public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
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	[thread overview]
Message-ID: <20260804090819.2136483-3-dietmar@proxmox.com> (raw)
In-Reply-To: <20260804090819.2136483-1-dietmar@proxmox.com>

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 <dietmar@proxmox.com>
---
 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




  parent reply	other threads:[~2026-08-04  9:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04  9:08 [PATCH storage 0/7] iscsi: per-node target and portal configuration Dietmar Maurer
2026-08-04  9:08 ` [PATCH storage 1/7] iscsi: discovery: do not stop early on a foreign target Dietmar Maurer
2026-08-04  9:08 ` Dietmar Maurer [this message]
2026-08-04  9:08 ` [PATCH storage 3/7] iscsi: validate target names with a dedicated format Dietmar Maurer
2026-08-04  9:08 ` [PATCH storage 4/7] iscsi: clarify that the portal property is the discovery address Dietmar Maurer
2026-08-04  9:08 ` [PATCH storage 5/7] iscsi: add iscsi-node-map property for per-node target and portals Dietmar Maurer
2026-08-04  9:08 ` [PATCH storage 6/7] iscsi: iscsi_portals: return empty list instead of fallback portal Dietmar Maurer
2026-08-04  9:08 ` [PATCH storage 7/7] iscsi: add periodic-discovery flag to skip re-discovery on login Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260804090819.2136483-3-dietmar@proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal