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 C48D31FF0B7 for ; Fri, 13 Nov 2026 04:28:52 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5746021ADC; Fri, 13 Nov 2026 04:22:07 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH storage 08/17] multipath: report the NVMe host NQN of each node Date: Fri, 13 Nov 2026 04:04:36 +0100 Message-ID: <20261113030541.1591528-9-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261113030541.1591528-1-t.lamprecht@proxmox.com> References: <20261113030541.1591528-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: 1794539148396 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.235 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: AZC7SREJ3DBPEQ3FMFSRPJJPBEFBF2F3 X-Message-ID-Hash: AZC7SREJ3DBPEQ3FMFSRPJJPBEFBF2F3 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 | 6 +++++- src/test/run_multipath_api_tests.pl | 12 +++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/PVE/API2/Multipath.pm b/src/PVE/API2/Multipath.pm index d5d2df9d..1d7f5707 100644 --- a/src/PVE/API2/Multipath.pm +++ b/src/PVE/API2/Multipath.pm @@ -86,7 +86,7 @@ my $node_schema = { state => { type => 'string', enum => ['ok', 'unavailable', 'no-report'] }, time => { type => 'integer', optional => 1 }, 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 58d11f5d..9dc8e2cf 100644 --- a/src/PVE/Multipath/Status.pm +++ b/src/PVE/Multipath/Status.pm @@ -48,6 +48,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\n" if !PVE::Multipath::is_running(); @@ -134,7 +137,8 @@ sub cluster_status() { || !defined($report->{time}) || time() - $report->{time} > 180; $entry->{$_} = $report->{$_} - for grep { defined($report->{$_}) } qw(error apply-error iscsi-initiator-name); + for grep { defined($report->{$_}) } + qw(error apply-error iscsi-initiator-name nvme-host-nqn); $entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok'; next if $entry->{state} ne 'ok'; diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl index 77ee3b9f..9bf44733 100755 --- a/src/test/run_multipath_api_tests.pl +++ b/src/test/run_multipath_api_tests.pl @@ -14,6 +14,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 { @@ -156,9 +157,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(); @@ -215,15 +219,20 @@ 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(); is($report->{error}, 'multipathd is not running', '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(); @@ -278,7 +287,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' }), @@ -307,6 +316,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');