public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
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	[thread overview]
Message-ID: <20261122012605.1848824-9-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20261122012605.1848824-1-t.lamprecht@proxmox.com>

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 <t.lamprecht@proxmox.com>
---
 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');




  parent reply	other threads:[~2026-11-22  1:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  1:25 [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 storage 01/18] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 storage 02/18] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 storage 03/18] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 storage 04/18] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 storage 05/18] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 storage 06/18] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 storage 07/18] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
2026-11-22  1:25 ` Thomas Lamprecht [this message]
2026-11-22  1:25 ` [PATCH v3 storage 09/18] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 docs 10/18] storage: document NVMe over Fabrics storages Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 11/18] report: add the NVMe over Fabrics host NQN and subsystems Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 12/18] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 13/18] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 14/18] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 15/18] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 16/18] ui: san: show the NVMe host NQN of each node Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 17/18] ui: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-22  1:25 ` [PATCH v3 manager 18/18] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps 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=20261122012605.1848824-9-t.lamprecht@proxmox.com \
    --to=t.lamprecht@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal