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 v4 storage 06/25] api: config: check the cluster version before the first nvmeof storage
Date: Mon, 23 Nov 2026 02:47:43 +0100	[thread overview]
Message-ID: <20261123020041.3728085-7-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20261123020041.3728085-1-t.lamprecht@proxmox.com>

A node without the nvmeof storage type drops the sections of such
storages when it writes the storage configuration, for example when a
storage is added or edited on that node. Refuse adding the first
storage of the type until all nodes are online and run pve-manager
9.2.38 or newer, the first version that depends on a storage library
with this type. Further ones are not checked, so that they can be
added while a node is offline.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
 src/PVE/API2/Storage/Config.pm |  5 +++++
 src/test/run_nvmeof_tests.pl   | 27 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/PVE/API2/Storage/Config.pm b/src/PVE/API2/Storage/Config.pm
index ce41c927..55ba9ee5 100755
--- a/src/PVE/API2/Storage/Config.pm
+++ b/src/PVE/API2/Storage/Config.pm
@@ -283,6 +283,11 @@ __PACKAGE__->register_method({
                     die "storage ID '$storeid' already defined\n";
                 }
 
+                # A node without the type drops its sections when it writes the configuration.
+                # FIXME: MAJOR VERSION: This check can be dropped at the next major version bump.
+                PVE::Cluster::assert_min_cluster_version(9, 2, 38)
+                    if $type eq 'nvmeof' && !grep { $_->{type} eq 'nvmeof' } values $cfg->{ids}->%*;
+
                 $cfg->{ids}->{$storeid} = $opts;
 
                 $returned_config = $plugin->on_add_hook($storeid, $opts, %$sensitive);
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index fc2b7078..566b0402 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -12,6 +12,7 @@ use Time::HiRes ();
 
 use PVE::Tools qw(file_set_contents);
 
+use PVE::API2::Storage::Config;
 use PVE::NVMeOF;
 use PVE::Storage;
 
@@ -196,6 +197,32 @@ subtest 'configuration, portals and volumes' => sub {
     );
 };
 
+subtest 'the first storage of the type needs an upgraded cluster' => sub {
+    my $raw = "dir: local\n\tpath /var/lib/vz\n\tcontent iso\n";
+    my $cluster = Test::MockModule->new('PVE::Cluster');
+    my $asserted;
+    $cluster->mock(assert_min_cluster_version => sub { $asserted = join('.', @_) });
+    my $storage = Test::MockModule->new('PVE::Storage');
+    $storage->mock(
+        lock_storage_config => sub { $_[0]->() },
+        config => sub { PVE::Storage::Plugin->parse_config('storage.cfg', $raw) },
+        write_config => sub { $raw = PVE::Storage::Plugin->write_config('storage.cfg', $_[0]) },
+        activate_storage => sub { },
+    );
+    my $add = sub($storeid, $nqn) {
+        $asserted = undef;
+        PVE::API2::Storage::Config->create({
+            storage => $storeid,
+            type => 'nvmeof',
+            subsysnqn => $nqn,
+            portals => '192.0.2.1',
+        });
+        return $asserted;
+    };
+    is($add->('fabric1', 'nqn.first'), '9.2.38', 'the first one checks the cluster');
+    is($add->('fabric2', 'nqn.second'), undef, 'a further one does not');
+};
+
 subtest 'sysfs topology' => sub {
     my $sys = $PVE::NVMeOF::SYSFS;
     make_path(




  parent reply	other threads:[~2026-11-23  2:01 UTC|newest]

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