From: Joaquin Varela <joaquinvarela@neatech.ar>
To: pve-devel@lists.proxmox.com
Subject: [PATCH storage v5 06/13] api: config: check the cluster version before the first zfsnvme storage
Date: Thu, 26 Nov 2026 12:09:47 -0300 [thread overview]
Message-ID: <20261126150956.310593-7-joaquinvarela@neatech.ar> (raw)
In-Reply-To: <20261126150956.310593-1-joaquinvarela@neatech.ar>
A node without the zfsnvme storage type drops the sections of such
storages when it writes the storage configuration, just as with nvmeof.
Refuse adding the first zfsnvme storage until all nodes are online and
run pve-manager 9.3.2 or newer, the first version after 9.3.1 that can
depend on a storage library with this type. Further ones are not
checked, so that they can be added while a node is offline.
Keep the minimum version of each type in a small table, so that the
check for nvmeof stays as it is.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
src/PVE/API2/Storage/Config.pm | 13 +++++++++++--
src/test/run_nvmeof_tests.pl | 35 ++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/src/PVE/API2/Storage/Config.pm b/src/PVE/API2/Storage/Config.pm
index 9197ce1d..7734c93b 100755
--- a/src/PVE/API2/Storage/Config.pm
+++ b/src/PVE/API2/Storage/Config.pm
@@ -24,6 +24,13 @@ my @ctypes = qw(images vztmpl iso backup);
my $storage_type_enum = PVE::Storage::Plugin->lookup_types();
+# The first pve-manager that depends on a pve-storage with the type, for the types that an older
+# node would drop from the storage configuration.
+my $first_storage_min_version = {
+ nvmeof => [9, 2, 38],
+ zfsnvme => [9, 3, 2],
+};
+
# Older nodes reject a content list with a type they do not know and fall back to the defaults of
# the storage type, which may allow more than intended. A type that the storage has already is not
# checked again, so that the storage can still be changed while a node is offline.
@@ -298,8 +305,10 @@ __PACKAGE__->register_method({
# 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}->%*;
+ if (my $min_version = $first_storage_min_version->{$type}) {
+ PVE::Cluster::assert_min_cluster_version($min_version->@*)
+ if !grep { $_->{type} eq $type } values $cfg->{ids}->%*;
+ }
$cfg->{ids}->{$storeid} = $opts;
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index 1b94c032..aa1d9931 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -244,6 +244,41 @@ subtest 'the first storage of the type needs an upgraded cluster' => sub {
};
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');
+
+ # Use a stand-in plugin and a plain config, as create then runs neither the schema checks nor
+ # the hooks of zfsnvme and writes no key file.
+ {
+
+ package StandInPlugin;
+ sub check_config { return { type => 'zfsnvme', %{ $_[2] } } }
+ sub on_add_hook { return }
+ }
+ my $lookup = PVE::SectionConfig->can('lookup');
+ my $sections = Test::MockModule->new('PVE::SectionConfig');
+ $sections->redefine(
+ lookup => sub($class, $type) {
+ return $type eq 'zfsnvme' ? 'StandInPlugin' : $lookup->($class, $type);
+ },
+ );
+ my $config = {
+ ids => {
+ local => { type => 'dir', path => '/var/lib/vz' },
+ fabric => { type => 'nvmeof', subsysnqn => 'nqn.test', portals => '192.0.2.1' },
+ },
+ };
+ $storage->mock(config => sub { $config }, write_config => sub { });
+ my $create = PVE::API2::Storage::Config->map_method_by_name('create')->{code};
+ my $add_zfs = sub($storeid) {
+ $asserted = undef;
+ $create->({ storage => $storeid, type => 'zfsnvme', subsysnqn => "nqn.$storeid" });
+ return $asserted;
+ };
+ is(
+ $add_zfs->('zfs1'),
+ '9.3.2',
+ 'the first zfsnvme storage checks the cluster despite an nvmeof one',
+ );
+ is($add_zfs->('zfs2'), undef, 'a further one does not');
};
subtest 'sysfs topology' => sub {
--
2.54.0.windows.1
next prev parent reply other threads:[~2026-11-26 15:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 15:09 [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 01/13] zfsnvme: add target state parsing and planning Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 02/13] zfsnvme: add the target transactions Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 03/13] zfsnvme: add storage configuration and volume methods Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 04/13] zfsnvme: connect the nodes and register the plugin Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 05/13] api: san luns: count zfsnvme storages as owners of their subsystem Joaquin Varela
2026-11-26 15:09 ` Joaquin Varela [this message]
2026-11-26 15:09 ` [PATCH storage v5 07/13] test: zfsnvme: add configuration and volume tests Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 08/13] test: zfsnvme: add node side tests Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 09/13] test: zfsnvme: add an in-memory nvmet target Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 10/13] test: zfsnvme: test the target parsers and planners Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 11/13] test: zfsnvme: test the target flows Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 12/13] test: zfsnvme: add a fault sweep, renderer and taint tests Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 13/13] zfsnvme: wait up to 30 seconds for the shared storage lock Joaquin Varela
2026-11-26 15:10 ` [PATCH docs v5] storage: document ZFS over NVMe/TCP Joaquin Varela
2026-11-26 15:11 ` [PATCH manager v5] ui: storage: add ZFS over NVMe/TCP editor Joaquin Varela
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=20261126150956.310593-7-joaquinvarela@neatech.ar \
--to=joaquinvarela@neatech.ar \
--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