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 v5 manager 25/26] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps
Date: Mon, 23 Nov 2026 14:32:17 +0100	[thread overview]
Message-ID: <20261123133412.3710030-26-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20261123133412.3710030-1-t.lamprecht@proxmox.com>

The report of a node lists the namespaces of its NVMe over Fabrics
storages next to the multipath maps, so the notifications about lost
and restored paths cover them too. Name the storages of a namespace in
them as for a map, also the one that has it as base volume.

Maps and namespaces each count by their own source. If the namespaces
of a node cannot be listed, a namespace missing from its report does not
count as gone, while a map missing from a successful multipathd query
still does. Likewise, a node that cannot query multipathd still notifies
on its namespaces, as they do not depend on it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
 PVE/MultipathNotification.pm       | 21 +++++++++++++--------
 PVE/Service/pvestatd.pm            | 16 +++++++++-------
 test/MultipathNotification_test.pl | 28 ++++++++++++++++++++++++----
 3 files changed, 46 insertions(+), 19 deletions(-)

diff --git a/PVE/MultipathNotification.pm b/PVE/MultipathNotification.pm
index 99c79405b..34719643c 100644
--- a/PVE/MultipathNotification.pm
+++ b/PVE/MultipathNotification.pm
@@ -8,7 +8,7 @@ use List::Util qw(max);
 use PVE::File qw(file_get_contents file_set_contents);
 
 # the fields of a LUN that a notification shows, kept across a restart of the daemon
