From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 3165E1FF143 for ; Sat, 23 May 2026 23:30:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6C20B1BDFE; Sat, 23 May 2026 23:29:42 +0200 (CEST) From: Thomas Lamprecht To: Proxmox VE development discussion , Mira Limbeck Subject: Re: [PATCH v2 storage 05/15] iscsi: add helper to get local config Date: Sat, 23 May 2026 23:26:08 +0200 Message-ID: <20260523212856.2822353-3-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260430173220.441001-6-m.limbeck@proxmox.com> References: <20260430173220.441001-1-m.limbeck@proxmox.com> <20260430173220.441001-6-m.limbeck@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779571725320 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: PZIYN6PFKTNO7K7JNDPJSPVCT7RPDOPD X-Message-ID-Hash: PZIYN6PFKTNO7K7JNDPJSPVCT7RPDOPD X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 30 Apr 2026 19:27:03 +0200, Mira Limbeck wrote:=0D > diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin= .pm=0D > @@ -36,6 +36,49 @@ my sub assert_iscsi_support {=0D > +my $get_local_config =3D sub {=0D > + my ($scfg) =3D @_;=0D > +=0D > + die "neither 'target' nor 'mapping' defined\n"=0D > + if !defined($scfg->{target}) && !defined($scfg->{mapping});=0D > +=0D > + my $res =3D {};=0D > + if ($scfg->{mapping}) {=0D > + $res->{is_mapping} =3D 1;=0D > +=0D > + my $local_mappings =3D=0D > + PVE::Storage::Mapping::find_mapping_on_current_node($scfg->{= mapping});=0D > + die "no iSCSI per-node entries found for mapping '$scfg->{mappin= g}'\n"=0D > + if !$local_mappings->@*;=0D =0D The die when $local_mappings is empty fires for any node that legitimately= =0D is not in the mapping's node set, and it propagates through status() and=0D check_connection() every pvestatd cycle. Treating that node like a=0D `nodes=3D`-restricted storage (reporting it as inactive) would be better;=0D worth defining how storage `nodes=3D` and per-node `map` coverage relate.=0D =0D > + for my $mapping ($local_mappings->@*) {=0D > + $res->{targets}->{ $mapping->{target} } =3D []=0D > + if !defined($res->{targets}->{ $mapping->{target} });=0D > + my $portals =3D [PVE::Tools::split_list($mapping->{portals})= ];=0D > +=0D > + my $add_port =3D sub {=0D > + my ($val) =3D @_;=0D > +=0D > + my ($ip, $port) =3D PVE::Tools::parse_host_and_port($val= );=0D > + if (defined($port)) {=0D > + return $val;=0D > + } else {=0D > + # add default port=0D > + return $ip . ':3260';=0D > + }=0D > + };=0D > + $portals->@* =3D map { $add_port->($_) } $portals->@*;=0D > +=0D > + push $res->{targets}->{ $mapping->{target} }->@*, $portals->= @*;=0D > + }=0D > + return $res;=0D > + } else {=0D > + $res->{is_mapping} =3D 0;=0D > + $res->{targets}->{ $scfg->{target} } =3D iscsi_portals($scfg->{t= arget}, $scfg->{portal});=0D > + return $res;=0D > + }=0D > +};=0D =0D Further, portals get canonicalized to host:port only on the mapping branch= =0D (add_port); the else branch keeps whatever iscsi_portals returns. This=0D asymmetry is what later needs the `(?::3260)?` and unanchored matches in=0D 06/08. Normalizing both branches here once would let the comparisons be=0D exact everywhere.=0D