From: Dietmar Maurer <dietmar@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH storage 1/7] iscsi: discovery: do not stop early on a foreign target
Date: Tue, 4 Aug 2026 11:08:13 +0200 [thread overview]
Message-ID: <20260804090819.2136483-2-dietmar@proxmox.com> (raw)
In-Reply-To: <20260804090819.2136483-1-dietmar@proxmox.com>
sendtargets returns every portal of a target in one call, so querying
further portals is pointless once the requested target showed up. The
check only looked at whether any target came back, so a portal that
serves other targets aborted the loop before the portals that actually
serve the requested one were queried.
Discovery without a requested target now queries all given portals,
which is what a caller enumerating a SAN wants.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
src/PVE/Storage/ISCSIPlugin.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
index 801b5d1..807adbd 100644
--- a/src/PVE/Storage/ISCSIPlugin.pm
+++ b/src/PVE/Storage/ISCSIPlugin.pm
@@ -134,6 +134,7 @@ sub iscsi_discovery {
for my $portal ($portals->@*) {
next if !iscsi_test_portal($target_in, $portal, $cache); # fixme: raise exception here?
+ my $target_found = 0;
my $cmd = [$ISCSIADM, '--mode', 'discovery', '--type', 'sendtargets', '--portal', $portal];
eval {
run_command(
@@ -146,13 +147,16 @@ sub iscsi_discovery {
# one target can have more than one portal (multipath)
# and sendtargets should return all of them in single call
push @{ $res->{$target} }, $portal;
+
+ $target_found = 1 if defined($target_in) && $target eq $target_in;
}
},
);
};
- # In case of multipath we can stop after receiving targets from any available portal
- last if scalar(keys %$res) > 0;
+ # sendtargets returns all portals of a target, so one hit is enough. Without a
+ # requested target, query every portal to get the full picture
+ last if $target_found;
}
return $res;
--
2.47.3
next prev 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 ` Dietmar Maurer [this message]
2026-08-04 9:08 ` [PATCH storage 2/7] iscsi: scan: do not persist discovery results in the node database Dietmar Maurer
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-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.