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 97DBB1FF0B2 for ; Sun, 22 Nov 2026 02:26:43 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id DFCE0216E5; Sun, 22 Nov 2026 02:26:18 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v3 storage 08/18] multipath: report the NVMe host NQN of each node Date: Sun, 22 Nov 2026 02:25:45 +0100 Message-ID: <20261122012605.1848824-9-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261122012605.1848824-1-t.lamprecht@proxmox.com> References: <20261122012605.1848824-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: 1795310771929 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.146 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: X43CV3SEUPSWUUDROJBNTYUWW3TRUKFP X-Message-ID-Hash: X43CV3SEUPSWUUDROJBNTYUWW3TRUKFP 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/SAN/Cluster.pm | 5 +++++ src/PVE/Multipath/Status.pm | 5 ++++- src/test/run_multipath_api_tests.pl | 12 +++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/PVE/API2/SAN/Cluster.pm b/src/PVE/API2/SAN/Cluster.pm index 54cb0dbc..ac372d65 100644 --- a/src/PVE/API2/SAN/Cluster.pm +++ b/src/PVE/API2/SAN/Cluster.pm @@ -124,6 +124,11 @@ my $node_schema = { optional => 1, description => 'The iSCSI initiator name of the node.', }, + 'nvme-host-nqn' => { + type => 'string', + optional => 1, + description => 'The NVMe host NQN of the node.', + }, }, }; diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm index e7ffb41c..1b85e108 100644 --- a/src/PVE/Multipath/Status.pm +++ b/src/PVE/Multipath/Status.pm @@ -65,6 +65,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(); @@ -199,7 +202,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 60683ad8..a91332df 100755 --- a/src/test/run_multipath_api_tests.pl +++ b/src/test/run_multipath_api_tests.pl @@ -15,6 +15,7 @@ use Test::MockModule; use PVE::API2::Multipath; use PVE::API2::SAN::Cluster; use PVE::Multipath::Generator; +use PVE::NVMeOF; use PVE::Storage; subtest 'add, update and remove an explicit entry' => sub { @@ -457,9 +458,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(); @@ -686,15 +690,19 @@ 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)], 'the configuration is applied before the status is published', ); 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(); @@ -703,6 +711,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(); @@ -757,7 +766,7 @@ subtest 'API returns final node and LUN states' => sub { }, ], }), - n2 => encode_report({ time => $NOW, luns => [] }), + n2 => encode_report({ time => $NOW, luns => [], 'nvme-host-nqn' => 'nqn.test:n2' }), n3 => encode_report({ time => $NOW - 181, luns => [] }), n4 => encode_report({ time => $NOW, luns => [] }), n5 => encode_report({ time => $NOW, error => 'multipath-tools is not installed' }), @@ -788,6 +797,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');