-my @KEEP = qw(wwid name state paths-active paths-expected paths-total storages vgname);
+my @KEEP = qw(wwid name native state paths-active paths-expected paths-total storages vgname);
 
 sub new($class, $file) {
     my $notified = -e $file ? eval { decode_json(file_get_contents($file)) } : {};
@@ -95,17 +95,19 @@ sub flush($self, $notify) {
 
 # Takes a multipath report of this node. A change counts once two reports in a row show it.
 sub update($self, $report, $notify) {
-    my $usable = ref($report) eq 'HASH' && !$report->{error} && !$report->{'scope-unknown'};
-    my $luns = $usable ? $report->{luns} : undef;
-    # without the hints of LVM, maps known only by their volume group can be left out
-    my $complete = $usable && !$report->{'vgs-unknown'};
+    my $valid = ref($report) eq 'HASH';
+    # Maps need multipathd, the namespaces of native NVMe multipath do not. Each row counts by its
+    # own source, so a node without multipathd still notifies on its namespaces.
+    my $maps = $valid && !$report->{error} && !$report->{'scope-unknown'};
+    my $namespaces = $valid && !$report->{'namespaces-unknown'};
     my $previous = $self->{previous};
     my $current = $self->{previous} = {};
-    if (!defined($luns)) {
+    if (!$maps && !$namespaces) {
         # problems confirmed before do not wait for a report that can confirm others
         flush($self, $notify);
         return;
     }
+    my $luns = [grep { $_->{native} ? $namespaces : $maps } ($report->{luns} // [])->@*];
 
     my $notified = $self->{notified};
     # a problem that is still to be notified comes before the recovery of its LUN
@@ -142,9 +144,12 @@ sub update($self, $report, $notify) {
             }
         }
     }
-    # a LUN can be left out of a report that is not complete, which does not mean it is gone
+    # A LUN can be left out of a report that is not complete, which does not mean it is gone:
+    # without the hints of LVM, maps known only by their volume group, and after a failed query the
+    # NVMe namespaces. Each counts by its own source.
     for my $wwid (sort keys %$notified) {
-        next if exists($current->{$wwid}) || !$complete;
+        next if exists($current->{$wwid});
+        next if $notified->{$wwid}->{native} ? !$namespaces : !$maps || $report->{'vgs-unknown'};
         if (++$self->{absent}->{$wwid} < 2) {
             $pending{recovery} = 1;
             next;
diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index 68d7f2e08..3d9842c86 100755
--- a/PVE/Service/pvestatd.pm
+++ b/PVE/Service/pvestatd.pm
@@ -814,7 +814,7 @@ my sub notify_multipath {
         my $scfg = PVE::Storage::storage_check_node($storage, $sid, $nodename, 1) // next;
         push $by_vg{ $scfg->{vgname} }->@*, $sid if defined($scfg->{vgname});
         my $base = PVE::Multipath::parse_base_volume($scfg->{base});
-        push $by_wwid{ $base->{wwid} }->@*, $sid if $base && $base->{kind} ne 'nvme';
+        push $by_wwid{ $base->{wwid} }->@*, $sid if $base;
     }
 
     my $data = PVE::Notify::common_template_data();
@@ -862,29 +862,31 @@ my sub notify_multipath {
         my ($n, $noun) = @_;
         return $n == 1 ? "1 $noun" : "$n ${noun}s";
     };
+    my %kinds = map { ($_->{native} ? 'namespace' : 'LUN') => 1 } $data->{luns}->@*;
+    my $device = scalar(keys %kinds) == 1 ? (keys %kinds)[0] : 'SAN device';
     if ($severity eq 'info') {
         if ($restored && $cleared) {
             $data->{event} = 'alerts resolved';
             $data->{summary} =
-                $plural->($restored, 'LUN')
+                $plural->($restored, $device)
                 . ' restored, '
                 . $plural->($cleared, 'alert')
                 . ' cleared';
         } elsif ($cleared) {
             $data->{event} = 'alert cleared';
-            $data->{summary} = $plural->($cleared, 'LUN');
+            $data->{summary} = $plural->($cleared, $device);
         } else {
             $data->{event} = 'paths restored';
-            $data->{summary} = $plural->($restored, 'LUN');
+            $data->{summary} = $plural->($restored, $device);
         }
     } else {
         $data->{event} = 'paths lost';
         if ($failed && $degraded) {
-            $data->{summary} = $plural->($failed, 'LUN') . " failed, $degraded degraded";
+            $data->{summary} = $plural->($failed, $device) . " failed, $degraded degraded";
         } elsif ($failed) {
-            $data->{summary} = $plural->($failed, 'LUN') . ' failed';
+            $data->{summary} = $plural->($failed, $device) . ' failed';
         } else {
-            $data->{summary} = $plural->($degraded, 'LUN') . ' degraded';
+            $data->{summary} = $plural->($degraded, $device) . ' degraded';
         }
     }
     $data->{failed} = $failed if $failed;
diff --git a/test/MultipathNotification_test.pl b/test/MultipathNotification_test.pl
index f78a31e6e..f33515fdd 100755
--- a/test/MultipathNotification_test.pl
+++ b/test/MultipathNotification_test.pl
@@ -92,14 +92,34 @@ pass_with(
 );
 $tracker = PVE::MultipathNotification->new($file);
 pass_with({}, [], 'notified LUNs left the report across a restart');
-pass_with({}, [], 'but an incomplete report does not count', 0);
-pass_with(
-    {},
+pass_with({}, [], 'but a report without the hints of LVM does not count', 0);
+report_with(
+    { luns => [], 'namespaces-unknown' => 1 },
     [['info', 'c:gone', 'd:gone']],
-    'two complete reports without them clear their alerts',
+    'one without the NVMe namespaces does for maps, so two reports clear their alerts',
 );
 pass_with({}, [], 'no duplicate removal');
 
+my $namespace = { n => { state => 'degraded', native => 1 } };
+pass_with($namespace, [], 'a namespace degrades');
+pass_with($namespace, [['warning', 'n:degraded']], 'which is notified');
+report_with({ luns => [], 'namespaces-unknown' => 1 }, [], 'a report without it does not count');
+report_with({ luns => [], 'namespaces-unknown' => 1 }, [], 'also not a second one');
+pass_with({}, [], 'but one without the hints of LVM does', 0);
+pass_with({}, [['info', 'n:gone']], 'and with another one its alert is cleared');
+
+my sub without_multipathd($state) {
+    return {
+        error => 'multipathd is not running',
+        luns => [{ wwid => 'm', state => $state, native => 1 }],
+    };
+}
+report_with(without_multipathd('failed'), [], 'without multipathd, a namespace fails');
+report_with(without_multipathd('failed'), [['error', 'm:failed']],
+    'which is notified all the same');
+report_with(without_multipathd('optimal'), [], 'it recovers');
+report_with(without_multipathd('optimal'), [['info', 'm:optimal']], 'which is notified too');
+
 pass_with($degraded, [], 'new incident');
 $accept = 0;
 pass_with($degraded, [['warning', 'a:degraded']], 'enqueue fails');




  parent reply	other threads:[~2026-11-23 13:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 13:31 applied: [PATCH v5 storage,docs,manager 00/26] NVMe over Fabrics storage Thomas Lamprecht
2026-11-23 13:31 ` [PATCH v5 storage 01/26] api: config: activate a new storage without holding the lock Thomas Lamprecht
2026-11-23 13:31 ` [PATCH v5 storage 02/26] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-23 13:31 ` [PATCH v5 storage 03/26] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only Thomas Lamprecht
2026-11-23 13:31 ` [PATCH v5 storage 04/26] api: disks: refuse a local wipe of a network NVMe namespace Thomas Lamprecht
2026-11-23 13:31 ` [PATCH v5 storage 05/26] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
2026-11-23 13:31 ` [PATCH v5 storage 06/26] d/control: bump pve-common for plain parameter error names Thomas Lamprecht
2026-11-23 13:31 ` [PATCH v5 storage 07/26] api: config: check the cluster version before the first nvmeof storage Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 08/26] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 09/26] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 10/26] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 11/26] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 12/26] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 13/26] multipath: report the NVMe host NQN of each node Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 14/26] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 storage 15/26] d/control: break pve-manager versions without namespace notifications Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 docs 16/26] storage: document NVMe over Fabrics storages Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 17/26] report: add the NVMe over Fabrics host NQN and subsystems Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 18/26] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 19/26] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 20/26] ui: storage: SAN setup: ignore spaces around a typed portal Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 21/26] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 22/26] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 23/26] ui: san: show the NVMe host NQN of each node Thomas Lamprecht
2026-11-23 13:32 ` [PATCH v5 manager 24/26] ui: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-23 13:32 ` Thomas Lamprecht [this message]
2026-11-23 13:32 ` [PATCH v5 manager 26/26] d/control: bump versioned dependencies for NVMe over Fabrics 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=20261123133412.3710030-26-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