From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Mira Limbeck <m.limbeck@proxmox.com>
Subject: Re: [PATCH v2 storage 05/15] iscsi: add helper to get local config
Date: Sat, 23 May 2026 23:26:08 +0200 [thread overview]
Message-ID: <20260523212856.2822353-3-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20260430173220.441001-6-m.limbeck@proxmox.com>
On Thu, 30 Apr 2026 19:27:03 +0200, Mira Limbeck wrote:
> diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
> @@ -36,6 +36,49 @@ my sub assert_iscsi_support {
> +my $get_local_config = sub {
> + my ($scfg) = @_;
> +
> + die "neither 'target' nor 'mapping' defined\n"
> + if !defined($scfg->{target}) && !defined($scfg->{mapping});
> +
> + my $res = {};
> + if ($scfg->{mapping}) {
> + $res->{is_mapping} = 1;
> +
> + my $local_mappings =
> + PVE::Storage::Mapping::find_mapping_on_current_node($scfg->{mapping});
> + die "no iSCSI per-node entries found for mapping '$scfg->{mapping}'\n"
> + if !$local_mappings->@*;
The die when $local_mappings is empty fires for any node that legitimately
is not in the mapping's node set, and it propagates through status() and
check_connection() every pvestatd cycle. Treating that node like a
`nodes=`-restricted storage (reporting it as inactive) would be better;
worth defining how storage `nodes=` and per-node `map` coverage relate.
> + for my $mapping ($local_mappings->@*) {
> + $res->{targets}->{ $mapping->{target} } = []
> + if !defined($res->{targets}->{ $mapping->{target} });
> + my $portals = [PVE::Tools::split_list($mapping->{portals})];
> +
> + my $add_port = sub {
> + my ($val) = @_;
> +
> + my ($ip, $port) = PVE::Tools::parse_host_and_port($val);
> + if (defined($port)) {
> + return $val;
> + } else {
> + # add default port
> + return $ip . ':3260';
> + }
> + };
> + $portals->@* = map { $add_port->($_) } $portals->@*;
> +
> + push $res->{targets}->{ $mapping->{target} }->@*, $portals->@*;
> + }
> + return $res;
> + } else {
> + $res->{is_mapping} = 0;
> + $res->{targets}->{ $scfg->{target} } = iscsi_portals($scfg->{target}, $scfg->{portal});
> + return $res;
> + }
> +};
Further, portals get canonicalized to host:port only on the mapping branch
(add_port); the else branch keeps whatever iscsi_portals returns. This
asymmetry is what later needs the `(?::3260)?` and unanchored matches in
06/08. Normalizing both branches here once would let the comparisons be
exact everywhere.
next prev parent reply other threads:[~2026-05-23 21:30 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 17:26 [PATCH v2 cluster/storage/manager 00/15] storage mapping Mira Limbeck
2026-04-30 17:26 ` [PATCH v2 cluster 01/15] mapping: add storage.cfg Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 02/15] mapping: add base plugin Mira Limbeck
2026-04-30 17:35 ` Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 03/15] mapping: add iSCSI plugin Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 04/15] iscsi: introduce mapping support Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 05/15] iscsi: add helper to get local config Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht [this message]
2026-04-30 17:27 ` [PATCH v2 storage 06/15] iscsi: change functions to handle mappings Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 07/15] iscsi: introduce helper to update discovery db Mira Limbeck
2026-05-11 16:46 ` Samuel Rufinatscha
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 08/15] iscsi: rework to update discovery db and simplify login Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 09/15] iscsi: remove stale sessions in non-mapping case Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 10/15] api: add mapping support Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 11/15] mapping: iscsi: add discovery-portal config option Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 12/15] iscsi: add support for non-persistent discovery Mira Limbeck
2026-04-30 17:38 ` Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 13/15] api: add non-persistent iscsi discovery option Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [POC v2 storage 14/15] mapping: add zfspool plugin Mira Limbeck
2026-05-23 21:26 ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 manager 15/15] api: mapping: add storage mapping path Mira Limbeck
2026-05-11 17:05 ` [PATCH v2 cluster/storage/manager 00/15] storage mapping Samuel Rufinatscha
2026-05-23 21:26 ` Thomas Lamprecht
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=20260523212856.2822353-3-t.lamprecht@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=m.limbeck@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.