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 DA3121FF0B3 for ; Thu, 26 Nov 2026 16:11:29 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id BE1F221801; Thu, 26 Nov 2026 16:11:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neatech-ar.20260707.gappssmtp.com; s=20260707; t=1795705809; x=1796310609; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=KyNtt+sCRWIDeNWHSxI6SblYqEaqHXndmp8J4YwIHzM=; b=T8HjRZimR4n+MjsHPaifE/2arzqTzdmWlYNz0ilUHOQFjl5VH0fcIFy4WV88M1WxB3 kPjWeA+TUJA1OCaiPjAXvU1fuNVoU+RL098zk3+FY+xBy+jqAdE5fuD/4P7LvGzGu4iy Emq6DIgYVUvOQQCCiUCxQ9pParbR2klc3hVRg/JodnN9UmJH5Xo4LrxwuJZdH6NBoVy+ Ify6Y29rXAqCWgCrVFH/HtjXWyBbrGYHgwc9esISB7rTDg84tRINY3E508AES42/5s2B WrNLsBlr2MsillGGOMD93PjfLKo/s0f4lsFAXqw+oI9xwN9h4KvAwK3x2HpBh//gA2s9 kVEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795705809; x=1796310609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=KyNtt+sCRWIDeNWHSxI6SblYqEaqHXndmp8J4YwIHzM=; b=JQZlSEVC26sEz4DwK/BwCC/KxXgteWnkQgB9uYvJARa9cE8jeytBVzv4GJFlEz2v+Y IWFdM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oe/2ZgfcYkU256z3EXh8JoGp io5Gt/qBDTZ5dAg1va0iXNyHPEQDbxThpl0flSriDX0QnWDZ3cSw= X-Received: by 2002:a05:6102:30ce:20b0:7cb:fef7:3763 with SMTP id ada2fe7eead31-7d7393d4015mr13828504137.3.1795705808676; Thu, 26 Nov 2026 07:10:08 -0800 (PST) From: Joaquin Varela 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 Message-ID: <20261126150956.310593-7-joaquinvarela@neatech.ar> X-Mailer: git-send-email 2.54.0.windows.1 In-Reply-To: <20261126150956.310593-1-joaquinvarela@neatech.ar> References: <20261126150956.310593-1-joaquinvarela@neatech.ar> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.286 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DMARC_PASS -0.1 DMARC pass policy RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no 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: VFG3KPUR7AL42H2JKJXUUYLX4LHILPYB X-Message-ID-Hash: VFG3KPUR7AL42H2JKJXUUYLX4LHILPYB X-MailFrom: joaquinvarela@neatech.ar 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: 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 --- 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