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 C1D661FF0AF for ; Fri, 20 Nov 2026 13:53:03 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 29CD3217B9; Fri, 20 Nov 2026 13:52:41 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage 1/3] multipath: status: only report initiator name if open-iscsi is installed Date: Fri, 20 Nov 2026 13:51:53 +0100 Message-ID: <20261120125236.2393788-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261120125236.2393788-1-d.csapak@proxmox.com> References: <20261120125236.2393788-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.269 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) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: OA6MEWVCY4SE4U77SZIAENOXYF255SGQ X-Message-ID-Hash: OA6MEWVCY4SE4U77SZIAENOXYF255SGQ X-MailFrom: d.csapak@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: when open-iscsi is removed but not purged, the file with the initiator name stays, so the node still reported it. A leftover name is of no use and should not end up in e.g. the access list of an array, so only report it if iscsiadm is executable (like the iSCSI status API call of a node checks). With that, a node without an initiator name does not have a usable open-iscsi (the package generates the name on installation, and iscsid does not start without it), so the UI can use that to show which nodes are missing it. Signed-off-by: Dominik Csapak --- src/PVE/API2/Multipath.pm | 2 +- src/PVE/Multipath/Status.pm | 9 ++++++--- src/test/run_multipath_api_tests.pl | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/PVE/API2/Multipath.pm b/src/PVE/API2/Multipath.pm index 59ca0eb..24955b3 100644 --- a/src/PVE/API2/Multipath.pm +++ b/src/PVE/API2/Multipath.pm @@ -154,7 +154,7 @@ my $node_schema = { 'iscsi-initiator-name' => { type => 'string', optional => 1, - description => 'The iSCSI initiator name of the node.', + description => 'The iSCSI initiator name of the node, if open-iscsi is installed.', }, }, }; diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm index 1f13109..77da988 100644 --- a/src/PVE/Multipath/Status.pm +++ b/src/PVE/Multipath/Status.pm @@ -62,9 +62,12 @@ sub update_node_status() { my $report = { luns => [] }; $report->{'apply-error'} = $apply->{error} if defined($apply->{error}); require PVE::Storage::ISCSIPlugin; - my $initiator = eval { PVE::Storage::ISCSIPlugin::read_initiator_info() }; - $report->{'iscsi-initiator-name'} = $initiator->{name} - if $initiator && defined($initiator->{name}); + # the initiator name stays if open-iscsi is removed but not purged, so skip it then + if (PVE::Storage::ISCSIPlugin::iscsi_supported()) { + my $initiator = eval { PVE::Storage::ISCSIPlugin::read_initiator_info() }; + $report->{'iscsi-initiator-name'} = $initiator->{name} + if $initiator && defined($initiator->{name}); + } eval { die "multipath-tools is not installed\n" if !PVE::Multipath::is_supported(); die "multipathd is not running or does not respond\n" if !PVE::Multipath::is_running(); diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl index 07ab562..e0dfb04 100755 --- a/src/test/run_multipath_api_tests.pl +++ b/src/test/run_multipath_api_tests.pl @@ -454,7 +454,7 @@ subtest 'an unconfigured node does not write drop-ins or reload' => sub { $mp->mock($function => sub { push @changes, $function }); } my $iscsi = Test::MockModule->new('PVE::Storage::ISCSIPlugin'); - $iscsi->mock(read_initiator_info => sub { {} }); + $iscsi->mock(read_initiator_info => sub { {} }, iscsi_supported => sub { 1 }); my $status = Test::MockModule->new('PVE::Multipath::Status'); my $report; $status->mock(publish => sub { $report = $_[0] }); @@ -563,7 +563,7 @@ subtest 'only managed maps and those under a storage get a row' => sub { my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin'); my $report; $status->mock(publish => sub { $report = $_[0] }); - $iscsi->mock(read_initiator_info => sub { undef }); + $iscsi->mock(read_initiator_info => sub { undef }, iscsi_supported => sub { 1 }); $mp->mock(is_supported => sub { 1 }, is_running => sub { 1 }); $mp->mock( get_maps => sub { @@ -636,7 +636,7 @@ subtest 'a LUN of a storage without a map is missing' => sub { my $config = Test::MockModule->new('PVE::Multipath::Config'); my %raw; $status->mock(publish => sub { $raw{n1} = encode_report({ $_[0]->%*, time => $NOW }) }); - $iscsi->mock(read_initiator_info => sub { undef }); + $iscsi->mock(read_initiator_info => sub { undef }, iscsi_supported => sub { 1 }); $mp->mock(is_supported => sub { 1 }, is_running => sub { 1 }, get_maps => sub { [] }); $lvm->mock(cached_pv_volume_groups => sub { {} }); $gen->mock( @@ -676,7 +676,10 @@ subtest 'one entry point applies configuration and reports unavailable reasons' my ($report, @order); $gen->mock(sync => sub { push @order, 'apply'; { error => 'reload failed' } }); $status->mock(publish => sub { push @order, 'publish'; $report = $_[0] }); - $iscsi->mock(read_initiator_info => sub { { name => 'iqn.2025-01.example:node' } }); + $iscsi->mock( + read_initiator_info => sub { { name => 'iqn.2025-01.example:node' } }, + iscsi_supported => sub { 1 }, + ); $mp->mock(is_supported => sub { 0 }); PVE::Multipath::Status::update_node_status(); is($report->{error}, 'multipath-tools is not installed', 'missing tools reason only'); @@ -686,6 +689,11 @@ subtest 'one entry point applies configuration and reports unavailable reasons' 'the configuration is applied before the status is published', ); is($report->{'apply-error'}, 'reload failed', 'apply failure is separate'); + is($report->{'iscsi-initiator-name'}, 'iqn.2025-01.example:node', 'initiator name reported'); + $iscsi->mock(iscsi_supported => sub { 0 }); + PVE::Multipath::Status::update_node_status(); + ok(!exists($report->{'iscsi-initiator-name'}), 'no leftover name without open-iscsi'); + $iscsi->mock(iscsi_supported => sub { 1 }); $mp->mock(is_supported => sub { 1 }); $mp->mock(is_running => sub { 0 }); PVE::Multipath::Status::update_node_status(); -- 2.47.3