From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id D9AA01FF0E3 for ; Wed, 18 Nov 2026 21:43:53 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D2FEE2187C; Wed, 18 Nov 2026 21:43:25 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v2 storage 08/17] multipath: report the NVMe host NQN of each node Date: Wed, 18 Nov 2026 21:42:27 +0100 Message-ID: <20261118204302.3100813-9-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118204302.3100813-1-t.lamprecht@proxmox.com> References: <20261118204302.3100813-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795034587601 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.163 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: JQWPFPO3WMN64ZXM7GB4RFDCQGNKUQC5 X-Message-ID-Hash: JQWPFPO3WMN64ZXM7GB4RFDCQGNKUQC5 X-MailFrom: t.lamprecht@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: The status report of a node has its iSCSI initiator name, so that the cluster-wide status shows the identities an admin needs for the access rules of an array in one place. Add the NVMe host NQN, which an NVMe over Fabrics target needs for the same purpose. A node without a valid NVMe host identity reports none. Signed-off-by: Thomas Lamprecht --- src/PVE/API2/Multipath.pm | 2 +- src/PVE/Multipath/Status.pm | 5 ++++- src/test/run_multipath_api_tests.pl | 12 +++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/PVE/API2/Multipath.pm b/src/PVE/API2/Multipath.pm index 8e60f70a..e69919c2 100644 --- a/src/PVE/API2/Multipath.pm +++ b/src/PVE/API2/Multipath.pm @@ -94,7 +94,7 @@ my $node_schema = { . ' base volume of a storage or to hold its volume group.', }, map { $_ => { type => 'string', optional => 1 } } - qw(error apply-error iscsi-initiator-name), + qw(error apply-error iscsi-initiator-name nvme-host-nqn), }, }; diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm index 8e4b4eb7..ae386164 100644 --- a/src/PVE/Multipath/Status.pm +++ b/src/PVE/Multipath/Status.pm @@ -52,6 +52,9 @@ sub update_node_status() { my $initiator = eval { PVE::Storage::ISCSIPlugin::read_initiator_info() }; $report->{'iscsi-initiator-name'} = $initiator->{name} if $initiator && defined($initiator->{name}); + require PVE::NVMeOF; + my $host = eval { PVE::NVMeOF::host_identity() }; + $report->{'nvme-host-nqn'} = $host->{nqn} if $host; 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(); @@ -171,7 +174,7 @@ sub cluster_status() { $entry->{time} = $report->{time} if defined($report->{time}); my $offline = exists($members->{$node}) && !$members->{$node}->{online}; next if $offline || !defined($report->{time}) || time() - $report->{time} > 180; - my @keys = qw(error apply-error iscsi-initiator-name other-maps); + my @keys = qw(error apply-error iscsi-initiator-name nvme-host-nqn other-maps); $entry->{$_} = $report->{$_} for grep { defined($report->{$_}) } @keys; $entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok'; $unhinted{$node} = 1 if $report->{'vgs-unknown'}; diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl index 6955076b..078ba66d 100755 --- a/src/test/run_multipath_api_tests.pl +++ b/src/test/run_multipath_api_tests.pl @@ -15,6 +15,7 @@ use Test::More; use Test::MockModule; use PVE::API2::Multipath; use PVE::Multipath::Generator; +use PVE::NVMeOF; use PVE::Storage; subtest 'explicit entries are ordinary configuration writes' => sub { @@ -205,9 +206,12 @@ subtest 'an unconfigured node does not write drop-ins or reload' => sub { } my $iscsi = Test::MockModule->new('PVE::Storage::ISCSIPlugin'); $iscsi->mock(read_initiator_info => sub { {} }); + my $nvme = Test::MockModule->new('PVE::NVMeOF'); + $nvme->mock(host_identity => sub { die "no host identity\n" }); my $status = Test::MockModule->new('PVE::Multipath::Status'); my $report; $status->mock(publish => sub { $report = $_[0] }); + for my $ids ({}, { plain => { type => 'iscsi', target => 'iqn.test' } }) { $storage->mock(config => sub { { ids => $ids } }); PVE::Multipath::Status::update_node_status(); @@ -383,11 +387,15 @@ subtest 'one entry point applies configuration and reports unavailable reasons' $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' } }); + my $nvme = Test::MockModule->new('PVE::NVMeOF'); + $nvme->mock(host_identity => sub { { nqn => 'nqn.2025-01.example:node', id => 'unused' } }); $mp->mock(is_supported => sub { 0 }); PVE::Multipath::Status::update_node_status(); is($report->{error}, 'multipath-tools is not installed', 'missing tools reason only'); + is($report->{'nvme-host-nqn'}, 'nqn.2025-01.example:node', 'host NQN reported in any case'); is_deeply(\@order, [qw(apply publish)], 'single call owns ordering'); is($report->{'apply-error'}, 'reload failed', 'apply failure is separate'); + $nvme->mock(host_identity => sub { die "no host identity\n" }); $mp->mock(is_supported => sub { 1 }); $mp->mock(is_running => sub { 0 }); PVE::Multipath::Status::update_node_status(); @@ -396,6 +404,7 @@ subtest 'one entry point applies configuration and reports unavailable reasons' 'multipathd is not running or does not respond', 'stopped daemon reason only', ); + ok(!exists($report->{'nvme-host-nqn'}), 'no host NQN without a valid host identity'); $mp->mock(is_running => sub { 1 }); $mp->mock(get_maps => sub { die "bad JSON\n" }); PVE::Multipath::Status::update_node_status(); @@ -450,7 +459,7 @@ subtest 'API returns final node and LUN states' => sub { }, ], }), - n2 => encode_json({ time => $NOW, luns => [] }), + n2 => encode_json({ time => $NOW, luns => [], 'nvme-host-nqn' => 'nqn.test:n2' }), n3 => encode_json({ time => $NOW - 181, luns => [] }), n4 => encode_json({ time => $NOW, luns => [] }), n5 => encode_json({ time => $NOW, error => 'multipath-tools is not installed' }), @@ -481,6 +490,7 @@ subtest 'API returns final node and LUN states' => sub { 'final node states', ); is($res->{nodes}->{n3}->{time}, $NOW - 181, 'old report time retained'); + is($res->{nodes}->{n2}->{'nvme-host-nqn'}, 'nqn.test:n2', 'host NQN passed on'); my $lun = $res->{luns}->[0]; is($lun->{state}, 'missing', 'worst known state'); is($lun->{nodes}->{n1}->{state}, 'optimal', 'observed healthy map');