From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 1B96C1FF0E3 for ; Tue, 04 Aug 2026 11:08:42 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B22862165B; Tue, 04 Aug 2026 11:08:25 +0200 (CEST) From: Dietmar Maurer To: pve-devel@lists.proxmox.com Subject: [PATCH storage 2/7] iscsi: scan: do not persist discovery results in the node database Date: Tue, 4 Aug 2026 11:08:14 +0200 Message-ID: <20260804090819.2136483-3-dietmar@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260804090819.2136483-1-dietmar@proxmox.com> References: <20260804090819.2136483-1-dietmar@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 2 AWL -0.116 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: 42AYXECFMQ2KDXTBN6TPETXDYI46CLJJ X-Message-ID-Hash: 42AYXECFMQ2KDXTBN6TPETXDYI46CLJJ X-MailFrom: dietmar@zilli.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: Scanning a portal is an inspection operation, but sendtargets discovery writes a node db record for every target the portal advertises. So filling the target dropdown in the storage wizard, or an abandoned wizard run, leaves the scanning node with records for targets nobody configured, and makes it diverge from its peers. Ask iscsiadm to leave the node db alone for scans. Discovery on the login path keeps persisting, since logging in works off those records. Signed-off-by: Dietmar Maurer --- src/PVE/Storage.pm | 2 +- src/PVE/Storage/ISCSIPlugin.pm | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index 64ea9da..81df50f 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -1655,7 +1655,7 @@ sub scan_iscsi { die "unable to parse/resolve portal address '${portal_in}'\n"; } - return PVE::Storage::ISCSIPlugin::iscsi_discovery(undef, [$portal]); + return PVE::Storage::ISCSIPlugin::iscsi_discovery(undef, [$portal], undef, 1); } sub storage_default_format { diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm index 807adbd..9944806 100644 --- a/src/PVE/Storage/ISCSIPlugin.pm +++ b/src/PVE/Storage/ISCSIPlugin.pm @@ -125,8 +125,11 @@ sub iscsi_portals { } } +# Discovery persists a node db record for every returned target unless +# $nonpersistent is set. Callers that only inspect a portal should set it, +# callers that log in afterwards rely on the records. sub iscsi_discovery { - my ($target_in, $portals, $cache) = @_; + my ($target_in, $portals, $cache, $nonpersistent) = @_; assert_iscsi_support(); @@ -136,6 +139,7 @@ sub iscsi_discovery { my $target_found = 0; my $cmd = [$ISCSIADM, '--mode', 'discovery', '--type', 'sendtargets', '--portal', $portal]; + push @$cmd, '--op', 'nonpersistent' if $nonpersistent; eval { run_command( $cmd, -- 2.47.3