* [PATCH docs v5] storage: document ZFS over NVMe/TCP
2026-11-26 15:09 8% [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
` (3 preceding siblings ...)
2026-11-26 15:09 7% ` [PATCH storage v5 08/13] test: zfsnvme: add node side tests Joaquin Varela
@ 2026-11-26 15:10 16% ` Joaquin Varela
4 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-11-26 15:10 UTC (permalink / raw)
To: pve-devel
Add a chapter for the zfsnvme storage type with its prerequisites,
properties, an example, what happens when all paths are down, how to
clean up after removing a storage and its limits. List the type in the
table of storage types and include the chapter in pvesm.
The chapter marks the type as a technology preview like the table does.
It says that Proxmox VE refuses to add the first storage of the type
until every node knows it, and how the type differs from NVMe over
Fabrics.
It also says that a removed storage or a failed add leaves its subsystem
on the target. Removing that subsystem is required before a key change,
the revocation of a node, or reusing its portals.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
pve-storage-zfsnvme.adoc | 210 +++++++++++++++++++++++++++++++++++++++
pvesm.adoc | 5 +
2 files changed, 215 insertions(+)
create mode 100644 pve-storage-zfsnvme.adoc
diff --git a/pve-storage-zfsnvme.adoc b/pve-storage-zfsnvme.adoc
new file mode 100644
index 0000000..7374cff
--- /dev/null
+++ b/pve-storage-zfsnvme.adoc
@@ -0,0 +1,210 @@
+[[storage_zfsnvme]]
+ZFS over NVMe/TCP Backend
+-------------------------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: ZFS over NVMe/TCP
+endif::wiki[]
+
+WARNING: ZFS over NVMe/TCP is currently a **technology preview** in {pve}.
+
+Storage pool type: `zfsnvme`
+
+This backend accesses a remote Linux machine with a ZFS pool and the kernel NVMe
+target via `ssh`. For each guest disk it creates a ZVOL and exports it as an
+NVMe namespace over TCP. The {pve} nodes connect with the native NVMe multipath
+of the Linux kernel.
+
+Unlike xref:storage_nvmeof[NVMe over Fabrics], which uses namespaces that a
+storage array already serves, this backend creates and manages the ZVOLs itself
+and exports them with the kernel `nvmet` target, with DH-HMAC-CHAP
+authentication, snapshots and clones.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+. Upgrade all nodes to a {pve} version that includes this storage type, also
+ nodes that will not use it. A node without support removes such storages
+ when it writes the cluster-wide storage configuration, so adding the first
+ ZFS over NVMe/TCP storage is refused while a node is offline or runs an
+ older version.
+. The target needs OpenZFS, configfs, and the `nvmet` and `nvmet-tcp` kernel
+ modules with NVMe in-band authentication support. The plugin loads
+ `nvmet_tcp` and mounts configfs on the target when needed. Root needs a POSIX
+ compatible login shell. The target needs `zfs`, `modprobe`, `mount`, `find`,
+ `grep`, `dd`, `tee`, `sha256sum`, `cat`, `chmod`, `env`, `ln`, `mkdir`,
+ `printf`, `rm`, `rmdir` and `test`, but not Perl or Bash.
+. Configure root `ssh` access like for xref:storage_zfs[ZFS over iSCSI], with
+ the key at `/etc/pve/priv/zfs/<server>_id_rsa`.
+. Disable cloud-init on the target. It can otherwise take a guest disk with a
+ `cidata` file system for its own datasource at boot.
+. Install `nvme-cli` on every node. It creates the host NQN in
+ `/etc/nvme/hostnqn` and the host ID in `/etc/nvme/hostid`, which must be unique
+ for each node. The nodes also need native NVMe multipath, which is the kernel
+ default (`nvme_core.multipath=Y`). The plugin loads the `nvme-tcp` kernel
+ module when it activates a storage.
+
+Configuration
+~~~~~~~~~~~~~
+
+The backend supports the common storage properties `content`, `nodes`,
+`disable`, and the following ZFS over NVMe/TCP specific properties. The
+properties `server`, `pool`, `blocksize`, `subsysnqn` and `nvme-portals` cannot
+be changed after the storage is added. A change to `nvme-keep-alive-tmo` or
+`nvme-nr-io-queues` only applies to new connections.
+
+server:: Required. IP address or DNS name for the `ssh` connection to the
+ target. Guest I/O only uses the NVMe/TCP paths, but volume operations need
+ this connection. Use the same value in all storages on one target.
+
+pool:: Required. ZFS pool or child dataset on the target that holds the volumes.
+ It must not contain, or be contained in, the pool of another storage on the
+ same target.
+
+blocksize:: Required. ZFS volume block size, for example `16k`.
+
+sparse:: Use ZFS thin provisioning. Otherwise volumes reserve their full size.
+
+subsysnqn:: Required. NVMe qualified name of the subsystem. It must be unique in
+ the cluster.
+
+nvme-portals:: Required. Comma-separated IP addresses of the NVMe/TCP listeners
+ on the target, at most 16. The default port is `4420`. Put IPv6 addresses in
+ brackets, for example `[2001:db8::10]:4420`.
++
+Every storage needs its own listeners, which must not publish any other `nvmet`
+subsystem. If a listener does not publish the subsystem yet, for example while
+the target restores its configuration, `nvmet` rejects the connection in a way
+that makes the node delete the controller. Adding, updating or activating a
+storage fails if a portal has the address and port of another ZFS over NVMe/TCP
+storage, or an address that another storage reaches with a different `server`.
+
+nvme-host-ifaces:: Required. Comma-separated local interfaces, one for each
+ portal in the same order. Every node needs interfaces with these names. This
+ keeps a failed path from reconnecting over the management network.
+
+nvme-host-nqns:: Required. Comma-separated contents of `/etc/nvme/hostnqn` of
+ all nodes that may use the storage, at most 64. Activation fails on a node
+ whose host NQN is not listed, so add the NQN of a new node first. Host NQNs can
+ only be added.
+
+dhchap-key:: Required when the storage is added. NVMe DH-HMAC-CHAP secret in
+ `DHHC-1` format, for example from `nvme gen-dhchap-key`. It cannot be changed.
+ As a sensitive property it is stored below `/etc/pve/priv/storage/` and not in
+ `storage.cfg`. With `pvesm`, pass the path of a file that contains the key.
+ The target keeps one key for each host NQN, so storages on one target with
+ overlapping `nvme-host-nqns` need the same key.
+
+nvme-iopolicy:: Native multipath I/O policy: `round-robin` (default),
+ `queue-depth` or `numa`.
+
+nvme-keep-alive-tmo:: Keep-alive timeout in seconds. The default is 5.
+
+nvme-reconnect-delay:: Seconds between the attempts to reconnect a lost
+ controller. The default is 2.
+
+nvme-ctrl-loss-tmo:: Seconds that the kernel keeps reconnecting a lost
+ controller before it deletes it. The default is 600. With `-1` it retries
+ forever.
+
+nvme-fast-io-fail-tmo:: Optional. Seconds after which I/O to a reconnecting
+ controller fails. Without it, the kernel queues I/O until the controller is
+ lost. It must not exceed a finite `nvme-ctrl-loss-tmo`.
+
+nvme-nr-io-queues:: Optional number of I/O queues for each controller.
+
+.Configuration Example (`/etc/pve/storage.cfg`)
+----
+zfsnvme: nvme-shared
+ server 203.0.113.10
+ pool tank/pve-nvme
+ subsysnqn nqn.2026-01.com.example:pve-nvme
+ nvme-portals 192.0.2.10,198.51.100.10
+ nvme-host-ifaces ens1f0,ens1f1
+ nvme-host-nqns nqn.2014-08.org.nvmexpress:uuid:11111111-1111-1111-1111-111111111111,nqn.2014-08.org.nvmexpress:uuid:22222222-2222-2222-2222-222222222222
+ blocksize 16k
+ sparse 1
+ content images
+----
+
+The key is not part of `storage.cfg`. In the web interface, add the storage as
+*ZFS over NVMe/TCP* and enter the key there. With `pvesm`, save the key in a
+file with mode `0600` and pass its path as `--dhchap-key`, then remove the file.
+
+.Storage features for backend `zfsnvme`
+[width="100%",cols="m,m,3*d",options="header"]
+|==============================================================================
+|Content types |Image formats |Shared |Snapshots |Clones
+|images |raw |yes |yes |yes
+|==============================================================================
+
+Security and Availability
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The target allows only the host NQNs of `nvme-host-nqns`. All nodes share the
+DH-HMAC-CHAP key of the storage, so any holder of it can connect as any allowed
+host. The key only authenticates the hosts to the target. The target is not
+authenticated, and the data is not encrypted, so use isolated storage networks.
+The kernel exposes the key in sysfs on the nodes and in configfs on the target,
+so limit shell access on all of them to trusted administrators.
+
+The key cannot be rotated. To change it, or to revoke a node, remove the node
+from the cluster first. Every cluster member can read the keys below
+`/etc/pve/priv/`, which include the `ssh` keys of the targets, so replace those
+too. Then move all volumes off the storage, remove it, and remove its subsystem
+on the target as described under xref:storage_zfsnvme_limits[Limits]. This
+step is required. Until the subsystem is gone, the target still allows the
+revoked host NQN with the old key, and it refuses a new key for a host NQN that
+the subsystem still allows. Add a new storage with a new key and `subsysnqn`,
+without the revoked host NQN. Storages on one target with overlapping host NQNs
+share the key, so replace them together.
+
+Shared access relies on the cluster locking and fencing of {pve}, so test
+quorum and fencing before you place production guests on the storage. Make sure
+that the ZFS target is not a single point of failure. Changes to the target are
+serialized by a cluster-wide lock and need quorum. Do not use a target with more
+than one cluster.
+
+While all paths of a node are down, I/O is queued until a path returns, or
+fails after `nvme-fast-io-fail-tmo` if set. When they stay down longer than
+`nvme-ctrl-loss-tmo`, the kernel deletes the controllers and the multipath
+devices of the storage on that node. Running guests keep the removed device
+open, so stop and start them after the paths are back, for example with
+`qm stop <vmid>` and `qm start <vmid>`. A reboot inside the guest is not enough.
+A target that rejects a connection, for example for a wrong key, makes the
+kernel delete the controller regardless of the timeout. With `-1` the devices
+are kept, but guest I/O can block for the whole outage unless
+`nvme-fast-io-fail-tmo` is set. Choose these timeouts to fit the workload.
+
+[[storage_zfsnvme_limits]]
+Limits
+~~~~~~
+
+* Only VM disks and VM states are supported, not container volumes.
+* Online resize of a running guest disk is not supported. Stop the VM first.
+* Volumes cannot be renamed. `pvesm export` and `pvesm import` are not
+ supported, so remote migration cannot move disks of this storage. Migration
+ between nodes of the cluster works, as the storage is shared and no disk is
+ copied.
+* Removing a storage never deletes volumes. It only removes the key file of the
+ storage. The controllers stay connected on the nodes. Disconnect them on each
+ node under *NVMe over Fabrics* in its *SAN* panel, where they show no storage
+ once it is gone.
+* Removing a storage, or a failed add, leaves its subsystem on the target, with
+ its host objects and their key. Remove that subsystem before you add a storage
+ with another key for the same host NQNs, or reuse its portals. Otherwise the
+ target refuses the new key, or a portal publishes two subsystems. It is also
+ what ends the access of a revoked node. To do it, remove the port links,
+ the allowed host links, the namespaces and the subsystem directory under
+ `/sys/kernel/config/nvmet`, or use `nvmetcli`. After a plain removal with no
+ new storage it is optional. The `nvmet` configuration is not persistent unless
+ you save it, so a reboot of the target also drops it.
+
+ifdef::wiki[]
+
+See Also
+~~~~~~~~
+
+* link:/wiki/Storage[Storage]
+
+endif::wiki[]
diff --git a/pvesm.adoc b/pvesm.adoc
index ec2ef97..e40c16f 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -83,6 +83,7 @@ nodes that can be accessed as RBD (RADOS Block Device).
|FC/SAS |native^6^ |block |yes^3^|yes^4^ |yes
|Ceph/RBD |rbd |block |yes |yes |yes
|ZFS over iSCSI |zfs |block |yes |yes |yes
+|ZFS over NVMe/TCP|zfsnvme |block |yes |yes |TP^5^
|========================================================================
^1^: Disk images for VMs are stored in ZFS volume (zvol) datasets, which provide
@@ -539,6 +540,8 @@ See Also
* link:/wiki/Storage:_ZFS_over_ISCSI[Storage: ZFS over ISCSI]
+* link:/wiki/Storage:_ZFS_over_NVMe/TCP[Storage: ZFS over NVMe/TCP]
+
endif::wiki[]
ifndef::wiki[]
@@ -575,6 +578,8 @@ include::pve-storage-btrfs.adoc[]
include::pve-storage-zfs.adoc[]
+include::pve-storage-zfsnvme.adoc[]
+
ifdef::manvolnum[]
include::pve-copyright.adoc[]
base-commit: 0d8269d6c45caeffed7a6d71b695ad25217c4a4c
--
2.54.0.windows.1
^ permalink raw reply related [relevance 16%]
* [PATCH storage v5 08/13] test: zfsnvme: add node side tests
2026-11-26 15:09 8% [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
` (2 preceding siblings ...)
2026-11-26 15:09 6% ` [PATCH storage v5 07/13] test: zfsnvme: add configuration and volume tests Joaquin Varela
@ 2026-11-26 15:09 7% ` Joaquin Varela
2026-11-26 15:10 16% ` [PATCH docs v5] storage: document ZFS over NVMe/TCP Joaquin Varela
4 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-11-26 15:09 UTC (permalink / raw)
To: pve-devel
Test the /dev/nvme-fabrics options, the connect child against a
pseudoterminal that answers like the fabrics device (skipped without
/dev/ptmx) and that a connect which times out gives up the host lock.
Also test rescans, the namespace checks of a deactivation, the deletion
of controllers and its re-check under the lock, loading nvme-tcp, path
selection and storage activation.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
src/test/zfsnvme_test.pm | 1584 +++++++++++++++++++++++++++++++++++++-
1 file changed, 1583 insertions(+), 1 deletion(-)
diff --git a/src/test/zfsnvme_test.pm b/src/test/zfsnvme_test.pm
index 41991649..4f27f38b 100644
--- a/src/test/zfsnvme_test.pm
+++ b/src/test/zfsnvme_test.pm
@@ -11,7 +11,7 @@ use lib qw(..);
use Compress::Zlib qw(crc32);
use Config;
use Errno qw(EACCES ECONNREFUSED EINVAL ENOENT);
-use Fcntl qw(O_NOCTTY O_RDWR);
+use Fcntl qw(:flock O_NOCTTY O_RDWR);
use File::Temp qw(tempdir);
use MIME::Base64 qw(encode_base64);
use POSIX qw(
@@ -1261,6 +1261,1588 @@ subtest 'vdisk_alloc dispatches under the shared storage lock' => sub {
$parent_mock->unmock('lookup');
};
+{
+ my $portal = { address => '192.0.2.22', port => 4420, host_iface => 'ens21' };
+ my $options = sub($scfg) {
+ return nv(
+ '_fabrics_options', $scfg, $portal, $hostnqn_a, $UUID, $KEY,
+ );
+ };
+ my ($string, $names) = $options->({ subsysnqn => $NQN });
+ is(
+ $string,
+ "transport=tcp,traddr=192.0.2.22,trsvcid=4420,host_iface=ens21,nqn=$NQN,"
+ . "hostnqn=$hostnqn_a,hostid=$UUID,dhchap_secret=$KEY,keep_alive_tmo=5,"
+ . 'reconnect_delay=2,ctrl_loss_tmo=600',
+ 'the portal, the identities, the key and the default timeouts',
+ );
+ is_deeply(
+ $names,
+ [
+ qw(transport traddr trsvcid host_iface nqn hostnqn hostid dhchap_secret),
+ qw(keep_alive_tmo reconnect_delay ctrl_loss_tmo),
+ ],
+ 'with the names of the options',
+ );
+ my $tuned = {
+ subsysnqn => $NQN,
+ 'nvme-keep-alive-tmo' => 10,
+ 'nvme-reconnect-delay' => 5,
+ 'nvme-ctrl-loss-tmo' => 60,
+ 'nvme-fast-io-fail-tmo' => 15,
+ 'nvme-nr-io-queues' => 4,
+ };
+ ($string, $names) = $options->($tuned);
+ my $tail = 'keep_alive_tmo=10,reconnect_delay=5,ctrl_loss_tmo=60,'
+ . 'fast_io_fail_tmo=15,nr_io_queues=4';
+ like($string, qr/,\Q$tail\E\z/, 'the configured timeouts and queues');
+ is_deeply([$names->@[-2, -1]], ['fast_io_fail_tmo', 'nr_io_queues'], 'are named too');
+ ($string) = $options->({ $tuned->%*, 'nvme-fast-io-fail-tmo' => 0 });
+ like($string, qr/,fast_io_fail_tmo=0,/, 'a fast I/O fail timeout of 0 is a real value');
+ ($string) = $options->({ $tuned->%*, 'nvme-ctrl-loss-tmo' => -1 });
+ like($string, qr/,ctrl_loss_tmo=-1,/, 'an infinite loss timeout');
+
+ for my $value ('6 0', '60,duplicate_connect', "60\x00", '') {
+ eval { $options->({ $tuned->%*, 'nvme-ctrl-loss-tmo' => $value }) };
+ is(
+ $@,
+ "internal error: invalid NVMe connect option 'ctrl_loss_tmo'\n",
+ 'a value that would end the option early is refused without echoing it',
+ );
+ }
+}
+
+# The connect runs in a child bounded by 10 seconds plus 10 for the host lock. Its result and
+# errors pass through, a stopped task and a timeout have their own message.
+{
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ my $connect = sub($child) {
+ local @FORKS = ();
+ $nvme_mock->redefine(_fabrics_connect => $child);
+ my $res = eval { nv('_connect_portal', scfg(), $portal, $hostnqn_a, $UUID, $KEY); };
+ my $error = $@;
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+ return ($res, $error, [@FORKS]);
+ };
+ @LOCKS = ();
+ my ($res, $error, $forks) = $connect->(sub($options, $names) { return 7 });
+ is($res, 7, 'returns the instance of the new controller');
+ is_deeply($forks, [20], 'from a child bounded by 10 seconds and 10 for the host lock');
+ is_deeply(\@LOCKS, ['enter', 'leave'], 'that takes the host lock of PVE::NVMeOF');
+ my $held;
+ $connect->(sub(@args) {
+ $held = $LOCK_HELD;
+ return 7;
+ });
+ ok($held, 'and creates the controller while it holds it');
+ for my $exception ("received interrupt\n", "interrupted by unexpected signal\n") {
+ (undef, $error) = $connect->(sub(@args) {
+ die $exception;
+ });
+ is($error, "received interrupt\n", 'a stopped task dies with the task marker');
+ }
+ my @warnings;
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ $nvmeof_mock->redefine(with_lock => sub($code, $limit = undef) { die $PVE::NVMeOF::TIMED_OUT });
+ (undef, $error) = $connect->(sub(@args) {
+ return 7;
+ });
+ is($error, "NVMe/TCP connect did not complete within 20 seconds\n", 'a timeout');
+ $nvmeof_mock->redefine(
+ with_lock => sub($code, $limit = undef) {
+ warn "malformed JSON string\n"; # what a child that died without a result leaves
+ return undef;
+ },
+ );
+ (undef, $error) = $connect->(sub(@args) {
+ return 7;
+ });
+ is($error, "NVMe/TCP connect left no result\n", 'a child without a result');
+ is_deeply(\@warnings, [], 'without the warning of with_lock in the task log');
+ $nvmeof_mock->redefine(with_lock => $lock_inline);
+}
+
+# The host lock is shared with the nvmeof storage and the controller API, and another activation
+# of the same storage can run at the same time, so the portal is checked again under the lock.
+{
+ reset_host();
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ my $connect = sub() {
+ my $res = eval { nv('_connect_portal', scfg(), $portal, $hostnqn_a, $UUID, $KEY); };
+ return ($res, $@);
+ };
+ my $created = 0;
+ $nvme_mock->redefine(_fabrics_connect => sub(@args) { $created++; return 7 });
+
+ local $LOCK_BUSY = 1;
+ my ($res, $error) = $connect->();
+ is(
+ $error,
+ "NVMe over Fabrics is busy - another operation is still running\n",
+ 'a busy host lock fails the connect',
+ );
+ is($created, 0, 'before anything is created');
+ $LOCK_BUSY = 0;
+
+ # [name, controller, expected result]
+ for my $case (
+ ['a live controller on the interface', ['nvme5', 'live', 'ens19'], -1],
+ ['a controller that is still connecting', ['nvme5', 'connecting', 'ens19'], -1],
+ ['a dead controller', ['nvme5', 'dead', 'ens19'], 7],
+ ['a controller on another interface', ['nvme5', 'live', 'ens20'], 7],
+ ['no controller', undef, 7],
+ ) {
+ my ($name, $controller, $expected) = $case->@*;
+ reset_host();
+ $created = 0;
+ if ($controller) {
+ my ($controller_name, $state, $iface) = $controller->@*;
+ add_controller($controller_name, '192.0.2.21', 4420, $iface, $state);
+ }
+ ($res, $error) = $connect->();
+ is($res, $expected, "with $name the result is $expected");
+ is($error, '', "and there is no error");
+ is($created, $expected == 7 ? 1 : 0, "and the controller is created or not accordingly");
+ }
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+}
+
+my %signal = (HUP => SIGHUP, INT => SIGINT, QUIT => SIGQUIT, TERM => SIGTERM, ALRM => SIGALRM);
+
+sub blocked_signals() {
+ my $mask = POSIX::SigSet->new();
+ sigprocmask(SIG_BLOCK, POSIX::SigSet->new(), $mask) or die "sigprocmask: $!\n";
+ return join(',', grep { $mask->ismember($signal{$_}) } sort keys %signal);
+}
+
+# The child itself: a real fork under the real with_lock, on a lock file of its own.
+subtest 'the connect child' => sub {
+ $nvmeof_mock->unmock('with_lock');
+ local $PVE::NVMeOF::RUN_DIR = tempdir(CLEANUP => 1);
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ my $connect = sub() {
+ my $res = eval { nv('_connect_portal', scfg(), $portal, $hostnqn_a, $UUID, $KEY); };
+ return ($res, $@);
+ };
+ $nvme_mock->redefine(_fabrics_connect => sub(@args) { return 7 });
+ my ($res, $error) = $connect->();
+ is($res, 7, 'the result of the child reaches the parent');
+ is(blocked_signals(), '', 'and the signal mask is restored');
+ $nvme_mock->redefine(
+ _fabrics_connect => sub(@args) { die "connect failed: Connection refused\n" },
+ );
+ (undef, $error) = $connect->();
+ is($error, "connect failed: Connection refused\n", 'and so does its error');
+ is(blocked_signals(), '', 'with the signal mask restored');
+
+ my $dir = tempdir(CLEANUP => 1);
+ $nvme_mock->redefine(_fabrics_connect => sub(@args) { warn "child warning\n"; return 7 });
+ open(my $saved, '>&', \*STDERR) or die "cannot save STDERR: $!\n";
+ open(STDERR, '>', "$dir/stderr") or die "cannot redirect STDERR: $!\n";
+ ($res, $error) = $connect->();
+ open(STDERR, '>&', $saved) or die "cannot restore STDERR: $!\n";
+ is($res, 7, 'a child that warns');
+ open(my $fh, '<', "$dir/stderr") or die "cannot read '$dir/stderr': $!\n";
+ is(join('', <$fh>), "child warning\n", 'is heard');
+ close($fh);
+
+ # the signal stays pending while the child runs, then the worker handler dies with the marker
+ for my $name (qw(TERM QUIT INT)) {
+ pipe(my $from_child, my $to_parent) or die "pipe: $!\n";
+ $nvme_mock->redefine(
+ _fabrics_connect => sub(@args) {
+ kill($name, getppid()) or die "kill: $!\n";
+ print {$to_parent} "$$ " . blocked_signals() . "\n";
+ close($to_parent);
+ return 7;
+ },
+ );
+ my $seen;
+ local $SIG{$name} = sub { # as in a PVE worker
+ chomp(my $report = <$from_child> // '');
+ my ($pid, $blocked) = split(/ /, $report, 2);
+ $seen = { blocked => $blocked, reaped => $pid && waitpid($pid, WNOHANG) == -1 };
+ die "received interrupt\n";
+ };
+ ($res, $error) = $connect->();
+ close($to_parent);
+ close($from_child);
+ is($error, "received interrupt\n", "$name stops the task with the task marker");
+ is(
+ $seen->{blocked},
+ 'HUP,INT,QUIT,TERM',
+ 'once the child, with the inherited mask, is done',
+ );
+ ok($seen->{reaped}, 'and reaped');
+ is(blocked_signals(), '', 'and the signal mask is restored');
+ }
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+ $nvmeof_mock->redefine(with_lock => $lock_inline);
+};
+
+# with_lock kills its child at the limit, so a stalled connect only keeps the host lock until the
+# caller gives up. A child inside that child would run on and keep the lock.
+subtest 'a connect that times out gives up the host lock' => sub {
+ $nvmeof_mock->unmock('with_lock');
+ my $dir = tempdir(CLEANUP => 1);
+ local $PVE::NVMeOF::RUN_DIR = $dir;
+ local $PVE::NVMeOF::LOCK_WAIT = 0;
+ # the real run_fork_with_timeout, with one second instead of the limit of the plugin
+ my $fork = \&PVE::Tools::run_fork_with_timeout;
+ my @limits;
+ $tools_mock->redefine(
+ run_fork_with_timeout => sub($limit, @rest) {
+ push @limits, $limit;
+ return $fork->($limit == 10 ? 1 : $limit, @rest);
+ },
+ );
+ my $marker = "$dir/marker";
+ $nvme_mock->redefine(
+ _fabrics_connect => sub(@args) {
+ sleep(2);
+ open(my $fh, '>', $marker) or die "cannot create '$marker': $!\n";
+ close($fh);
+ return 7;
+ },
+ );
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ eval { nv('_connect_portal', scfg(), $portal, $hostnqn_a, $UUID, $KEY) };
+ is($@, "NVMe/TCP connect did not complete within 10 seconds\n", 'the caller gives up');
+ is_deeply(\@limits, [10], 'at the limit that it passes to with_lock');
+ open(my $lock, '>>', "$dir/fabrics.lock") or die "cannot open the lock file: $!\n";
+ ok(flock($lock, LOCK_EX | LOCK_NB), 'and the host lock is free at once');
+ close($lock);
+ sleep(2);
+ ok(!-e $marker, 'as the connect was stopped and not left to run to its end');
+ $tools_mock->unmock('run_fork_with_timeout');
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+ $nvmeof_mock->redefine(with_lock => $lock_inline);
+};
+
+# The body of the connect child, inline. A pseudoterminal stands in for the fabrics device, a
+# character device that answers reads with the lines the test writes to the master.
+subtest 'the connect child body' => sub {
+ my $body = $nvme_mock->original('_fabrics_connect');
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ my ($options, $names) = nv('_fabrics_options', scfg(), $portal, $hostnqn_a, $UUID, $KEY);
+ my $tokens = sub(@names) {
+ return join(',', map { "$_=%s" } @names) . "\n";
+ };
+ # a body that waits for a line the test did not write must not hang the suite
+ local $SIG{ALRM} = sub { die "the child body did not finish\n" };
+ my $run = sub() {
+ @RESTRICTED = ();
+ alarm(30);
+ my $res = eval { $body->($options, $names) };
+ alarm(0);
+ return ($res, $@);
+ };
+ my $dir = tempdir(CLEANUP => 1);
+ my $file = "$dir/file";
+ open(my $fh, '>', $file) or die "cannot create '$file': $!\n";
+ close($fh);
+ for my $case (
+ [
+ 'a missing device',
+ "$dir/missing",
+ qr/\A'\Q$dir\E\/missing' does not exist; load the nvme-tcp kernel module\n\z/,
+ ],
+ ['a regular file', $file, qr/\A'\Q$file\E' is not a character device\n\z/],
+ [
+ 'a device without the option list',
+ '/dev/null',
+ qr/\Athe running kernel does not support the NVMe connect option 'transport'\n\z/,
+ ],
+ ) {
+ my ($name, $device, $expected) = $case->@*;
+ $nvme_mock->redefine(_fabrics_device => sub () { return $device });
+ my (undef, $error) = $run->();
+ like($error, $expected, "$name is refused");
+ unlike($error, qr/\Q$KEY\E/, 'without the key in the error');
+ }
+ is(-s $file, 0, 'and nothing is written before the device is checked');
+
+ my $pty = sub() {
+ # TIOCSPTLCK and TIOCGPTN are only known for these architectures
+ return if $Config{archname} !~ m/\A(?:x86_64|i[3-6]86|aarch64|arm|riscv64)-linux/;
+ sysopen(my $master, '/dev/ptmx', O_RDWR | O_NOCTTY) or return;
+ my $zero = pack('i', 0);
+ ioctl($master, 0x40045431, $zero) or return;
+ my $number = pack('i', 0);
+ ioctl($master, 0x80045430, $number) or return;
+ my $slave = '/dev/pts/' . unpack('i', $number);
+ # keeps the line discipline: canonical reads, no echo, no translation
+ sysopen(my $keep, $slave, O_RDWR | O_NOCTTY) or return;
+ my $termios = POSIX::Termios->new();
+ $termios->getattr(fileno($keep)) or die "tcgetattr: $!\n";
+ $termios->setlflag(($termios->getlflag() & ~(ECHO | ECHONL)) | ICANON);
+ $termios->setoflag($termios->getoflag() & ~OPOST);
+ $termios->setattr(fileno($keep), TCSANOW) or die "tcsetattr: $!\n";
+ return ($master, $slave, $keep);
+ };
+ my $received = sub($master) {
+ my $readable = '';
+ vec($readable, fileno($master), 1) = 1;
+ return '' if !select($readable, undef, undef, 0.1);
+ sysread($master, my $buffer, 65536) // die "cannot read the pseudoterminal: $!\n";
+ return $buffer;
+ };
+ my ($master, $slave, $keep) = $pty->();
+ SKIP: {
+ skip 'no pseudoterminal available', 25 if !$master;
+ $nvme_mock->redefine(_fabrics_device => sub () { return $slave });
+
+ my ($res, $error);
+ for my $instance (3, 12) {
+ syswrite($master, $tokens->($names->@*, 'tls'));
+ syswrite($master, "instance=$instance,cntlid=1\n");
+ ($res, $error) = $run->();
+ is($error, '', "a connect (instance $instance)");
+ is($res, $instance, 'returns the instance of the controller');
+ is($received->($master), $options, 'after exactly one write of the options');
+ my $attrs = "/sys/class/nvme/nvme$instance";
+ is_deeply(
+ \@RESTRICTED,
+ ["$attrs/dhchap_secret", "$attrs/dhchap_ctrl_secret"],
+ 'and restricts the secret attributes of that controller',
+ );
+ }
+
+ for my $missing (qw(host_iface nqn)) {
+ syswrite($master,
+ $tokens->(map { $_ eq $missing ? "${_}_suffix" : $_ } $names->@*));
+ ($res, $error) = $run->();
+ is(
+ $error,
+ "the running kernel does not support the NVMe connect option '$missing'\n",
+ "an option the kernel does not list ($missing)",
+ );
+ is($received->($master), '', 'is found before anything is written');
+ }
+
+ for my $result ("garbage\n", "instance=3,cntlid=1,garbage\n") {
+ syswrite($master, $tokens->($names->@*));
+ syswrite($master, $result);
+ ($res, $error) = $run->();
+ is($error, "unexpected connect result\n", 'an unexpected result is refused');
+ is($received->($master), $options, 'after the one write');
+ is_deeply(\@RESTRICTED, [], 'and nothing is restricted');
+ }
+
+ symlink($slave, "$dir/link") or die "symlink: $!\n";
+ $nvme_mock->redefine(_fabrics_device => sub () { return "$dir/link" });
+ ($res, $error) = $run->();
+ is(
+ $error,
+ "cannot open '$dir/link': Too many levels of symbolic links\n",
+ 'a symbolic link to the device is not followed',
+ );
+ $nvme_mock->redefine(_fabrics_device => sub () { return $slave });
+
+ # A failed write: the error has the errno text and never the options.
+ my $writes = 0;
+ $nvme_mock->redefine(
+ _fabrics_write => sub($fh, $data) { $writes++; $! = ECONNREFUSED; return undef },
+ );
+ syswrite($master, $tokens->($names->@*));
+ ($res, $error) = $run->();
+ is(
+ $error,
+ "connect failed: Connection refused\n",
+ 'a refused connect has the errno text',
+ );
+ is($writes, 1, 'after one write, which is not repeated');
+ is_deeply(\@RESTRICTED, [], 'and nothing is restricted');
+ $writes = 0;
+ $nvme_mock->redefine(
+ _fabrics_write => sub($fh, $data) { $writes++; return length($data) - 1 });
+ syswrite($master, $tokens->($names->@*));
+ syswrite($master, "instance=3,cntlid=1\n"); # never read: a short write ends the connect
+ ($res, $error) = $run->();
+ is($error, "connect failed: short write\n", 'a short write');
+ is($writes, 1, 'is not completed');
+ is_deeply(\@RESTRICTED, [], 'and restricts nothing');
+ $nvme_mock->unmock('_fabrics_write');
+ }
+ $nvme_mock->unmock('_fabrics_device');
+};
+
+# no namespace of the subsystem on this node, unless a test says otherwise
+my $no_namespaces = sub($nqn) { return {} };
+$nvmeof_mock->redefine(namespaces => $no_namespaces);
+
+{
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ add_controller('nvme3', '192.0.2.23', 4420, 'ens21', 'live', $OTHER_NQN);
+ my $opened = "process 123 (qemu-system-x86_64) has namespace 'nvme0n1' open";
+ $nvme_mock->redefine(_namespace_users => sub($nqn) { return [$opened] });
+ eval { $PLUGIN->deactivate_storage('nvmetest', scfg()) };
+ is(
+ $@,
+ "refusing to disconnect NVMe storage 'nvmetest': $opened\n",
+ 'deactivation refuses a namespace opened by a VM',
+ );
+ is_deeply(\@DELETED, [], 'and deletes nothing');
+ $nvme_mock->redefine(_namespace_users => sub($nqn) { return [] });
+ is($PLUGIN->deactivate_storage('nvmetest', scfg()), 1, 'an unused storage is deactivated');
+ is_deeply(\@DELETED, ['nvme1', 'nvme2'], 'by deleting the controllers of its subsystem');
+ is_deeply(\@FORKS, [25], 'in one child bounded by 15 seconds and 10 for the host lock');
+ is_deeply($DIRS{'/sys/class/nvme'}, ['nvme3'], 'the controllers of other subsystems stay');
+ is($PLUGIN->deactivate_storage('nvmetest', scfg()), 1, 'a storage without controllers');
+ is_deeply(\@FORKS, [25], 'needs no child');
+ $nvme_mock->unmock('_namespace_users');
+
+ my $delete = $nvme_mock->original('_delete_controllers');
+ @SYSFS_WRITES = ();
+ is($delete->([{ name => 'nvme1' }, { name => 'nvme2' }]), 2, 'the child deletes each one');
+ is_deeply(
+ \@SYSFS_WRITES,
+ [map { ["/sys/class/nvme/$_/delete_controller", '1'] } qw(nvme1 nvme2)],
+ 'through sysfs',
+ );
+ # the stock file_write: a failed write warns with the errno text, a failed open does not
+ my $file_write = $sysfs_mock->original('file_write');
+ my $dir = tempdir(CLEANUP => 1);
+ my @warnings;
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ for my $case (['/dev/full', 'No space left on device'], [$dir, 'Is a directory']) {
+ my ($path, $reason) = $case->@*;
+ $sysfs_mock->redefine(file_write => sub($file, @args) { $file_write->($path, @args) });
+ eval { $delete->([{ name => 'nvme1' }, { name => 'nvme2' }]) };
+ is(
+ $@,
+ "cannot delete NVMe controller 'nvme1': $reason\n",
+ "a failed delete names the controller and the errno text ($reason)",
+ );
+ }
+ $sysfs_mock->redefine(file_write => sub($file, @args) { $file_write->("$dir/a/b", @args) });
+ is(
+ $delete->([{ name => 'nvme1' }, { name => 'nvme2' }]),
+ 2,
+ 'a controller that went away since it was listed counts as deleted',
+ );
+ $sysfs_mock->redefine(
+ file_write => sub($path, $data, @rest) {
+ warn "error writing '$data' to '$path': Device or resource busy\n";
+ $! = 0;
+ return 0;
+ },
+ );
+ eval { $delete->([{ name => 'nvme1' }]) };
+ is(
+ $@,
+ "cannot delete NVMe controller 'nvme1': Device or resource busy\n",
+ 'the errno text of a failed write is the one of the warning',
+ );
+ is_deeply(\@warnings, [], 'which is not passed on');
+ $sysfs_mock->redefine(file_write => $sysfs_write);
+}
+
+# What keeps a namespace from going away comes from the helpers of PVE::Diskmanage and PVE::NVMeOF,
+# as in disconnect_guarded. They are mocked here, so each case sets what one device answers.
+subtest 'users of the namespaces' => sub {
+ my $disk_mock = Test::MockModule->new('PVE::Diskmanage');
+ my (@heads, @asked, @claims, %mounted, %held, %claimed, %opener, %partitions);
+ $nvmeof_mock->redefine(
+ namespaces => sub($nqn) {
+ die "test error: namespaces of '$nqn'\n" if $nqn ne $NQN;
+ return { map { $_ => {} } @heads };
+ },
+ );
+ $nvmeof_mock->redefine(
+ is_claimed => sub($device) {
+ push @claims, $device;
+ return $claimed{$device};
+ },
+ );
+ $disk_mock->redefine(is_mounted => sub($device) { return $mounted{$device} });
+ $disk_mock->redefine(has_holder => sub($device) { return $held{$device} });
+ $disk_mock->redefine(
+ device_opener => sub(@devices) {
+ push @asked, [@devices];
+ return shift(($opener{ $devices[0] } //= [])->@*); # one answer for each try
+ },
+ );
+ $nvme_mock->redefine(
+ _partitions => sub($device) { return ($partitions{$device} // [])->@* });
+ my $reset = sub(@names) {
+ @heads = @names;
+ @asked = @claims = ();
+ %mounted = %held = %claimed = %opener = %partitions = ();
+ reset_host();
+ };
+
+ $reset->();
+ is_deeply(nv('_namespace_users', $NQN), [], 'no namespace, no users');
+ is_deeply([\@claims, \@asked], [[], []], 'and nothing is asked');
+
+ $reset->('nvme7n1');
+ $partitions{'/dev/nvme7n1'} = ['/dev/nvme7n1p1', '/dev/nvme7n1p2'];
+ is_deeply(nv('_namespace_users', $NQN), [], 'a namespace that nothing uses');
+ is_deeply(
+ \@claims,
+ ['/dev/nvme7n1', '/dev/nvme7n1p1', '/dev/nvme7n1p2'],
+ 'is checked for a claim on the namespace and on each partition',
+ );
+ is_deeply(
+ \@asked,
+ [['/dev/nvme7n1', '/dev/nvme7n1p1', '/dev/nvme7n1p2']],
+ 'and for openers of all three at once',
+ );
+
+ $reset->('nvme7n1');
+ $mounted{'/dev/nvme7n1'} = '/dev/nvme7n1p1';
+ is_deeply(
+ nv('_namespace_users', $NQN),
+ ["'/dev/nvme7n1p1' is mounted"],
+ 'a mounted partition is a user',
+ );
+ is_deeply([\@claims, \@asked], [[], []], 'which ends the check of the namespace');
+
+ $reset->('nvme7n1');
+ $held{'/dev/nvme7n1'} = '/dev/nvme7n1p2';
+ is_deeply(
+ nv('_namespace_users', $NQN),
+ ["'/dev/nvme7n1p2' has a holder"],
+ 'so is a partition with a holder, like a volume group',
+ );
+
+ # a swap area claims the device like a mount, and is neither mounted nor held
+ $reset->('nvme7n1');
+ $partitions{'/dev/nvme7n1'} = ['/dev/nvme7n1p1'];
+ $claimed{'/dev/nvme7n1p1'} = 1;
+ is_deeply(
+ nv('_namespace_users', $NQN),
+ ["'/dev/nvme7n1p1' is claimed, for example by a swap area"],
+ 'a partition that is claimed, which is how a swap area looks',
+ );
+ is_deeply(\@asked, [], 'before anyone looks for openers');
+
+ $reset->('nvme7n1');
+ my $before = $NOW;
+ $partitions{'/dev/nvme7n1'} = ['/dev/nvme7n1p1'];
+ $opener{'/dev/nvme7n1'} = [('200 (mkfs.ext4)') x 5];
+ is_deeply(
+ nv('_namespace_users', $NQN),
+ ["process 200 (mkfs.ext4) has namespace 'nvme7n1' open"],
+ 'a process that keeps a partition open is a user',
+ );
+ is(scalar(@asked), 4, 'after four tries');
+ is(sprintf('%.1f', $NOW - $before), '0.9', 'with 0.3 seconds between them');
+
+ $reset->('nvme7n1');
+ $opener{'/dev/nvme7n1'} = ['4 (udevd)'];
+ is_deeply(nv('_namespace_users', $NQN), [], 'a process that lets go meanwhile is not');
+ is(scalar(@asked), 2, 'after the second try');
+
+ $reset->('nvme7n2', 'nvme7n1');
+ $mounted{'/dev/nvme7n2'} = '/dev/nvme7n2';
+ is_deeply(
+ nv('_namespace_users', $NQN),
+ ["'/dev/nvme7n2' is mounted"],
+ 'of two namespaces only the one in use is named',
+ );
+ is_deeply(\@asked, [['/dev/nvme7n1']], 'while the other one was checked');
+
+ # a namespace that cannot be read must not look like one that is gone
+ $nvmeof_mock->redefine(
+ namespaces => sub($nqn) { die "cannot read the WWID of namespace 'nvme7n1'\n" },
+ );
+ $reset->();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ eval { $PLUGIN->deactivate_storage('nvmetest', scfg()) };
+ is($@, "cannot read the WWID of namespace 'nvme7n1'\n", 'the deactivation fails with it');
+ is_deeply(\@DELETED, [], 'and deletes nothing');
+
+ # the whole deactivation on top of the real check
+ $nvmeof_mock->redefine(namespaces => sub($nqn) { return { nvme7n1 => {} } });
+ $mounted{'/dev/nvme7n1'} = '/dev/nvme7n1p1';
+ eval { $PLUGIN->deactivate_storage('nvmetest', scfg()) };
+ is(
+ $@,
+ "refusing to disconnect NVMe storage 'nvmetest': '/dev/nvme7n1p1' is mounted\n",
+ 'a deactivation refuses a mounted partition',
+ );
+ is_deeply(\@DELETED, [], 'and deletes nothing');
+ delete $mounted{'/dev/nvme7n1'};
+ is($PLUGIN->deactivate_storage('nvmetest', scfg()), 1, 'and goes ahead once it is free');
+ is_deeply(\@DELETED, ['nvme1'], 'by deleting the controller');
+
+ $nvmeof_mock->redefine(namespaces => $no_namespaces);
+ $nvmeof_mock->unmock('is_claimed');
+ $nvme_mock->unmock('_partitions');
+};
+
+{
+ my $link = "/dev/disk/by-id/nvme-uuid.$UUID";
+ my $check = sub($target, %files) {
+ local %LINKS = (defined($target) ? ($link => $target) : ());
+ local %FILES = (
+ '/sys/block/nvme3n1/uuid' => uc($UUID),
+ '/sys/block/nvme3n1/nsid' => '7',
+ '/sys/block/nvme3n1/device/subsysnqn' => $NQN,
+ %files,
+ );
+ my $ok = nv('_nvmet_local_namespace_ok', $link, $NQN, 7, $UUID);
+ return $ok ? 1 : 0;
+ };
+ my $device = '../../nvme3n1';
+ is($check->($device), 1, 'accepts the namespace of the subsystem, whatever the UUID case');
+ is($check->($device, '/sys/block/nvme3n1/nsid' => '8'), 0, 'refuses another NSID');
+ is(
+ $check->($device, '/sys/block/nvme3n1/device/subsysnqn' => $OTHER_NQN),
+ 0,
+ 'another subsystem',
+ );
+ is(
+ $check->($device, '/sys/block/nvme3n1/uuid' => '22345678-1234-1234-1234-123456789abc'),
+ 0,
+ 'another UUID',
+ );
+ is($check->($device, '/sys/block/nvme3n1/uuid' => undef), 0, 'an unreadable device');
+ is($check->(undef), 0, 'a missing link');
+
+ for my $target ('../../nvme3c1n1', '../../nvme3n1p1', '../../sda') {
+ is($check->($target), 0, "a link to $target");
+ }
+
+ my $dir = tempdir(CLEANUP => 1);
+ symlink('../../nvme3n1', "$dir/link") or die "symlink: $!\n";
+ is($nvme_mock->original('_link_target')->("$dir/link"), '../../nvme3n1', 'read, not followed');
+}
+
+my $activate = sub($storeid, $scfg, $cache = undef) {
+ local $FILES{"/etc/pve/priv/storage/$storeid.nvme-dhchap"} = $KEY;
+ local %CONFIG = (%CONFIG, $storeid => $scfg);
+ @ACTIVATIONS = ();
+ $nvme_mock->redefine(
+ _nvmet_activate_target => sub(@args) { push @ACTIVATIONS, [@args]; return },
+ );
+ my $res = eval { $PLUGIN->activate_storage($storeid, $scfg, $cache) };
+ my $error = $@;
+ $nvme_mock->unmock('_nvmet_activate_target');
+ return ($res, $error);
+};
+my $forced = sub($storeid) { return { 'zfsnvme-force-reconcile' => { $storeid => 1 } } };
+
+subtest 'activation preconditions' => sub {
+ my $file = sub($path, $value) {
+ return sub() { $FILES{$path} = $value }
+ };
+ my $missing_iface = sub() {
+ $nvme_mock->redefine(_local_iface_exists => sub($iface) { return $iface ne 'ens20' });
+ };
+ my $other_storage = sub(%override) {
+ return sub() { $CONFIG{other} = scfg(subsysnqn => $OTHER_NQN, %override) };
+ };
+ my $fabrics_injection = 'traddr=198.51.100.9';
+ for my $case (
+ [
+ 'a kernel without native NVMe multipath',
+ $file->('/sys/module/nvme_core/parameters/multipath', undef),
+ qr/native NVMe multipath is disabled/,
+ ],
+ [
+ 'multipath disabled',
+ $file->('/sys/module/nvme_core/parameters/multipath', 'N'),
+ qr/native NVMe multipath is disabled/,
+ ],
+ [
+ 'no host NQN',
+ $file->('/etc/nvme/hostnqn', undef),
+ qr/invalid or missing NVMe host NQN in '\/etc\/nvme\/hostnqn'/,
+ ],
+ [
+ 'a host NQN with a connect option',
+ $file->('/etc/nvme/hostnqn', "$hostnqn_a,$fabrics_injection"),
+ qr/invalid or missing NVMe host NQN in '\/etc\/nvme\/hostnqn'/,
+ ],
+ [
+ 'a host that is not allowed',
+ $file->(
+ '/etc/nvme/hostnqn',
+ 'nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-00000000dead',
+ ),
+ qr/local NVMe host NQN .* is missing from nvme-host-nqns/,
+ ],
+ [
+ 'no host ID',
+ $file->('/etc/nvme/hostid', undef),
+ qr/invalid or missing NVMe host ID in '\/etc\/nvme\/hostid'/,
+ ],
+ [
+ 'the zero host ID',
+ $file->('/etc/nvme/hostid', '00000000-0000-0000-0000-000000000000'),
+ qr/invalid or missing NVMe host ID in '\/etc\/nvme\/hostid'/,
+ ],
+ [
+ 'a host ID with a connect option',
+ $file->('/etc/nvme/hostid', "$UUID,$fabrics_injection"),
+ qr/invalid or missing NVMe host ID in '\/etc\/nvme\/hostid'/,
+ ],
+ [
+ 'a host ID with a newline',
+ $file->('/etc/nvme/hostid', "$UUID\n"),
+ qr/invalid or missing NVMe host ID in '\/etc\/nvme\/hostid'/,
+ ],
+ [
+ 'a connection parameter that is not a number',
+ sub() { },
+ qr/invalid NVMe connection parameter 'reconnect-delay'/,
+ 'nvme-reconnect-delay' => "2,$fabrics_injection",
+ ],
+ [
+ 'a missing local interface',
+ $missing_iface,
+ qr/interface 'ens20' does not exist on this node/,
+ ],
+ [
+ 'a pool shared with another storage',
+ $other_storage->('nvme-portals' => '192.0.2.31,192.0.2.32'),
+ qr/ZFS pool 'tank' on '192\.0\.2\.10' is already used by storage 'other'/,
+ ],
+ [
+ 'a listener shared with another storage',
+ $other_storage->(pool => 'data', 'nvme-portals' => '192.0.2.31,192.0.2.22'),
+ qr/portal '192\.0\.2\.22' port 4420 is already used by storage 'other'/,
+ ],
+ ) {
+ my ($name, $setup, $error, %override) = $case->@*;
+ reset_host();
+ local %CONFIG = ();
+ $nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+ $setup->();
+ my (undef, $got) = $activate->('zfsnvme-unit-s', scfg(%override));
+ like($got, $error, "refuses $name");
+ is_deeply([@ACTIVATIONS, @CONNECTS, @SYSFS_WRITES], [], 'and does nothing');
+ }
+ $nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+};
+
+# As PVE::NVMeOF does, so that a node without local NVMe disks can use the storage after a reboot
+subtest 'loading the nvme-tcp module' => sub {
+ my $multipath = '/sys/module/nvme_core/parameters/multipath';
+ my @commands;
+ local $COMMAND = sub($cmd, %opts) {
+ push @commands, [$cmd, $opts{timeout}];
+ return 0;
+ };
+ reset_host();
+ my (undef, $err) = $activate->('zfsnvme-module', scfg());
+ is($err, '', 'a node that has the module activates the storage');
+ is_deeply(\@commands, [], 'without a command');
+
+ reset_host();
+ $TCP_LOADED = 0;
+ delete $FILES{$multipath}; # the module brings nvme_core with it
+ local $COMMAND = sub($cmd, %opts) {
+ push @commands, [$cmd, $opts{timeout}];
+ $FILES{$multipath} = 'Y';
+ return 0;
+ };
+ (undef, $err) = $activate->('zfsnvme-module', scfg());
+ is($err, '', 'a node without it loads it and activates the storage');
+ is_deeply(
+ \@commands,
+ [[['modprobe', 'nvme-tcp'], 10]],
+ 'with modprobe, for 10 seconds at most',
+ );
+
+ reset_host();
+ $TCP_LOADED = 0;
+ @commands = ();
+ local $COMMAND =
+ sub($cmd, %opts) { die "command 'modprobe nvme-tcp' failed: exit code 1\n" };
+ (undef, $err) = $activate->('zfsnvme-module', scfg());
+ is($err, "command 'modprobe nvme-tcp' failed: exit code 1\n",
+ 'a module that does not load');
+ is_deeply([@ACTIVATIONS, @CONNECTS, @SYSFS_WRITES], [], 'fails before anything is done');
+
+ reset_host();
+ $TCP_LOADED = 0;
+ local $COMMAND = sub($cmd, %opts) { return 0 };
+ $FILES{$multipath} = 'N';
+ (undef, $err) = $activate->('zfsnvme-module', scfg());
+ like($err, qr/native NVMe multipath is disabled/,
+ 'a kernel with multipath off still fails');
+};
+
+subtest 'a stopped task ends the activation at the connect' => sub {
+ for my $case (
+ ["received interrupt\n", 1],
+ ["interrupted by unexpected signal\n", 1],
+ ["connect failed: Connection refused\n", 0],
+ ["NVMe/TCP connect did not complete within 10 seconds\n", 0],
+ ) {
+ my ($exception, $cancelled) = $case->@*;
+ reset_host();
+ my $calls = 0;
+ $nvme_mock->redefine(
+ _fabrics_connect => sub($options, $names) {
+ my %option = map { split(/=/, $_, 2) } split(/,/, $options);
+ ++$calls;
+ # cancellation must escape even if the write created a live path
+ add_controller("nvme$calls", $option{traddr}, 4420, $option{host_iface})
+ if $cancelled || $calls > 1;
+ die $exception if $calls == 1;
+ return $calls;
+ },
+ );
+ my ($res, $err) = $activate->('zfsnvme-cancel', scfg());
+ is($err, $cancelled ? "received interrupt\n" : '', 'only a stopped task escapes');
+ is($res, $cancelled ? undef : 1, 'an ordinary failure still permits a degraded path');
+ is($calls, $cancelled ? 1 : 2, 'a stopped task never attempts the next portal');
+ unlike($err . join('', @WARNINGS), qr/\Q$KEY\E/, 'errors and warnings hide the key');
+ }
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+
+ reset_host();
+ no warnings 'redefine';
+ local *PVE::Storage::ZFSNVMePlugin::_restrict_attr =
+ sub($path) { die "received interrupt\n" };
+ my ($res, $err) = $activate->('zfsnvme-cancel-scan', scfg());
+ is($err, "received interrupt\n",
+ 'cancellation in the post-connect permission scan escapes');
+ is(scalar(@CONNECTS), 1, 'no next portal after a cancelled permission scan');
+};
+
+# A dead path is deleted in a bounded child, 5 seconds during an activation, which goes on, and 15
+# for a deactivation, which fails. Each gets 10 more seconds for the host lock. Only a stopped task
+# escapes an activation.
+subtest 'deleting a controller is bounded and keeps a stopped task' => sub {
+ my $interrupt = "received interrupt\n";
+ my $failed = "cannot delete NVMe controller 'nvme1'\n";
+ # [label, what the child does, activation error, deactivation error]
+ for my $case (
+ ['a stopped task', $interrupt, $interrupt, $interrupt],
+ ['a signalled child', "interrupted by unexpected signal\n", $interrupt, $interrupt],
+ ['a failed deletion', $failed, '', $failed],
+ [
+ 'a timeout',
+ undef,
+ '',
+ "disconnecting NVMe subsystem '$NQN' did not complete within 25 seconds\n",
+ ],
+ ) {
+ my ($label, $exception, $activation_error, $deactivation_error) = $case->@*;
+ $nvmeof_mock->redefine(
+ with_lock => sub($code, $limit = undef) {
+ # without an exception, the deletion times out
+ if (!defined($exception) && $limit != 20) {
+ push @FORKS, $limit;
+ die $PVE::NVMeOF::TIMED_OUT;
+ }
+ return $lock_inline->($code, $limit);
+ },
+ );
+ $nvme_mock->redefine(_delete_controllers => sub($controllers) { die $exception })
+ if defined($exception);
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'dead');
+ my ($res, $err) = $activate->('zfsnvme-delete', scfg());
+ is($err, $activation_error, "$label while a dead path is deleted");
+ is($FORKS[0], 15, 'in a child bounded by 5 seconds and 10 for the host lock');
+ is(scalar(@CONNECTS), $activation_error ? 0 : 2, 'only a failure goes on to connect');
+ my $warned = $exception
+ // "deleting NVMe controller 'nvme1' did not complete within 15 seconds\n";
+ like(join("\n", @WARNINGS), qr/\Q$warned\E/, 'and is warned about')
+ if !$activation_error;
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ eval { $PLUGIN->deactivate_storage('zfsnvme-delete', scfg()) };
+ is($@, $deactivation_error, "$label fails the deactivation");
+ is_deeply(\@FORKS, [25], 'in a child bounded by 15 seconds and 10 for the host lock');
+ $nvme_mock->redefine(_delete_controllers => $delete_mock);
+ }
+ $nvmeof_mock->redefine(with_lock => $lock_inline);
+};
+
+# connecting and deleting controllers take the host lock one at a time, never twice
+subtest 'the host lock of the controllers' => sub {
+ my $busy = "NVMe over Fabrics is busy - another operation is still running\n";
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'dead');
+ my ($res, $err) = $activate->('zfsnvme-lock', scfg());
+ is($err, '', 'an activation that replaces a dead path and adds one');
+ is_deeply(
+ \@LOCKS,
+ [('enter', 'leave') x 3],
+ 'takes the lock for the deletion and for each connect, one after the other',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'dead');
+ $LOCK_BUSY = 1;
+ ($res, $err) = $activate->('zfsnvme-lock', scfg());
+ like(
+ $err,
+ qr/^no live NVMe\/TCP path for storage 'zfsnvme-lock'/,
+ 'a busy lock leaves an activation without a live path to fail',
+ );
+ is_deeply([\@DELETED, \@CONNECTS], [[], []], 'after it deleted and connected nothing');
+ like(join("\n", @WARNINGS), qr/\Q$busy\E/, 'and warned about the lock');
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ $LOCK_BUSY = 1;
+ eval { $PLUGIN->deactivate_storage('zfsnvme-lock', scfg()) };
+ is($@, $busy, 'a busy lock fails the deactivation');
+ is_deeply(\@DELETED, [], 'which keeps the controllers');
+ $LOCK_BUSY = 0;
+ is($PLUGIN->deactivate_storage('zfsnvme-lock', scfg()), 1, 'and succeeds when it is free');
+ is_deeply(\@LOCKS, ['enter', 'leave'], 'under the lock');
+
+ # Another activation connects the second portal after this one checked its controllers.
+ reset_host();
+ my $meanwhile;
+ $network_mock->redefine(
+ tcp_ping => sub($host, $port, $timeout = undef) {
+ add_controller('nvme9', $host, $port, 'ens20')
+ if $host eq '192.0.2.22' && !$meanwhile++;
+ return 1;
+ },
+ );
+ ($res, $err) = $activate->('zfsnvme-lock', scfg());
+ is($err, '', 'an activation whose portal got a controller meanwhile succeeds');
+ is_deeply(\@CONNECTS, ['192.0.2.21@ens19'], 'and does not connect that portal twice');
+ $network_mock->redefine(tcp_ping => sub($host, $port, $timeout = undef) { return 1 });
+};
+
+# The kernel reuses the name of a controller that is gone, and another process can run while this
+# one waits for the host lock. So a delete looks at the controller again once it has the lock, and
+# a deactivation lists the controllers there. $ON_LOCK runs when the lock is taken for the nth time.
+subtest 'controllers are checked again under the host lock' => sub {
+ my $path = '/sys/class/nvme/nvme1';
+ my $other_subsystem = sub() { $FILES{"$path/subsysnqn"} = $OTHER_NQN };
+ my $live_again = sub() { $FILES{"$path/state"} = 'live' };
+ my $other_address = sub() {
+ $FILES{"$path/address"} = 'traddr=192.0.2.23,trsvcid=4420,host_iface=ens19';
+ };
+ my $dead = ['dead', 'ens19'];
+ my $moved = ['live', 'ens20'];
+ # [label, state and interface of the controller, change, nth lock, deleted, connects]
+ for my $case (
+ ['dead, unchanged', $dead, sub() { }, 1, ['nvme1'], 2],
+ ['dead, name reused by another subsystem', $dead, $other_subsystem, 1, [], 2],
+ ['dead, then live again', $dead, $live_again, 1, [], 1],
+ ['dead, name reused with another address', $dead, $other_address, 1, [], 2],
+ ['moved, unchanged', $moved, sub() { }, 2, ['nvme1'], 2],
+ ['moved, name reused by another subsystem', $moved, $other_subsystem, 2, [], 2],
+ ) {
+ my ($label, $controller, $change, $nth, $deleted, $connects) = $case->@*;
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, $controller->[1], $controller->[0]);
+ local $ON_LOCK = sub($entry) { $change->() if $entry == $nth };
+ my ($res, $err) = $activate->('zfsnvme-recheck', scfg());
+ is($err, '', "$label: the activation succeeds");
+ is_deeply(\@DELETED, $deleted, 'and deletes what it found, not what the name is now');
+ is(scalar(@CONNECTS), $connects, 'and connects the portals that need it');
+ }
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'dead');
+ local $ON_LOCK = sub($entry) { $other_subsystem->() };
+ $activate->('zfsnvme-recheck', scfg());
+ is(
+ $FILES{"$path/subsysnqn"},
+ $OTHER_NQN,
+ 'the controller of the other subsystem is left alone',
+ );
+ is_deeply($DIRS{'/sys/class/nvme'}, ['nvme1', 'nvme71', 'nvme72'], 'and still there');
+
+ # the list of a deactivation is the one under the lock
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ local $ON_LOCK = sub($entry) {
+ $other_subsystem->();
+ add_controller('nvme4', '192.0.2.21', 4420, 'ens20');
+ };
+ is($PLUGIN->deactivate_storage('zfsnvme-recheck', scfg()), 1, 'a deactivation succeeds');
+ is_deeply(
+ \@DELETED,
+ ['nvme2', 'nvme4'],
+ 'and deletes the controllers of the subsystem then',
+ );
+ is(
+ $FILES{"$path/subsysnqn"},
+ $OTHER_NQN,
+ 'not the one that got another subsystem meanwhile',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ local $ON_LOCK = sub($entry) { $DIRS{'/sys/class/nvme'} = [] };
+ is($PLUGIN->deactivate_storage('zfsnvme-recheck', scfg()), 1, 'and one without any left');
+ is_deeply(\@DELETED, [], 'deletes none');
+};
+
+# the core runs the hook inside the storage.cfg lock of the cluster
+subtest 'deleting a storage only touches local files' => sub {
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ @TARGET_CALLS = ();
+ $PLUGIN->on_delete_hook('zfsnvme-delete', scfg());
+ is_deeply(
+ \@UNLINKED,
+ ['/etc/pve/priv/storage/zfsnvme-delete.nvme-dhchap'],
+ 'the key file is removed',
+ );
+ is_deeply(
+ [\@TARGET_CALLS, \@DELETED, \@SYSFS_WRITES, \@FORKS, \@LOCKS, \@WARNINGS],
+ [[], [], [], [], [], []],
+ 'and nothing else: no target call, no lock, the controllers stay connected',
+ );
+};
+
+subtest 'slow-path backoff' => sub {
+ reset_host();
+ local %REFUSE = ('192.0.2.22' => 1);
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ my $scfg = scfg();
+ my ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is($error, '', 'a degraded storage activates');
+ is(scalar(@ACTIVATIONS), 1, 'through the target');
+ is_deeply(
+ [$ACTIVATIONS[0]->@[0, 2 .. 4]],
+ [
+ 'zfsnvme-unit-a',
+ [
+ map { {
+ family => 'ipv4',
+ address => "192.0.2.2$_",
+ port => 4420,
+ host_iface => 'ens' . (18 + $_),
+ } } 1,
+ 2,
+ ],
+ [$hostnqn_a, $hostnqn_b],
+ $KEY,
+ ],
+ 'with the storage, its parsed portals, hosts and key',
+ );
+ like(
+ join("\n", @WARNINGS),
+ qr/storage 'zfsnvme-unit-a' is degraded: 1\/2 paths live/,
+ 'and warns',
+ );
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is($error, '', 'within a minute, a live path takes the fast path');
+ is(scalar(@ACTIVATIONS), 0, 'without a target call');
+ {
+ local $NOW = $NOW + 61;
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is(scalar(@ACTIVATIONS), 1, 'a minute later the target is tried again');
+ }
+ my $cache = $forced->('zfsnvme-unit-a');
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg, $cache);
+ is(scalar(@ACTIVATIONS), 1, 'a forced activation always reaches the target');
+ ok(!$cache->{'zfsnvme-force-reconcile'}->{'zfsnvme-unit-a'}, 'and consumes the request');
+ $FILES{'/sys/class/nvme/nvme1/state'} = 'dead';
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is(
+ $error,
+ "no live NVMe/TCP path for storage 'zfsnvme-unit-a'\n",
+ 'within a minute, without a live path the activation fails at once',
+ );
+ is_deeply([@ACTIVATIONS, @DELETED], [], 'without a target call or a reconnect');
+ {
+ local $NOW = $NOW + 61;
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is(scalar(@ACTIVATIONS), 1, 'a minute later the target is tried');
+ is_deeply(\@DELETED, ['nvme1'], 'and the dead path is reconnected');
+ }
+
+ reset_host();
+ local %REFUSE = ('192.0.2.22' => 1);
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ local $NOW = 30; # the monotonic clock shortly after boot
+ ($res, $error) = $activate->('zfsnvme-unit-b', $scfg);
+ is(scalar(@ACTIVATIONS), 1, 'a storage that was never activated is not in its backoff');
+
+ # a storage without any path waits for one once per backoff period, not on every status update
+ reset_host();
+ local %REFUSE = ('192.0.2.21' => 1, '192.0.2.22' => 1);
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is($error, "no live NVMe/TCP path for storage 'zfsnvme-unit-d'\n", 'no path, no storage');
+ is_deeply(
+ [scalar(@ACTIVATIONS), scalar(@CONNECTS)],
+ [1, 2],
+ 'after the target and each portal',
+ );
+ @CONNECTS = ();
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is(
+ $error,
+ "no live NVMe/TCP path for storage 'zfsnvme-unit-d'\n",
+ 'within a minute it fails',
+ );
+ is_deeply([@ACTIVATIONS, @CONNECTS], [], 'at once, without a target call or a connect');
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg, $forced->('zfsnvme-unit-d'));
+ is_deeply(
+ [scalar(@ACTIVATIONS), scalar(@CONNECTS)],
+ [1, 2],
+ 'a forced activation tries again',
+ );
+ {
+ local $NOW = $NOW + 61;
+ @CONNECTS = ();
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is_deeply(
+ [scalar(@ACTIVATIONS), scalar(@CONNECTS)],
+ [1, 2],
+ 'so does one a minute later',
+ );
+ }
+
+ # Adding a storage activates it right away, and removes it again if that fails. A new storage
+ # with the same ID must not inherit the backoff of the one that was removed.
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is($error, "no live NVMe/TCP path for storage 'zfsnvme-unit-d'\n", 'in its backoff again');
+ $PLUGIN->on_delete_hook('zfsnvme-unit-d', $scfg);
+ @CONNECTS = ();
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is_deeply(
+ [scalar(@ACTIVATIONS), scalar(@CONNECTS)],
+ [1, 2],
+ 'after its removal, the same ID reaches the target and the portals again',
+ );
+
+ # A slow path whose target call fails starts the backoff as well.
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ local $FILES{'/etc/pve/priv/storage/zfsnvme-unit-t.nvme-dhchap'} = $KEY;
+ local %CONFIG = ('zfsnvme-unit-t' => $scfg);
+ my $calls = 0;
+ $nvme_mock->redefine(
+ _nvmet_activate_target => sub(@args) {
+ $calls++;
+ die "NVMe target '192.0.2.10' is unreachable: timeout\n";
+ },
+ );
+ eval { $PLUGIN->activate_storage('zfsnvme-unit-t', $scfg) };
+ like($@, qr/is unreachable/, 'an unreachable target fails the slow path');
+ eval { $PLUGIN->activate_storage('zfsnvme-unit-t', $scfg) };
+ is($@, '', 'within a minute the live path takes the fast path');
+ is($calls, 1, 'without another target call');
+ $nvme_mock->unmock('_nvmet_activate_target');
+};
+
+subtest 'connecting the paths' => sub {
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ $network_mock->redefine(
+ tcp_ping => sub($host, $port, $timeout = undef) { return $host ne '192.0.2.22' },
+ );
+ my (undef, $error) = $activate->('zfsnvme-unit-v', scfg(), $forced->('zfsnvme-unit-v'));
+ is_deeply(\@CONNECTS, [], 'an unreachable portal is not connected');
+ like(join("\n", @WARNINGS), qr/'192\.0\.2\.22:4420' is unreachable/, 'but warned about');
+ $network_mock->redefine(tcp_ping => sub($host, $port, $timeout = undef) { return 1 });
+
+ # After a target restart, the kernel reconnects its controllers itself.
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'connecting');
+ local %REFUSE = ('192.0.2.22' => 1);
+ my $sleeps = 0;
+ $nvme_mock->redefine(
+ _sleep => sub($seconds) {
+ $NOW += $seconds;
+ $FILES{'/sys/class/nvme/nvme1/state'} = 'live' if ++$sleeps == 3;
+ return;
+ },
+ );
+ (undef, $error) = $activate->('zfsnvme-unit-w', scfg());
+ is($error, '', 'an activation waits for a controller that reconnects');
+ is($sleeps, 3, 'until it is live');
+ $nvme_mock->redefine(_sleep => sub($seconds) { $NOW += $seconds; return });
+};
+
+subtest 'moving a path to its configured interface' => sub {
+ my $single = scfg('nvme-portals' => '192.0.2.21', 'nvme-host-ifaces' => 'ens19');
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ my ($res, $error) = $activate->('zfsnvme-unit-c', scfg());
+ is($error, '', 'a storage whose only live path uses another interface');
+ is_deeply(\@CONNECTS, ['192.0.2.21@ens19', '192.0.2.22@ens20'], 'connects both paths');
+ is_deeply(\@DELETED, ['nvme1'], 'and then disconnects the old one');
+ is_deeply(\@WARNINGS, [], 'the storage is healthy');
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ local %CONNECT_STATE = ('192.0.2.21' => 'connecting');
+ my $start = $NOW;
+ ($res, $error) = $activate->('zfsnvme-unit-g', $single);
+ is($error, '', 'a new path that does not become live');
+ is_deeply(\@DELETED, [], 'keeps the old path');
+ like(
+ join("\n", @WARNINGS),
+ qr/'192\.0\.2\.21:4420' is not live on 'ens19' yet; keeping its path on another interface/,
+ 'and warns',
+ );
+ like(join("\n", @WARNINGS), qr/is degraded: 0\/1 paths live/, 'the storage is degraded');
+ is($NOW - $start, 10, 'after waiting 10 seconds for the new path');
+ ($res, $error) = $activate->('zfsnvme-unit-g', $single);
+ ok(!$error && !@ACTIVATIONS, 'within a minute, the old path takes the fast path');
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ local %REFUSE = ('192.0.2.21' => 1);
+ ($res, $error) = $activate->('zfsnvme-unit-h', $single);
+ is($error, '', 'a new path that cannot connect');
+ is_deeply(\@DELETED, [], 'keeps the old path too');
+ like(
+ join("\n", @WARNINGS),
+ qr/192\.0\.2\.21:4420: connect failed: Connection refused/,
+ 'and warns',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ my $connect = $PLUGIN->can('_connect_portal');
+ {
+ no warnings 'redefine';
+ local %REFUSE = ();
+ local *PVE::Storage::ZFSNVMePlugin::_connect_portal = sub($scfg, $portal, @ids) {
+ $connect->($scfg, $portal, @ids);
+ die "connection failed after creation\n";
+ };
+ ($res, $error) = $activate->('zfsnvme-unit-h-partial', $single);
+ }
+ ok(!$error && $res == 1, 'a partially successful connect leaves the storage usable');
+ is($FILES{'/sys/class/nvme/nvme71/state'}, 'live', 'a live replacement was created');
+ is_deeply(\@DELETED, [], 'the connect error still preserves the old interface path');
+ like(
+ join("\n", @WARNINGS),
+ qr/192\.0\.2\.21:4420: connection failed after creation/,
+ 'and preserves the original connect warning',
+ );
+};
+
+subtest 'reconnect timeouts reach connected controllers' => sub {
+ my $sysfs = sub () {
+ return [
+ map { [$_->[0] =~ s{\A/sys/class/nvme/}{}r, $_->[1] =~ s/\n\z//r] }
+ grep { $_->[0] =~ m{\A/sys/class/nvme/} } @SYSFS_WRITES
+ ];
+ };
+ my $case = sub($storeid, $scfg, %current) {
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ for my $name (qw(nvme1 nvme2)) {
+ $FILES{"/sys/class/nvme/$name/$_"} = $current{$_} for keys %current;
+ }
+ my ($res, $error) = $activate->($storeid, $scfg, $forced->($storeid));
+ is($error, '', "activation of $storeid");
+ return $sysfs->();
+ };
+ my $timeouts = scfg(
+ 'nvme-reconnect-delay' => 5,
+ 'nvme-ctrl-loss-tmo' => 60,
+ 'nvme-fast-io-fail-tmo' => 10,
+ );
+ my $written = [
+ map { (
+ ["$_/reconnect_delay", 5], ["$_/ctrl_loss_tmo", 60], ["$_/fast_io_fail_tmo", 10],
+ ) } qw(nvme1 nvme2)
+ ];
+ is_deeply($case->('zfsnvme-unit-i', $timeouts), $written, 'changes reach every controller');
+ is_deeply(
+ [grep { $_->[0] =~ /iopolicy/ } @SYSFS_WRITES],
+ [['/sys/class/nvme-subsystem/nvme-subsys7/iopolicy', "round-robin\n"]],
+ 'with the multipath policy',
+ );
+ my %current = (reconnect_delay => '5', ctrl_loss_tmo => '60', fast_io_fail_tmo => '10');
+ is_deeply(
+ $case->('zfsnvme-unit-j', $timeouts, %current),
+ [],
+ 'unchanged ones are not written',
+ );
+ is_deeply(
+ $case->('zfsnvme-unit-k', scfg('nvme-ctrl-loss-tmo' => -1)),
+ [map { ["$_/ctrl_loss_tmo", -1] } qw(nvme1 nvme2)],
+ 'an infinite loss timeout',
+ );
+ is_deeply(
+ $case->('zfsnvme-unit-l', scfg('nvme-ctrl-loss-tmo' => 7), ctrl_loss_tmo => '8'),
+ [],
+ 'the loss timeout the kernel rounds up to the reconnect delay',
+ );
+ is_deeply(
+ $case->('zfsnvme-unit-m', scfg(), fast_io_fail_tmo => '5'),
+ [map { ["$_/fast_io_fail_tmo", -1] } qw(nvme1 nvme2)],
+ 'an unset fast I/O fail timeout is turned off',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ my ($res, $error) = $activate->('zfsnvme-unit-n', $timeouts);
+ ok(!$error && $res == 1, 'a healthy storage activates on the fast path');
+ is(scalar(@ACTIVATIONS) + scalar(@CONNECTS), 0, 'without a target call or connect');
+ is_deeply($sysfs->(), $written, 'which also writes changed timeouts');
+ is_deeply(
+ [grep { $_->[0] =~ /iopolicy/ } @SYSFS_WRITES],
+ [['/sys/class/nvme-subsystem/nvme-subsys7/iopolicy', "round-robin\n"]],
+ 'and the multipath policy',
+ );
+ delete $FILES{'/etc/pve/priv/storage/zfsnvme-unit-n.nvme-dhchap'};
+ $res = eval {
+ local %CONFIG = ('zfsnvme-unit-n' => $timeouts);
+ $PLUGIN->activate_storage('zfsnvme-unit-n', $timeouts);
+ };
+ is($@, "missing NVMe DH-HMAC-CHAP key\n", 'the fast path needs the key file');
+
+ # file_write warns about a failed write and is silent about a failed open, errno stays in $!
+ my @perl_warnings;
+ local $SIG{__WARN__} = sub($warning) { push @perl_warnings, $warning };
+ my $failing = sub($pattern, $errno, $warn) {
+ $sysfs_mock->redefine(
+ file_write => sub($path, $data, @rest) {
+ return $sysfs_write->($path, $data) if $path !~ $pattern;
+ $! = $errno;
+ return undef if !$warn;
+ warn "error writing '$data' to '$path': $!\n";
+ $! = ENOENT; # not the reason: file_write closed the file since
+ return 0;
+ },
+ );
+ };
+ my $reason = sub($errno) { local $! = $errno; return "$!" };
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/nvme1/ctrl_loss_tmo\z}, EINVAL, 1);
+ ($res, $error) = $activate->('zfsnvme-unit-e', $timeouts);
+ is($error, '', 'a timeout that cannot be written does not fail the activation');
+ my $einval = $reason->(EINVAL);
+ is_deeply(
+ [@WARNINGS, @perl_warnings],
+ ["cannot set ctrl_loss_tmo of NVMe controller 'nvme1': $einval"],
+ 'and is reported once, as a task warning with the reason',
+ );
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/nvme2/ctrl_loss_tmo\z}, EACCES, 0);
+ ($res, $error) = $activate->('zfsnvme-unit-tmo-open', $timeouts);
+ is($error, '', 'a timeout that cannot be opened does not fail the activation');
+ is_deeply(
+ [@WARNINGS, @perl_warnings],
+ ["cannot set ctrl_loss_tmo of NVMe controller 'nvme2': " . $reason->(EACCES)],
+ 'and is reported once, with the reason',
+ );
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/iopolicy\z}, EACCES, 0);
+ ($res, $error) = $activate->('zfsnvme-unit-f', $timeouts);
+ is(
+ $error,
+ 'unable to set NVMe multipath policy: ' . $reason->(EACCES) . "\n",
+ 'a policy that cannot be set fails the activation',
+ );
+ is_deeply([@WARNINGS, @perl_warnings], [], 'with the reason in the error only');
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/iopolicy\z}, EINVAL, 1);
+ ($res, $error) = $activate->('zfsnvme-unit-policy-write', $timeouts);
+ is(
+ $error,
+ "unable to set NVMe multipath policy: $einval\n",
+ 'a policy that cannot be written fails the activation',
+ );
+ is_deeply([@WARNINGS, @perl_warnings], [],
+ 'and the warning of file_write is not passed on');
+
+ # The stock file_write on an attribute that does not exist: unlike a deletion or a rescan,
+ # setting a timeout or the policy treats the failed open (ENOENT) as a failure like any other.
+ my $file_write = $sysfs_mock->original('file_write');
+ my $missing = tempdir(CLEANUP => 1) . '/a/b';
+ my $absent = sub($pattern) {
+ $sysfs_mock->redefine(
+ file_write => sub($path, $data, @rest) {
+ return $sysfs_write->($path, $data) if $path !~ $pattern;
+ return $file_write->($missing, $data, @rest);
+ },
+ );
+ };
+ my $enoent = $reason->(ENOENT);
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $absent->(qr{/nvme1/reconnect_delay\z});
+ ($res, $error) = $activate->('zfsnvme-unit-tmo-missing', $timeouts);
+ is($error, '', 'a missing timeout attribute does not fail the activation');
+ is_deeply(
+ [@WARNINGS, @perl_warnings],
+ ["cannot set reconnect_delay of NVMe controller 'nvme1': $enoent"],
+ 'but is reported once, as a task warning with the reason',
+ );
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $absent->(qr{/iopolicy\z});
+ ($res, $error) = $activate->('zfsnvme-unit-policy-missing', $timeouts);
+ is(
+ $error,
+ "unable to set NVMe multipath policy: $enoent\n",
+ 'a missing policy attribute fails the activation',
+ );
+ is_deeply([@WARNINGS, @perl_warnings], [], 'with the reason in the error only');
+ $sysfs_mock->redefine(file_write => $sysfs_write);
+};
+
+subtest 'the key attributes of the controllers are private' => sub {
+ my $attrs = sub(@names) {
+ my @attrs = qw(dhchap_secret dhchap_ctrl_secret);
+ return [
+ map {
+ my $name = $_;
+ map { "/sys/class/nvme/$name/$_" } @attrs
+ } @names
+ ];
+ };
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ add_controller('nvme3', '192.0.2.23', 4420, 'ens21', 'live', $OTHER_NQN);
+ my ($res, $error) = $activate->('zfsnvme-unit-o', scfg());
+ is($error, '', 'a healthy storage');
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme1', 'nvme2'),
+ 'restricts its controllers on the fast path',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ ($res, $error) = $activate->('zfsnvme-unit-p', scfg(), $forced->('zfsnvme-unit-p'));
+ is($error, '', 'a forced activation');
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme1', 'nvme1', 'nvme71'),
+ 'restricts those of the existing controllers first, then those of new ones',
+ );
+
+ reset_host();
+ local %CONNECT_STATE = map { ($_ => 'connecting') } '192.0.2.21', '192.0.2.22';
+ ($res, $error) = $activate->('zfsnvme-unit-q', scfg());
+ is(
+ $error,
+ "no live NVMe/TCP path for storage 'zfsnvme-unit-q'\n",
+ 'an activation that fails',
+ );
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme71', 'nvme71', 'nvme72'),
+ 'each one after its connect',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'connecting');
+ $nvme_mock->redefine(_nvmet_activate_target => sub(@args) { die "unreachable\n" });
+ $res = eval {
+ local $FILES{'/etc/pve/priv/storage/zfsnvme-unit-x.nvme-dhchap'} = $KEY;
+ local %CONFIG = ('zfsnvme-unit-x' => scfg());
+ $PLUGIN->activate_storage('zfsnvme-unit-x', scfg());
+ };
+ is($@, "unreachable\n", 'a slow path that fails at the target');
+ is_deeply(\@RESTRICTED, $attrs->('nvme1'), 'still restricts the existing controllers');
+ $nvme_mock->unmock('_nvmet_activate_target');
+
+ # the first connect fails after it created a live controller, in the second case the permission
+ # scan after it fails too
+ my $connect = $PLUGIN->can('_connect_portal');
+ my $connect_error = "connection failed after creation\n";
+ for my $scan_error (0, 1) {
+ reset_host();
+ my $scan_failed = 0;
+ {
+ no warnings 'redefine';
+ local *PVE::Storage::ZFSNVMePlugin::_connect_portal = sub($scfg, $portal, @ids) {
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme71'),
+ 'a failed connect restricts both attributes before the next connect',
+ ) if @CONNECTS == 1 && !$scan_error;
+ $connect->($scfg, $portal, @ids);
+ die $connect_error if @CONNECTS == 1;
+ };
+ local *PVE::Storage::ZFSNVMePlugin::_restrict_attr = sub($path) {
+ push @RESTRICTED, $path;
+ eval { 1 }; # A permission helper must not erase the saved connect error.
+ die "permission scan failed\n" if $scan_error && !$scan_failed++;
+ return;
+ };
+ ($res, $error) = $activate->("zfsnvme-unit-secret-failure-$scan_error", scfg());
+ }
+ is($error, '', 'a connect error does not discard its live controller');
+ ok(
+ scalar(grep { $_ eq "192.0.2.21:4420: $connect_error" } @WARNINGS),
+ 'and warns about it',
+ );
+ if ($scan_error) {
+ ok(
+ scalar(
+ grep { $_ eq "cannot restrict NVMe controller attributes for '$NQN'" }
+ @WARNINGS
+ ),
+ 'the scan failure has its own warning',
+ );
+ unlike(join("\n", @WARNINGS), qr/permission scan failed/, 'without its exception');
+ } else {
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme71', 'nvme71', 'nvme72'),
+ 'each attempt restricts the controllers, including a failed last connect',
+ );
+ }
+ }
+
+ my $dir = tempdir(CLEANUP => 1);
+ my $restrict = $nvme_mock->original('_restrict_attr');
+ for my $mode (0644, 0640, 0600, 0400) {
+ my $file = sprintf('%s/attr-%o', $dir, $mode);
+ open(my $fh, '>', $file) or die "open: $!\n";
+ close($fh);
+ chmod($mode, $file);
+ $restrict->($file);
+ is(
+ (stat($file))[2] & 07777,
+ $mode & 077 ? 0600 : $mode,
+ sprintf('an attribute with mode %o', $mode),
+ );
+ }
+ @WARNINGS = ();
+ $restrict->("$dir/missing");
+ is_deeply(\@WARNINGS, [], 'a missing attribute is skipped');
+ my $not_directory = "$dir/attr-600/child";
+ $restrict->($not_directory);
+ like(join("\n", @WARNINGS), qr/\Q$not_directory\E/, 'another stat failure warns');
+};
+
+subtest 'controllers match IPv6 portals in any spelling' => sub {
+ reset_host();
+ add_controller('nvme1', '2001:db8:0:0::11', 4420, 'ens19');
+ add_controller('nvme2', '2001:DB8::12', 4420, 'ens20');
+ my $scfg = scfg('nvme-portals' => '[2001:db8::11],[2001:db8::0:12]');
+ my ($res, $error) = $activate->('zfsnvme-unit-r', $scfg);
+ is($error, '', 'both paths are live');
+ is(scalar(@ACTIVATIONS) + scalar(@CONNECTS), 0, 'without a target call or connect');
+};
+
+is_deeply(\@COMMANDS, [], 'the host side ran no command');
+
done_testing();
1;
--
2.54.0.windows.1
^ permalink raw reply related [relevance 7%]
* [PATCH storage v5 07/13] test: zfsnvme: add configuration and volume tests
2026-11-26 15:09 8% [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-11-26 15:09 11% ` [PATCH storage v5 04/13] zfsnvme: connect the nodes and register the plugin Joaquin Varela
2026-11-26 15:09 25% ` [PATCH storage v5 05/13] api: san luns: count zfsnvme storages as owners of their subsystem Joaquin Varela
@ 2026-11-26 15:09 6% ` Joaquin Varela
2026-11-26 15:09 7% ` [PATCH storage v5 08/13] test: zfsnvme: add node side tests Joaquin Varela
2026-11-26 15:10 16% ` [PATCH docs v5] storage: document ZFS over NVMe/TCP Joaquin Varela
4 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-11-26 15:09 UTC (permalink / raw)
To: pve-devel
Add zfsnvme_test.pm with tests for the schema and config checks, the key
handling in the storage hooks and in pvesm, the SSH runner and the
volume methods. Nothing in it connects to a target or touches a local
NVMe device.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
src/test/run_plugin_tests.pl | 1 +
src/test/zfsnvme_test.pm | 1266 ++++++++++++++++++++++++++++++++++
2 files changed, 1267 insertions(+)
create mode 100644 src/test/zfsnvme_test.pm
diff --git a/src/test/run_plugin_tests.pl b/src/test/run_plugin_tests.pl
index da0d0dea..19465c25 100755
--- a/src/test/run_plugin_tests.pl
+++ b/src/test/run_plugin_tests.pl
@@ -25,6 +25,7 @@ my $res = $harness->runtests(
"plugin_isolation_test.pm",
"plugin_load_test.pm",
"plugin_properties_test.pm",
+ "zfsnvme_test.pm",
);
exit -1 if !$res || $res->{failed} || $res->{parse_errors};
diff --git a/src/test/zfsnvme_test.pm b/src/test/zfsnvme_test.pm
new file mode 100644
index 00000000..41991649
--- /dev/null
+++ b/src/test/zfsnvme_test.pm
@@ -0,0 +1,1266 @@
+package PVE::Storage::TestZFSNVMe;
+
+# Storage API and local NVMe host side of the zfsnvme plugin, the target side is in
+# zfsnvme_target_test.pm. Every probe of the local host is mocked and the children that the
+# plugin forks run inline, except where the child itself is tested.
+
+use v5.36;
+
+use lib qw(..);
+
+use Compress::Zlib qw(crc32);
+use Config;
+use Errno qw(EACCES ECONNREFUSED EINVAL ENOENT);
+use Fcntl qw(O_NOCTTY O_RDWR);
+use File::Temp qw(tempdir);
+use MIME::Base64 qw(encode_base64);
+use POSIX qw(
+ ECHO ECHONL ICANON OPOST SIG_BLOCK SIGALRM SIGHUP SIGINT SIGQUIT SIGTERM TCSANOW WNOHANG
+ sigprocmask
+);
+use Test::MockModule;
+use Test::More;
+
+use PVE::NVMeOF;
+use PVE::Storage;
+use PVE::Storage::ZFSNVMePlugin;
+
+my $PLUGIN = 'PVE::Storage::ZFSNVMePlugin';
+my $NQN = 'nqn.2026-01.com.example:test';
+my $OTHER_NQN = 'nqn.2026-01.com.example:other';
+my $UUID = '12345678-1234-1234-1234-123456789abc';
+my $ROOT = '/sys/kernel/config/nvmet';
+my $hostnqn_a = 'nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-000000000001';
+my $hostnqn_b = 'nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-000000000002';
+
+sub make_key($hash, $length, $seed = 1) {
+ my $raw = join('', map { chr(($_ * 131 + $seed * 17) % 256) } 1 .. $length);
+ return "DHHC-1:$hash:" . encode_base64($raw . pack('V', crc32($raw)), '') . ':';
+}
+my $KEY = make_key('00', 32);
+my $KEY_B = make_key('00', 32, 2);
+
+sub scfg(%override) {
+ return {
+ type => 'zfsnvme',
+ server => '192.0.2.10',
+ pool => 'tank',
+ subsysnqn => $NQN,
+ 'nvme-portals' => '192.0.2.21,192.0.2.22',
+ 'nvme-host-ifaces' => 'ens19,ens20',
+ 'nvme-host-nqns' => "$hostnqn_a,$hostnqn_b",
+ %override,
+ };
+}
+
+# Calls a plugin package sub by name, so a mocked sub is the one called.
+sub nv($name, @args) {
+ my $code = $PLUGIN->can($name) // die "plugin has no sub '$name'\n";
+ return $code->(@args);
+}
+
+# Mocks. Target calls are answered by $TARGET and the ssh command of the runner by $COMMAND. Sysfs
+# and key files come from %FILES and %DIRS, block devices are %BLOCK and symbolic links %LINKS. The
+# host lock runs its steps inline and records their limit in @FORKS, waits advance $NOW. Only the
+# runner tests, which set $COMMAND, may reach run_command.
+
+our ($TARGET, $COMMAND, $NOW, $TCP_LOADED);
+our (%FILES, %DIRS, %CONFIG, %BLOCK, %LINKS, @TARGET_CALLS, @WARNINGS, @WRITES);
+our (@SYSFS_WRITES, @CONNECTS, @ACTIVATIONS, @UNLINKED, @RESTRICTED, @DELETED, @FORKS);
+our (%REFUSE, %CONNECT_STATE);
+$NOW = 1_000_000;
+
+my $nvme_mock = Test::MockModule->new($PLUGIN);
+my $file_mock = Test::MockModule->new('PVE::File');
+my $sysfs_mock = Test::MockModule->new('PVE::SysFSTools');
+my $tools_mock = Test::MockModule->new('PVE::Tools');
+my $network_mock = Test::MockModule->new('PVE::Network');
+my $storage_mock = Test::MockModule->new('PVE::Storage');
+my $parent_mock = Test::MockModule->new('PVE::Storage::Plugin');
+
+$nvme_mock->redefine(
+ _nvmet_run => sub($scfg, $steps, %opts) {
+ push @TARGET_CALLS, { steps => $steps, %opts };
+ die "unexpected NVMe target call '$opts{op}'\n" if !$TARGET;
+ return $TARGET->($steps, %opts);
+ },
+);
+# also recorded in case the caller handles the error, the last test checks that there is none
+our @COMMANDS;
+my $no_command = sub($cmd, %opts) {
+ push @COMMANDS, $cmd;
+ die "test error: unexpected command '" . (ref($cmd) ? $cmd->[0] : $cmd) . "'\n";
+};
+$nvme_mock->redefine(
+ run_command => sub($cmd, %opts) {
+ return $COMMAND ? $COMMAND->($cmd, %opts) : $no_command->($cmd, %opts);
+ },
+);
+$tools_mock->redefine(run_command => $no_command);
+$nvme_mock->redefine(_now => sub () { return $NOW });
+$nvme_mock->redefine(_sleep => sub($seconds) { $NOW += $seconds; return });
+$nvme_mock->redefine(_block_device => sub($path) { return $BLOCK{$path} });
+$nvme_mock->redefine(_link_target => sub($path) { return $LINKS{$path} });
+$nvme_mock->redefine(_nvme_tcp_loaded => sub () { return $TCP_LOADED });
+$nvme_mock->redefine(_restrict_attr => sub($path) { push @RESTRICTED, $path; return });
+$nvme_mock->redefine(_unlink_file => sub($path) { push @UNLINKED, $path; return 1 });
+$nvme_mock->redefine(log_warn => sub($message) { push @WARNINGS, $message; return });
+$nvme_mock->redefine(file_read_firstline => sub($path) { return $FILES{$path} });
+$nvme_mock->redefine(
+ file_set_contents => sub($path, $data, $perm = undef, @rest) {
+ push @WRITES, { path => $path, data => $data, perm => $perm };
+ return;
+ },
+);
+$nvme_mock->redefine(make_path => sub(@args) { push @WRITES, { make_path => [@args] }; return });
+$nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+
+my $connect_mock = sub($options, $names) {
+ my %option = map { split(/=/, $_, 2) } split(/,/, $options);
+ push @CONNECTS, "$option{traddr}\@$option{host_iface}";
+ die "connect failed: Connection refused\n" if $REFUSE{ $option{traddr} };
+ my $instance = 70 + scalar(@CONNECTS);
+ add_controller(
+ "nvme$instance",
+ $option{traddr},
+ $option{trsvcid},
+ $option{host_iface},
+ $CONNECT_STATE{ $option{traddr} } // 'live',
+ );
+ return $instance;
+};
+$nvme_mock->redefine(_fabrics_connect => $connect_mock);
+my $delete_mock = sub($controllers) {
+ for my $controller ($controllers->@*) {
+ push @DELETED, $controller->{name};
+ $DIRS{'/sys/class/nvme'} =
+ [grep { $_ ne $controller->{name} } ($DIRS{'/sys/class/nvme'} // [])->@*];
+ }
+ return scalar($controllers->@*);
+};
+$nvme_mock->redefine(_delete_controllers => $delete_mock);
+# $code runs inline, @LOCKS records when the lock is held and $LOCK_BUSY makes it unavailable.
+# $ON_LOCK runs once the lock is held, with the number of times it was taken, for a change that
+# another process makes while this one waits.
+our (@LOCKS, $LOCK_BUSY, $LOCK_HELD, $ON_LOCK);
+my $nvmeof_mock = Test::MockModule->new('PVE::NVMeOF');
+my $lock_inline = sub($code, $limit = undef) {
+ push @FORKS, $limit;
+ die "NVMe over Fabrics is busy - another operation is still running\n" if $LOCK_BUSY;
+ die "test error: the host lock is not re-entrant\n" if $LOCK_HELD;
+ push @LOCKS, 'enter';
+ local $LOCK_HELD = 1;
+ my $res = eval {
+ $ON_LOCK->(scalar(grep { $_ eq 'enter' } @LOCKS)) if $ON_LOCK;
+ $code->();
+ };
+ my $error = $@;
+ push @LOCKS, 'leave';
+ die $error if $error;
+ return $res;
+};
+$nvmeof_mock->redefine(with_lock => $lock_inline);
+# host_identity reads the host files through its own file_read_firstline
+$nvmeof_mock->redefine(file_read_firstline => sub($path) { return $FILES{$path} });
+$file_mock->redefine(
+ dir_glob_foreach => sub($dir, $regex, $func) {
+ for my $entry (($DIRS{$dir} // [])->@*) {
+ if (my @res = $entry =~ m/^($regex)$/) {
+ $func->(@res);
+ }
+ }
+ },
+);
+my $sysfs_write = sub($path, $data, $allow_existing = undef) {
+ push @SYSFS_WRITES, [$path, $data];
+ $FILES{$path} = $data =~ s/\n\z//r;
+ return 1;
+};
+$sysfs_mock->redefine(file_write => $sysfs_write);
+$network_mock->redefine(tcp_ping => sub($host, $port, $timeout = undef) { return 1 });
+$storage_mock->redefine(config => sub () { return { ids => {%CONFIG} } });
+
+sub add_controller($name, $address, $port, $iface, $state = 'live', $nqn = $NQN) {
+ my $base = "/sys/class/nvme/$name";
+ push $DIRS{'/sys/class/nvme'}->@*, $name;
+ $FILES{"$base/subsysnqn"} = $nqn;
+ $FILES{"$base/state"} = $state;
+ $FILES{"$base/address"} = "traddr=$address,trsvcid=$port,host_iface=$iface";
+ $FILES{"$base/reconnect_delay"} //= '2';
+ $FILES{"$base/ctrl_loss_tmo"} //= '600';
+ $FILES{"$base/fast_io_fail_tmo"} //= 'off';
+ return;
+}
+
+sub reset_host() {
+ %DIRS = ('/sys/class/nvme-subsystem' => ['nvme-subsys7']);
+ %FILES = (
+ '/sys/module/nvme_core/parameters/multipath' => 'Y',
+ '/etc/nvme/hostnqn' => $hostnqn_a,
+ '/etc/nvme/hostid' => '12345678-1234-1234-1234-123456789abc',
+ '/sys/class/nvme-subsystem/nvme-subsys7/subsysnqn' => $NQN,
+ );
+ %BLOCK = %LINKS = %CONNECT_STATE = ();
+ @CONNECTS = @ACTIVATIONS = @SYSFS_WRITES = @WRITES = @WARNINGS = ();
+ @RESTRICTED = @UNLINKED = @DELETED = @FORKS = @LOCKS = ();
+ $LOCK_BUSY = 0;
+ $ON_LOCK = undef;
+ $TCP_LOADED = 1;
+ $NOW += 61; # a new minute: no storage is in its slow-path backoff
+ return;
+}
+
+# [feature, volume, snapshot, running, expected]
+for my $case (
+ ['copy', 'base-100-disk-0', undef, 0, 1],
+ ['copy', 'vm-100-disk-0', undef, 0, 1],
+ ['copy', 'vm-100-disk-0', undef, 1, 1],
+ ['copy', 'base-100-disk-0/vm-101-disk-0', undef, 0, 1],
+ ['copy', 'vm-100-disk-0', 'snap', 0, undef],
+ ['clone', 'base-100-disk-0', undef, undef, 1],
+ ['clone', 'vm-100-disk-0', undef, undef, undef],
+ ['template', 'vm-100-disk-0', undef, undef, 1],
+ ['snapshot', 'vm-100-disk-0', undef, 0, 1],
+ ['snapshot', 'vm-100-disk-0', 'snap', 0, 1],
+) {
+ my ($feature, $volname, $snap, $running, $expected) = $case->@*;
+ my @args = defined($running) ? ($snap, $running, {}) : ();
+ is(
+ $PLUGIN->volume_has_feature({}, $feature, 'nvmetest', $volname, @args),
+ $expected,
+ "$feature of $volname"
+ . ($snap ? '@' . $snap : '')
+ . ($running ? ' while running' : ''),
+ );
+}
+ok(!$PLUGIN->storage_can_replicate({}, 'nvmetest'), 'no storage replication');
+
+for my $case (
+ ['vm-100-disk-0', ['vm-vol', 'vm-100-disk-0', 100, undef, undef, '', 'raw']],
+ ['vm-100-state-snap1', ['vm-state', 'vm-100-state-snap1', 100, undef, undef, '', 'raw']],
+ ['base-100-disk-0', ['vm-vol', 'base-100-disk-0', 100, undef, undef, 1, 'raw']],
+ ['subvol-100-disk-0', ['ct-vol', 'subvol-100-disk-0', 100, undef, undef, '', 'subvol']],
+ ['basevol-100-disk-0', ['ct-vol', 'basevol-100-disk-0', 100, undef, undef, 1, 'subvol']],
+ [
+ 'base-100-disk-0/vm-200-disk-0',
+ ['vm-vol', 'vm-200-disk-0', 200, 'base-100-disk-0', 100, '', 'raw'],
+ ],
+ [
+ 'basevol-100-disk-0/subvol-200-disk-0',
+ ['ct-vol', 'subvol-200-disk-0', 200, 'basevol-100-disk-0', 100, '', 'subvol'],
+ ],
+) {
+ my ($name, $expected) = $case->@*;
+ is_deeply([$PLUGIN->parse_volname($name)], $expected, "parse_volname keeps the tuple of $name");
+}
+for my $name ('not-a-volume', 'vm-no-id-disk-0', 'vm-100-disk 0', 'vm-100-') {
+ eval { $PLUGIN->parse_volname($name) };
+ like($@, qr/unable to parse zfs volume name/, "rejects invalid volume name $name");
+}
+
+# as run_remote_command_tests.pl does for ZFS over iSCSI: such a name is refused before anything
+# runs on the target, also with a trailing newline that $ would accept
+for my $name ('vm-100-a b', 'vm-100-a:b', 'vm-100-a;b', 'vm-100-$(echo a)', "vm-100-a\n") {
+ (my $shown = $name) =~ s/\n/\\n/;
+ my $error = "unable to parse zfs volume name '$name'\n";
+ local (@TARGET_CALLS, @COMMANDS) = ();
+ eval { $PLUGIN->parse_volname($name) };
+ is($@, $error, "parse_volname refuses '$shown'");
+ eval { $PLUGIN->parse_volname("base-100-disk-0/$name") };
+ like($@, qr/^unable to parse zfs volume name/, "parse_volname refuses '$shown' in a clone");
+ eval { $PLUGIN->alloc_image('nvmetest', scfg(), 100, 'raw', $name, 1024) };
+ is($@, $error, "allocating '$shown' fails");
+ is(scalar(@TARGET_CALLS) + scalar(@COMMANDS), 0, "nothing reaches the target for '$shown'");
+}
+is($PLUGIN->get_parsed_format('vm-100-disk-0'), 'raw', 'the format of a raw volume');
+is($PLUGIN->volname_for_format('vm-100-disk-0', 'raw'), 'vm-100-disk-0', 'raw has no extension');
+eval { $PLUGIN->volname_for_format('vm-100-disk-0', 'qcow2') };
+like($@, qr/unsupported format 'qcow2'/, 'qcow2 volumes are not supported');
+
+is_deeply(
+ \@PVE::Storage::ZFSNVMePlugin::ISA,
+ ['PVE::Storage::Plugin'],
+ 'the backend inherits directly from the storage plugin base',
+);
+for my $method (qw(
+ zfs_request zfs_get_lu_name zfs_create_lu zfs_resize_lu zfs_list_zvol zfs_parse_zvol_list
+ zfs_get_properties zfs_get_pool_stats zfs_create_zvol zfs_delete_zvol zfs_get_base
+))
+{
+ ok(!$PLUGIN->can($method), "the ZFS helper $method is private");
+}
+
+# the plugin isolates its properties, so each one in options() is declared except the common ones
+{
+ my $data = $PLUGIN->plugindata();
+ my ($properties, $options) = ($PLUGIN->properties(), $PLUGIN->options());
+ my $common = PVE::Storage::Plugin->base_properties();
+ ok($data->{'isolate-properties'}, 'the plugin isolates its properties');
+ is_deeply(
+ [grep { !$properties->{$_} && !$common->{$_} } sort keys $options->%*],
+ [],
+ 'options() lists no property that nobody declares',
+ );
+ is_deeply(
+ [grep { !$options->{$_} } sort keys $properties->%*],
+ [],
+ 'and every property of the plugin, so each one can be set',
+ );
+ is_deeply(
+ [grep { $common->{$_} } sort keys $properties->%*],
+ [],
+ 'the plugin declares no common property',
+ );
+ is_deeply(
+ [grep { !$properties->{$_}->{title} } sort keys $properties->%*],
+ [],
+ 'every property has a title',
+ );
+
+ for my $kind (qw(advanced-properties hidden-properties)) {
+ is_deeply(
+ [grep { !$properties->{$_} && !$common->{$_} } sort keys $data->{$kind}->%*],
+ [],
+ "$kind names declared properties",
+ );
+ }
+ is_deeply(
+ $data->{'sensitive-properties'},
+ { 'dhchap-key' => 1 },
+ 'the key stays out of storage.cfg',
+ );
+ ok($properties->{'dhchap-key'}->{sensitive}, 'and is flagged in its schema');
+ is_deeply($options->{'dhchap-key'}, { optional => 1 }, 'optional in options() for the hook');
+ is_deeply(
+ $data->{content},
+ [{ images => 1, 'vm-vol' => 1, 'vm-state' => 1 }, { images => 1 }],
+ 'the content types are images, VM disks and VM states, and images by default',
+ );
+
+ my $raw =
+ "zfsnvme: st\n\tserver 192.0.2.10\n\tpool tank\n\tblocksize 16k\n\tsparse 1\n"
+ . "\tsubsysnqn $NQN\n\tnvme-portals 192.0.2.21,192.0.2.22\n"
+ . "\tnvme-host-ifaces ens19,ens20\n\tnvme-host-nqns $hostnqn_a\n\tcontent images\n";
+ my $cfg = PVE::Storage::Plugin->parse_config('storage.cfg', $raw);
+ is_deeply(
+ [map { $cfg->{ids}->{st}->{$_} } qw(server pool blocksize sparse subsysnqn)],
+ ['192.0.2.10', 'tank', '16k', 1, $NQN],
+ 'a storage section with the declared shared properties is read',
+ );
+ my @warnings;
+ {
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ PVE::Storage::Plugin->parse_config('storage.cfg', $raw =~ s/16k/3k/r);
+ }
+ like(
+ join('', @warnings),
+ qr/unable to parse value of 'blocksize': invalid format/,
+ 'and they are checked with their own schema',
+ );
+
+ my $create = PVE::Storage::Plugin::add_sensitive_properties_to_schema(
+ PVE::Storage::Plugin->createSchema(),
+ );
+ my $update = PVE::Storage::Plugin::add_sensitive_properties_to_schema(
+ PVE::Storage::Plugin->updateSchema(), 1,
+ );
+ my %param = (
+ type => 'zfsnvme',
+ storage => 'st',
+ server => '192.0.2.10',
+ pool => 'tank',
+ blocksize => '16k',
+ subsysnqn => $NQN,
+ 'nvme-portals' => '192.0.2.21,192.0.2.22',
+ 'nvme-host-ifaces' => 'ens19,ens20',
+ 'nvme-host-nqns' => $hostnqn_a,
+ 'dhchap-key' => $KEY,
+ );
+ my $verify = sub($schema, %param) {
+ eval { PVE::JSONSchema::validate(\%param, $schema, '', {}) };
+ return $@;
+ };
+ is($verify->($create, %param), '', 'adding a storage takes its properties and the key');
+ like(
+ $verify->($create, %param, pool => undef),
+ qr/pool: property is missing/,
+ 'and needs the required ones',
+ );
+ my %changes = (storage => 'st', type => 'zfsnvme', 'nvme-iopolicy' => 'numa');
+ is($verify->($update, %changes, 'dhchap-key' => $KEY), '', 'updating takes the key too');
+ like(
+ $verify->($update, %changes, pool => 'other'),
+ qr/pool: property is not defined in schema/,
+ 'but not a property that cannot be changed',
+ );
+}
+
+is(nv('verify_nvme_nqn', $hostnqn_a), $hostnqn_a, 'accepts a standard NQN');
+ok(!nv('verify_nvme_nqn', 'not-an-nqn', 1), 'rejects an invalid NQN');
+ok(!nv('verify_nvme_nqn', 'nqn.x:' . ('a' x 220), 1), 'rejects a long NQN');
+is_deeply(
+ nv('parse_nvme_host_nqns', "$hostnqn_a, $hostnqn_b"),
+ [$hostnqn_a, $hostnqn_b],
+ 'parses the host allow-list',
+);
+ok(!nv('parse_nvme_host_nqns', "$hostnqn_a,$hostnqn_a", 1), 'rejects duplicate host NQNs');
+ok(!nv('parse_nvme_host_nqns', '', 1), 'requires a host NQN');
+
+is_deeply(
+ nv('parse_nvme_portals', '198.51.100.11:4420,[2001:db8::11]:4421,198.51.100.12'),
+ [
+ { address => '198.51.100.11', port => 4420, family => 'ipv4' },
+ { address => '2001:db8::11', port => 4421, family => 'ipv6' },
+ { address => '198.51.100.12', port => 4420, family => 'ipv4' },
+ ],
+ 'parses IPv4 and IPv6 portals',
+);
+is_deeply(
+ [
+ map { $_->{address} }
+ nv('parse_nvme_portals', '[2001:DB8:0:0::11],[2001:db8::0:12]:4421')->@*
+ ],
+ ['2001:db8::11', '2001:db8::12'],
+ 'IPv6 addresses are canonical',
+);
+eval { nv('parse_nvme_portals', '[2001:db8::11]:4420,[2001:db8:0::11]:4420'); };
+like($@, qr/duplicate NVMe\/TCP portal/, 'two spellings of one IPv6 portal are a duplicate');
+eval { nv('parse_nvme_portals', '198.51.100.11:4420,198.51.100.11:4420') };
+like($@, qr/duplicate NVMe\/TCP portal/, 'duplicate portal is rejected');
+eval { nv('parse_nvme_portals', '198.51.100.11,198.51.100.11:04420') };
+is($@, "duplicate NVMe/TCP portal '198.51.100.11:04420'\n", 'a port with a leading zero');
+eval { nv('parse_nvme_portals', '198.51.100.11:4421,[::ffff:198.51.100.11]:4421') };
+is(
+ $@,
+ "duplicate NVMe/TCP portal '[::ffff:198.51.100.11]:4421'\n",
+ 'an IPv4-mapped IPv6 address of an IPv4 portal',
+);
+is_deeply(
+ nv('parse_nvme_portals', '[::ffff:198.51.100.11]:4421'),
+ [{ address => '198.51.100.11', port => 4421, family => 'ipv4' }],
+ 'an IPv4-mapped IPv6 address is the IPv4 portal',
+);
+ok(!nv('parse_nvme_portals', '198.51.100.11:70000', 1), 'rejects an invalid port');
+ok(!nv('parse_nvme_portals', '[198.51.100.11]', 1), 'rejects IPv4 in brackets');
+# the addresses that PVE::NVMeOF::parse_portal refuses, also behind an IPv4-mapped IPv6 address
+for my $portal (
+ '0.0.0.0',
+ '0.0.0.0:4420',
+ '255.255.255.255',
+ '224.0.0.1',
+ '239.255.255.250:4420',
+ '[::]',
+ '[fe80::1]',
+ '[febf::1]:4420',
+ '[ff02::1]',
+ '[::ffff:0.0.0.0]',
+ '[::ffff:224.0.0.1]',
+) {
+ ok(!nv('parse_nvme_portals', $portal, 1), "refuses the portal $portal");
+}
+eval { nv('parse_nvme_portals', '198.51.100.11,0.0.0.0') };
+is($@, "invalid NVMe/TCP portal '0.0.0.0'\n", 'and names it in the error');
+my $too_many = join(',', map { "198.51.100.$_:4420" } 1 .. 17);
+ok(!nv('parse_nvme_portals', $too_many, 1), 'limits the number of paths');
+
+is_deeply(
+ nv(
+ '_configured_portals',
+ {
+ 'nvme-portals' => '198.51.100.11:4420,198.51.100.12:4421',
+ 'nvme-host-ifaces' => 'ens20,ens21',
+ },
+ ),
+ [
+ { address => '198.51.100.11', port => 4420, family => 'ipv4', host_iface => 'ens20' },
+ { address => '198.51.100.12', port => 4421, family => 'ipv4', host_iface => 'ens21' },
+ ],
+ 'binds each portal to its local interface',
+);
+eval {
+ nv(
+ '_configured_portals',
+ {
+ 'nvme-portals' => '198.51.100.11,198.51.100.12',
+ 'nvme-host-ifaces' => 'ens20',
+ },
+ );
+};
+like($@, qr/one interface for each/, 'portal and interface counts must match');
+ok(!nv('parse_nvme_host_ifaces', 'ens20,not/an/interface', 1), 'rejects an invalid interface name');
+for my $name ('.', '..') {
+ ok(!nv('parse_nvme_host_ifaces', "ens20,$name", 1), "rejects the directory name '$name'");
+}
+for my $option ('nvme-host-ifaces', 'nvme-host-nqns') {
+ my $opts = $PLUGIN->options()->{$option};
+ ok(!$opts->{optional} && !$opts->{fixed}, "$option is required, and can be changed");
+ my $config = scfg(type => 'zfsnvme', content => 'images', blocksize => '16k');
+ delete $config->{$option};
+ eval { $PLUGIN->check_config('st', $config, 1, 1) };
+ like($@, qr/missing value for required option '\Q$option\E'/, "a new storage needs $option");
+}
+$nvme_mock->redefine(_local_iface_exists => sub($iface) { return $iface eq 'ens20' });
+eval { nv('_validate_local_ifaces', [{ host_iface => 'ens20' }, { host_iface => 'ens21' }]); };
+like($@, qr/host interface 'ens21' does not exist/, 'a missing local interface fails preflight');
+$nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+
+my $listener_used = sub($address, $port, $storeid = 'existing') {
+ return "NVMe/TCP portal '$address' port $port is already used by storage '$storeid';"
+ . " give each storage its own address or port\n";
+};
+# [name, the existing storage, our overrides, error]
+for my $case (
+ [
+ 'the NQN of another storage',
+ { server => '192.0.2.11', pool => 'tank/existing', subsysnqn => $NQN },
+ {},
+ qr/NQN is already used by storage 'existing'/,
+ ],
+ [
+ 'the NQN and the listener of another storage',
+ { pool => 'data', subsysnqn => $NQN, 'nvme-portals' => '192.0.2.21' },
+ {},
+ "NVMe subsystem NQN is already used by storage 'existing'\n",
+ ],
+ [
+ 'the pool of another storage',
+ { pool => 'tank' },
+ {},
+ qr/ZFS pool 'tank' on '192\.0\.2\.10' is already used/,
+ ],
+ [
+ 'a pool inside ours',
+ { pool => 'tank/sub' },
+ {},
+ qr/ZFS pool 'tank' on '192\.0\.2\.10' overlaps the pool of storage 'existing'/,
+ ],
+ [
+ 'a pool above ours',
+ { pool => 'tank' },
+ { pool => 'tank/sub' },
+ qr/overlaps the pool of storage 'existing'/,
+ ],
+ [
+ 'a pool above ours on another server',
+ { pool => 'tank', server => '192.0.2.99' },
+ { pool => 'tank/sub' },
+ undef,
+ ],
+ ['a pool around ours', { pool => 'ta' }, {}, undef],
+ ['a parent pool', { pool => 'tan' }, {}, undef],
+ # one NVMe/TCP listener (family, address, port) per storage, on any server
+ [
+ 'the listener of another storage',
+ { pool => 'data', 'nvme-portals' => '192.0.2.31,192.0.2.22' },
+ {},
+ $listener_used->('192.0.2.22', 4420),
+ ],
+ [
+ 'the listener of another storage that names the default port',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21:4420' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the listener of a disabled storage',
+ { pool => 'data', disable => 1, 'nvme-portals' => '192.0.2.21' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the listener of a storage that spells the server another way',
+ { server => 'nas.example', pool => 'data', 'nvme-portals' => '192.0.2.21' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the listener of a storage on another server',
+ { server => '192.0.2.99', pool => 'tank', 'nvme-portals' => '192.0.2.21' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'an IPv6 listener written another way',
+ { pool => 'data', 'nvme-portals' => '[2001:db8:0::21]' },
+ { 'nvme-portals' => '[2001:DB8::0021]:4420' },
+ $listener_used->('2001:db8::21', 4420),
+ ],
+ [
+ 'an IPv4 listener reached through an IPv4-mapped IPv6 address',
+ { pool => 'data', 'nvme-portals' => '[::ffff:192.0.2.21]' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'an IPv4-mapped IPv6 address of an IPv4 listener',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21' },
+ { 'nvme-portals' => '[::FFFF:c000:215]' },
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the same addresses on other ports',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21:4421,192.0.2.22:4421' },
+ {},
+ undef,
+ ],
+ [
+ 'the same address on another port through another spelling of the server',
+ {
+ server => 'nas.example',
+ pool => 'data',
+ 'nvme-portals' => '192.0.2.31,192.0.2.22:4421',
+ },
+ {},
+ "storage 'existing' reaches target address '192.0.2.22' through server 'nas.example';"
+ . " use the same server value for both storages\n",
+ ],
+ [
+ 'an IPv6 address written another way through another spelling of the server',
+ { server => 'nas.example', pool => 'data', 'nvme-portals' => '[2001:db8::0:21]:4421' },
+ { 'nvme-portals' => '[2001:db8::21]' },
+ qr/\Astorage 'existing' reaches target address '2001:db8::21' through server/,
+ ],
+ [
+ 'other addresses on another server',
+ { server => 'nas.example', pool => 'tank', 'nvme-portals' => '192.0.2.31,192.0.2.32' },
+ {},
+ undef,
+ ],
+ [
+ 'other addresses on the same server',
+ { pool => 'data', 'nvme-portals' => '192.0.2.31,[2001:db8::22]' },
+ {},
+ undef,
+ ],
+ ['a storage without portals', { pool => 'data' }, {}, undef],
+ # it cannot be activated, and is checked when its portals are fixed
+ [
+ 'a storage whose portals do not parse',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21,192.0.2.300' },
+ {},
+ undef,
+ ],
+ [
+ 'the listener of another storage type',
+ { type => 'zfs', pool => 'tank', 'nvme-portals' => '192.0.2.21' },
+ {},
+ undef,
+ ],
+) {
+ my ($name, $other, $ours, $error) = $case->@*;
+ my $existing = {
+ type => 'zfsnvme',
+ server => '192.0.2.10',
+ subsysnqn => $OTHER_NQN,
+ pool => 'x',
+ $other->%*,
+ };
+ my $cfg = { ids => { existing => $existing } };
+ eval { nv('_assert_unique_target', 'new', scfg($ours->%*), $cfg) };
+ if (ref($error)) {
+ like($@, $error, "refuses $name");
+ } elsif (defined($error)) {
+ is($@, $error, "refuses $name");
+ } else {
+ is($@, '', "accepts $name");
+ }
+}
+
+{
+ my $states = {
+ '198.51.100.11:4420' => [{ state => 'live', host_iface => 'eth0' }],
+ '198.51.100.12:4420' => [
+ { state => 'connecting', host_iface => 'eth1' },
+ { state => 'live', host_iface => 'ens21' },
+ ],
+ '198.51.100.13:4420' => [{ state => 'dead', host_iface => 'ens22' }],
+ };
+ my $portals = [
+ { address => '198.51.100.11', port => 4420, host_iface => 'ens20' },
+ { address => '198.51.100.12', port => 4420, host_iface => 'ens21' },
+ { address => '198.51.100.13', port => 4420, host_iface => 'ens22' },
+ ];
+ is(nv('_live_portal_count', $states, $portals), 1, 'the wrong interface is not healthy');
+ is(nv('_live_portal_count', $states, $portals, 1), 2, 'but it carries I/O');
+}
+
+# DHHC-1:<hash>:<base64 of the key and its little-endian CRC-32>:
+for my $case (['00', 32], ['00', 48], ['00', 64], ['01', 32], ['02', 48], ['03', 64]) {
+ my $key = make_key($case->@*);
+ is(nv('_validate_secret', $key), $key, "accepts a $case->[1] byte key with hash $case->[0]");
+}
+my $bad_crc = do {
+ my $raw = 'k' x 32;
+ 'DHHC-1:00:' . encode_base64($raw . pack('V', crc32($raw) ^ 1), '') . ':';
+};
+for my $case (
+ ['a plaintext secret', 'plaintext'],
+ ['a key without the final colon', substr($KEY, 0, -1)],
+ ['an unknown hash', make_key('04', 32)],
+ ['a 48 byte key for SHA-256', make_key('01', 48)],
+ ['a 32 byte key for SHA-384', make_key('02', 32)],
+ ['a 32 byte key for SHA-512', make_key('03', 32)],
+ ['a 16 byte key', make_key('00', 16)],
+ ['a wrong CRC', $bad_crc],
+ ['truncated base64', substr($KEY, 0, -2) . ':'],
+ ['a key with a trailing newline', "$KEY\n"],
+) {
+ my ($name, $key) = $case->@*;
+ eval { nv('_validate_secret', $key) };
+ is($@, "invalid NVMe DH-HMAC-CHAP key representation\n", "rejects $name without echoing it");
+}
+eval { nv('_validate_secret', undef) };
+is($@, "missing NVMe DH-HMAC-CHAP key\n", 'a missing key');
+# check_config only validates. Defaults are applied where they are used.
+{
+ $parent_mock->redefine(
+ check_config => sub($class, $id, $config, $create, $skip = undef) { return $config },
+ );
+ my $config = scfg();
+ my $copy = { $config->%* };
+ is_deeply($PLUGIN->check_config('st', $config, 1, 1), $copy, 'no defaults on create');
+ is_deeply(
+ $PLUGIN->check_config('st', { 'nvme-host-ifaces' => 'ens20,ens21' }, 0),
+ { 'nvme-host-ifaces' => 'ens20,ens21' },
+ 'a partial update is accepted',
+ );
+ eval { $PLUGIN->check_config('st', scfg('nvme-fast-io-fail-tmo' => 700), 1, 1) };
+ like($@, qr/must not exceed nvme-ctrl-loss-tmo/, 'validated against the default');
+ eval { $PLUGIN->check_config('st', scfg('nvme-host-ifaces' => 'ens19'), 1, 1) };
+ like($@, qr/one interface for each/, 'cross-field validation stays');
+ # the pool is validated like every later use of it validates it
+ is(
+ $PLUGIN->check_config('st', scfg(pool => 'tank/nvme.1'), 1, 1)->{pool},
+ 'tank/nvme.1',
+ 'a nested pool is accepted',
+ );
+ for my $pool ('-rH', 'tank/vm 1', '') {
+ eval { $PLUGIN->check_config('st', scfg(pool => $pool), 1, 1) };
+ is($@, "invalid ZFS pool name\n", "the pool name '$pool' is refused on create");
+ eval { $PLUGIN->check_config('st', { pool => $pool }, 0) };
+ is($@, "invalid ZFS pool name\n", 'and on update');
+ }
+ $parent_mock->unmock('check_config');
+}
+eval {
+ nv(
+ '_validate_fail_fast_timeout',
+ { 'nvme-ctrl-loss-tmo' => 30, 'nvme-fast-io-fail-tmo' => 31 },
+ 600,
+ );
+};
+like($@, qr/must not exceed nvme-ctrl-loss-tmo/, 'fast I/O fail cannot outlive the loss timeout');
+eval {
+ nv(
+ '_validate_fail_fast_timeout',
+ { 'nvme-ctrl-loss-tmo' => -1, 'nvme-fast-io-fail-tmo' => 30 },
+ 600,
+ );
+};
+is($@, '', 'fast I/O fail stays valid with infinite reconnects');
+
+{
+ my $secret = '/etc/pve/priv/storage/nvmetest.nvme-dhchap';
+ local %CONFIG = ();
+ local %FILES = ();
+ local @WRITES = ();
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg()) };
+ is($@, "missing NVMe DH-HMAC-CHAP key\n", 'a new storage needs a key');
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY) };
+ is($@, '', 'a new storage stores its key');
+ is_deeply(
+ [grep { $_->{path} } @WRITES],
+ [{ path => $secret, data => "$KEY\n", perm => 0600 }],
+ 'readable by root only',
+ );
+ is_deeply(
+ [map { $_->{make_path} } grep { $_->{make_path} } @WRITES],
+ [['/etc/pve/priv/storage', { mode => 0700 }]],
+ 'in a private directory',
+ );
+
+ local $FILES{$secret} = $KEY;
+ @WRITES = ();
+ eval {
+ $PLUGIN->on_update_hook_full(
+ 'nvmetest',
+ scfg(),
+ { 'nvme-host-ifaces' => 'ens21,ens22' },
+ );
+ };
+ is($@, '', 'a partial update validates against the current configuration');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, undef, { 'dhchap-key' => $KEY }) };
+ is($@, '', 'the same key is accepted');
+ eval {
+ $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, undef, { 'dhchap-key' => $KEY_B });
+ };
+ like($@, qr/NVMe DH-HMAC-CHAP key rotation is not supported/, 'a different key is refused');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), { 'nvme-host-nqns' => $hostnqn_a }) };
+ like($@, qr/removing NVMe host NQN '\Q$hostnqn_b\E' is not supported/, 'no host removal');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, ['nvme-host-nqns']) };
+ like($@, qr/at least one NVMe host NQN is required/, 'deleting the host list is refused');
+ @WRITES = ();
+ eval {
+ my $update = { 'nvme-host-nqns' => "$hostnqn_a,$hostnqn_b,nqn.x:c" };
+ $PLUGIN->on_update_hook_full('nvmetest', scfg(), $update);
+ };
+ is($@, '', 'adding a host is accepted');
+ is_deeply(\@WRITES, [], 'without storing the key again');
+
+ delete local $FILES{$secret};
+ @WRITES = ();
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, undef, { 'dhchap-key' => $KEY }) };
+ is($@, '', 'a storage without key file');
+ is_deeply(
+ [grep { $_->{path} } @WRITES],
+ [{ path => $secret, data => "$KEY\n", perm => 0600 }],
+ 'stores the new key',
+ );
+}
+
+# nvmet keeps one key per host NQN, so storages of one target that share a host must share the key
+{
+ my $other = {
+ type => 'zfsnvme',
+ server => '192.0.2.10',
+ pool => 'data',
+ subsysnqn => $OTHER_NQN,
+ 'nvme-host-nqns' => $hostnqn_b,
+ };
+ my $cfg = { ids => { other => $other, nvmetest => scfg() } };
+ local %FILES = ('/etc/pve/priv/storage/other.nvme-dhchap' => $KEY_B);
+ eval { nv('_assert_shared_host_key', 'nvmetest', scfg(), $KEY, $cfg) };
+ is(
+ $@,
+ "storage 'other' uses a different DH-HMAC-CHAP key for the same NVMe host NQNs"
+ . " on '192.0.2.10'\n",
+ 'a different key for a shared host is refused',
+ );
+ for my $case (
+ ['the same key', $KEY_B, {}],
+ ['another server', $KEY, { server => '192.0.2.11' }],
+ ['no shared host', $KEY, { 'nvme-host-nqns' => 'nqn.2026-01.com.example:other-host' }],
+ ['another storage type', $KEY, { type => 'zfs' }],
+ ) {
+ my ($name, $key, $change) = $case->@*;
+ my $ids = { ids => { other => { $other->%*, $change->%* } } };
+ eval { nv('_assert_shared_host_key', 'nvmetest', scfg(), $key, $ids); };
+ is($@, '', "accepts $name");
+ }
+ {
+ local %FILES = ();
+ eval { nv('_assert_shared_host_key', 'nvmetest', scfg(), $KEY, $cfg); };
+ is($@, '', 'a storage without a key file is skipped');
+ }
+
+ local %CONFIG = (other => $other);
+ local @WRITES = ();
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY) };
+ like($@, qr/storage 'other' uses a different DH-HMAC-CHAP key/, 'on_add_hook refuses it');
+ unlike($@, qr/DHHC-1/, 'without naming a key');
+ is_deeply([grep { $_->{path} } @WRITES], [], 'and stores no key');
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY_B) };
+ is($@, '', 'the same key is accepted');
+
+ local $FILES{'/etc/pve/priv/storage/nvmetest.nvme-dhchap'} = $KEY;
+ my $current = scfg('nvme-host-nqns' => $hostnqn_a);
+ eval {
+ $PLUGIN->on_update_hook_full(
+ 'nvmetest',
+ $current,
+ { 'nvme-host-nqns' => "$hostnqn_a,$hostnqn_b" },
+ );
+ };
+ like($@, qr/storage 'other' uses a different DH-HMAC-CHAP key/, 'nor shared by an update');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', $current, { 'nvme-iopolicy' => 'numa' }) };
+ is($@, '', 'other updates are accepted');
+}
+
+# an update checks the new portals, and the current definition of the storage itself does not count
+{
+ my $secret = '/etc/pve/priv/storage/nvmetest.nvme-dhchap';
+ my $other = scfg(
+ subsysnqn => $OTHER_NQN,
+ pool => 'data',
+ 'nvme-portals' => '192.0.2.23',
+ 'nvme-host-ifaces' => 'ens21',
+ );
+ local %CONFIG = (other => $other);
+ local %FILES = ();
+ local @WRITES = ();
+ my $shared = scfg('nvme-portals' => '192.0.2.21,192.0.2.23');
+ eval { $PLUGIN->on_add_hook('nvmetest', $shared, 'dhchap-key' => $KEY) };
+ is($@, $listener_used->('192.0.2.23', 4420, 'other'), 'on_add_hook refuses a used listener');
+ is_deeply([grep { $_->{path} } @WRITES], [], 'and stores no key');
+
+ %CONFIG = (other => $other, nvmetest => scfg());
+ $FILES{$secret} = $KEY;
+ my $update = sub($current, $portals) {
+ eval {
+ $PLUGIN->on_update_hook_full('nvmetest', $current, { 'nvme-portals' => $portals });
+ };
+ return $@;
+ };
+ is($update->(scfg(), '192.0.2.22,192.0.2.21'), '', 'an update keeps its own listeners');
+ is(
+ $update->(scfg(), '192.0.2.21,192.0.2.23:4420'),
+ $listener_used->('192.0.2.23', 4420, 'other'),
+ 'on_update_hook_full refuses a used listener',
+ );
+ is($update->(scfg(), '192.0.2.21,192.0.2.23:4421'), '', 'but not its address on another port');
+ is($update->($shared, '192.0.2.21,192.0.2.22'), '', 'an update can leave a used listener');
+ is_deeply([grep { $_->{path} } @WRITES], [], 'without storing the key again');
+}
+
+# a new storage cannot use a subsystem that an nvmeof storage lists, an existing one is not checked
+{
+ my $nvmeof = { type => 'nvmeof', subsysnqn => $NQN, portals => '192.0.2.21' };
+ local %FILES = ();
+ local @WRITES = ();
+ local %CONFIG = (san => $nvmeof);
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY) };
+ is(
+ $@,
+ "NVMe subsystem NQN is already used by storage 'san'\n",
+ 'a new storage refuses the subsystem of an nvmeof storage',
+ );
+ is_deeply([grep { $_->{path} } @WRITES], [], 'and stores no key');
+
+ %CONFIG = (san => { $nvmeof->%*, subsysnqn => $OTHER_NQN });
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY) };
+ is($@, '', 'another subsystem is accepted');
+
+ %CONFIG = (nvmetest => $nvmeof);
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY) };
+ is($@, '', 'the storage itself does not count');
+
+ local $FILES{'/etc/pve/priv/storage/nvmetest.nvme-dhchap'} = $KEY;
+ %CONFIG = (san => $nvmeof);
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), { 'nvme-iopolicy' => 'numa' }) };
+ is($@, '', 'a storage that exists keeps working');
+}
+
+# pvesm reads the key from a file, so it never appears on a command line.
+{
+ require PVE::CLI::pvesm;
+
+ my $dir = tempdir(CLEANUP => 1);
+ my $file = sub($name, $content) {
+ open(my $fh, '>', "$dir/$name") or die "open: $!\n";
+ print {$fh} $content;
+ close($fh);
+ return "$dir/$name";
+ };
+ my $padded = $file->('padded', " $KEY \nsecond line\n");
+ my $empty = $file->('empty', "\n");
+ my %map = map {
+ my $command = $_;
+ (
+ $command => (
+ grep { $_->{name} eq 'dhchap-key' }
+ PVE::CLI::pvesm::param_mapping($command)->@*
+ )[0],
+ )
+ } qw(create update);
+ ok($map{create} && $map{update}, 'pvesm create and update map dhchap-key');
+ my $read = $map{create}->{func};
+ eval { $read->($KEY) };
+ is(
+ $@,
+ "dhchap-key expects the path of a file containing the key\n",
+ 'a key in place of the file name is refused without repeating it',
+ );
+ is($read->($padded), $KEY, 'the first line of the file, trimmed');
+ eval { $read->($empty) };
+ like($@, qr/key file '.*' is empty/, 'an empty file is refused');
+ eval { $read->('/dev/null') };
+ like($@, qr/is empty/, 'a file that is not regular, like /dev/stdin, is read');
+ eval { $read->($dir) };
+ like($@, qr/expects the path of a file/, 'a directory is refused');
+}
+
+sub target(%answers) {
+ return sub($steps, %opts) {
+ my $answer = $answers{ $opts{op} } // die "unexpected NVMe target call '$opts{op}'\n";
+ return $answer->($steps, %opts) if ref($answer) eq 'CODE';
+ return { rc => 0, out => $answer, err => '' };
+ };
+}
+
+my @volume_list = (
+ "tank\t-\t-\tfilesystem",
+ "tank/vm-100-disk-0\t1048576\t-\tvolume",
+ "tank/vm-200-disk-0\t1048576\t-\tvolume",
+ "tank/vm-300-disk-0\t1048576\t-\tvolume",
+ "tank/vm-400-disk-0\t1048576\t-\tvolume",
+ "tank/base-90-disk-0\t1048576\t-\tvolume",
+ "tank/vm-101-disk-0\t1048576\ttank/base-90-disk-0\@__base__\tvolume",
+ "tank/vm-102-disk-0\t1048576\ttankXprod/base-90-disk-0\@__base__\tvolume",
+ "tank/subvol-103-disk-0\t-\t-\tfilesystem",
+ "tank/vm-104-disk-0\t-\t-\tfilesystem",
+);
+my @ownership = (
+ "tank\t-\t-",
+ "tank/vm-100-disk-0\t$NQN\tlocal",
+ "tank/vm-200-disk-0\t-\t-",
+ "tank/vm-300-disk-0\t$NQN\tinherited from tank",
+ "tank/vm-400-disk-0\t$NQN\treceived",
+ "tank/base-90-disk-0\t$NQN\tlocal",
+ "tank/vm-101-disk-0\t$NQN\tlocal",
+ "tank/vm-102-disk-0\t$NQN\tlocal",
+ "tank/subvol-103-disk-0\t$OTHER_NQN\tlocal",
+ "tank/vm-104-disk-0\t$NQN\tlocal",
+);
+{
+ local $TARGET = target('zfs list' => \@volume_list, 'zfs get' => \@ownership);
+ my $images = $PLUGIN->list_images('nvmetest', scfg());
+ my %by_volid = map { $_->{volid} => $_ } $images->@*;
+ my %by_name = map { $_->{name} => $_ } $images->@*;
+ is_deeply(
+ [sort keys %by_name],
+ ['base-90-disk-0', 'vm-100-disk-0', 'vm-101-disk-0', 'vm-102-disk-0', 'vm-400-disk-0'],
+ 'listing requires a zvol with a local or received owner',
+ );
+ is(
+ $by_name{'vm-102-disk-0'}->{parent},
+ 'tankXprod/base-90-disk-0@__base__',
+ 'a foreign pool origin is not mistaken for a local parent',
+ );
+ is_deeply(
+ $by_volid{'nvmetest:base-90-disk-0/vm-101-disk-0'},
+ {
+ name => 'vm-101-disk-0',
+ size => 1048576,
+ parent => 'base-90-disk-0@__base__',
+ format => 'raw',
+ vmid => 101,
+ volid => 'nvmetest:base-90-disk-0/vm-101-disk-0',
+ },
+ 'a linked clone keeps the volume ID format of the ZFS plugins',
+ );
+ is_deeply(
+ [map { $_->{volid} } $PLUGIN->list_images('nvmetest', scfg(), 400)->@*],
+ ['nvmetest:vm-400-disk-0'],
+ 'filtered by VM',
+ );
+ my $listed = $PLUGIN->list_images('nvmetest', scfg(), undef, ['nvmetest:vm-100-disk-0']);
+ is_deeply([map { $_->{volid} } $listed->@*], ['nvmetest:vm-100-disk-0'], 'by volume list');
+ is(
+ $PLUGIN->find_free_diskname('nvmetest', scfg(), 200),
+ 'vm-200-disk-1',
+ 'a name held by an unowned zvol is not handed out',
+ );
+ is($PLUGIN->find_free_diskname('nvmetest', scfg(), 90), 'vm-90-disk-1', 'nor one of a base');
+ is(
+ $PLUGIN->find_free_diskname('nvmetest', scfg(), 104),
+ 'vm-104-disk-1',
+ 'nor one held by a filesystem',
+ );
+ my @steps = map { $_->{steps}->@* } @TARGET_CALLS;
+ ok(!grep({ $_->[0] ne 'zfs' || $_->[1] !~ /\A(?:get|list)\z/ } @steps), 'listing only reads');
+}
+
+{
+ my @warnings;
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ for my $case (
+ [['100', '200'], [300, 100, 200, 1]],
+ [['-', '200'], [0, 0, 0, 0]],
+ [['1'], [0, 0, 0, 0]],
+ ) {
+ local $TARGET = target('zfs get' => $case->[0]);
+ is_deeply([$PLUGIN->status('nvmetest', scfg())], $case->[1], "status for '$case->[0]->@*'");
+ }
+ local $TARGET =
+ target('zfs get' => sub(@args) { return { rc => 255, out => [], err => 'no route' } });
+ is_deeply([$PLUGIN->status('nvmetest', scfg())], [0, 0, 0, 0], 'unreachable is inactive');
+ is(scalar(@warnings), 3, 'and every inactive status warns');
+ like($warnings[0], qr/unexpected ZFS pool usage for storage 'nvmetest'/, 'about the usage');
+ is(
+ $warnings[-1],
+ "storage 'nvmetest': zfs error on '192.0.2.10': no route\n",
+ 'or naming the storage and the target',
+ );
+}
+
+{
+ local @TARGET_CALLS = ();
+ local $TARGET = target();
+ eval { $PLUGIN->volume_resize(scfg(), 'nvmetest', 'vm-100-disk-0', 2 * 1024**3, 1) };
+ like(
+ $@,
+ qr/online resize is not supported for NVMe\/TCP block devices; stop the VM first/,
+ 'online resize is refused',
+ );
+ eval { $PLUGIN->volume_resize(scfg(), 'nvmetest', 'vm-100-disk-0', 2 * 1024**3, 0, 'snap') };
+ like($@, qr/resizing a snapshot is not supported/, 'as is resizing a snapshot');
+ is_deeply(\@TARGET_CALLS, [], 'before any target call');
+ for my $method (qw(volume_export volume_import rename_volume rename_snapshot)) {
+ eval { $PLUGIN->$method(scfg(), 'nvmetest', 'vm-100-disk-0') };
+ like($@, qr/not supported/, "$method is not supported");
+ }
+ for my $direction (qw(export import)) {
+ my $formats = "volume_${direction}_formats";
+ is_deeply(
+ [$PLUGIN->$formats(scfg(), 'nvmetest', 'vm-100-disk-0')],
+ [],
+ "no $direction formats",
+ );
+ }
+ is($PLUGIN->deactivate_volume('nvmetest', scfg(), 'vm-100-disk-0'), 1, 'no-op deactivation');
+ eval { $PLUGIN->deactivate_volume('nvmetest', scfg(), 'vm-100-disk-0', 'snap') };
+ like($@, qr/unable to deactivate snapshot/, 'snapshots cannot be deactivated');
+}
+
+{
+ $nvme_mock->redefine(_nvmet_volume_uuid => sub($scfg, $name) { return $UUID });
+ is_deeply(
+ $PLUGIN->qemu_blockdev_options(scfg(), 'nvmetest', 'vm-100-disk-0'),
+ { driver => 'host_device', filename => "/dev/disk/by-id/nvme-uuid.$UUID" },
+ 'the QEMU host_device driver on the stable namespace UUID link',
+ );
+ eval {
+ my $options = { 'snapshot-name' => 's' };
+ $PLUGIN->qemu_blockdev_options(scfg(), 'nvmetest', 'vm-100-disk-0', undef, $options);
+ };
+ like($@, qr/direct access to snapshots not implemented/, 'snapshots have no block device');
+ $nvme_mock->unmock('_nvmet_volume_uuid');
+}
+
+{
+ my $run = $nvme_mock->original('_nvmet_run');
+ my @runs;
+ local $COMMAND = sub($cmd, %opts) {
+ push @runs, { cmd => $cmd, %opts };
+ return 0;
+ };
+ my $steps = [['zfs', 'get', '-H', 'type', 'tank'], ['printf', '%s\n', 'x y']];
+ my $res = $run->(scfg(), $steps, op => 'test');
+ is_deeply(
+ $runs[0]->{cmd},
+ [
+ '/usr/bin/ssh',
+ '-o',
+ 'BatchMode=yes',
+ '-o',
+ 'ConnectTimeout=10',
+ '-o',
+ 'LogLevel=ERROR',
+ '-i',
+ '/etc/pve/priv/zfs/192.0.2.10_id_rsa',
+ '--',
+ 'root@192.0.2.10',
+ q{zfs get -H type tank && printf '%s\n' 'x y'},
+ ],
+ 'one ssh argv with the rendered command, and no login banner in errors',
+ );
+ unlike(join(' ', $runs[0]->{cmd}->@*), qr/perl/, 'no Perl runs on the target');
+ is($runs[0]->{timeout}, 15, 'reads time out after 15 seconds by default');
+ ok(!$runs[0]->{noerr} && !exists($runs[0]->{input}),
+ 'failures are exceptions, stdin is closed');
+ is_deeply($res, { rc => 0, out => [], err => '' }, 'a successful call');
+
+ @runs = ();
+ $run->(
+ scfg(),
+ [{ key => ["$ROOT/hosts/$hostnqn_a/dhchap_key"] }],
+ op => 'key',
+ input => "$KEY\n",
+ timeout => 7,
+ );
+ is($runs[0]->{input}, "$KEY\n", 'the key goes to stdin');
+ unlike(join(' ', $runs[0]->{cmd}->@*), qr/DHHC-1/, 'and never into the command line');
+ is($runs[0]->{timeout}, 7, 'with the timeout of the caller');
+
+ for my $case (
+ [
+ 'output and the first error line',
+ sub(%o) {
+ $o{outfunc}->('a');
+ $o{outfunc}->('b');
+ $o{errfunc}->('');
+ $o{errfunc}->('first');
+ $o{errfunc}->('second');
+ die "command 'ssh' failed: exit code 3\n";
+ },
+ { rc => 3, out => ['a', 'b'], err => 'first' },
+ ],
+ [
+ 'an exit code without message',
+ sub(%o) { die "command 'ssh' failed: exit code 2\n" },
+ { rc => 2, out => [], err => 'exit code 2' },
+ ],
+ [
+ 'a timeout',
+ sub(%o) { die "command 'ssh' failed: got timeout\n" },
+ { rc => -1, out => [], err => 'timeout' },
+ ],
+ [
+ 'an ssh that could not connect',
+ sub(%o) { die "command 'ssh' failed: exit code 255\n" },
+ { rc => 255, out => [], err => 'exit code 255' },
+ ],
+ [
+ 'an ssh killed by a signal',
+ sub(%o) { die "command 'ssh' failed: got signal 9\n" },
+ { rc => -1, out => [], err => 'ssh failed' },
+ ],
+ ) {
+ my ($name, $behaviour, $expected) = $case->@*;
+ local $COMMAND = sub($cmd, %opts) { return $behaviour->(%opts) };
+ is_deeply(
+ $run->(scfg(), [['cat', '/proc/mounts']], op => 'test'),
+ $expected,
+ "returns $name",
+ );
+ }
+ for my $exception ("received interrupt\n", "command 'ssh $KEY' failed: received interrupt\n") {
+ local $COMMAND = sub($cmd, %opts) { $opts{outfunc}->('partial'); die $exception };
+ eval { $run->(scfg(), [['cat', '/proc/mounts']], op => 'test') };
+ is($@, "received interrupt\n", 'a stopped task dies with the task marker and nothing else');
+ }
+ @runs = ();
+ eval { $run->(scfg(), [['cat', '/proc/mounts']]) };
+ like($@, qr/NVMe target call without label/, 'every call has a label');
+ eval { $run->(scfg(), [['printf', '%s', 'x' x 65536]], op => 'test') };
+ like($@, qr/NVMe target command too long/, 'oversized calls are refused');
+ is_deeply(\@runs, [], 'before running anything');
+}
+
+subtest 'vdisk_alloc dispatches under the shared storage lock' => sub {
+ my $cluster_mock = Test::MockModule->new('PVE::Cluster');
+ my (@locks, @allocations);
+ $cluster_mock->redefine(
+ cfs_lock_storage => sub($storeid, $timeout, $func, @param) {
+ push @locks, [$storeid, $timeout];
+ return $func->(@param);
+ },
+ );
+ $parent_mock->redefine(lookup => sub($class, $type) { return $PLUGIN });
+ $storage_mock->redefine(activate_storage => sub($cfg, $storeid) { return 1 });
+ $nvme_mock->redefine(
+ alloc_image => sub($class, $storeid, $scfg, $vmid, $fmt, $name, $size) {
+ push @allocations, [$storeid, $vmid, $fmt, $name, $size];
+ return $name;
+ },
+ );
+ my $cfg = { ids => { nvmetest => scfg(shared => 1) } };
+ is(
+ PVE::Storage::vdisk_alloc($cfg, 'nvmetest', 105, 'raw', 'vm-105-disk-0', 131_072),
+ 'nvmetest:vm-105-disk-0',
+ 'core allocation returns the allocated volume ID',
+ );
+ is_deeply(\@locks, [['nvmetest', undef]], 'cfs_lock_storage gets the timeout of the core');
+ is_deeply(
+ \@allocations,
+ [['nvmetest', 105, 'raw', 'vm-105-disk-0', 131_072]],
+ 'alloc_image runs once inside the lock',
+ );
+ $nvme_mock->unmock('alloc_image');
+ $storage_mock->unmock('activate_storage');
+ $parent_mock->unmock('lookup');
+};
+
+done_testing();
+
+1;
--
2.54.0.windows.1
^ permalink raw reply related [relevance 6%]
* [PATCH storage v5 04/13] zfsnvme: connect the nodes and register the plugin
2026-11-26 15:09 8% [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
@ 2026-11-26 15:09 11% ` Joaquin Varela
2026-11-26 15:09 25% ` [PATCH storage v5 05/13] api: san luns: count zfsnvme storages as owners of their subsystem Joaquin Varela
` (3 subsequent siblings)
4 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-11-26 15:09 UTC (permalink / raw)
To: pve-devel
Connect the nodes with native NVMe multipath. One write to
/dev/nvme-fabrics creates each controller, in a bounded child that
holds the PVE::NVMeOF host lock, so the key never shows up on a
command line. activate_volume checks the namespace identity.
The host NQN and ID come from nvme-cli, which is recommended already.
Register the 'zfsnvme' type, add it to @SHARED_STORAGE and let 'pvesm
add' and 'pvesm set' read --dhchap-key from a file. The delete hook
only removes the key file, as it runs under the storage.cfg lock. The
subsystem stays on the target, so a new key for its host NQNs is
refused until it is removed there.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
src/PVE/CLI/pvesm.pm | 21 +-
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/Plugin.pm | 12 +-
src/PVE/Storage/ZFSNVMePlugin.pm | 575 +++++++++++++++++++++++++++++++
5 files changed, 608 insertions(+), 3 deletions(-)
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 05da60d8..33272fad 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -79,12 +79,29 @@ sub param_mapping {
},
};
+ my $dhchap_key_map = {
+ name => 'dhchap-key',
+ desc => 'a file containing the NVMe DH-HMAC-CHAP key',
+ func => sub {
+ my ($value) = @_;
+ # never repeat a key passed in place of the file name
+ die "dhchap-key expects the path of a file containing the key\n"
+ if $value =~ /^DHHC-1:/i || -d $value;
+ my ($key) = split(/\n/, PVE::Tools::file_get_contents($value), 2);
+ $key = PVE::Tools::trim($key // '');
+ die "DH-HMAC-CHAP key file '$value' is empty\n" if $key eq '';
+ return $key;
+ },
+ };
+
my $mapping = {
'cifsscan' => [$password_map],
'cifs' => [$password_map],
'pbs' => [$password_map],
- 'create' => [$password_map, $enc_key_map, $master_key_map, $keyring_map],
- 'update' => [$password_map, $enc_key_map, $master_key_map, $keyring_map],
+ 'create' =>
+ [$password_map, $enc_key_map, $master_key_map, $keyring_map, $dhchap_key_map],
+ 'update' =>
+ [$password_map, $enc_key_map, $master_key_map, $keyring_map, $dhchap_key_map],
};
return $mapping->{$name};
}
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index c77a6755..df4c6943 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -39,6 +39,7 @@ use PVE::Storage::CephFSPlugin;
use PVE::Storage::ISCSIDirectPlugin;
use PVE::Storage::ZFSPoolPlugin;
use PVE::Storage::ZFSPlugin;
+use PVE::Storage::ZFSNVMePlugin;
use PVE::Storage::PBSPlugin;
use PVE::Storage::BTRFSPlugin;
use PVE::Storage::ESXiPlugin;
@@ -65,6 +66,7 @@ PVE::Storage::CephFSPlugin->register();
PVE::Storage::ISCSIDirectPlugin->register();
PVE::Storage::ZFSPoolPlugin->register();
PVE::Storage::ZFSPlugin->register();
+PVE::Storage::ZFSNVMePlugin->register();
PVE::Storage::PBSPlugin->register();
PVE::Storage::BTRFSPlugin->register();
PVE::Storage::ESXiPlugin->register();
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index 7f2ff6c8..553f65a3 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -12,6 +12,7 @@ SOURCES= \
ISCSIDirectPlugin.pm \
ZFSPoolPlugin.pm \
ZFSPlugin.pm \
+ ZFSNVMePlugin.pm \
PBSPlugin.pm \
BTRFSPlugin.pm \
LvmThinPlugin.pm \
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 998bc68a..60207301 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -42,7 +42,17 @@ our @COMMON_TAR_FLAGS = qw(
);
our @SHARED_STORAGE = (
- 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs', 'nvmeof',
+ 'iscsi',
+ 'nfs',
+ 'cifs',
+ 'rbd',
+ 'cephfs',
+ 'iscsidirect',
+ 'zfs',
+ 'zfsnvme',
+ 'drbd',
+ 'pbs',
+ 'nvmeof',
);
our $QCOW2_PREALLOCATION = {
diff --git a/src/PVE/Storage/ZFSNVMePlugin.pm b/src/PVE/Storage/ZFSNVMePlugin.pm
index 1f95f8c5..4d2eaf7e 100644
--- a/src/PVE/Storage/ZFSNVMePlugin.pm
+++ b/src/PVE/Storage/ZFSNVMePlugin.pm
@@ -14,6 +14,7 @@ use Socket qw(AF_INET6 inet_ntop inet_pton);
use Time::HiRes;
use PVE::Cluster;
+use PVE::Diskmanage;
use PVE::File;
use PVE::JSONSchema;
use PVE::Network;
@@ -2363,4 +2364,578 @@ sub on_update_hook_full($class, $storeid, $scfg, $update, $delete = undef, $sens
return;
}
+my %slow_path_last; # time of the last slow-path activation, by storeid
+
+sub _block_device($path) {
+ return -b $path;
+}
+
+sub _link_target($path) {
+ return readlink($path);
+}
+
+sub _fabrics_device() {
+ return '/dev/nvme-fabrics';
+}
+
+sub _nvme_tcp_loaded() {
+ return -e '/sys/module/nvme_tcp';
+}
+
+sub _partitions($device) {
+ return glob("${device}p[0-9]*");
+}
+
+# Runs $code in a child under the host lock of PVE::NVMeOF, which the nvmeof storage and the
+# controller API share. with_lock kills the child at its limit, which also frees the lock. The limit
+# is $timeout plus the lock wait in all, counted from the start of the call. The bound is not hard:
+# a child stuck in the kernel (a write or delete in D state) is only reaped once the kernel returns,
+# and a timeout does not mean that the operation did not happen. $code must not take locks or call
+# run_locked.
+#
+# A stopped task (TERM, HUP, INT and QUIT) stays pending in the parent while the child runs, and
+# the child inherits the mask. So a connect still creates its controller and restricts the secret
+# attributes before the stop takes effect, unless PVE escalates to KILL after 5 seconds. That ends
+# both processes and leaves the attributes world-readable until the next activation. Once the child
+# is reaped, the worker handler dies with the task marker, also over a result or an error of the
+# child. ALRM, the timeout, is not blocked.
+my sub run_locked($timeout, $what, $code) {
+ my $limit = $timeout + $PVE::NVMeOF::LOCK_WAIT;
+ my $previous = POSIX::SigSet->new();
+ sigprocmask(SIG_BLOCK, POSIX::SigSet->new(SIGHUP, SIGINT, SIGQUIT, SIGTERM), $previous)
+ or die "cannot block signals: $!\n";
+ my $outer_warn = $SIG{__WARN__};
+ my $res = eval {
+ # with_lock only warns in the parent when its child leaves no result, which dies below.
+ # The child keeps the handler of the caller, so its warnings reach the task log.
+ local $SIG{__WARN__} = sub($message) { };
+ PVE::NVMeOF::with_lock(
+ sub {
+ local $SIG{__WARN__} = $outer_warn;
+ return $code->();
+ },
+ $limit,
+ );
+ };
+ my $error = $@;
+ sigprocmask(SIG_SETMASK, $previous) or die "cannot restore signals: $!\n";
+ if ($error) {
+ rethrow_task_interrupt($error);
+ die "$what did not complete within $limit seconds\n" if $error eq $PVE::NVMeOF::TIMED_OUT;
+ die $error;
+ }
+ die "$what left no result\n" if !defined($res);
+ return $res;
+}
+
+# the values are validated by the caller, the kernel reads each one up to the next ','
+sub _fabrics_options($scfg, $portal, $hostnqn, $hostid, $key) {
+ my @options = (
+ [transport => 'tcp'],
+ [traddr => $portal->{address}],
+ [trsvcid => $portal->{port}],
+ [host_iface => $portal->{host_iface}],
+ [nqn => $scfg->{subsysnqn}],
+ [hostnqn => $hostnqn],
+ [hostid => $hostid],
+ [dhchap_secret => $key],
+ [keep_alive_tmo => $scfg->{'nvme-keep-alive-tmo'} // 5],
+ [reconnect_delay => $scfg->{'nvme-reconnect-delay'} // 2],
+ [ctrl_loss_tmo => $scfg->{'nvme-ctrl-loss-tmo'} // 600],
+ );
+ # unlike unset, which leaves fast I/O failure off, 0 is a real timeout
+ push @options, [fast_io_fail_tmo => $scfg->{'nvme-fast-io-fail-tmo'}]
+ if defined($scfg->{'nvme-fast-io-fail-tmo'});
+ push @options, [nr_io_queues => $scfg->{'nvme-nr-io-queues'}]
+ if defined($scfg->{'nvme-nr-io-queues'});
+ for my $option (@options) {
+ die "internal error: invalid NVMe connect option '$option->[0]'\n"
+ if !defined($option->[1]) || $option->[1] !~ $RE_FABRICS_VALUE;
+ }
+ return (join(',', map { "$_->[0]=$_->[1]" } @options), [map { $_->[0] } @options]);
+}
+
+# One write of $options creates exactly one controller. It is never repeated, because the kernel
+# may have created the controller even when it reports an error. Errors carry the errno text and
+# never the options, which hold the key.
+sub _fabrics_connect($options, $names) {
+ my $device = _fabrics_device();
+ my $probe;
+ if (!sysopen($probe, $device, O_RDONLY | O_NOFOLLOW)) {
+ die "'$device' does not exist; load the nvme-tcp kernel module\n" if $! == ENOENT;
+ die "cannot open '$device': $!\n";
+ }
+ my @stat = stat($probe);
+ die "'$device' is not a character device\n" if !@stat || !S_ISCHR($stat[2]);
+ # without a controller, a read lists the supported options as patterns
+ my $supported = '';
+ sysread($probe, $supported, 4096) // die "cannot read '$device': $!\n";
+ close($probe);
+ my %supported = map { s/=.*//r => 1 } split(/,/, $supported =~ s/\n\z//r);
+ for my $name ($names->@*) {
+ die "the running kernel does not support the NVMe connect option '$name'\n"
+ if !$supported{$name};
+ }
+
+ # Not PVE::SysFSTools::file_write: the kernel returns the instance of the new controller on a
+ # read of the file descriptor that wrote the options.
+ sysopen(my $fh, $device, O_RDWR | O_NOFOLLOW) or die "cannot open '$device': $!\n";
+ my $written = _fabrics_write($fh, $options);
+ die "connect failed: $!\n" if !defined($written);
+ die "connect failed: short write\n" if $written != length($options);
+ my $result = '';
+ sysread($fh, $result, 128) // die "cannot read the connect result: $!\n";
+ die "unexpected connect result\n" if $result !~ $RE_FABRICS_RESULT;
+ my $instance = int($+{instance});
+ # The kernel creates the secret attributes world-readable. The caller keeps a stopped task from
+ # interrupting before this, short of a KILL.
+ _restrict_attr("/sys/class/nvme/nvme$instance/$_") for qw(dhchap_secret dhchap_ctrl_secret);
+ close($fh);
+ return $instance;
+}
+
+sub _fabrics_write($fh, $options) {
+ return syswrite($fh, $options);
+}
+
+# PVE::SysFSTools::file_write returns undef without a warning when the open fails, leaving its
+# errno in $!, and 0 after warning "error writing ...: <errno text>" when the write fails, which is
+# not passed on. With $missing_ok, an attribute that went away with its controller is no failure.
+my sub write_attribute($path, $value, $missing_ok = 0) {
+ my $warning;
+ my $written = do {
+ local $SIG{__WARN__} = sub($message) { $warning = $message };
+ PVE::SysFSTools::file_write($path, $value);
+ };
+ return if $written;
+ return if !defined($warning) && $missing_ok && $! == ENOENT;
+ return "$!" if !defined($warning);
+ return $warning =~ s/\A.*: //sr =~ s/\n\z//r;
+}
+
+# runs in a child, as the deletion can block in the kernel
+sub _delete_controllers($controllers) {
+ for my $controller ($controllers->@*) {
+ my $path = "/sys/class/nvme/$controller->{name}/delete_controller";
+ my $error = write_attribute($path, '1', 1) // next;
+ die "cannot delete NVMe controller '$controller->{name}': $error\n";
+ }
+ return scalar($controllers->@*);
+}
+
+my sub nvme_controllers($nqn) {
+ my $controllers = [];
+ PVE::File::dir_glob_foreach(
+ '/sys/class/nvme',
+ $RE_NVME_CONTROLLER,
+ sub($entry) {
+ my $base = "/sys/class/nvme/$entry";
+ my $subsys = file_read_firstline("$base/subsysnqn");
+ return if !defined($subsys) || $subsys ne $nqn;
+ my $address = file_read_firstline("$base/address") // '';
+ my $traddr = $address =~ $RE_TRADDR ? $+{value} : undef;
+ my $trsvcid = $address =~ $RE_TRSVCID ? $+{value} : undef;
+ my $host_iface = $address =~ $RE_HOST_IFACE_ADDRESS ? $+{value} : undef;
+ push $controllers->@*,
+ {
+ name => $entry,
+ state => file_read_firstline("$base/state") // 'unknown',
+ traddr => nvmet_canonical_address($traddr),
+ trsvcid => $trsvcid,
+ host_iface => $host_iface,
+ };
+ },
+ );
+ return $controllers;
+}
+
+# a portal has more than one controller while its path moves to another interface
+my sub controller_states($nqn) {
+ my $states = {};
+ for my $controller (nvme_controllers($nqn)->@*) {
+ next if !defined($controller->{traddr}) || !defined($controller->{trsvcid});
+ push $states->{"$controller->{traddr}:$controller->{trsvcid}"}->@*, $controller;
+ }
+ return $states;
+}
+
+# The kernel reuses the name of a controller that is gone, and the wait for the host lock can be
+# long, so the name of a listed controller can belong to another one by the time it is deleted. A
+# dead controller must still be dead, as it can recover meanwhile.
+my sub same_controller($listed, $now) {
+ return 0 if !$now;
+ for my $key (qw(traddr trsvcid host_iface)) {
+ return 0 if ($now->{$key} // '') ne ($listed->{$key} // '');
+ }
+ return $listed->{state} ne 'dead' || $now->{state} eq 'dead';
+}
+
+# runs in a child under the host lock, and deletes the listed controllers that are still the same
+my sub delete_listed($nqn, $listed) {
+ my %now = map { $_->{name} => $_ } nvme_controllers($nqn)->@*;
+ return _delete_controllers([grep { same_controller($_, $now{ $_->{name} }) } $listed->@*]);
+}
+
+# What keeps the namespaces of the subsystem from going away, as PVE::NVMeOF::disconnect_guarded
+# checks it. A swap area claims its device like a mount does, so the claim covers it.
+sub _namespace_users($nqn) {
+ my @users;
+ for my $head (sort keys PVE::NVMeOF::namespaces($nqn)->%*) {
+ my $device = "/dev/$head";
+ my @devices = ($device, _partitions($device));
+ if (defined(my $mounted = PVE::Diskmanage::is_mounted($device))) {
+ push @users, "'$mounted' is mounted";
+ } elsif (defined(my $held = PVE::Diskmanage::has_holder($device))) {
+ push @users, "'$held' has a holder";
+ } elsif (my ($claimed) = grep { PVE::NVMeOF::is_claimed($_) } @devices) {
+ push @users, "'$claimed' is claimed, for example by a swap area";
+ } else {
+ # retry briefly to ignore transient openers like LVM status scans
+ my $opener;
+ for my $try (1 .. 4) {
+ _sleep(0.3) if $try > 1;
+ $opener = PVE::Diskmanage::device_opener(@devices);
+ last if !defined($opener);
+ }
+ push @users, "process $opener has namespace '$head' open" if defined($opener);
+ }
+ }
+ return \@users;
+}
+
+my sub portal_reachable($portal) {
+ return PVE::Network::tcp_ping($portal->{address}, $portal->{port}, 2) // 0;
+}
+
+# with $any_iface, a live controller on any interface counts, as such a path carries I/O
+sub _live_portal_count($states, $portals, $any_iface = 0) {
+ my $live = 0;
+ for my $portal ($portals->@*) {
+ my $id = "$portal->{address}:$portal->{port}";
+ $live++ if grep {
+ $_->{state} eq 'live'
+ && ($any_iface || ($_->{host_iface} // '') eq $portal->{host_iface})
+ } ($states->{$id} // [])->@*;
+ }
+ return $live;
+}
+
+# Gives up after 10 seconds plus the lock wait in all, counted from the start of the call. Returns
+# -1 if the portal got a controller on its interface meanwhile, as another activation can run at
+# the same time.
+sub _connect_portal($scfg, $portal, $hostnqn, $hostid, $key) {
+ my ($options, $names) = _fabrics_options($scfg, $portal, $hostnqn, $hostid, $key);
+ my $id = "$portal->{address}:$portal->{port}";
+ return run_locked(
+ 10,
+ 'NVMe/TCP connect',
+ sub {
+ my $states = controller_states($scfg->{subsysnqn});
+ return -1
+ if grep {
+ ($_->{host_iface} // '') eq $portal->{host_iface} && $_->{state} ne 'dead'
+ } ($states->{$id} // [])->@*;
+ return _fabrics_connect($options, $names);
+ },
+ );
+}
+
+my sub set_iopolicy($nqn, $policy) {
+ PVE::File::dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ $RE_NVME_SUBSYSTEM,
+ sub($entry) {
+ my $base = "/sys/class/nvme-subsystem/$entry";
+ my $subsys = file_read_firstline("$base/subsysnqn");
+ return if !defined($subsys) || $subsys ne $nqn;
+ my $error = write_attribute("$base/iopolicy", "$policy\n");
+ die "unable to set NVMe multipath policy: $error\n" if defined($error);
+ },
+ );
+}
+
+# Connected controllers keep the values of their connect unless this writes them. sysfs shows "off"
+# for -1 and the loss timeout rounded up to a multiple of the reconnect delay.
+my sub set_tunables($scfg) {
+ my $delay = $scfg->{'nvme-reconnect-delay'} // 2;
+ my $loss = $scfg->{'nvme-ctrl-loss-tmo'} // 600;
+ my $fast = $scfg->{'nvme-fast-io-fail-tmo'};
+ my $shown_loss = $loss < 0 ? 'off' : int(($loss + $delay - 1) / $delay) * $delay;
+ my $shown_fast = defined($fast) && $fast >= 0 ? $fast : 'off';
+
+ for my $controller (nvme_controllers($scfg->{subsysnqn})->@*) {
+ my $base = "/sys/class/nvme/$controller->{name}";
+ my $current_delay = file_read_firstline("$base/reconnect_delay") // next;
+ my $write = sub($attr, $value) {
+ my $error = write_attribute("$base/$attr", "$value\n") // return;
+ log_warn("cannot set $attr of NVMe controller '$controller->{name}': $error");
+ };
+ my $delay_changed = $current_delay ne "$delay";
+ $write->('reconnect_delay', $delay) if $delay_changed;
+ $write->('ctrl_loss_tmo', $loss < 0 ? -1 : $loss)
+ if $delay_changed
+ || (file_read_firstline("$base/ctrl_loss_tmo") // '') ne "$shown_loss";
+ $write->('fast_io_fail_tmo', $shown_fast eq 'off' ? -1 : $fast)
+ if (file_read_firstline("$base/fast_io_fail_tmo") // '') ne "$shown_fast";
+ }
+}
+
+sub _restrict_attr($path) {
+ my @stat = stat($path);
+ if (!@stat) {
+ log_warn("cannot stat NVMe controller attribute '$path': $!") if $! != ENOENT;
+ return;
+ }
+ return if !($stat[2] & 077);
+ chmod(0600, $path) or log_warn("cannot restrict permissions of '$path': $!");
+}
+
+my sub restrict_secret_attrs($nqn) {
+ for my $controller (nvme_controllers($nqn)->@*) {
+ _restrict_attr("/sys/class/nvme/$controller->{name}/$_")
+ for qw(dhchap_secret dhchap_ctrl_secret);
+ }
+}
+
+my sub rescan_namespaces($nqn) {
+ for my $controller (nvme_controllers($nqn)->@*) {
+ next if $controller->{state} ne 'live';
+ my $path = "/sys/class/nvme/$controller->{name}/rescan_controller";
+ my $error = write_attribute($path, "1\n", 1) // next;
+ log_warn("cannot rescan NVMe controller '$controller->{name}': $error");
+ }
+}
+
+# the activation reconnects or keeps the path either way, so a failure only warns
+my sub disconnect_controller($nqn, $controller) {
+ my $name = $controller->{name};
+ eval {
+ run_locked(
+ 5,
+ "deleting NVMe controller '$name'",
+ sub { return delete_listed($nqn, [$controller]) },
+ );
+ };
+ if (my $error = $@) {
+ rethrow_task_interrupt($error);
+ log_warn($error);
+ }
+}
+
+my sub wait_for_live_path($nqn, $portal) {
+ for (my $attempt = 0; $attempt < 40; $attempt++) {
+ return 1 if _live_portal_count(controller_states($nqn), [$portal]);
+ _sleep(0.25);
+ }
+ return 0;
+}
+
+# A path connected on another interface moves make-before-break: its old controller is only
+# disconnected once the new one is live, so a changed mapping never takes away a path with I/O.
+my sub connect_portals($scfg, $portals, $hostnqn, $hostid, $key) {
+ my $nqn = $scfg->{subsysnqn};
+ for my $portal ($portals->@*) {
+ my $id = "$portal->{address}:$portal->{port}";
+ my $iface = $portal->{host_iface};
+ my @controllers = (controller_states($nqn)->{$id} // [])->@*;
+ my ($configured) = grep { ($_->{host_iface} // '') eq $iface } @controllers;
+ my @moved = grep { ($_->{host_iface} // '') ne $iface } @controllers;
+
+ if (!$configured || $configured->{state} eq 'dead') {
+ disconnect_controller($nqn, $configured) if $configured;
+ if (!portal_reachable($portal)) {
+ log_warn("NVMe/TCP portal '$id' is unreachable");
+ next;
+ }
+ eval { _connect_portal($scfg, $portal, $hostnqn, $hostid, $key) };
+ my $connect_error = $@;
+ # A failed or timed-out connect can still have created a controller.
+ eval { restrict_secret_attrs($nqn); 1 };
+ if (my $error = $@) {
+ rethrow_task_interrupt($error);
+ log_warn("cannot restrict NVMe controller attributes for '$nqn'");
+ }
+ rethrow_task_interrupt($connect_error) if $connect_error;
+ if ($connect_error) {
+ log_warn("$id: $connect_error");
+ next;
+ }
+ }
+ next if !@moved;
+ if (!wait_for_live_path($nqn, $portal)) {
+ log_warn("NVMe/TCP portal '$id' is not live on '$iface' yet; keeping its path on"
+ . " another interface");
+ next;
+ }
+ disconnect_controller($nqn, $_) for @moved;
+ }
+}
+
+sub activate_storage($class, $storeid, $scfg, $cache = undef) {
+ $cache //= {};
+ my $nqn = $scfg->{subsysnqn};
+ # first, whatever the rest of the activation does, also for controllers connected by hand
+ restrict_secret_attrs($nqn);
+
+ # as PVE::NVMeOF::assert_support, which also wants the nvme binary that this plugin never runs
+ run_command(['modprobe', 'nvme-tcp'], timeout => 10) if !_nvme_tcp_loaded();
+ my $multipath = file_read_firstline('/sys/module/nvme_core/parameters/multipath') // '';
+ die "native NVMe multipath is disabled in the running kernel\n" if $multipath ne 'Y';
+
+ my $portals = _configured_portals($scfg);
+ verify_nvme_nqn($nqn);
+ _validate_local_ifaces($portals);
+ _assert_unique_target($storeid, $scfg);
+ my $host = PVE::NVMeOF::host_identity();
+ my $hostnqn = $host->{nqn};
+ my $hostnqns = parse_nvme_host_nqns($scfg->{'nvme-host-nqns'});
+ die "local NVMe host NQN '$hostnqn' is missing from nvme-host-nqns\n"
+ if !grep { $_ eq $hostnqn } $hostnqns->@*;
+ my $policy = $scfg->{'nvme-iopolicy'} // 'round-robin';
+ my $force_reconcile = delete($cache->{'zfsnvme-force-reconcile'}->{$storeid}) // 0;
+ my $states = controller_states($nqn);
+ my $healthy = _live_portal_count($states, $portals);
+ my $usable = _live_portal_count($states, $portals, 1);
+ my $last = $slow_path_last{$storeid};
+ my $recent = defined($last) && _now() - $last < $slow_path_backoff;
+
+ # This runs in the periodic status loop. Once every configured path is live, lifecycle
+ # operations keep the target converged, so no remote call is needed. A degraded storage retries
+ # the target at most once a minute. In between, one with a live path is usable and one
+ # without fails at once. Missing namespaces force the slow path.
+ if (!$force_reconcile && ($healthy == scalar($portals->@*) || $recent)) {
+ die "no live NVMe/TCP path for storage '$storeid'\n" if !$usable;
+ die "missing NVMe DH-HMAC-CHAP key\n"
+ if (file_read_firstline(secret_path($storeid)) // '') eq '';
+ set_iopolicy($nqn, $policy);
+ set_tunables($scfg);
+ return 1;
+ }
+
+ $slow_path_last{$storeid} = _now();
+ my $hostid = $host->{id};
+ my $key = get_secret($storeid);
+ for my $name (qw(keep-alive-tmo reconnect-delay ctrl-loss-tmo fast-io-fail-tmo nr-io-queues)) {
+ my $value = $scfg->{"nvme-$name"};
+ die "invalid NVMe connection parameter '$name'\n"
+ if defined($value) && $value !~ $RE_CONFIG_INT;
+ }
+ _nvmet_activate_target($storeid, $scfg, $portals, $hostnqns, $key);
+ connect_portals($scfg, $portals, $hostnqn, $hostid, $key);
+
+ # after a restart controllers can sit in their kernel reconnect delay, so wait, do not duplicate
+ for (my $attempt = 0; $attempt < 60; $attempt++) {
+ $states = controller_states($nqn);
+ last if _live_portal_count($states, $portals, 1);
+ _sleep(0.25);
+ }
+ die "no live NVMe/TCP path for storage '$storeid'\n"
+ if !_live_portal_count($states, $portals, 1);
+ $healthy = _live_portal_count($states, $portals);
+ log_warn("storage '$storeid' is degraded: $healthy/" . scalar($portals->@*) . " paths live")
+ if $healthy < scalar($portals->@*);
+
+ set_iopolicy($nqn, $policy);
+ set_tunables($scfg);
+ return 1;
+}
+
+sub deactivate_storage($class, $storeid, $scfg, $cache = undef) {
+ my $nqn = $scfg->{subsysnqn};
+ my $users = _namespace_users($nqn);
+ die "refusing to disconnect NVMe storage '$storeid': " . join(', ', $users->@*) . "\n"
+ if $users->@*;
+
+ return 1 if !nvme_controllers($nqn)->@*;
+ # One child deletes the controllers that it finds once it has the lock. It gives up after 15
+ # seconds plus the lock wait in all, counted from the start of the call. Then the remaining
+ # controllers stay and the deactivation fails.
+ run_locked(
+ 15,
+ "disconnecting NVMe subsystem '$nqn'",
+ sub { return _delete_controllers(nvme_controllers($nqn)) },
+ );
+ return 1;
+}
+
+# The core runs this inside the storage.cfg lock of the cluster, so it only touches local state.
+# The subsystem stays on the target and the controllers of the nodes stay connected.
+sub on_delete_hook($class, $storeid, $scfg) {
+ # A storage that is added again under this ID is a new one. Adding a storage removes it again
+ # when its activation fails, and a long running worker would keep the backoff of that failure.
+ delete $slow_path_last{$storeid};
+ delete_secret($storeid);
+ return;
+}
+
+sub path($class, $scfg, $volname, $storeid, $snapname = undef) {
+ die "direct access to snapshots not implemented\n" if defined($snapname);
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my $uuid = _nvmet_volume_uuid($scfg, $name);
+ my $path = "/dev/disk/by-id/nvme-uuid.$uuid";
+ return ($path, $vmid, $vtype);
+}
+
+sub qemu_blockdev_options(
+ $class, $scfg, $storeid, $volname,
+ $machine_version = undef,
+ $options = undef,
+) {
+ die "direct access to snapshots not implemented\n" if $options->{'snapshot-name'};
+ my ($path) = $class->path($scfg, $volname, $storeid);
+ return { driver => 'host_device', filename => $path };
+}
+
+# a UUID claimed by another subsystem must never reach a guest
+sub _nvmet_local_namespace_ok($path, $nqn, $nsid, $uuid) {
+ my $link = _link_target($path) // return 0;
+ my $device = (split m{/}, $link)[-1];
+ return 0 if !defined($device) || $device !~ $RE_NVME_NAMESPACE;
+ my $sys = "/sys/block/$+{device}";
+ return 0 if lc(file_read_firstline("$sys/uuid") // '') ne lc($uuid);
+ return 0 if (file_read_firstline("$sys/nsid") // '') ne "$nsid";
+ return 0 if (file_read_firstline("$sys/device/subsysnqn") // '') ne $nqn;
+ return 1;
+}
+
+sub activate_volume(
+ $class, $storeid, $scfg, $volname,
+ $snapname = undef,
+ $cache = undef,
+ $hints = undef,
+) {
+ die "unable to activate snapshot from remote zfs storage\n" if $snapname;
+ my (undef, $name) = $class->parse_volname($volname);
+ my $nqn = nvmet_nqn($scfg);
+ my $dataset = nvmet_dataset($scfg, $name);
+
+ my ($inv, $cfs) = nvmet_read($scfg);
+ my ($nsid, $uuid) = _nvmet_owned_identity($inv, $nqn, $dataset);
+ my $state = _nvmet_export_state($cfs, $nqn, $nsid, $uuid, "/dev/zvol/$dataset");
+ my $path = "/dev/disk/by-id/nvme-uuid.$uuid";
+ my $ok = sub {
+ return _block_device($path) && _nvmet_local_namespace_ok($path, $nqn, $nsid, $uuid);
+ };
+ return 1 if $state eq 'present' && $ok->();
+
+ $cache //= {};
+ $cache->{'zfsnvme-force-reconcile'}->{$storeid} = 1;
+ $class->activate_storage($storeid, $scfg, $cache);
+ for (my $attempt = 0; $attempt < 40 && !_block_device($path); $attempt++) {
+ # a host can miss the change notice, and rescanning is harmless
+ rescan_namespaces($nqn) if $attempt % 8 == 0;
+ _sleep(0.25);
+ }
+ die "NVMe namespace for '$volname' did not appear\n" if !_block_device($path);
+ die "NVMe namespace for '$volname' has an unexpected identity\n" if !$ok->();
+ return 1;
+}
+
+sub deactivate_volume(
+ $class, $storeid, $scfg, $volname, $snapname = undef, $cache = undef,
+) {
+ die "unable to deactivate snapshot from remote zfs storage\n" if $snapname;
+ return 1;
+}
+
1;
--
2.54.0.windows.1
^ permalink raw reply related [relevance 11%]
* [PATCH storage v5 05/13] api: san luns: count zfsnvme storages as owners of their subsystem
2026-11-26 15:09 8% [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-11-26 15:09 11% ` [PATCH storage v5 04/13] zfsnvme: connect the nodes and register the plugin Joaquin Varela
@ 2026-11-26 15:09 25% ` Joaquin Varela
2026-11-26 15:09 6% ` [PATCH storage v5 07/13] test: zfsnvme: add configuration and volume tests Joaquin Varela
` (2 subsequent siblings)
4 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-11-26 15:09 UTC (permalink / raw)
To: pve-devel
A zfsnvme storage owns the subsystem it exports, like an nvmeof storage
does. Count it as the owner in the SAN LUN list, in the unreferenced
check behind wiping and disconnecting, in the controller list and in the
check for one storage per subsystem. Otherwise its namespaces show up as
owned by nobody and a second storage could take its subsystem.
Add PVE::NVMeOF::storage_subsystem() for the match and let the
used-by-storage descriptions name both types. Expected paths stay with
nvmeof, as they come from the portals option and zfsnvme lists its
portals in nvme-portals with its own syntax. The cluster multipath
status keeps listing only nvmeof namespaces.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
src/PVE/API2/NVMeOF.pm | 7 ++++---
src/PVE/API2/SAN/Cluster.pm | 6 +++---
src/PVE/API2/SAN/Node.pm | 5 +++--
src/PVE/NVMeOF.pm | 6 ++++++
src/PVE/Storage/NVMeOFPlugin.pm | 4 ++--
src/PVE/Storage/SAN.pm | 16 ++++++++--------
src/test/run_nvmeof_api_tests.pl | 16 ++++++++++++++--
src/test/run_nvmeof_tests.pl | 12 ++++++++++++
src/test/run_san_lun_scan_tests.pl | 11 +++++++++++
src/test/run_san_nvme_tests.pl | 4 ++++
10 files changed, 67 insertions(+), 20 deletions(-)
diff --git a/src/PVE/API2/NVMeOF.pm b/src/PVE/API2/NVMeOF.pm
index 9205d084..eecb242a 100644
--- a/src/PVE/API2/NVMeOF.pm
+++ b/src/PVE/API2/NVMeOF.pm
@@ -119,7 +119,8 @@ __PACKAGE__->register_method({
'used-by-storage' => {
type => 'string',
optional => 1,
- description => 'An NVMe over Fabrics storage using the subsystem.',
+ description =>
+ 'An NVMe over Fabrics or ZFS over NVMe/TCP storage using the subsystem.',
},
},
},
@@ -128,8 +129,8 @@ __PACKAGE__->register_method({
my $cfg = PVE::Storage::config();
my %owners;
for my $sid (sort keys $cfg->{ids}->%*) {
- my $scfg = $cfg->{ids}->{$sid};
- $owners{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
+ my $nqn = PVE::NVMeOF::storage_subsystem($cfg->{ids}->{$sid}) // next;
+ $owners{$nqn} //= $sid;
}
my $controllers = PVE::NVMeOF::controllers();
my $counts = PVE::NVMeOF::namespace_counts();
diff --git a/src/PVE/API2/SAN/Cluster.pm b/src/PVE/API2/SAN/Cluster.pm
index 7198846c..e0d3e145 100644
--- a/src/PVE/API2/SAN/Cluster.pm
+++ b/src/PVE/API2/SAN/Cluster.pm
@@ -185,9 +185,9 @@ __PACKAGE__->register_method({
optional => 1,
description =>
'The storage that uses the LUN: as its base volume or through'
- . ' the volume group on it, or as an iSCSI or NVMe over Fabrics'
- . ' storage that serves the LUNs of its target or subsystem as'
- . ' images.',
+ . ' the volume group on it, or as an iSCSI, NVMe over Fabrics or'
+ . ' ZFS over NVMe/TCP storage that serves the LUNs of its target'
+ . ' or subsystem as images.',
},
'multipath-storage' => {
type => 'string',
diff --git a/src/PVE/API2/SAN/Node.pm b/src/PVE/API2/SAN/Node.pm
index 260c95f7..ddaf0e9b 100644
--- a/src/PVE/API2/SAN/Node.pm
+++ b/src/PVE/API2/SAN/Node.pm
@@ -205,8 +205,9 @@ __PACKAGE__->register_method({
},
'used-by-storage' => {
description => "The storage that uses the LUN: as its base volume or"
- . " through the volume group on it, or as an iSCSI or NVMe over Fabrics"
- . " storage that serves the LUNs of its target or subsystem as images.",
+ . " through the volume group on it, or as an iSCSI, NVMe over Fabrics or"
+ . " ZFS over NVMe/TCP storage that serves the LUNs of its target or"
+ . " subsystem as images.",
type => 'string',
optional => 1,
},
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index a2091f55..5c450468 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -90,6 +90,12 @@ sub storage_paths($scfg) {
PVE::Tools::split_list($scfg->{portals})];
}
+# The NQN of the subsystem that a storage owns, or undef. NVMe over Fabrics and ZFS over NVMe/TCP
+# storages each own one. Only the former lists its portals in 'portals', see storage_paths.
+sub storage_subsystem($scfg) {
+ return $scfg->{type} =~ /\A(?:nvmeof|zfsnvme)\z/ ? $scfg->{subsysnqn} : undef;
+}
+
sub host_identity() {
my ($nqn) = (file_read_firstline($HOSTNQN_FILE) // '') =~ /\A($NQN_PATTERN)\z/;
my ($id) = (file_read_firstline($HOSTID_FILE) // '') =~
diff --git a/src/PVE/Storage/NVMeOFPlugin.pm b/src/PVE/Storage/NVMeOFPlugin.pm
index 05acf08b..1b8ff72d 100644
--- a/src/PVE/Storage/NVMeOFPlugin.pm
+++ b/src/PVE/Storage/NVMeOFPlugin.pm
@@ -91,9 +91,9 @@ sub on_add_hook($class, $storeid, $scfg, %param) {
# the LUN and controller lists and the node status attribute a subsystem to its one storage
my $ids = PVE::Storage::config()->{ids};
for my $sid (sort keys %$ids) {
- next if $sid eq $storeid || $ids->{$sid}->{type} ne 'nvmeof';
+ next if $sid eq $storeid;
die "storage '$sid' already uses this subsystem\n"
- if $ids->{$sid}->{subsysnqn} eq $scfg->{subsysnqn};
+ if (PVE::NVMeOF::storage_subsystem($ids->{$sid}) // '') eq $scfg->{subsysnqn};
}
PVE::NVMeOF::clear_connect_failures($scfg);
return;
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index bf363301..c9ee670b 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -60,11 +60,12 @@ sub scan_luns($cfg) {
if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
my $base = PVE::Multipath::parse_base_volume($scfg->{base});
$base_owner{ $base->{wwid} } //= $sid if $base;
- next if $scfg->{type} ne 'nvmeof';
- $nvme_owner{ $scfg->{subsysnqn} } //= $sid;
- # only a storage in use on this node expects its paths here
- $nvme_paths{ $scfg->{subsysnqn} } //= $sid
- if PVE::Storage::storage_check_enabled($cfg, $sid, undef, 1);
+ my $nqn = PVE::NVMeOF::storage_subsystem($scfg) // next;
+ $nvme_owner{$nqn} //= $sid;
+ # only a storage in use on this node expects its paths here, and only one with 'portals'
+ $nvme_paths{$nqn} //= $sid
+ if $scfg->{type} eq 'nvmeof'
+ && PVE::Storage::storage_check_enabled($cfg, $sid, undef, 1);
}
my %rows;
@@ -343,9 +344,8 @@ sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this target\n";
}
if (
- $type eq 'nvmeof'
- && defined($nqn)
- && $scfg->{subsysnqn} eq $nqn
+ defined($nqn)
+ && (PVE::NVMeOF::storage_subsystem($scfg) // '') eq $nqn
&& PVE::Storage::san_storage_serves_images($scfg)
) {
die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this subsystem\n";
diff --git a/src/test/run_nvmeof_api_tests.pl b/src/test/run_nvmeof_api_tests.pl
index 888c8dba..8bffb463 100755
--- a/src/test/run_nvmeof_api_tests.pl
+++ b/src/test/run_nvmeof_api_tests.pl
@@ -212,8 +212,12 @@ subtest 'node API contract' => sub {
my $nvme = Test::MockModule->new('PVE::NVMeOF');
my $storage = Test::MockModule->new('PVE::Storage');
$storage->mock(
- config =>
- sub { { ids => { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } } } },
+ config => sub { {
+ ids => {
+ fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' },
+ zfs => { type => 'zfsnvme', subsysnqn => 'nqn.zfs' },
+ },
+ } },
);
$nvme->mock(is_supported => sub { 0 });
$nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'uuid' } });
@@ -237,6 +241,13 @@ subtest 'node API contract' => sub {
trsvcid => 4420,
state => 'connecting',
},
+ nvme2 => {
+ subsystem => 'nqn.zfs',
+ transport => 'tcp',
+ traddr => '192.0.2.2',
+ trsvcid => 4420,
+ state => 'live',
+ },
} },
);
$nvme->mock(
@@ -246,6 +257,7 @@ subtest 'node API contract' => sub {
my $rows = $api->controllers({ node => 'n1' });
is($rows->[0]->{namespaces}, 2, 'namespaces counted for the subsystem of the controller');
is($rows->[0]->{'used-by-storage'}, 'fabric', 'controller attributed');
+ is($rows->[1]->{'used-by-storage'}, 'zfs', 'also the controller of a zfsnvme storage');
is($rows->[0]->{state}, 'connecting', 'kernel state remains visible');
for my $pair (['status', $status], ['controllers', $rows]) {
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index 02fccb46..1b94c032 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -109,6 +109,18 @@ subtest 'configuration, portals and volumes' => sub {
ok(!PVE::NVMeOF::in_cooldown($cfg, $first), 'adding it tries all portals again');
eval { $class->on_add_hook('second', {%$cfg}) };
like($@, qr/storage 'fabric' already uses this subsystem/, 'one storage per subsystem');
+ {
+ local $ids->{zfs} = { type => 'zfsnvme', subsysnqn => 'nqn.zfs' };
+ eval { $class->on_add_hook('second', { %$cfg, subsysnqn => 'nqn.zfs' }) };
+ like($@, qr/storage 'zfs' already uses this subsystem/,
+ 'also one of a zfsnvme storage');
+ is(PVE::NVMeOF::storage_subsystem($ids->{zfs}), 'nqn.zfs', 'it owns its subsystem');
+ is(
+ PVE::NVMeOF::storage_subsystem({ type => 'lvm', subsysnqn => 'x' }),
+ undef,
+ 'others not',
+ );
+ }
$ids->{vg} = { type => 'lvm', base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'vg' };
my $images = { content => { images => 1 } };
eval { $class->on_update_hook_full('fabric', $cfg, $images, [], {}) };
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
index 7fd9563b..82a79353 100755
--- a/src/test/run_san_lun_scan_tests.pl
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -382,6 +382,17 @@ $config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } }
my $elsewhere = PVE::Storage::SAN::scan_luns($cfg);
is($elsewhere->[0]->{'paths-expected'}, undef, 'nor a storage of other nodes');
}
+{
+ local $cfg->{ids}->{fabric} = {
+ type => 'zfsnvme',
+ subsysnqn => 'nqn.test',
+ 'nvme-portals' => '192.0.2.1,192.0.2.2',
+ content => { images => 1 },
+ };
+ my $zfs = PVE::Storage::SAN::scan_luns($cfg);
+ is($zfs->[0]->{'used-by-storage'}, 'fabric', 'a zfsnvme storage uses its namespaces too');
+ is($zfs->[0]->{'paths-expected'}, undef, 'but its portals are not in the key of nvmeof');
+}
for my $base (qw(fabric nvme-fabric)) {
$cfg->{ids}->{data}->{base} = "$base:nvme-eui.0123456789abcdef";
$rows = PVE::Storage::SAN::scan_luns($cfg);
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 86690318..bb35b30c 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -102,6 +102,10 @@ like($@, qr/serves images from this subsystem/, 'also when restricted to VM disk
$cfg->{ids}->{fabric}->{content} = { none => 1 };
eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
is($@, '', 'connection-only storage permits namespace initialization');
+$cfg->{ids} =
+ { zfs => { type => 'zfsnvme', subsysnqn => 'nqn.test', content => { images => 1 } } };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like($@, qr/storage 'zfs' serves images from this subsystem/, 'a zfsnvme storage refuses too');
for my $nqn (undef, '') {
$disk->mock(read_subsysnqn => sub { $nqn });
--
2.54.0.windows.1
^ permalink raw reply related [relevance 25%]
* [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin
@ 2026-11-26 15:09 8% Joaquin Varela
2026-11-26 15:09 11% ` [PATCH storage v5 04/13] zfsnvme: connect the nodes and register the plugin Joaquin Varela
` (4 more replies)
0 siblings, 5 replies; 143+ results
From: Joaquin Varela @ 2026-11-26 15:09 UTC (permalink / raw)
To: pve-devel
Hi,
this is v5 of the zfsnvme backend, rebased on current master for Proxmox VE
9.3. v4 was never sent, so the changes below are against v3.
The new nvmeof storage connects to namespaces that an array already serves.
zfsnvme creates and manages the zvols on a Linux ZFS host and exports them
with the kernel nvmet target, with DH-HMAC-CHAP, snapshots and clones. So the
two complement each other. zfsnvme now uses the nvmeof helpers where they fit:
the host lock, host_identity and parse_portal. It keeps its own connect, which
writes /dev/nvme-fabrics, so the DH-HMAC-CHAP secret never shows up in argv.
Changes since v3:
- storage API 17: isolated properties, a sensitive dhchap-key, titles,
advanced and hidden properties, vm-vol and vm-state content
- volume names use the same character set as ZFS over iSCSI
- the delete hook only removes the key file, so it does no remote work
while the storage.cfg lock is held. The subsystem stays on the target
until the admin removes it, as the docs describe.
- the plugin is taint safe for pvedaemon and pveproxy, with a perl -T test
- the plugin loads nvme-tcp on the nodes
- deactivation checks the users of a namespace with the Diskmanage helpers
and only deletes controllers it still owns, checked under the host lock
- the old 3/4, the fencing of abandoned target commands, is dropped. It was
the only shell control flow on the target.
- patch 5 lets the SAN view, the wipe check and the controller list count a
zfsnvme storage as the owner of its subsystem. The cluster multipath
status still lists only nvmeof namespaces.
- patch 6 checks the cluster version before the first zfsnvme storage, like
for nvmeof. The version there, 9.3.2, is a guess. Please adapt it to the
first pve-manager that will depend on this.
- smaller patches, so none hits the size limit of the list, and fewer
comments
Patch 5 would also fit the hook that Dirk Nehring proposed for SAN LUNs of
other plugins [0]. zfsnvme could then answer that hook instead of the type
check.
Every patch builds and passes make test on a PVE 9.3 node. On a lab cluster
with two PVE 9.3 nodes, a Linux nvmet target and two paths, the series passed
adding the storage over the API (also a failed add and its retry), volume
allocation, live migration both ways, snapshot and rollback (also with RAM
state), template and linked clone, resize, a target reboot and the loss of one
path with a running guest, and an nvmeof storage on the same target. The SAN
guards held as well: a node where the guest does not run refused to wipe its
namespace and to disconnect its last path.
The docs and manager patches follow in this thread.
v3: https://lore.proxmox.com/pve-devel/20261005002609.571-1-joaquinvarela@neatech.ar/
[0]: https://lore.proxmox.com/pve-devel/20261124200340.380381-1-dnehring@marcant.net/
Joaquin Varela (13):
zfsnvme: add target state parsing and planning
zfsnvme: add the target transactions
zfsnvme: add storage configuration and volume methods
zfsnvme: connect the nodes and register the plugin
api: san luns: count zfsnvme storages as owners of their subsystem
api: config: check the cluster version before the first zfsnvme
storage
test: zfsnvme: add configuration and volume tests
test: zfsnvme: add node side tests
test: zfsnvme: add an in-memory nvmet target
test: zfsnvme: test the target parsers and planners
test: zfsnvme: test the target flows
test: zfsnvme: add a fault sweep, renderer and taint tests
zfsnvme: wait up to 30 seconds for the shared storage lock
src/PVE/API2/NVMeOF.pm | 7 +-
src/PVE/API2/SAN/Cluster.pm | 6 +-
src/PVE/API2/SAN/Node.pm | 5 +-
src/PVE/API2/Storage/Config.pm | 13 +-
src/PVE/CLI/pvesm.pm | 21 +-
src/PVE/NVMeOF.pm | 6 +
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 4 +-
src/PVE/Storage/Plugin.pm | 12 +-
src/PVE/Storage/SAN.pm | 16 +-
src/PVE/Storage/ZFSNVMePlugin.pm | 2947 +++++++++++
src/test/Makefile | 4 +
src/test/run_nvmeof_api_tests.pl | 16 +-
src/test/run_nvmeof_tests.pl | 47 +
src/test/run_plugin_tests.pl | 2 +
src/test/run_san_lun_scan_tests.pl | 11 +
src/test/run_san_nvme_tests.pl | 4 +
src/test/run_zfsnvme_taint_tests.pl | 988 ++++
.../zfsnvme_fixtures/configfs_snapshot.txt | 38 +
src/test/zfsnvme_fixtures/zfs_inventory.txt | 15 +
src/test/zfsnvme_target_test.pm | 4514 +++++++++++++++++
src/test/zfsnvme_test.pm | 2881 +++++++++++
23 files changed, 11535 insertions(+), 25 deletions(-)
create mode 100644 src/PVE/Storage/ZFSNVMePlugin.pm
create mode 100755 src/test/run_zfsnvme_taint_tests.pl
create mode 100644 src/test/zfsnvme_fixtures/configfs_snapshot.txt
create mode 100644 src/test/zfsnvme_fixtures/zfs_inventory.txt
create mode 100644 src/test/zfsnvme_target_test.pm
create mode 100644 src/test/zfsnvme_test.pm
base-commit: 3ac027fd9fcd8fdfe6bb3acb1e4b58e8cd1cfde8
--
2.54.0.windows.1
^ permalink raw reply [relevance 8%]
* superseded: [PATCH v4 storage,docs,manager 00/25] NVMe over Fabrics storage
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (18 preceding siblings ...)
2026-11-23 1:48 13% ` [PATCH v4 manager 25/25] d/control: bump versioned dependencies for NVMe over Fabrics Thomas Lamprecht
@ 2026-11-23 13:35 6% ` Thomas Lamprecht
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:35 UTC (permalink / raw)
To: pve-devel
Superseded-by: https://lore.proxmox.com/pve-devel/20261123133412.3710030-1-t.lamprecht@proxmox.com
^ permalink raw reply [relevance 6%]
* [PATCH v5 storage 05/26] nvmeof: add a storage for NVMe over Fabrics subsystems
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-23 13:31 16% ` [PATCH v5 storage 03/26] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only Thomas Lamprecht
@ 2026-11-23 13:31 15% ` Thomas Lamprecht
2026-11-23 13:32 18% ` [PATCH v5 storage 08/26] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
` (15 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:31 UTC (permalink / raw)
To: pve-devel
NVMe/TCP namespaces need a manual nvme-cli setup on every node so far.
Add a storage type that connects one subsystem through each configured
portal and offers its namespaces as raw volumes. Native NVMe multipath
joins the paths and the kernel reconnects lost ones; a namespace that it
does not join, as on a target that does not declare that the subsystem
may have several controllers, is refused as volume. Only one storage may
use a subsystem, as the LUN list, the controller list and the node
status attribute a subsystem to one storage.
Activating the storage requires a live controller, also when every
portal already has one, so that adding a storage tells why it cannot be
used. So that an activation, like the one of a status pass, does not
wait long, it tries no further portal after 15 seconds once a controller
is live, or after 45 seconds without one, and leaves the rest to the
next activation. A portal whose connect failed is retried after a
minute, but not one that only waited for another fabrics operation, and
adding a storage forgets those failures. The package nvme-cli is only
recommended, as no other storage type needs it.
With direct use, the SAN checks before wiping a namespace or creating a
volume group on it count every namespace of the subsystem as in use by
the storage. They refuse a namespace whose subsystem they cannot read.
The plugin isolates its properties, so names like 'portals' belong to
this storage type alone, and a third-party plugin that declares one of
them is still loaded. As the first in-tree plugin that isolates, it
makes the storage API check the parameters for adding and updating a
storage of any type against the options of that type alone, apart from
the sensitive properties of plugins that do not isolate theirs.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
ApiChangeLog | 9 +-
debian/control | 1 +
src/PVE/Makefile | 1 +
src/PVE/NVMeOF.pm | 316 ++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 307 +++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 15 +
src/test/Makefile | 5 +
src/test/run_nvmeof_taint_tests.pl | 62 ++++
src/test/run_nvmeof_tests.pl | 577 +++++++++++++++++++++++++++++
src/test/run_san_nvme_tests.pl | 23 ++
13 files changed, 1316 insertions(+), 5 deletions(-)
create mode 100644 src/PVE/NVMeOF.pm
create mode 100644 src/PVE/Storage/NVMeOFPlugin.pm
create mode 100755 src/test/run_nvmeof_taint_tests.pl
create mode 100755 src/test/run_nvmeof_tests.pl
diff --git a/ApiChangeLog b/ApiChangeLog
index 40c3bea3..b7e7442a 100644
--- a/ApiChangeLog
+++ b/ApiChangeLog
@@ -101,10 +101,11 @@ Future changes should be documented in here.
declares a property of that name is then not loaded until it renames it, so prefer names that
are specific to the plugin, for example prefixed with its type.
- As soon as one such plugin is installed, the API checks the parameters for adding and updating a
- storage against the options of its type alone, for all storage types. Only the sensitive
- properties of a plugin that does not isolate its own are still accepted without being listed in
- its `options()`, by their own names: an alias that only another plugin declares for one is not.
+ Since the in-tree 'nvmeof' plugin isolates its properties, the API checks the parameters for
+ adding and updating a storage against the options of its type alone, for all storage types,
+ also for plugins of older API versions. Only the sensitive properties of a plugin that does not
+ isolate its own are still accepted without being listed in its `options()`, by their own names:
+ an alias that only another plugin declares for one is not.
Set 'sensitive-properties' in an isolating plugin, even if empty. Without it, the fallback list of
version 11 also applies to the plugin's own properties of these names.
diff --git a/debian/control b/debian/control
index fdcf8117..b5c2f529 100644
--- a/debian/control
+++ b/debian/control
@@ -55,6 +55,7 @@ Depends: bzip2,
${misc:Depends},
${perl:Depends},
Recommends: multipath-tools,
+ nvme-cli,
pve-esxi-import-tools (>= 0.6.0),
skopeo,
zfsutils-linux (>= 2.4.1-pve2),
diff --git a/src/PVE/Makefile b/src/PVE/Makefile
index 13fecbf8..238eefd4 100644
--- a/src/PVE/Makefile
+++ b/src/PVE/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Storage.pm ${DESTDIR}${PERLDIR}/PVE/Storage.pm
install -D -m 0644 Diskmanage.pm ${DESTDIR}${PERLDIR}/PVE/Diskmanage.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/NVMeOF.pm
install -D -m 0644 ISCSI/Topology.pm ${DESTDIR}${PERLDIR}/PVE/ISCSI/Topology.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/Multipath.pm
install -D -m 0644 Multipath/Config.pm ${DESTDIR}${PERLDIR}/PVE/Multipath/Config.pm
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
new file mode 100644
index 00000000..2be6d8e7
--- /dev/null
+++ b/src/PVE/NVMeOF.pm
@@ -0,0 +1,316 @@
+package PVE::NVMeOF;
+
+use v5.36;
+
+use Cwd qw(abs_path);
+use Digest::SHA qw(sha1_hex);
+use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
+use File::Basename qw(basename);
+use File::Path qw(make_path);
+use POSIX qw(ceil);
+use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
+use Time::HiRes ();
+
+use PVE::JSONSchema;
+use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
+
+use PVE::Diskmanage;
+
+our $NVME = '/usr/sbin/nvme';
+our $SYSFS = '/sys';
+our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
+our $HOSTID_FILE = '/etc/nvme/hostid';
+our $RUN_DIR = '/run/pve/nvmeof';
+our $LOCK_WAIT = 10;
+# no control characters, which could reach logs and the arguments of nvme-cli
+our $NQN_PATTERN = 'nqn\.[^\s\x00-\x1f\x7f,=]+';
+our $DISCOVERY_NQN = 'nqn.2014-08.org.nvmexpress.discovery';
+our $TIMED_OUT = "NVMe over Fabrics operation timed out - it may still be running\n";
+
+sub canonical_address($addr) {
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ return inet_ntop(AF_INET, $packed);
+ }
+ if (defined(my $packed = inet_pton(AF_INET6, $addr))) {
+ return inet_ntop(AF_INET, substr($packed, 12))
+ if substr($packed, 0, 12) eq ("\0" x 10) . "\xff\xff";
+ return inet_ntop(AF_INET6, $packed);
+ }
+ return lc($addr);
+}
+
+# Link-local IPv6 needs a node-specific interface and cannot identify a shared configured portal.
+sub parse_portal($portal) {
+ my ($addr, $port);
+ if ($portal =~ m/^\[([0-9a-fA-F:.]+)\](?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } elsif ($portal =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } else {
+ return undef;
+ }
+ return undef if defined($port) && ($port < 1 || $port > 65535);
+ $addr = canonical_address($addr);
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ my $multicast = (unpack('C', $packed) & 0xf0) == 0xe0;
+ return undef if $addr eq '0.0.0.0' || $addr eq '255.255.255.255' || $multicast;
+ } elsif (defined($packed = inet_pton(AF_INET6, $addr))) {
+ my $prefix = unpack('n', $packed);
+ return undef
+ if $addr eq '::' || ($prefix & 0xffc0) == 0xfe80 || ($prefix & 0xff00) == 0xff00;
+ } else {
+ return undef;
+ }
+ return { traddr => $addr, trsvcid => int($port // 4420) };
+}
+
+PVE::JSONSchema::register_format(
+ 'pve-storage-nvme-portal',
+ sub($portal, $noerr = undef) {
+ return $portal if parse_portal($portal);
+ return undef if $noerr;
+ die "value is not an IPv4 address or a bracketed IPv6 address with optional port\n";
+ },
+);
+
+sub format_path($path) {
+ # an IPv6 address, not the address of a Fibre Channel port, which has a colon too
+ my $ipv6 = $path->{traddr} =~ /:/ && $path->{traddr} =~ /^[0-9a-fA-F:.]+$/;
+ my $addr = $ipv6 ? "[$path->{traddr}]" : $path->{traddr};
+ return defined($path->{trsvcid}) ? "$addr:$path->{trsvcid}" : $addr;
+}
+
+sub storage_paths($scfg) {
+ return [map { parse_portal($_) // die "invalid portal '$_'\n" }
+ PVE::Tools::split_list($scfg->{portals})];
+}
+
+sub host_identity() {
+ my ($nqn) = (file_read_firstline($HOSTNQN_FILE) // '') =~ /\A($NQN_PATTERN)\z/;
+ my ($id) = (file_read_firstline($HOSTID_FILE) // '') =~
+ /\A([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\z/i;
+ if (!defined($nqn) || length($nqn) > 223) {
+ die "invalid or missing NVMe host NQN in '$HOSTNQN_FILE' - install nvme-cli and check the"
+ . " host identity\n";
+ }
+ die "invalid or missing NVMe host ID in '$HOSTID_FILE' - expected a nonzero UUID\n"
+ if !defined($id) || $id =~ /^[0-]+$/;
+ return { nqn => $nqn, id => lc($id) };
+}
+
+sub is_supported() { return -x $NVME ? 1 : 0 }
+
+sub assert_support() {
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command(['modprobe', 'nvme-tcp'], timeout => 10)
+ if !-e "$SYSFS/module/nvme_tcp";
+ my $multipath = file_read_firstline("$SYSFS/module/nvme_core/parameters/multipath") // '';
+ die "native NVMe multipath is disabled - enable nvme_core.multipath\n" if $multipath ne 'Y';
+}
+
+sub controllers() {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-fabrics/ctl";
+ dir_glob_foreach(
+ $dir,
+ 'nvme[0-9]+',
+ sub($name, @) {
+ my $address = file_read_firstline("$dir/$name/address") // return;
+ my %address = map { split(/=/, $_, 2) } grep { /=/ } split(/,/, $address);
+ return if !defined($address{traddr});
+ $res->{$name} = {
+ transport => file_read_firstline("$dir/$name/transport") // '',
+ subsystem => PVE::Diskmanage::read_subsysnqn("$dir/$name/subsysnqn") // '',
+ state => file_read_firstline("$dir/$name/state") // 'unknown',
+ traddr => canonical_address($address{traddr}),
+ trsvcid => $address{trsvcid},
+ };
+ },
+ );
+ return $res;
+}
+
+sub subsystem_controllers($subsystem) {
+ my $controllers = controllers();
+ return {
+ map { $_ => $controllers->{$_} } grep {
+ $controllers->{$_}->{subsystem} eq $subsystem
+ && $controllers->{$_}->{transport} eq 'tcp'
+ } keys %$controllers
+ };
+}
+
+# The NQN of a subsystem, untainted, or undef if it is invalid or the one of the discovery service.
+sub subsystem_nqn($nqn) {
+ my ($res) = ($nqn // '') =~ /\A($NQN_PATTERN)\z/;
+ return undef if !defined($res) || length($res) > 223 || $res eq $DISCOVERY_NQN;
+ return $res;
+}
+
+sub namespace_wwid($dev) {
+ return file_read_firstline("$SYSFS/block/$dev/wwid");
+}
+
+# Native NVMe multipath shows a namespace as a device of its subsystem. If the target does not
+# declare that the subsystem may have several controllers, a namespace is a device of each
+# controller instead, without the other paths.
+sub is_namespace_head($dev) {
+ my $parent = abs_path("$SYSFS/block/$dev/device") // return 0;
+ return basename($parent) =~ /^nvme-subsys[0-9]+$/ ? 1 : 0;
+}
+
+sub has_live_controller($controllers) {
+ return scalar(grep { $_->{state} eq 'live' } values %$controllers);
+}
+
+sub path_controller($controllers, $path) {
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ if ($ctrl->{traddr} eq $path->{traddr} && ($ctrl->{trsvcid} // '') eq $path->{trsvcid}) {
+ return $name;
+ }
+ }
+ return undef;
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-subsystem";
+ dir_glob_foreach(
+ $dir,
+ 'nvme-subsys[0-9]+',
+ sub($subsys, @) {
+ # one that cannot be read could be this subsystem, whose namespaces must not look gone
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn")
+ // die "cannot read the NQN of NVMe subsystem '$subsys'\n";
+ return if $nqn ne $subsystem;
+ dir_glob_foreach(
+ "$dir/$subsys",
+ 'nvme[0-9]+n[0-9]+',
+ sub($dev, @) {
+ # a failed read must not look like a namespace that is gone
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid")
+ // die "cannot read the WWID of namespace '$dev'\n";
+ my $size = file_read_firstline("$SYSFS/block/$dev/size")
+ // die "cannot read the size of namespace '$dev'\n";
+ $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
+ },
+ );
+ },
+ );
+ return $res;
+}
+
+# $limit sets the time the operation may take in all, including the wait for the lock.
+sub with_lock($code, $limit = undef) {
+ my $total = $LOCK_WAIT + 35;
+ # an alarm counts whole seconds and none at zero
+ $total = ceil($limit) if defined($limit);
+ $total = 1 if $total < 1;
+ my ($res, $timeout) = PVE::Tools::run_fork_with_timeout(
+ $total,
+ sub {
+ make_path($RUN_DIR);
+ open(my $lock, '>>', "$RUN_DIR/fabrics.lock") or die "cannot open NVMe lock - $!\n";
+ # A busy lock fails the operation, so wait a while for it, but give up before the time
+ # limit, which counts as a hanging operation.
+ my $wait = $LOCK_WAIT < $total ? $LOCK_WAIT : $total - 1;
+ my $deadline = Time::HiRes::time() + $wait;
+ while (!flock($lock, LOCK_EX | LOCK_NB)) {
+ die "NVMe over Fabrics is busy - another operation is still running\n"
+ if Time::HiRes::time() >= $deadline;
+ Time::HiRes::usleep(100_000);
+ }
+ # Commands inherit the lock, so that it stays held until they exit, even if the caller
+ # timed out while one was stuck in the kernel.
+ my $flags = fcntl($lock, F_GETFD, 0) // die "cannot read NVMe lock flags - $!\n";
+ fcntl($lock, F_SETFD, $flags & ~FD_CLOEXEC)
+ or die "cannot inherit NVMe lock - $!\n";
+ return $code->();
+ },
+ );
+ die $TIMED_OUT if $timeout;
+ return $res;
+}
+
+my sub retry_file($scfg, $path) {
+ my ($key) =
+ sha1_hex(join(
+ "\0", $scfg->{subsysnqn}, format_path($path), $scfg->{'fast-io-fail-tmo'} // 120)) =~
+ /\A([0-9a-f]{40})\z/;
+ return "$RUN_DIR/retry/$key";
+}
+
+sub in_cooldown($scfg, $path) {
+ my $mtime = (stat(retry_file($scfg, $path)))[9] // return 0;
+ my $age = time() - $mtime;
+ return $age > -60 && $age < 60;
+}
+
+sub note_connect_failure($scfg, $path) {
+ make_path("$RUN_DIR/retry");
+ file_set_contents(retry_file($scfg, $path), '');
+}
+
+sub clear_connect_failures($scfg) {
+ unlink(retry_file($scfg, $_)) for storage_paths($scfg)->@*;
+}
+
+sub connect_path($scfg, $path, $limit = undef) {
+ my $nqn = subsystem_nqn($scfg->{subsysnqn}) // die "invalid subsystem NQN\n";
+ my ($fail) = ($scfg->{'fast-io-fail-tmo'} // 120) =~ /\A(-?[0-9]+)\z/;
+ die "invalid fast I/O fail timeout\n" if !defined($fail) || $fail < -1;
+ # A connect that hangs until the time limit failed too, but the process that would note it is
+ # gone by then.
+ my $res = eval {
+ with_lock(
+ sub {
+ return if path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ assert_support();
+ my $host = host_identity();
+ # only a failed attempt is a failure of the portal, not a busy lock
+ eval {
+ run_command(
+ [
+ $NVME,
+ 'connect',
+ '--transport=tcp',
+ '--nqn',
+ $nqn,
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $path->{trsvcid},
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--ctrl-loss-tmo=-1',
+ '--fast_io_fail_tmo',
+ $fail,
+ ],
+ timeout => 30,
+ errmsg => 'nvme connect',
+ );
+ # nvme-cli can exit successfully without having connected
+ die "no controller appeared\n"
+ if !path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ };
+ if (my $err = $@) {
+ note_connect_failure($scfg, $path);
+ die $err;
+ }
+ unlink(retry_file($scfg, $path));
+ return;
+ },
+ $limit,
+ );
+ };
+ if (my $err = $@) {
+ note_connect_failure($scfg, $path) if $err eq $TIMED_OUT;
+ die $err;
+ }
+ return $res;
+}
+
+1;
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index c640cd8e..c77a6755 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -33,6 +33,7 @@ use PVE::Storage::LvmThinPlugin;
use PVE::Storage::NFSPlugin;
use PVE::Storage::CIFSPlugin;
use PVE::Storage::ISCSIPlugin;
+use PVE::Storage::NVMeOFPlugin;
use PVE::Storage::RBDPlugin;
use PVE::Storage::CephFSPlugin;
use PVE::Storage::ISCSIDirectPlugin;
@@ -58,6 +59,7 @@ PVE::Storage::LvmThinPlugin->register();
PVE::Storage::NFSPlugin->register();
PVE::Storage::CIFSPlugin->register();
PVE::Storage::ISCSIPlugin->register();
+PVE::Storage::NVMeOFPlugin->register();
PVE::Storage::RBDPlugin->register();
PVE::Storage::CephFSPlugin->register();
PVE::Storage::ISCSIDirectPlugin->register();
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a2df83c0..7f2ff6c8 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -6,6 +6,7 @@ SOURCES= \
NFSPlugin.pm \
CIFSPlugin.pm \
ISCSIPlugin.pm \
+ NVMeOFPlugin.pm \
CephFSPlugin.pm \
RBDPlugin.pm \
ISCSIDirectPlugin.pm \
diff --git a/src/PVE/Storage/NVMeOFPlugin.pm b/src/PVE/Storage/NVMeOFPlugin.pm
new file mode 100644
index 00000000..02adc62c
--- /dev/null
+++ b/src/PVE/Storage/NVMeOFPlugin.pm
@@ -0,0 +1,307 @@
+package PVE::Storage::NVMeOFPlugin;
+
+use v5.36;
+
+use Cwd ();
+use Time::HiRes ();
+
+use PVE::Network;
+
+use PVE::Diskmanage;
+use PVE::NVMeOF;
+use PVE::Storage::Plugin;
+
+use base qw(PVE::Storage::Plugin);
+
+# Adding a storage activates it under the lock of the storage configuration, so no further portal is
+# tried after this many seconds once a controller is live, or after three times as long without one.
+# Later activations connect the rest.
+our $ACTIVATION_BUDGET = 15;
+
+sub type { return 'nvmeof' }
+
+sub plugindata {
+ return {
+ content => [{ images => 1, 'vm-vol' => 1, none => 1 }, { images => 1 }],
+ select_existing => 1,
+ 'isolate-properties' => 1,
+ 'advanced-properties' => {
+ 'fast-io-fail-tmo' => 1,
+ },
+ 'hidden-properties' => {
+ bwlimit => 1,
+ },
+ 'sensitive-properties' => {},
+ };
+}
+
+sub properties {
+ return {
+ subsysnqn => {
+ title => "Subsystem",
+ description => 'The NQN of the NVMe subsystem.',
+ type => 'string',
+ pattern => $PVE::NVMeOF::NQN_PATTERN,
+ maxLength => 223,
+ },
+ portals => {
+ title => "Portals",
+ description =>
+ 'TCP portals of the NVMe subsystem, as IPv4 or bracketed IPv6 addresses'
+ . ' with an optional port (default 4420).',
+ type => 'string',
+ format => 'pve-storage-nvme-portal-list',
+ },
+ 'fast-io-fail-tmo' => {
+ title => "Fail I/O After (s)",
+ description => 'Seconds before I/O through a reconnecting path fails. -1 disables'
+ . ' this timeout; I/O can remain queued while paths reconnect.',
+ type => 'integer',
+ minimum => -1,
+ default => 120,
+ },
+ };
+}
+
+sub options {
+ return {
+ subsysnqn => { fixed => 1 },
+ portals => {},
+ 'fast-io-fail-tmo' => { optional => 1 },
+ nodes => { optional => 1 },
+ disable => { optional => 1 },
+ content => { optional => 1 },
+ bwlimit => { optional => 1 },
+ };
+}
+
+my sub assert_valid_config($scfg) {
+ die "the discovery subsystem cannot be used as storage\n"
+ if $scfg->{subsysnqn} eq $PVE::NVMeOF::DISCOVERY_NQN;
+ my $paths = PVE::NVMeOF::storage_paths($scfg);
+ # the list format also accepts a list of separators only
+ die "no portal given\n" if !@$paths;
+ my %seen;
+ for my $path (@$paths) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ die "portal '$portal' is listed more than once\n" if $seen{$portal}++;
+ }
+}
+
+sub on_add_hook($class, $storeid, $scfg, %param) {
+ assert_valid_config($scfg);
+ # the LUN and controller lists and the node status attribute a subsystem to its one storage
+ my $ids = PVE::Storage::config()->{ids};
+ for my $sid (sort keys %$ids) {
+ next if $sid eq $storeid || $ids->{$sid}->{type} ne 'nvmeof';
+ die "storage '$sid' already uses this subsystem\n"
+ if $ids->{$sid}->{subsysnqn} eq $scfg->{subsysnqn};
+ }
+ # adding the storage again, for example once the array allows the node, tries all portals
+ PVE::NVMeOF::clear_connect_failures($scfg);
+ return;
+}
+
+sub on_update_hook_full($class, $storeid, $scfg, $update, $delete, $sensitive, @) {
+ my $merged = { %$scfg, %$update };
+ delete $merged->{$_} for ($delete // [])->@*;
+ # without the property, the default of the plugin applies, which serves images
+ $merged->{content} //= $class->plugindata()->{content}->[1];
+ assert_valid_config($merged);
+ # the namespace of a volume group must not become a disk image of a guest as well
+ if (
+ PVE::Storage::san_storage_serves_images($merged)
+ && !PVE::Storage::san_storage_serves_images($scfg)
+ ) {
+ my $ids = PVE::Storage::config()->{ids};
+ for my $sid (sort keys %$ids) {
+ die "storage '$sid' uses a namespace of this storage as base, so it cannot serve"
+ . " images\n"
+ if $ids->{$sid}->{type} eq 'lvm'
+ && ($ids->{$sid}->{base} // '') =~ /^\Q$storeid\E:/;
+ }
+ }
+ # a changed portal list, for example with a portal fixed and added again, tries all of them
+ PVE::NVMeOF::clear_connect_failures($merged) if exists($update->{portals});
+ return $class->SUPER::on_update_hook_full($storeid, $scfg, $update, $delete, $sensitive);
+}
+
+sub parse_volname($class, $volname) {
+ if ($volname =~ m!^(nvme-[a-zA-Z0-9_.:+-]+)$! && $volname !~ /-part[0-9]+$/) {
+ return ($class->guest_volume_vtype('raw'), $1, undef, undef, undef, undef, 'raw');
+ }
+ die "unable to parse NVMe over Fabrics volume name '$volname'\n";
+}
+
+# The name of a volume can be the by-id name of any NVMe device, also of a local disk or of a
+# namespace of another subsystem.
+sub assert_namespace($scfg, $volname, $real) {
+ my ($dev) = $real =~ m!^/dev/(nvme[0-9]+n[0-9]+)$!;
+ die "volume '$volname' is not an NVMe namespace\n" if !defined($dev);
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$PVE::NVMeOF::SYSFS/block/$dev/device/subsysnqn")
+ // '';
+ die "volume '$volname' is not part of subsystem '$scfg->{subsysnqn}'\n"
+ if $nqn ne $scfg->{subsysnqn};
+ die "volume '$volname' is the device of a single controller, not of native NVMe multipath\n"
+ if !PVE::NVMeOF::is_namespace_head($dev);
+ # another by-id name of the subsystem, like model and serial, can name another namespace
+ my $wwid = PVE::NVMeOF::namespace_wwid($dev) // '';
+ die "volume '$volname' is not named after the WWID of its namespace\n"
+ if $volname ne "nvme-$wwid";
+}
+
+sub filesystem_path($class, $scfg, $volname, $snapname = undef, @) {
+ die "snapshot is not possible on NVMe over Fabrics storage\n" if defined($snapname);
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my $path = "/dev/disk/by-id/$name";
+ # not every user of a path activates the volume first, and the base volume of an LVM storage
+ # has no device before its storage connects
+ my $real = Cwd::realpath($path);
+ assert_namespace($scfg, $volname, $real) if defined($real) && -e $real;
+ return wantarray ? ($path, $vmid, $vtype) : $path;
+}
+
+sub create_base { die "can't create base images in NVMe over Fabrics storage\n" }
+sub clone_image { die "can't clone images in NVMe over Fabrics storage\n" }
+sub alloc_image { die "can't allocate space in NVMe over Fabrics storage\n" }
+sub free_image { die "can't free space in NVMe over Fabrics storage\n" }
+sub volume_resize { die "volume resize is not possible on NVMe over Fabrics storage\n" }
+
+sub list_volumes($class, $storeid, $scfg, $vmid = undef, $content_types = undef, @) {
+ my $res = $class->list_images($storeid, $scfg, $vmid);
+ $_->{content} = 'images' for @$res;
+ return $res;
+}
+
+sub list_images($class, $storeid, $scfg, $vmid = undef, $vollist = undef, $cache = undef, @) {
+ return [] if defined($vmid) && !$vollist;
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ my $res = [];
+ for my $dev (sort keys %$namespaces) {
+ my $ns = $namespaces->{$dev};
+ my $volid = "$storeid:nvme-$ns->{wwid}";
+ next if $vollist && !grep { $_ eq $volid } @$vollist;
+ push @$res,
+ {
+ volid => $volid,
+ format => 'raw',
+ size => $ns->{size},
+ vmid => 0,
+ };
+ }
+ return $res;
+}
+
+sub status($class, $storeid, $scfg, $cache = undef, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return (0, 0, 0, PVE::NVMeOF::has_live_controller($controllers) ? 1 : 0);
+}
+
+sub activate_storage($class, $storeid, $scfg, $cache = undef, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ my @missing = grep { !defined(PVE::NVMeOF::path_controller($controllers, $_)) }
+ PVE::NVMeOF::storage_paths($scfg)->@*;
+ if (!@missing) {
+ # the kernel reconnects them, but meanwhile the namespaces cannot be used
+ die "no controller of the subsystem is live\n"
+ if !PVE::NVMeOF::has_live_controller($controllers);
+ return;
+ }
+ # A missing prerequisite is no failure of a portal, so the portals stay eligible for the next
+ # attempt. A storage with a usable path still works, with fewer paths.
+ eval {
+ PVE::NVMeOF::assert_support();
+ PVE::NVMeOF::host_identity();
+ };
+ if (my $err = $@) {
+ die $err if !PVE::NVMeOF::has_live_controller($controllers);
+ warn "storage '$storeid': cannot connect to the other portals - $err";
+ return;
+ }
+ my @errors;
+ my $live = PVE::NVMeOF::has_live_controller($controllers);
+ my $start = Time::HiRes::time();
+ # The time limit also bounds an attempt that starts late, so that an activation, like the one of
+ # a status pass, does not wait long for one storage.
+ my $left = sub { $start + ($live ? 1 : 3) * $ACTIVATION_BUDGET - Time::HiRes::time() };
+ for my $path (@missing) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ if ($left->() < 5) {
+ push @errors, "$portal: not tried within the time limit";
+ next;
+ }
+ if (PVE::NVMeOF::in_cooldown($scfg, $path)) {
+ push @errors, "$portal: failed less than a minute ago";
+ next;
+ }
+ eval {
+ if (!PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2)) {
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ die "no answer from portal\n";
+ }
+ PVE::NVMeOF::connect_path($scfg, $path, $left->());
+ };
+ if (my $err = $@) {
+ warn "storage '$storeid': connecting to '$portal' failed - $err";
+ chomp $err;
+ push @errors, "$portal: $err";
+ } else {
+ # a new controller can still be connecting
+ $live = PVE::NVMeOF::has_live_controller(
+ PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn}));
+ }
+ }
+ # some paths are enough, but without a usable one the namespaces cannot be used
+ $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ if (!PVE::NVMeOF::has_live_controller($controllers)) {
+ die "cannot connect to any portal - " . join('; ', @errors) . "\n" if @errors;
+ die "no controller of the subsystem is live yet\n";
+ }
+ return;
+}
+
+sub deactivate_storage { return }
+
+sub check_connection($class, $storeid, $scfg, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return 1 if PVE::NVMeOF::has_live_controller($controllers);
+ my $paths = PVE::NVMeOF::storage_paths($scfg);
+ # with a controller for each portal, there is nothing to connect, only to wait for the kernel
+ die "no controller of the subsystem is live\n"
+ if !grep { !defined(PVE::NVMeOF::path_controller($controllers, $_)) } @$paths;
+ # Many portals that do not answer must not hold up an activation, so the check has a time limit
+ # too. The portals left untried go to the activation, which skips those that just failed.
+ my $deadline = Time::HiRes::time() + $ACTIVATION_BUDGET;
+ for my $path (@$paths) {
+ return 1 if Time::HiRes::time() >= $deadline;
+ next if defined(PVE::NVMeOF::path_controller($controllers, $path));
+ next if PVE::NVMeOF::in_cooldown($scfg, $path);
+ return 1 if PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ }
+ return 0;
+}
+
+sub activate_volume($class, $storeid, $scfg, $volname, $snapname = undef, $cache = undef, @) {
+ my $path = $class->filesystem_path($scfg, $volname, $snapname);
+ # as for the multipath map of an iSCSI LUN, a status pass does not wait for the device
+ my $deadline = Time::HiRes::time() + ($cache && $cache->{status_only} ? 0 : 10);
+ while (!-b $path && Time::HiRes::time() < $deadline) {
+ last if !keys PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn})->%*;
+ Time::HiRes::usleep(250_000);
+ }
+ my $real = Cwd::realpath($path);
+ die "volume '$volname' is not available on this node\n" if !$real || !-b $real;
+ assert_namespace($scfg, $volname, $real);
+}
+
+sub volume_has_feature(
+ $class, $scfg, $feature, $storeid, $volname,
+ $snapname = undef,
+ $running = undef, @,
+) {
+ return 1 if $feature eq 'copy' && !defined($snapname);
+ return undef;
+}
+
+1;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index fe243679..7079a259 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -42,7 +42,7 @@ our @COMMON_TAR_FLAGS = qw(
);
our @SHARED_STORAGE = (
- 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs',
+ 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs', 'nvmeof',
);
our $QCOW2_PREALLOCATION = {
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index 0a9e441c..595c3b55 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -302,6 +302,13 @@ sub lun_partitions($lun) {
}
sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
+ my $name = basename($lun->{devpath});
+ my $nqn;
+ if ($name =~ /^nvme\d+n\d+$/) {
+ # without its subsystem, a storage that offers the namespace to guests cannot be ruled out
+ $nqn = PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn") // '';
+ die "cannot use '$lun->{devpath}' - cannot read its NVMe subsystem\n" if $nqn eq '';
+ }
my %vgs = map { $_ => 1 } PVE::Storage::LVMPlugin::lun_volume_groups(
[$lun->{devpath}, lun_partitions($lun)->@*],
)->@*;
@@ -324,6 +331,14 @@ sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
) {
die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this target\n";
}
+ if (
+ $type eq 'nvmeof'
+ && defined($nqn)
+ && $scfg->{subsysnqn} eq $nqn
+ && PVE::Storage::san_storage_serves_images($scfg)
+ ) {
+ die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this subsystem\n";
+ }
next if $type ne 'lvm' || !$scfg->{base};
my $base = PVE::Multipath::parse_base_volume($scfg->{base});
my $matches = $base
diff --git a/src/test/Makefile b/src/test/Makefile
index 500f9493..ee639e5f 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -17,6 +17,7 @@ test: \
test_lvmplugin \
test_multipath \
test_multipath_api \
+ test_nvmeof \
test_ovf \
test_plugin \
test_remote_command \
@@ -119,3 +120,7 @@ test_disk_api: run_disk_api_tests.pl
test_storage_create: run_storage_create_tests.pl
./run_storage_create_tests.pl
+
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+ ./run_nvmeof_tests.pl
+ perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
new file mode 100755
index 00000000..6fd37410
--- /dev/null
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -T
+
+use v5.36;
+use lib qw(..);
+use File::Temp qw(tempdir);
+use Scalar::Util qw(tainted);
+use Test::MockModule;
+use Test::More;
+
+use PVE::Tools qw(file_get_contents file_set_contents);
+
+use PVE::NVMeOF;
+
+$ENV{PATH} = '/usr/sbin:/usr/bin:/sbin:/bin';
+delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+my $dir = tempdir('nvmeof-taint-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::HOSTNQN_FILE = "$dir/hostnqn";
+local $PVE::NVMeOF::HOSTID_FILE = "$dir/hostid";
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+file_set_contents($PVE::NVMeOF::HOSTNQN_FILE, "nqn.host\n");
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "12345678-1234-1234-1234-123456789abc\n");
+file_set_contents("$dir/config", "nqn.test\n192.0.2.1\n120\n");
+my ($nqn, $portal, $fail) = split(/\n/, file_get_contents("$dir/config"));
+ok(tainted($nqn), 'configuration input is tainted');
+my $nvme = Test::MockModule->new('PVE::NVMeOF');
+$nvme->mock(with_lock => sub { $_[0]->() });
+my $commands = 0;
+$nvme->mock(
+ subsystem_controllers => sub {
+ return $commands ? { nvme0 => { traddr => '192.0.2.1', trsvcid => 4420 } } : {};
+ },
+);
+$nvme->mock(assert_support => sub { });
+$nvme->mock(
+ run_command => sub($cmd, %opts) {
+ $commands++;
+ is(
+ scalar(grep { tainted($_) } @$cmd),
+ 0,
+ 'all connect operands are validated and untainted',
+ );
+ PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ },
+);
+my $path = PVE::NVMeOF::parse_portal($portal);
+eval { PVE::NVMeOF::connect_path({ subsysnqn => $nqn, 'fast-io-fail-tmo' => $fail }, $path) };
+is($@, '', 'connect command can execute in taint mode');
+is($commands, 1, 'one connect');
+PVE::NVMeOF::note_connect_failure({ subsysnqn => $nqn }, $path);
+ok(
+ PVE::NVMeOF::in_cooldown({ subsysnqn => $nqn }, $path),
+ 'cooldown accepts validated file-backed configuration',
+);
+for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.discovery') {
+ eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
+ like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
+}
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
+eval { PVE::NVMeOF::host_identity() };
+like($@, qr/nonzero UUID/, 'zero host ID refused');
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
new file mode 100755
index 00000000..e8285695
--- /dev/null
+++ b/src/test/run_nvmeof_tests.pl
@@ -0,0 +1,577 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use Fcntl qw(:flock);
+use File::Path qw(make_path remove_tree);
+use File::Temp qw(tempdir);
+use POSIX ();
+use Test::MockModule;
+use Test::More;
+use Time::HiRes ();
+
+use PVE::Tools qw(file_set_contents);
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+local $PVE::NVMeOF::SYSFS = "$dir/sys";
+my $class = 'PVE::Storage::NVMeOFPlugin';
+my $cfg = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,[2001:db8::2]:4421',
+ content => { none => 1 },
+};
+
+subtest 'configuration, portals and volumes' => sub {
+ is(PVE::Storage::Plugin->lookup('nvmeof'), $class, 'plugin registered');
+ is_deeply(
+ [sort keys $class->properties()->%*],
+ [qw(fast-io-fail-tmo portals subsysnqn)],
+ 'only three plugin-specific properties',
+ );
+ my sub nvmeof_schema($schema) {
+ my @types = map { ($_->{oneOf} // [])->@* } ($schema->{allOf} // [])->@*;
+ my ($nvmeof) = grep { $_->{'instance-type'} eq 'nvmeof' } @types;
+ return $nvmeof->{properties} // {};
+ }
+ my $create = nvmeof_schema(PVE::Storage::Plugin->createSchema());
+ is_deeply(
+ [sort grep { !$create->{$_}->{optional} } keys $create->%*],
+ [qw(portals subsysnqn)],
+ 'adding a storage requires the subsystem and the portals',
+ );
+ my $update = nvmeof_schema(PVE::Storage::Plugin->updateSchema());
+ ok($update->{portals} && !$update->{subsysnqn}, 'the subsystem cannot be changed');
+ my $parsed = PVE::Storage::Plugin->parse_config(
+ 'storage.cfg',
+ "nvmeof: fabric\n\tsubsysnqn nqn.test\n\tportals 192.0.2.1\n\tcontent none\n",
+ );
+ is($parsed->{ids}->{fabric}->{subsysnqn}, 'nqn.test', 'storage.cfg accepts the plugin');
+ is_deeply(
+ $parsed->{ids}->{fabric}->{content},
+ { none => 1 },
+ 'connection-only content parses',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ { traddr => '192.0.2.1', trsvcid => 4420 },
+ 'default I/O port',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('[2001:0db8::1]:4421'),
+ { traddr => '2001:db8::1', trsvcid => 4421 },
+ 'canonical IPv6',
+ );
+ is(
+ PVE::NVMeOF::format_path({ traddr => '2001:db8::1', trsvcid => 4421 }),
+ '[2001:db8::1]:4421',
+ 'an IPv6 portal in brackets',
+ );
+ is(
+ PVE::NVMeOF::format_path({ traddr => 'nn-0x2000:pn-0x2001' }),
+ 'nn-0x2000:pn-0x2001',
+ 'the address of a Fibre Channel port as it is',
+ );
+
+ for my $bad (
+ 'host.example', '1.2.3.4:0', '1.2.3.4:65536', '[fe80::1]', '[::]', '224.0.0.1',
+ ) {
+ ok(!PVE::NVMeOF::parse_portal($bad), "invalid portal $bad");
+ }
+ eval { $class->on_add_hook('fabric', { %$cfg, portals => '192.0.2.1,192.0.2.1:4420' }); };
+ like($@, qr/listed more than once/, 'duplicate portals refused');
+ eval { $class->on_add_hook('fabric', { %$cfg, portals => ',,' }); };
+ like($@, qr/no portal given/, 'a list without a portal refused');
+ eval {
+ $class->on_add_hook(
+ 'fabric',
+ { %$cfg, subsysnqn => 'nqn.2014-08.org.nvmexpress.discovery' },
+ );
+ };
+ like($@, qr/discovery subsystem/, 'discovery subsystem refused');
+ ok(!PVE::NVMeOF::subsystem_nqn("nqn.test\e[31m"),
+ 'an NQN with a control character refused');
+ ok(!PVE::NVMeOF::subsystem_nqn("nqn.test\x{2028}x"), 'so is one with a Unicode separator');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $ids = { fabric => $cfg, local => { type => 'dir' } };
+ $storage->mock(config => sub { { ids => $ids } });
+ my $first = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $first);
+ is(eval { $class->on_add_hook('fabric', $cfg); 1 }, 1, 'a storage is not in its own way');
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $first), 'adding it tries all portals again');
+ eval { $class->on_add_hook('second', {%$cfg}) };
+ like($@, qr/storage 'fabric' already uses this subsystem/, 'one storage per subsystem');
+ $ids->{vg} = { type => 'lvm', base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'vg' };
+ my $images = { content => { images => 1 } };
+ eval { $class->on_update_hook_full('fabric', $cfg, $images, [], {}) };
+ like(
+ $@,
+ qr/storage 'vg' uses a namespace/,
+ 'no direct use of a namespace with a volume group',
+ );
+ my $none = { %$cfg, content => { none => 1 } };
+ eval { $class->on_update_hook_full('fabric', $none, {}, ['content'], {}) };
+ like($@, qr/storage 'vg' uses a namespace/, 'also not through the default content');
+ is(
+ eval { $class->on_update_hook_full('other', $cfg, $images, [], {}); 1 },
+ 1,
+ 'unless unused',
+ );
+ delete $ids->{vg};
+ PVE::NVMeOF::note_connect_failure($cfg, $first);
+ $class->on_update_hook_full('fabric', $cfg, { portals => $cfg->{portals} }, [], {});
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $first), 'a new portal list tries all portals again');
+ is(
+ scalar($class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef')),
+ '/dev/disk/by-id/nvme-eui.0123456789abcdef',
+ 'stable volume path',
+ );
+ {
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $nqn = 'nqn.other';
+ $disk->redefine(read_subsysnqn => sub { $nqn });
+ my $sysfs = Test::MockModule->new('PVE::NVMeOF');
+ my $head = 1;
+ $sysfs->redefine(namespace_wwid => sub { 'x' }, is_namespace_head => sub { $head });
+ my $check = sub {
+ eval { PVE::Storage::NVMeOFPlugin::assert_namespace($cfg, @_) };
+ $@;
+ };
+ like($check->('nvme-x', '/dev/nvme0n1'), qr/not part of subsystem/, 'other subsystem');
+ like($check->('nvme-x', '/dev/sda'), qr/not an NVMe namespace/, 'other device type');
+ like($check->('nvme-x', '/dev/nvme0n1p1'), qr/not an NVMe namespace/, 'partition');
+ $nqn = 'nqn.test';
+ is($check->('nvme-x', '/dev/nvme0n1'), '', 'namespace of the subsystem');
+ $head = 0;
+ like(
+ $check->('nvme-x', '/dev/nvme0n1'),
+ qr/device of a single controller/,
+ 'a namespace without native multipath',
+ );
+ $head = 1;
+ like(
+ $check->('nvme-Vendor_Model_123_1', '/dev/nvme0n1'),
+ qr/not named after the WWID/,
+ 'another by-id name of a namespace of the subsystem',
+ );
+ my $cwd = Test::MockModule->new('Cwd');
+ $cwd->redefine(realpath => sub { $dir });
+ eval { $class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef') };
+ like($@, qr/not an NVMe namespace/, 'the path of an existing device is checked');
+ }
+
+ for my $bad ('nvme-../../sda', 'nvme-eui.abc-part1', 'sda') {
+ eval { $class->parse_volname($bad) };
+ like($@, qr/unable to parse/, "invalid volume $bad");
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ $nvme->mock(namespaces => sub { { nvme0n1 => { wwid => 'eui.abc', size => 4096 } } });
+ is(
+ $class->list_volumes('fabric', $cfg)->[0]->{volid},
+ 'fabric:nvme-eui.abc',
+ 'content none still offers bases',
+ );
+ is_deeply($class->list_images('fabric', $cfg, 100), [], 'namespaces have no VM owner');
+ $nvme->mock(subsystem_controllers => sub { {} });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test') };
+ like($@, qr/not available/,
+ 'missing namespace fails without waiting on absent controllers');
+ my ($now, $queries) = (0, 0);
+ my $clock = Test::MockModule->new('Time::HiRes');
+ $clock->redefine(time => sub { $now += 5 }, usleep => sub { });
+ $nvme->mock(subsystem_controllers => sub { $queries++; { nvme1 => {} } });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test', undef, {}) };
+ is($queries, 1, 'a missing namespace of a connected subsystem is waited for');
+ eval {
+ $class->activate_volume(
+ 'fabric',
+ $cfg,
+ 'nvme-nonexistent-test',
+ undef,
+ { status_only => 1 },
+ );
+ };
+ like($@, qr/not available/, 'in a status pass it fails as well');
+ is($queries, 1, 'but without a wait');
+ is(
+ ($class->parse_volname('nvme-eui.0123456789abcdef'))[0],
+ 'vm-vol',
+ 'namespaces are VM disks',
+ );
+};
+
+subtest 'sysfs topology' => sub {
+ my $sys = $PVE::NVMeOF::SYSFS;
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1",
+ "$sys/class/nvme-subsystem/nvme-subsys0/nvme0n1",
+ "$sys/block/nvme0n1",
+ );
+ my %attrs = (
+ address => 'traddr=192.0.2.1,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.test',
+ state => 'connecting',
+ );
+ file_set_contents("$sys/class/nvme-fabrics/ctl/nvme1/$_", "$attrs{$_}\n") for keys %attrs;
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys0/subsysnqn", "nqn.test\n");
+ file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ file_set_contents("$sys/block/nvme0n1/size", "8\n");
+ make_path(
+ "$sys/devices/virtual/nvme-subsystem/nvme-subsys0",
+ "$sys/devices/virtual/nvme-fabrics/ctl/nvme1",
+ "$sys/block/nvme1n1",
+ );
+ symlink('../../devices/virtual/nvme-subsystem/nvme-subsys0', "$sys/block/nvme0n1/device")
+ or die "symlink failed - $!\n";
+ symlink('../../devices/virtual/nvme-fabrics/ctl/nvme1', "$sys/block/nvme1n1/device")
+ or die "symlink failed - $!\n";
+ ok(
+ PVE::NVMeOF::is_namespace_head('nvme0n1'),
+ 'a device of the subsystem is a namespace head',
+ );
+ ok(!PVE::NVMeOF::is_namespace_head('nvme1n1'), 'the device of a single controller is not');
+ ok(!PVE::NVMeOF::is_namespace_head('nvme9n1'), 'nor one that is gone');
+ is(
+ PVE::NVMeOF::controllers()->{nvme1}->{state},
+ 'connecting',
+ 'reconnecting controller is still present',
+ );
+ is(
+ PVE::NVMeOF::path_controller(
+ PVE::NVMeOF::subsystem_controllers('nqn.test'),
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ ),
+ 'nvme1',
+ 'portal controller found',
+ );
+ is_deeply(
+ PVE::NVMeOF::namespaces('nqn.test'),
+ { nvme0n1 => { wwid => 'eui.abc', size => 4096 } },
+ 'namespace facts',
+ );
+ is_deeply(PVE::NVMeOF::namespaces('nqn.other'), {}, 'other subsystem excluded');
+ unlink("$sys/block/nvme0n1/wwid");
+ eval { PVE::NVMeOF::namespaces('nqn.test') };
+ like($@, qr/cannot read the WWID/, 'an unreadable namespace is an error, not a gone one');
+ file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ make_path("$sys/class/nvme-subsystem/nvme-subsys9");
+ eval { PVE::NVMeOF::namespaces('nqn.test') };
+ like($@, qr/cannot read the NQN/, 'so is a subsystem that could be the one asked for');
+ rmdir("$sys/class/nvme-subsystem/nvme-subsys9");
+};
+
+subtest 'serialized commands inherit the lock' => sub {
+ local $PVE::NVMeOF::LOCK_WAIT = 0;
+ my $script = join(
+ ' ',
+ 'my @held = grep { (readlink($_) // "") =~ /fabrics.lock$/ } glob("/proc/self/fd/*");',
+ 'die "not inherited" if !@held;',
+ 'open(my $fh, ">>", $ARGV[0]) or die $!;',
+ 'die "lock missing" if flock($fh, LOCK_EX|LOCK_NB);',
+ 'print "locked\\n";',
+ );
+ my $value = PVE::NVMeOF::with_lock(sub {
+ my $out = '';
+ PVE::Tools::run_command(
+ [
+ '/usr/bin/perl',
+ '-MFcntl=:flock',
+ '-e',
+ $script,
+ "$PVE::NVMeOF::RUN_DIR/fabrics.lock",
+ ],
+ timeout => 5,
+ outfunc => sub { $out .= $_[0] },
+ );
+ return $out;
+ });
+ is($value, 'locked', 'exec cannot acquire the lock held by its parent');
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or die $!;
+ flock($lock, LOCK_EX) or die $!;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'busy operation never enters callback');
+ close($lock);
+
+ my $tools = Test::MockModule->new('PVE::Tools');
+ my $timed_out = 1;
+ $tools->mock(run_fork_with_timeout => sub { return ($_[1]->(), $timed_out) });
+ my $retained;
+ eval {
+ PVE::NVMeOF::with_lock(sub {
+ my ($path) =
+ grep { (readlink($_) // '') =~ /fabrics.lock$/ } glob('/proc/self/fd/*');
+ my ($fd) = $path =~ m{/(\d+)$};
+ open($retained, '>&', $fd) or die $!;
+ return 1;
+ });
+ };
+ like($@, qr/timed out.*may still be running/, 'timeout does not claim deletion completed');
+ $timed_out = 0;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'retained descriptor keeps serialization after the caller returns');
+ close($retained);
+ is(PVE::NVMeOF::with_lock(sub { 1 }), 1, 'last descriptor close releases serialization');
+
+ my @timeouts;
+ $tools->mock(run_fork_with_timeout => sub { push @timeouts, $_[0]; return ($_[1]->(), 0) });
+ PVE::NVMeOF::with_lock(sub { 1 }, $_) for undef, 100, 4.2, 0.3;
+ my $hung = PVE::NVMeOF::storage_paths($cfg)->[0];
+ $tools->mock(run_fork_with_timeout => sub { return (undef, 1) });
+ eval { PVE::NVMeOF::connect_path($cfg, $hung) };
+ is($@, $PVE::NVMeOF::TIMED_OUT, 'a hanging connect times out');
+ ok(PVE::NVMeOF::in_cooldown($cfg, $hung), 'and arms the cooldown of its portal');
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ my $full = $PVE::NVMeOF::LOCK_WAIT + 35;
+ is_deeply(
+ \@timeouts, [$full, 100, 5, 1], 'a limit sets the time in whole seconds',
+ );
+};
+
+subtest 'a short hold of the lock does not fail a connect' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my $scfg = { %$cfg, subsysnqn => 'nqn.wait', portals => '192.0.2.3' };
+ my $ctl = "$PVE::NVMeOF::SYSFS/class/nvme-fabrics/ctl/nvme9";
+ $net->mock(tcp_ping => sub { 1 });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(
+ run_command => sub(@) {
+ my %attrs = (
+ address => 'traddr=192.0.2.3,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.wait',
+ state => 'live',
+ );
+ make_path($ctl);
+ file_set_contents("$ctl/$_", "$attrs{$_}\n") for keys %attrs;
+ },
+ );
+ pipe(my $held, my $signal) or die "pipe failed - $!\n";
+ my $holder = fork() // die "fork failed - $!\n";
+ if (!$holder) {
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or POSIX::_exit(1);
+ flock($lock, LOCK_EX) or POSIX::_exit(1);
+ syswrite($signal, '1');
+ Time::HiRes::sleep(0.5);
+ POSIX::_exit(0);
+ }
+ close($signal);
+ sysread($held, my $state, 1);
+ is($state, '1', 'another process holds the lock');
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ $class->activate_storage('wait', $scfg);
+ }
+ waitpid($holder, 0);
+ is($warning, '', 'the connect waits for the lock');
+ my $path = PVE::NVMeOF::storage_paths($scfg)->[0];
+ ok(!PVE::NVMeOF::in_cooldown($scfg, $path), 'and arms no cooldown');
+ is(
+ PVE::NVMeOF::path_controller(PVE::NVMeOF::subsystem_controllers('nqn.wait'), $path),
+ 'nvme9',
+ 'the portal is connected',
+ );
+ remove_tree($ctl);
+
+ local $PVE::NVMeOF::LOCK_WAIT = 0.2;
+ pipe($held, $signal) or die "pipe failed - $!\n";
+ $holder = fork() // die "fork failed - $!\n";
+ if (!$holder) {
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or POSIX::_exit(1);
+ flock($lock, LOCK_EX) or POSIX::_exit(1);
+ syswrite($signal, '1');
+ Time::HiRes::sleep(1);
+ POSIX::_exit(0);
+ }
+ close($signal);
+ sysread($held, $state, 1);
+ {
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('wait', $scfg) };
+ }
+ waitpid($holder, 0);
+ like($@, qr/NVMe over Fabrics is busy/, 'a longer hold fails the connect');
+ ok(!PVE::NVMeOF::in_cooldown($scfg, $path), 'but arms no cooldown for the portal');
+};
+
+subtest 'connect options, kernel reconnect and cooldown' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my @commands;
+ my $controllers = {};
+ my @limits;
+ $nvme->mock(with_lock => sub { push @limits, $_[1]; $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(subsystem_controllers => sub { $controllers });
+ my $appear = 1;
+ our $state = 'live';
+ my ($now, $connect_secs) = (0, 0);
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ is($opts{timeout}, 30, 'bounded connect');
+ push @commands, $cmd;
+ $now += $connect_secs;
+ my %arg =
+ map { $cmd->[$_] => $cmd->[$_ + 1] } grep { $cmd->[$_] =~ /^--tr/ } 0 .. $#$cmd;
+ my $controller =
+ { traddr => $arg{'--traddr'}, trsvcid => $arg{'--trsvcid'}, state => $state };
+ $controllers->{ 'nvme' . scalar(@commands) } = $controller if $appear;
+ },
+ );
+ $net->mock(tcp_ping => sub { 1 });
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 2, 'one connect per missing portal');
+ ok(grep({ $_ eq '--ctrl-loss-tmo=-1' } $commands[0]->@*), 'kernel reconnects indefinitely');
+ is_deeply([@{ $commands[0] }[-2, -1]], ['--fast_io_fail_tmo', 120], 'fast failure default');
+ {
+ my $clock = Test::MockModule->new('Time::HiRes');
+ $clock->redefine(time => sub { $now });
+ my $activate = sub($secs) {
+ ($controllers, $connect_secs, @commands) = ({}, $secs);
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('fabric', $cfg) };
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ return scalar(@commands);
+ };
+ is($activate->(20), 1, 'with a live controller, a spent time budget leaves the rest');
+ $appear = 0;
+ is($activate->(20), 2, 'without one, a slow portal does not keep the next one out');
+ is($activate->(50), 1, 'but a very slow one does');
+ @limits = ();
+ is($activate->(40), 2, 'one that starts late is still tried');
+ is_deeply(\@limits, [45, 5], 'but only for the rest of the time limit');
+ local $state = 'connecting';
+ $appear = 1;
+ is($activate->(20), 2, 'a new controller that is still connecting is not live');
+ $appear = 0;
+ ($appear, $connect_secs) = (1, 0);
+ }
+ @commands = ();
+ $controllers = {
+ nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' },
+ nvme2 => { traddr => '2001:db8::2', trsvcid => 4421, state => 'live' },
+ };
+ $class->activate_storage('fabric', $cfg);
+ is_deeply(\@commands, [],
+ 'existing controllers are never reconnected, regardless of state');
+ $controllers->{nvme2}->{state} = 'connecting';
+ eval { $class->activate_storage('fabric', $cfg) };
+ like($@, qr/no controller of the subsystem is live/, 'without a live one it fails');
+ is_deeply(\@commands, [], 'but leaves the reconnect to the kernel');
+ $controllers->{nvme2}->{state} = 'live';
+ $class->deactivate_storage('fabric', $cfg);
+ is_deeply(\@commands, [], 'deactivation does not remove controllers');
+ $controllers = {};
+ my $path = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $path);
+ ok(PVE::NVMeOF::in_cooldown($cfg, $path), 'failure starts cooldown');
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 1, 'only the other portal connects');
+ ($controllers, $appear) = ({}, 0);
+ my $other = PVE::NVMeOF::storage_paths($cfg)->[1];
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ eval { $class->activate_storage('fabric', $cfg) };
+ }
+ like($warning, qr/no controller appeared/, 'a connect without a controller is a failure');
+ ok(PVE::NVMeOF::in_cooldown($cfg, $other), 'which starts the cooldown too');
+ like(
+ $@,
+ qr/^cannot connect to any portal - .*failed less than a minute ago; .*no controller appeared/,
+ 'without any controller the activation fails with the reason of each portal',
+ );
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ $nvme->mock(assert_support => sub { die "nvme-cli is not installed\n" });
+ @commands = ();
+ eval { $class->activate_storage('fabric', $cfg) };
+ is($@, "nvme-cli is not installed\n", 'a missing prerequisite fails the activation');
+ is_deeply(\@commands, [], 'before any connect');
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $path), 'and without a cooldown');
+ $controllers = { nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'live' } };
+ $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ is(
+ eval { $class->activate_storage('fabric', $cfg); 1 },
+ 1,
+ 'but not with a usable path',
+ );
+ }
+ like($warning, qr/cannot connect to the other portals - nvme-cli/, 'which it warns about');
+ $nvme->mock(assert_support => sub { });
+ $controllers =
+ { nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' } };
+ {
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('fabric', $cfg) };
+ }
+ like(
+ $@,
+ qr/^cannot connect to any portal/,
+ 'a reconnecting path is not usable when the missing one fails',
+ );
+ # a connect that worked, but whose controller is not live yet
+ ($controllers, $now, $connect_secs) = ({}, 0, 0);
+ $net->mock(tcp_ping => sub { 1 });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ my %arg =
+ map { $cmd->[$_] => $cmd->[$_ + 1] } grep { $cmd->[$_] =~ /^--tr/ } 0 .. $#$cmd;
+ $controllers->{nvme7} =
+ { traddr => $arg{'--traddr'}, trsvcid => $arg{'--trsvcid'}, state => 'connecting' };
+ },
+ );
+ eval { $class->activate_storage('fabric', { %$cfg, portals => '192.0.2.7' }) };
+ is($@, "no controller of the subsystem is live yet\n", 'says so without an empty reason');
+};
+
+subtest 'the connection check has a time limit too' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my $clock = Test::MockModule->new('Time::HiRes');
+ my ($now, $pings) = (0, 0);
+ $clock->redefine(time => sub { $now });
+ $nvme->mock(subsystem_controllers => sub { {} });
+ $net->mock(tcp_ping => sub { $now += 2; $pings++; 0 });
+ my $scfg = { %$cfg, portals => join(',', map { "192.0.2.$_" } 1 .. 20) };
+ is($class->check_connection('many', $scfg), 1, 'untried portals go to the activation');
+ is($pings, 8, 'which the check leaves after its time limit');
+ ok(
+ PVE::NVMeOF::in_cooldown($scfg, PVE::NVMeOF::parse_portal('192.0.2.8')),
+ 'the failed ones cool down',
+ );
+ ($now, $pings) = (0, 0);
+ is($class->check_connection('many', $scfg), 1, 'a later pass skips the failed portals');
+ ok(
+ PVE::NVMeOF::in_cooldown($scfg, PVE::NVMeOF::parse_portal('192.0.2.16')),
+ 'and gets further',
+ );
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ $scfg->{portals} = '192.0.2.1,192.0.2.2';
+ ($now, $pings) = (0, 0);
+ is($class->check_connection('few', $scfg), 0, 'all tried and none answers');
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ my $reconnecting = { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' };
+ $nvme->mock(subsystem_controllers => sub { { nvme1 => $reconnecting } });
+ ($scfg->{portals}, $pings) = ('192.0.2.1', 0);
+ eval { $class->check_connection('few', $scfg) };
+ is($@, "no controller of the subsystem is live\n", 'with a controller for each portal');
+ is($pings, 0, 'which the check does not ping');
+};
+
+done_testing();
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 3245b774..61872a60 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -38,6 +38,7 @@ $storage->mock(config => sub { $cfg });
$disk->mock(verify_blockdev_path => sub { $device });
$disk->mock(is_partition => sub { 0 });
$disk->mock(get_nvme_transport => sub { 'fc' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
$disk->mock(is_iscsi_device => sub { 0 });
$disk->mock(is_mounted => sub { 0 });
$disk->mock(has_holder => sub { 0 });
@@ -86,6 +87,28 @@ for my $base (qw(fabric nvme-fabric)) {
eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
like($@, qr/base volume/, "native base reference on storage '$base' refuses");
}
+$cfg->{ids} =
+ { fabric =>
+ { type => 'nvmeof', subsysnqn => 'nqn.test', disable => 1, content => { images => 1 } } };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like(
+ $@,
+ qr/serves images from this subsystem/,
+ 'direct namespace image use refuses even when disabled',
+);
+$cfg->{ids}->{fabric}->{content} = { 'vm-vol' => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like($@, qr/serves images from this subsystem/, 'also when restricted to VM disks');
+$cfg->{ids}->{fabric}->{content} = { none => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+is($@, '', 'connection-only storage permits namespace initialization');
+
+for my $nqn (undef, '') {
+ $disk->mock(read_subsysnqn => sub { $nqn });
+ eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+ like($@, qr/cannot read its NVMe subsystem/, 'an unreadable subsystem refuses');
+}
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
$cfg->{ids} = {};
@order = @opens = ();
$tools->mock(file_get_contents => sub { 1024 });
^ permalink raw reply related [relevance 15%]
* [PATCH v5 manager 21/26] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (14 preceding siblings ...)
2026-11-23 13:32 20% ` [PATCH v5 manager 19/26] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
@ 2026-11-23 13:32 19% ` Thomas Lamprecht
2026-11-23 13:32 13% ` [PATCH v5 manager 22/26] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
` (3 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
Add a guided setup for shared LVM on a namespace of an NVMe over Fabrics
subsystem, with the same steps as for iSCSI. Datacenter > Storage > Add
and the SAN view list it next to the other setups. It connects to a
subsystem found at a discovery portal and shows the host NQNs of the
nodes for the access rules of the array.
The target step is shared with iSCSI, as only the storage type, its
scan and the node identities differ. A reused NVMe over Fabrics storage
keeps its I/O portals, which the step shows read-only. The portals that
the step suggests leave out the default I/O port of such a storage, so
that the discovery also tries the discovery port.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 2 +-
www/manager6/SANUtils.js | 2 +-
www/manager6/dc/SAN.js | 4 +-
www/manager6/dc/StorageView.js | 5 +
www/manager6/storage/wizard/LunSelect.js | 35 ++-
www/manager6/storage/wizard/NodeIdentities.js | 57 +++--
.../storage/wizard/{IScsi.js => Target.js} | 232 +++++++++++++-----
www/manager6/storage/wizard/Wizard.js | 62 +++--
www/manager6/window/SANLunState.js | 30 ++-
9 files changed, 299 insertions(+), 130 deletions(-)
rename www/manager6/storage/wizard/{IScsi.js => Target.js} (60%)
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index dddf17590..f2fc80279 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -393,7 +393,7 @@ JSSRC= \
storage/wizard/Wizard.js \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
- storage/wizard/IScsi.js \
+ storage/wizard/Target.js \
storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index 992265162..bd1c87324 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -237,7 +237,7 @@ Ext.define('PVE.SANUtils', {
},
openSetup: function (type, reloadCallback) {
- let wizard = type === 'fc' ? 'FibreChannel' : 'IScsi';
+ let wizard = { fc: 'FibreChannel', nvmeof: 'NVMeOF' }[type] ?? 'IScsi';
Ext.create(`PVE.storage.wizard.${wizard}`, { autoShow: true, reloadCallback });
},
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index eea8aea65..2f624cbd2 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -112,7 +112,7 @@ Ext.define('PVE.dc.SANView', {
autoShow: true,
});
let setupItem = (type) => ({
- text: type === 'fc' ? gettext('Fibre Channel') : 'iSCSI',
+ text: type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
iconCls: `fa fa-fw fa-${type === 'fc' ? 'plug' : 'building'}`,
disabled: !PVE.SANUtils.canSetup(type),
handler: () => PVE.SANUtils.openSetup(type, reload),
@@ -121,7 +121,7 @@ Ext.define('PVE.dc.SANView', {
{
text: gettext('Add Shared LVM'),
disabled: !PVE.SANUtils.canSetup('iscsi'),
- menu: [setupItem('iscsi'), setupItem('fc')],
+ menu: [setupItem('iscsi'), setupItem('fc'), setupItem('nvmeof')],
},
{
text: gettext('Multipath Overrides'),
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 5f4f519be..4182b4c12 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -201,6 +201,11 @@ Ext.define(
gettext('Set up shared LVM on a Fibre Channel LUN with multipath.'),
'san lun multipath lvm fc guided',
),
+ setup(
+ 'nvmeof',
+ gettext('Set up shared LVM on a namespace of an NVMe/TCP subsystem.'),
+ 'san nvme namespace lvm tcp guided',
+ ),
];
let types = {
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index 36a9a3804..7fd814bf0 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -30,10 +30,11 @@ Ext.define('PVE.storage.wizard.LunSelect', {
// The scan names one target per LUN, also for a LUN reached through several. The content
// listing has the LUNs of the connection, and a LUN that shows up later is listed once the
// scan names the target of the connection for it.
+ let targetKey = wizard.wizardType === 'nvmeof' ? 'nvme-subsystem' : 'iscsi-target';
let filter = {
id: 'connection',
filterFn: (rec) =>
- rec.get('iscsi-target') === connection.target ||
+ rec.get(targetKey) === connection.target ||
(me.connectionWwids ?? []).includes(rec.get('wwid')),
};
me.store.addFilter(filter);
@@ -45,7 +46,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
success: function (response) {
if (!me.destroyed) {
me.connectionWwids = response.result.data
- .map((entry) => entry.volid.match(/\.dm-uuid-mpath-(.+)$/)?.[1])
+ .map((entry) => entry.volid.match(/(?:\.dm-uuid-mpath-|:nvme-)(.+)$/)?.[1])
.filter(Boolean);
me.store.addFilter(filter);
}
@@ -74,7 +75,9 @@ Ext.define('PVE.storage.wizard.LunSelect', {
// the setup refuses a LUN with data, so do not offer one
let hasData = (row) => row.usage === 'lvm' || row.usage === 'other';
let blocked = (row) => inUse(row) || hasData(row);
- let noLunsText = gettext('No LUNs found. Check connections and array access.');
+ let noLunsText = me.nvme
+ ? gettext('No namespaces found. Check connections and array access.')
+ : gettext('No LUNs found. Check connections and array access.');
let updateSelection = function () {
let row = me.getSelection();
me.down('#selection').setValue(row && !blocked(row) ? row.wwid : '');
@@ -91,9 +94,13 @@ Ext.define('PVE.storage.wizard.LunSelect', {
xtype: 'component',
cls: 'pmx-hint',
margin: '0 0 10 0',
- html: gettext(
- 'LUNs with known data or users cannot be selected. To keep the volume group on a LUN, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a LUN, stop its users on all hosts and wipe it under Node > SAN first.',
- ),
+ html: me.nvme
+ ? gettext(
+ 'Namespaces with known data or users cannot be selected. To keep the volume group on a namespace, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a namespace, stop its users on all hosts and wipe it under Node > SAN first.',
+ )
+ : gettext(
+ 'LUNs with known data or users cannot be selected. To keep the volume group on a LUN, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a LUN, stop its users on all hosts and wipe it under Node > SAN first.',
+ ),
},
...(me.rescanNote
? [
@@ -126,6 +133,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
renderer: Ext.htmlEncode,
},
{ text: 'LUN', dataIndex: 'iscsi-lun', width: 60 },
+ { text: 'NSID', dataIndex: 'nvme-nsid', width: 60 },
{
text: gettext('Model'),
dataIndex: 'model',
@@ -144,6 +152,8 @@ Ext.define('PVE.storage.wizard.LunSelect', {
dataIndex: 'multipath',
width: 170,
renderer: PVE.SANUtils.renderSanLunMultipath,
+ // native NVMe multipath needs no setup per namespace
+ hidden: me.nvme,
},
{
text: gettext('Used By'),
@@ -189,9 +199,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
searchchange: function (field, query) {
let grid = me.down('grid');
if (grid?.rendered) {
- grid.setEmptyText(
- query ? gettext('No LUNs match the search.') : noLunsText,
- );
+ let noMatch = me.nvme
+ ? gettext('No namespaces match the search.')
+ : gettext('No LUNs match the search.');
+ grid.setEmptyText(query ? noMatch : noLunsText);
}
},
},
@@ -206,8 +217,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let search = me.down('pveRecordSearchField');
me.on('activate', function () {
search.setTargetStore(me.store);
- if (me.up('window').wizardType === 'fc') {
- me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ let type = me.up('window').wizardType;
+ me.down('gridcolumn[dataIndex=iscsi-lun]').setHidden(type !== 'iscsi');
+ me.down('gridcolumn[dataIndex=nvme-nsid]').setHidden(type !== 'nvmeof');
+ if (type === 'fc') {
me.store.addFilter({
id: 'transport',
filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')),
diff --git a/www/manager6/storage/wizard/NodeIdentities.js b/www/manager6/storage/wizard/NodeIdentities.js
index 0a54f7ce1..36d37e164 100644
--- a/www/manager6/storage/wizard/NodeIdentities.js
+++ b/www/manager6/storage/wizard/NodeIdentities.js
@@ -1,32 +1,21 @@
Ext.define('pve-san-node-identity', {
extend: 'Ext.data.Model',
idProperty: 'node',
- fields: ['node', 'state', 'iscsi-initiator-name'],
+ fields: ['node', 'state', 'iscsi-initiator-name', 'nvme-host-nqn'],
});
-// The nodes with their initiator names, to allow them on the array, and to select the nodes that
-// use the target. The node serving the web UI sets up the volume group, so it stays selected.
+// The nodes with their iSCSI initiator names or NVMe host NQNs, to allow them on the array, and to
+// select the nodes that use the target. The node serving the web UI sets up the volume group, so it
+// stays selected.
Ext.define('PVE.storage.wizard.NodeIdentities', {
extend: 'Ext.grid.Panel',
xtype: 'pveStorageWizardNodeIdentities',
height: 220,
selModel: { selType: 'checkboxmodel', mode: 'SIMPLE' },
viewConfig: { enableTextSelection: true },
- columns: [
- { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
- {
- text: gettext('Multipath Setup'),
- dataIndex: 'state',
- width: 175,
- renderer: PVE.SANUtils.renderState,
- },
- {
- text: gettext('Initiator Name'),
- dataIndex: 'iscsi-initiator-name',
- flex: 1,
- renderer: Ext.htmlEncode,
- },
- ],
+
+ // the identity of a node that the array allows
+ identity: 'iscsi-initiator-name',
getSelectedNodes: function () {
return this.getSelection()
@@ -62,6 +51,24 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
initComponent: function () {
let me = this;
+ let nvme = me.identity === 'nvme-host-nqn';
+ me.columns = [
+ { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
+ {
+ text: gettext('Multipath Setup'),
+ dataIndex: 'state',
+ width: 175,
+ renderer: PVE.SANUtils.renderState,
+ // the state of multipathd, which native NVMe multipath does not use
+ hidden: nvme,
+ },
+ {
+ text: nvme ? gettext('Host NQN') : gettext('Initiator Name'),
+ dataIndex: me.identity,
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ];
me.rstore = Ext.create('Proxmox.data.UpdateStore', {
storeid: 'san-wizard-identities',
model: 'pve-san-node-identity',
@@ -90,19 +97,23 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
me.tbar = [
{
xtype: 'tbtext',
- text: gettext(
- 'Select the nodes that will use the target and allow their initiator names on the array.',
- ),
+ text: nvme
+ ? gettext(
+ 'Select the nodes that will use the subsystem and allow their host NQNs on the array.',
+ )
+ : gettext(
+ 'Select the nodes that will use the target and allow their initiator names on the array.',
+ ),
},
'->',
{
- text: gettext('Copy Initiator Names'),
+ text: nvme ? gettext('Copy Host NQNs') : gettext('Copy Initiator Names'),
iconCls: 'fa fa-clipboard',
handler: () =>
PVE.Utils.copyToClipboard(
me
.getSelection()
- .map((rec) => rec.get('iscsi-initiator-name'))
+ .map((rec) => rec.get(me.identity))
.filter(Boolean)
.join('\n'),
),
diff --git a/www/manager6/storage/wizard/IScsi.js b/www/manager6/storage/wizard/Target.js
similarity index 60%
rename from www/manager6/storage/wizard/IScsi.js
rename to www/manager6/storage/wizard/Target.js
index d2102b37c..712fab295 100644
--- a/www/manager6/storage/wizard/IScsi.js
+++ b/www/manager6/storage/wizard/Target.js
@@ -1,16 +1,21 @@
-Ext.define('PVE.storage.wizard.IScsiTarget', {
+// The step of a guided setup that connects to the target of an iSCSI or the subsystem of an NVMe
+// over Fabrics array, through a storage of that type.
+Ext.define('PVE.storage.wizard.Target', {
extend: 'Proxmox.panel.InputPanel',
- xtype: 'pveStorageWizardIScsiTarget',
- onlineHelp: 'storage_open_iscsi',
+ xtype: 'pveStorageWizardTarget',
- // The iSCSI storage the target already has, which the setup uses instead of adding one.
+ storageType: 'iscsi',
+
+ // The storage the target already has, which the setup uses instead of adding one.
existingConnection: function () {
let me = this;
let target = me.down('field[name=target]').getValue();
- return me.storages?.find((entry) => entry.type === 'iscsi' && entry.target === target);
+ return me.storages?.find(
+ (entry) => entry.type === me.storageType && entry[me.targetKey] === target,
+ );
},
- // The ID of the iSCSI storage the setup adds, named after the storage on the LUN by default.
+ // The ID of the storage the setup adds, named after the storage on the LUN by default.
newConnectionId: function () {
let me = this;
let id = me.down('field[name=storage]').getValue();
@@ -21,8 +26,9 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
// step and Next both use it, so that the note does not promise what Next then refuses.
reuseConflict: function (selectedNodes) {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let target = me.down('field[name=target]').getValue();
- let users = (me.storages ?? []).filter((entry) => entry.target === target);
+ let users = (me.storages ?? []).filter((entry) => entry[me.targetKey] === target);
if (!users.length) {
return undefined;
}
@@ -30,30 +36,46 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
let format = (text, ...args) => Ext.String.format(text, ...args);
if (users.length !== 1) {
return format(
- gettext(
- 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
- ),
+ nvme
+ ? gettext(
+ 'Storages {0} use this subsystem. The setup can only reuse a subsystem that one storage uses.',
+ )
+ : gettext(
+ 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
+ ),
users.map((entry) => entry.storage).join(', '),
);
- } else if (base.type !== 'iscsi') {
+ } else if (base.type !== me.storageType) {
return format(
- gettext(
- 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses this subsystem. The setup can only reuse an NVMe over Fabrics storage.',
+ )
+ : gettext(
+ 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
+ ),
base.storage,
);
} else if (`${base.content ?? ''}` !== 'none') {
return format(
- gettext(
- 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses the namespaces of this subsystem directly. If no guest uses them, clear Use namespaces directly in its edit dialog, otherwise use another subsystem.',
+ )
+ : gettext(
+ 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
+ ),
base.storage,
);
} else if (base.disable) {
return format(
- gettext(
- 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" connects to this subsystem, but it is disabled. Enable that storage first.',
+ )
+ : gettext(
+ 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
+ ),
base.storage,
);
}
@@ -61,17 +83,17 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
if (baseNodes.length && !baseNodes.includes(Proxmox.NodeName)) {
return format(
gettext(
- 'iSCSI storage "{0}" is not available on node "{1}". Open the web UI on one of its nodes.',
+ 'Storage "{0}" is not available on node "{1}". Open the web UI on one of its nodes.',
),
base.storage,
Proxmox.NodeName,
);
} else if (baseNodes.length && selectedNodes.some((node) => !baseNodes.includes(node))) {
return format(
- gettext('iSCSI storage "{0}" is not available on all selected nodes.'),
+ gettext('Storage "{0}" is not available on all selected nodes.'),
base.storage,
);
- } else if (!base['managed-multipath']) {
+ } else if (!nvme && !base['managed-multipath']) {
return format(
gettext(
'Enable Multipath in the edit dialog of storage "{0}" before using it here.',
@@ -94,6 +116,14 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
field.setReadOnly(!!existing);
let id = me.down('field[name=storage]').getValue();
field.setEmptyText(id ? `${id}-base` : '');
+ // a reused storage keeps its own portals
+ let portals = me.down('field[name=portals]');
+ if (portals) {
+ if (existing) {
+ portals.setValue(existing.portals);
+ }
+ portals.setReadOnly(!!existing);
+ }
// the nodes of a storage that the setup uses are the default selection
let identities = me.down('pveStorageWizardNodeIdentities');
@@ -112,19 +142,32 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
note.setHidden(!conflict);
},
- // The portals of the enabled iSCSI storages, to discover the target of another LUN through one
- // of them.
+ // The portals of the enabled storages of the type, to discover the target of another LUN
+ // through one of them. An NVMe over Fabrics storage lists the I/O portals of its subsystem,
+ // whose default port would skip the discovery port 8009, so the suggestion leaves it out.
updatePortalSuggestions: function () {
let me = this;
let users = new Map();
- for (const { type, portal, storage, disable } of me.storages ?? []) {
- if (['iscsi', 'iscsidirect'].includes(type) && portal && !disable) {
- users.set(portal, [...(users.get(portal) ?? []), storage]);
+ for (const { type, portal, portals, storage, disable } of me.storages ?? []) {
+ let list = [];
+ if (disable) {
+ continue;
+ } else if (me.storageType === 'nvmeof' && type === 'nvmeof') {
+ // as the storage splits its list
+ list = `${portals ?? ''}`
+ .split(/[\s,;]+/)
+ .filter(Boolean)
+ .map((entry) => entry.replace(/:4420$/, ''));
+ } else if (me.storageType === 'iscsi' && ['iscsi', 'iscsidirect'].includes(type)) {
+ list = portal ? [portal] : [];
+ }
+ for (const entry of new Set(list)) {
+ users.set(entry, [...(users.get(entry) ?? []), storage]);
}
}
let suggestions = [...users.keys()]
.sort()
- .map((portal) => ({ portal, storages: users.get(portal).sort().join(', ') }));
+ .map((entry) => ({ portal: entry, storages: users.get(entry).sort().join(', ') }));
let field = me.down('field[name=portal]');
field.getStore().setData(suggestions);
field.setHideTrigger(!suggestions.length);
@@ -132,6 +175,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
onSubmit: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let wizard = me.up('window');
let values = me.getValues();
// a pasted portal can come with spaces around it
@@ -140,7 +184,9 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
let target = me.down('field[name=target]');
if (!values.target || target.discoveredPortal !== values.portal) {
wizard.showError(
- gettext('Select a target once the targets of this portal are listed.'),
+ nvme
+ ? gettext('Select a subsystem once the subsystems of this portal are listed.')
+ : gettext('Select a target once the targets of this portal are listed.'),
);
return;
}
@@ -182,9 +228,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
// the step showed which storage it reuses, if any, which must still hold
if (me.existingConnection()?.storage !== shown) {
wizard.showError(
- gettext(
- 'The iSCSI storage of this target changed in the meantime. Check this step, then retry.',
- ),
+ nvme
+ ? gettext(
+ 'The NVMe over Fabrics storage of this subsystem changed in the meantime. Check this step, then retry.',
+ )
+ : gettext(
+ 'The iSCSI storage of this target changed in the meantime. Check this step, then retry.',
+ ),
);
return;
}
@@ -212,25 +262,35 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
if (restricted.length) {
nodes = (selectedNodes.length ? selectedNodes : restricted).join(',');
}
- connected({ storage: base.storage, target: base.target, nodes });
+ connected({ storage: base.storage, target: base[me.targetKey], nodes });
return;
}
let params = {
- type: 'iscsi',
+ type: me.storageType,
storage: me.newConnectionId(),
- portal: values.portal,
- target: values.target,
content: 'none',
- 'managed-multipath': 1,
+ ...(nvme
+ ? // the storage configuration does not keep outer spaces, so neither may the
+ // copy that the cleanup compares
+ { subsysnqn: values.target, portals: values.portals.trim() }
+ : {
+ portal: values.portal,
+ target: values.target,
+ 'managed-multipath': 1,
+ }),
};
if (nodes) {
params.nodes = nodes;
}
if (params.storage === values.storage) {
wizard.showError(
- gettext(
- 'The storage for guest disks and the iSCSI storage need different IDs. Change the iSCSI Storage ID under Advanced.',
- ),
+ nvme
+ ? gettext(
+ 'The storage for guest disks and the NVMe over Fabrics storage need different IDs. Change the NVMe over Fabrics Storage ID under Advanced.',
+ )
+ : gettext(
+ 'The storage for guest disks and the iSCSI storage need different IDs. Change the iSCSI Storage ID under Advanced.',
+ ),
);
return;
}
@@ -238,9 +298,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
wizard.showError(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'The ID "{0}" for the iSCSI storage is already in use. Set another one under Advanced.',
- ),
+ nvme
+ ? gettext(
+ 'The ID "{0}" for the NVMe over Fabrics storage is already in use. Set another one under Advanced.',
+ )
+ : gettext(
+ 'The ID "{0}" for the iSCSI storage is already in use. Set another one under Advanced.',
+ ),
params.storage,
),
),
@@ -260,9 +324,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
initComponent: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
+ me.targetKey = nvme ? 'subsysnqn' : 'target';
+ me.onlineHelp = nvme ? 'storage_nvmeof' : 'storage_open_iscsi';
+ let targetLabel = nvme ? gettext('Subsystem') : gettext('Target');
let common = PVE.panel.StorageBase.commonFields(true);
// wide enough for the longest label of the step
- let labelWidth = 150;
+ let labelWidth = nvme ? 200 : 150;
let update = () => me.updateConnectionField();
let discovery = new Ext.util.DelayedTask(function () {
let portal = me.down('field[name=portal]').getValue()?.trim();
@@ -290,7 +358,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
{
xtype: 'combobox',
name: 'portal',
- fieldLabel: gettext('Portal'),
+ fieldLabel: nvme ? gettext('Discovery Portal') : gettext('Portal'),
labelWidth,
allowBlank: false,
queryMode: 'local',
@@ -317,6 +385,8 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
let target = me.down('field[name=target]');
target.setValue('');
target.disable();
+ // and the I/O portals of its subsystem
+ me.down('field[name=portals]')?.setValue('');
// an answer for the previous portal would select one of its targets
target.setPortal('');
discovery.delay(500);
@@ -324,46 +394,76 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
},
{
- xtype: 'pveIScsiScan',
+ xtype: nvme ? 'pveNVMeOFScan' : 'pveIScsiScan',
name: 'target',
- fieldLabel: gettext('Target'),
+ fieldLabel: targetLabel,
labelWidth,
disabled: true,
showNodeSelector: false,
nodename: Proxmox.NodeName,
- listeners: { change: update },
+ listeners: {
+ change: function (field, value) {
+ // the I/O portals that the discovery reported for the subsystem
+ let rec =
+ nvme &&
+ field.getStore().findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ me.down('field[name=portals]').setValue(rec.get('portals'));
+ }
+ update();
+ },
+ },
listConfig: {
width: 650,
- emptyText: PVE.Utils.renderNotFound(gettext('iSCSI Target')),
+ emptyText: PVE.Utils.renderNotFound(
+ nvme ? gettext('Subsystem') : gettext('iSCSI Target'),
+ ),
columns: [
{
- text: gettext('Target'),
- dataIndex: 'target',
+ text: targetLabel,
+ dataIndex: me.targetKey,
flex: 1,
renderer: Ext.htmlEncode,
},
{
text: gettext('Portals'),
- dataIndex: 'portal',
+ dataIndex: nvme ? 'portals' : 'portal',
width: 220,
renderer: Ext.htmlEncode,
},
],
},
},
+ ...(nvme
+ ? [
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ labelWidth,
+ allowBlank: false,
+ },
+ ]
+ : []),
{
xtype: 'component',
itemId: 'connectionNote',
margin: '0 0 10 0',
hidden: true,
},
- { xtype: 'pveStorageWizardNodeIdentities', listeners: { nodeschange: update } },
+ {
+ xtype: 'pveStorageWizardNodeIdentities',
+ identity: nvme ? 'nvme-host-nqn' : 'iscsi-initiator-name',
+ listeners: { nodeschange: update },
+ },
];
me.advancedItems = [
{
...common.id,
name: 'connection',
- fieldLabel: gettext('iSCSI Storage ID'),
+ fieldLabel: nvme
+ ? gettext('NVMe over Fabrics Storage ID')
+ : gettext('iSCSI Storage ID'),
labelWidth,
allowBlank: true,
},
@@ -393,12 +493,15 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
});
+// Both add the LVM storage the same way; only the volume ID that names its base differs.
Ext.define('PVE.storage.wizard.IScsi', {
extend: 'PVE.storage.wizard.SAN',
wizardType: 'iscsi',
createStorage: function (values, lun) {
let me = this;
+ let nvme = me.wizardType === 'nvmeof';
+ let suffix = nvme ? `:nvme-${lun.wwid}` : `.dm-uuid-mpath-${lun.wwid}`;
let fail = (response) => me.showError(response.htmlStatus);
Proxmox.Utils.API2Request({
url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(me.connection.storage)}/content`,
@@ -410,14 +513,16 @@ Ext.define('PVE.storage.wizard.IScsi', {
if (me.destroyed) {
return;
}
- let volume = response.result.data.find((entry) =>
- entry.volid.endsWith(`.dm-uuid-mpath-${lun.wwid}`),
- );
+ let volume = response.result.data.find((entry) => entry.volid.endsWith(suffix));
if (!volume) {
me.showError(
- gettext(
- 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
- ),
+ nvme
+ ? gettext(
+ 'The selected namespace is not available yet. Check Node > SAN, then retry.',
+ )
+ : gettext(
+ 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
+ ),
);
return;
}
@@ -426,3 +531,8 @@ Ext.define('PVE.storage.wizard.IScsi', {
});
},
});
+
+Ext.define('PVE.storage.wizard.NVMeOF', {
+ extend: 'PVE.storage.wizard.IScsi',
+ wizardType: 'nvmeof',
+});
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index 97b1405f5..6a9d3227c 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -10,8 +10,8 @@ Ext.define('PVE.storage.wizard.SAN', {
type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
),
- // Removes the iSCSI storage that a closed setup added if it still has the settings of the
- // setup and no storage uses it, and calls done in any case.
+ // Removes the iSCSI or NVMe over Fabrics storage that a closed setup added if it still has
+ // the settings of the setup and no storage uses it, and calls done in any case.
removeAddedConnection: function (connection, done) {
let id = connection.storage;
// the storage list adds these to the configuration of a storage
@@ -29,7 +29,7 @@ Ext.define('PVE.storage.wizard.SAN', {
gettext('Error'),
Ext.htmlEncode(
Ext.String.format(
- gettext('Could not remove iSCSI storage "{0}" of the closed setup'),
+ gettext('Could not remove storage "{0}" of the closed setup'),
id,
),
) + `: ${response.htmlStatus}`,
@@ -45,7 +45,7 @@ Ext.define('PVE.storage.wizard.SAN', {
let own = storages.find((entry) => entry.storage === id);
let created = connection.created;
let unchanged =
- own?.type === 'iscsi' &&
+ own?.type === created.type &&
keys(own).join() === keys(created).join() &&
keys(own).every((key) => text(key, own[key]) === text(key, created[key]));
let used = storages.some((entry) => `${entry.base ?? ''}`.startsWith(`${id}:`));
@@ -169,7 +169,7 @@ Ext.define('PVE.storage.wizard.SAN', {
};
},
- // Removes an iSCSI storage that the setup added for a storage it did not add, then reloads.
+ // Removes a connection storage that the setup added for a storage it did not add, then reloads.
cleanUp: function () {
let me = this;
let done = () => me.reloadCallback?.();
@@ -225,6 +225,7 @@ Ext.define('PVE.storage.wizard.SAN', {
storage: values.storage,
nodes: params.nodes,
fc: me.wizardType === 'fc',
+ nvme: me.wizardType === 'nvmeof',
autoShow: true,
});
};
@@ -233,6 +234,9 @@ Ext.define('PVE.storage.wizard.SAN', {
multipathSummary: function (lun) {
let me = this;
+ if (me.wizardType === 'nvmeof') {
+ return PVE.SANUtils.multipathText('native');
+ }
// an explicit entry takes precedence, also for a LUN of the iSCSI storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
@@ -257,7 +261,9 @@ Ext.define('PVE.storage.wizard.SAN', {
...(connection
? [
[
- gettext('iSCSI Storage'),
+ me.wizardType === 'nvmeof'
+ ? gettext('NVMe over Fabrics Storage')
+ : gettext('iSCSI Storage'),
connection.created
? Ext.String.format(
gettext('{0}, added by this setup'),
@@ -302,10 +308,15 @@ Ext.define('PVE.storage.wizard.SAN', {
me.down('#action').setHtml(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- // TRANSLATORS: {0} is the label of the Finish button.
- '{0} creates the volume group "{1}" on this LUN and adds it as shared LVM storage "{2}".',
- ),
+ me.wizardType === 'nvmeof'
+ ? gettext(
+ // TRANSLATORS: {0} is the label of the Finish button.
+ '{0} creates the volume group "{1}" on this namespace and adds it as shared LVM storage "{2}".',
+ )
+ : gettext(
+ // TRANSLATORS: {0} is the label of the Finish button.
+ '{0} creates the volume group "{1}" on this LUN and adds it as shared LVM storage "{2}".',
+ ),
gettext('Finish'),
values.vgname,
values.storage,
@@ -350,10 +361,13 @@ Ext.define('PVE.storage.wizard.SAN', {
initComponent: function () {
let me = this;
- if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ if (!['iscsi', 'fc', 'nvmeof'].includes(me.wizardType)) {
throw 'no SAN storage type specified';
}
- let iscsi = me.wizardType === 'iscsi';
+ // the iSCSI and NVMe over Fabrics setups connect to the array with a storage first
+ let target = me.wizardType !== 'fc';
+ let nvme = me.wizardType === 'nvmeof';
+ let onlineHelp = nvme ? 'storage_nvmeof' : 'storage_multipath';
me.subject = PVE.storage.wizard.SAN.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
let common = PVE.panel.StorageBase.commonFields(true);
@@ -369,9 +383,9 @@ Ext.define('PVE.storage.wizard.SAN', {
let settings = {
xtype: 'inputpanel',
title: gettext('Storage'),
- onlineHelp: 'storage_multipath',
+ onlineHelp,
items: [
- ...(iscsi
+ ...(target
? []
: [
{
@@ -389,29 +403,31 @@ Ext.define('PVE.storage.wizard.SAN', {
],
advancedItems: [
vgname,
- ...(iscsi
+ ...(target
? []
: [{ ...common.nodes, validator: PVE.storage.wizard.SAN.validateNodes }]),
],
itemId: 'settings',
};
me.items = [
- ...(iscsi
+ ...(target
? [
{
- xtype: 'pveStorageWizardIScsiTarget',
- title: gettext('Target'),
+ xtype: 'pveStorageWizardTarget',
+ storageType: me.wizardType,
+ title: nvme ? gettext('Subsystem') : gettext('Target'),
itemId: 'target',
},
]
: []),
{
xtype: 'pveStorageWizardLunSelect',
- title: 'LUN',
+ title: nvme ? gettext('Namespace') : 'LUN',
itemId: 'luns',
- onlineHelp: 'storage_multipath',
+ nvme,
+ onlineHelp,
// the nodes only see a newly mapped Fibre Channel LUN after a rescan
- rescanNote: iscsi
+ rescanNote: target
? undefined
: Ext.String.format(
gettext(
@@ -460,14 +476,14 @@ Ext.define('PVE.storage.wizard.SAN', {
me.down('#settings').on('activate', followId);
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (iscsi && tab === me.down('#luns')) {
+ if (target && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- if (iscsi) {
+ if (target) {
me.down('#submit').setText(gettext('Next'));
}
me.on('destroy', () => !me.writing && me.cleanUp());
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index d257e99ba..5dfce247a 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -20,8 +20,11 @@ Ext.define('PVE.window.SANLunState', {
if (!me.wwid) {
throw 'no LUN specified';
}
+ let title = me.nvme
+ ? gettext('Storage {0}: Namespace State')
+ : gettext('Storage {0}: LUN State');
me.title = me.storage
- ? Ext.String.format(gettext('Storage {0}: LUN State'), me.storage)
+ ? Ext.String.format(title, me.storage)
: Ext.String.format(
gettext('LUN {0}: Paths by Node'),
Ext.htmlEncode(me.name || me.wwid),
@@ -56,13 +59,17 @@ Ext.define('PVE.window.SANLunState', {
sortAfterUpdate: true,
});
let added = Ext.String.format(gettext('Storage "{0}" was added.'), me.storage);
- let missingAdvice = me.fc
+ let missingAdvice = me.nvme
? gettext(
- 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and zoning on the array, then rescan the Fibre Channel hosts on {0}.',
+ 'The namespace is missing on {0}, so guests on this storage cannot run there. Check the host access to the subsystem on the array.',
)
- : gettext(
- 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and initiator access on the array.',
- );
+ : me.fc
+ ? gettext(
+ 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and zoning on the array, then rescan the Fibre Channel hosts on {0}.',
+ )
+ : gettext(
+ 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and initiator access on the array.',
+ );
let updateAdvice = function () {
if (me.destroyed || !me.storage) {
return;
@@ -79,7 +86,12 @@ Ext.define('PVE.window.SANLunState', {
let text = [
added,
waiting &&
- Ext.String.format(gettext('Waiting for a LUN report from: {0}.'), waiting),
+ Ext.String.format(
+ me.nvme
+ ? gettext('Waiting for a namespace report from: {0}.')
+ : gettext('Waiting for a LUN report from: {0}.'),
+ waiting,
+ ),
missing && Ext.String.format(missingAdvice, missing),
];
me.down('#advice').setHtml(Ext.htmlEncode(text.filter(Boolean).join(' ')));
@@ -97,7 +109,9 @@ Ext.define('PVE.window.SANLunState', {
flex: 1,
store,
disableSelection: true,
- emptyText: gettext('No node reported this LUN yet.'),
+ emptyText: me.nvme
+ ? gettext('No node reported this namespace yet.')
+ : gettext('No node reported this LUN yet.'),
columns: [
{
text: gettext('Node'),
^ permalink raw reply related [relevance 19%]
* [PATCH v5 docs 16/26] storage: document NVMe over Fabrics storages
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (11 preceding siblings ...)
2026-11-23 13:32 5% ` [PATCH v5 storage 15/26] d/control: break pve-manager versions without namespace notifications Thomas Lamprecht
@ 2026-11-23 13:32 19% ` Thomas Lamprecht
2026-11-23 13:32 18% ` [PATCH v5 manager 18/26] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
` (6 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
Add a chapter for the nvmeof storage type: prerequisites, setting up
shared LVM on a namespace with the guided setup or by hand, the
properties, checking and disconnecting paths, and the limits of the
storage type. The introduction lists it among the network storages, and
the LVM chapter names it next to iSCSI as base storage.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
notifications.adoc | 5 +-
pve-gui.adoc | 12 ++-
pve-intro.adoc | 3 +-
pve-storage-lvm.adoc | 10 +-
pve-storage-multipath.adoc | 3 +-
pve-storage-nvmeof.adoc | 207 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 24 +++--
7 files changed, 243 insertions(+), 21 deletions(-)
create mode 100644 pve-storage-nvmeof.adoc
diff --git a/notifications.adoc b/notifications.adoc
index 96ca47b..b5606a3 100644
--- a/notifications.adoc
+++ b/notifications.adoc
@@ -495,8 +495,9 @@ Notification Events
| `job-id` | Job ID
|=======================================================================
-A `multipath` notification groups affected LUNs on the same node. If any LUN
-in a problem notification is *Failed*, the severity is `error`.
+A `multipath` notification groups the affected LUNs and NVMe namespaces of a
+node. If any of them in a problem notification is *Failed*, the severity is
+`error`.
NOTE: Backup job notifications only have `job-id` set if the backup job
was executed automatically based on its schedule, but not if it was triggered
diff --git a/pve-gui.adoc b/pve-gui.adoc
index 9a1f70b..a514eca 100644
--- a/pve-gui.adoc
+++ b/pve-gui.adoc
@@ -233,10 +233,11 @@ On the datacenter level, you can access cluster-wide settings and information.
* *Options:* view and manage cluster-wide default settings.
* *Storage:* provides an interface for managing cluster storage. The *Add* menu
- offers guided setups for shared LVM on iSCSI and Fibre Channel LUNs.
+ offers guided setups for shared LVM on iSCSI and Fibre Channel LUNs and on
+ NVMe over Fabrics namespaces.
-* *SAN:* shows the state of the SAN LUNs on all nodes and manages the multipath
- configuration.
+* *SAN:* shows the state of the SAN LUNs and NVMe namespaces on all nodes and
+ manages the multipath configuration.
* *Backup:* schedule backup jobs. This operates cluster wide, so it doesn't
matter where the VMs/containers are on your cluster when scheduling.
@@ -288,8 +289,9 @@ The top header has useful buttons such as 'Reboot', 'Shutdown', 'Shell',
* *Disks:* get an overview of the attached disks, and manage how they are used.
-* *SAN:* get an overview of the SAN LUNs of the node, with their paths and
- usage. Below it, *iSCSI* shows the iSCSI targets and sessions.
+* *SAN:* get an overview of the SAN LUNs and NVMe namespaces of the node, with
+ their paths and usage. Below it, *iSCSI* shows the iSCSI targets and sessions,
+ and *NVMe over Fabrics* the connected controllers.
* *Ceph:* is only used if you have installed a Ceph server on your
host. In this case, you can manage your Ceph cluster and see the status
diff --git a/pve-intro.adoc b/pve-intro.adoc
index c2a0b6a..baec59f 100644
--- a/pve-intro.adoc
+++ b/pve-intro.adoc
@@ -103,9 +103,10 @@ the cluster have direct access to VM disk images.
The following network storage types are supported:
-* LVM group (network backing with iSCSI targets)
+* LVM group (network backing with iSCSI targets or NVMe over Fabrics)
* iSCSI target
* iSCSI LUNs (direct use)
+* NVMe over Fabrics subsystem
* NFS share
* CIFS share
* Ceph RBD
diff --git a/pve-storage-lvm.adoc b/pve-storage-lvm.adoc
index 92019fc..8b9564c 100644
--- a/pve-storage-lvm.adoc
+++ b/pve-storage-lvm.adoc
@@ -34,7 +34,8 @@ LVM volume group name. This must point to an existing volume group.
Base volume. This volume is automatically activated before accessing
the storage. This is mostly useful when the LVM volume group resides
-on a remote iSCSI server.
+on a remote iSCSI server or on an xref:storage_nvmeof[NVMe over Fabrics]
+namespace.
`saferemove`::
@@ -143,9 +144,10 @@ A benefit of LVM is that it can be used with shared storage.
For example, an iSCSI LUN. The backend implements proper cluster-wide locking if
the storage is marked as shared in the configuration.
-TIP: *Shared LVM on iSCSI* or *Shared LVM on Fibre Channel* in *Datacenter ->
-Storage -> Add* in the web UI creates a shared LVM storage on a SAN LUN, see
-xref:storage_multipath_setup[Multipath].
+TIP: *Shared LVM on iSCSI*, *Shared LVM on Fibre Channel* or *Shared LVM on NVMe
+over Fabrics* in *Datacenter -> Storage -> Add* in the web UI creates a shared
+LVM storage on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace].
NOTE: If you extend a shared volume group onto another device on one node, the
other nodes may only see the added physical volume after LVM has scanned their
diff --git a/pve-storage-multipath.adoc b/pve-storage-multipath.adoc
index 3e07eba..45ab3a8 100644
--- a/pve-storage-multipath.adoc
+++ b/pve-storage-multipath.adoc
@@ -15,7 +15,8 @@ Fibre Channel.
{pve} sets up the maps on all nodes and shows their state under *Datacenter ->
SAN*. An iSCSI storage with *Multipath* enabled requests the maps of its LUNs, a
Fibre Channel LUN needs a multipath entry. NVMe namespaces use the multipath
-support of the kernel instead and are not covered here.
+support of the kernel instead, see xref:storage_nvmeof[NVMe over Fabrics], and
+are not covered here.
Prerequisites
~~~~~~~~~~~~~
diff --git a/pve-storage-nvmeof.adoc b/pve-storage-nvmeof.adoc
new file mode 100644
index 0000000..3a37045
--- /dev/null
+++ b/pve-storage-nvmeof.adoc
@@ -0,0 +1,207 @@
+[[storage_nvmeof]]
+NVMe over Fabrics Backend
+-------------------------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: NVMe over Fabrics
+endif::wiki[]
+
+Storage pool type: `nvmeof`
+
+NVMe over Fabrics (NVMe-oF) gives a node access to the namespaces of an NVMe
+subsystem on a storage array over TCP. Namespaces are the NVMe counterpart of
+LUNs. Use one as the base volume of a shared LVM storage, or use the namespaces
+directly as disk images.
+
+Each node connects one controller per portal of the storage. The kernel
+combines these paths into one device per namespace with its native NVMe
+multipath and reconnects lost paths on its own. `multipath-tools` is not
+involved.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+. Upgrade all nodes to `pve-manager` 9.2.38 or newer before adding the first
+ NVMe over Fabrics storage, also nodes that will not use it. A node without
+ support for this storage type removes such storages from the cluster-wide
+ storage configuration when it writes that configuration, for example when a
+ storage is added or edited on that node. Adding the first such storage is
+ refused while a node is offline or runs an older version.
+. Install `nvme-cli` on every participating node. The `libpve-storage-perl`
+ package recommends it, but installations without recommended packages need it
+ added separately. Its installation creates the node's host NQN in
+ `/etc/nvme/hostnqn` and host ID in `/etc/nvme/hostid`. Nodes cloned from one
+ image share them. Give each a new identity before it connects, with
+ `nvme gen-hostnqn > /etc/nvme/hostnqn` and `uuidgen > /etc/nvme/hostid`.
+. Allow each node's host NQN on the array. The names are shown under
+ *Datacenter -> SAN* and in the guided setup.
+. Present the same namespace to all intended nodes. Portals are IP addresses
+ that every node of the storage can reach; host names are not accepted.
+. Use a storage network that only trusted hosts can reach. The connections use
+ neither authentication nor TLS.
+. Keep native NVMe multipath enabled, which is the kernel default
+ (`nvme_core.multipath=Y`). It joins the paths of a namespace only if the
+ target declares that the subsystem may have several controllers, which most
+ targets do, also with a single portal. A namespace that it does not join is
+ refused as volume.
+
+[[storage_nvmeof_setup]]
+Setting Up Shared LVM
+~~~~~~~~~~~~~~~~~~~~~
+
+. On a node that can reach the array, select *Shared LVM on NVMe over Fabrics*
+ under *Datacenter -> Storage -> Add*. The *Add Shared LVM* menu of
+ *Datacenter -> SAN* has the same setup.
+. Enter the *ID* of the new LVM storage, a discovery portal and the subsystem,
+ and check the portals. If no NVMe over Fabrics storage connects the nodes to
+ that subsystem yet, the setup adds one named after the ID with a `-base`
+ suffix, or as set under *Advanced*. This storage connects to the subsystem
+ with `content none`, while the LVM storage manages guest disks. Clear the
+ nodes in the list of host NQNs that should not use the storages. Continuing
+ creates or reuses the NVMe over Fabrics storage before you select a namespace.
+. Select the namespace after checking that no host uses it and that no data on
+ it must be kept. The volume group is named after the ID unless set under
+ *Advanced*.
+. Check the state of the namespace on each node of the storage, which the
+ setup shows once the storage is added, as described for LUNs in
+ xref:storage_multipath_setup[Multipath]. For a node that stays *Missing*,
+ check its access to the namespace on the array before placing guests on the
+ storage.
+
+The discovery fills in *Portals*. A discovery portal without a port is asked at
+port 8009, or at 4420 if that fails. Some targets, such as the Linux kernel
+target, report only the portal that was asked: add the others to the list.
+With a single portal, the state of the namespace shows `1/1`, which has no path
+redundancy.
+Portals can also be changed later in the edit dialog of the NVMe over Fabrics
+storage; each node then connects new ones on its own. The guided setup needs
+the discovery service of the target, also to reuse an existing connection;
+without one, add the storages as described next.
+
+*Datacenter -> Storage -> Add -> NVMe over Fabrics* adds only the NVMe over
+Fabrics storage. Without a discovery portal, enter the subsystem NQN and its
+portals as they are. Enable *Use namespaces directly* there to use whole
+namespaces as guest disks, or add an *LVM* storage on a namespace later, with
+the NVMe over Fabrics storage as *Base storage*. Both at once are refused, as
+with direct use every namespace of the subsystem counts as in use by the
+storage. Before disabling direct use, check that no guest on any node has a
+namespace of the subsystem configured as disk: disabling it does not detach such
+disks.
+
+To set it up by hand, run these commands on a node that can reach the array:
+
+----
+# pvesm scan nvmeof <portal>
+# pvesm add nvmeof <nvmeof-storage> --subsysnqn <nqn> --portals <portals> \
+ --content none
+# pvesm list <nvmeof-storage>
+# pvesm add lvm <storage> --vgname <vg> --base <volume-id> --shared 1
+----
+
+Use the complete volume ID from the listing, `<nvmeof-storage>:nvme-<wwid>`.
+Adding the LVM storage creates the volume group if it does not exist yet.
+Creating it is refused if the namespace holds data that {pve} recognizes, such
+as partitions, a file system or a volume group, or if another storage references
+it. To keep an existing volume group, add the LVM storage with its name. To
+discard the data of a namespace instead, stop its users on all hosts and wipe it
+as described for LUNs in xref:storage_multipath_setup[Multipath].
+
+Configuration
+~~~~~~~~~~~~~
+
+The backend supports the common storage properties `content`, `nodes`,
+`disable`, and the following NVMe over Fabrics specific properties:
+
+subsysnqn::
+
+The NQN of the NVMe subsystem. It cannot be changed later, and only one storage
+can use a subsystem.
+
+portals::
+
+Comma-separated list of the subsystem's TCP portals, one per path. Each is an
+IPv4 address or an IPv6 address in brackets, with an optional port (default
+4420).
+
+fast-io-fail-tmo::
+
+Seconds a path may be reconnecting before I/O sent to it fails. The default is
+120 seconds. If no usable path of a namespace remains, its I/O can fail once its
+paths have been reconnecting that long. With `-1`, I/O waits until a path
+returns. A change applies to newly connected controllers only.
+
+.Configuration Example (`/etc/pve/storage.cfg`)
+----
+nvmeof: fabric
+ subsysnqn nqn.2010-06.com.example:array1
+ portals 192.0.2.10,192.0.2.11
+ content none
+----
+
+.Storage features for backend `nvmeof`
+[width="100%",cols="m,m,3*d",options="header"]
+|==============================================================================
+|Content types |Image formats |Shared |Snapshots |Clones
+|images none |raw |yes |no |no
+|==============================================================================
+
+{pve} does not create or delete namespaces; manage them on the array. A volume
+is named `nvme-<wwid>` after its namespace, like its link in `/dev/disk/by-id/`.
+
+Checking and Disconnecting Paths
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Datacenter -> SAN* lists the namespaces of NVMe over Fabrics storages among the
+LUNs, with their state on each node of the storage and *Multipath* shown as
+*Native*, as does *Node -> SAN* for the namespaces of a node. Expand a namespace
+under *Node -> SAN* to inspect its paths. Its *State* counts the usable paths
+out of the portals of the storage, or out of the connected paths if more are
+connected, for example `1/2` while one of two paths is unusable, and shows
+*Failed* without a usable path. *Node -> SAN -> NVMe over Fabrics* lists the
+node's controllers, one per connected portal, with their *State*: *Connected*,
+or *Reconnecting* while the kernel retries a lost path. A node sends a
+xref:notification_events[multipath notification] when the paths of a namespace
+stay degraded or failed in two consecutive checks, and when they recover, under
+the same rules as for a LUN. This does not need `multipathd`.
+
+Each node of an enabled storage connects to the portals that it is not yet
+connected to. A portal that failed is retried after a minute. Removing a portal,
+or disabling or removing the storage, does not disconnect anything. To remove
+such a path, select its controller under *Node -> SAN -> NVMe over Fabrics* on
+each node and press *Disconnect*, or run
+`pvesh delete /nodes/<node>/san/nvmeof/controller/<controller>`. This is refused
+if a namespace that is mounted, in use by another device or as swap, open in a
+process such as a running guest, or referenced by a storage would lose its last
+usable path. If the controller is no usable path itself, such as one that keeps
+reconnecting to a deleted subsystem, the local uses are still checked, but not
+the storage references, as that check reads the namespace. While a namespace has
+no usable path, its I/O waits until a path is usable again, or until
+`fast-io-fail-tmo` has passed for reconnecting controllers. An LVM command of
+the status checks can keep the namespace open meanwhile, and Disconnect refuses
+while it does. The process check does not find a process that opened the
+namespace through another device node, for example one in a container. A
+controller with namespaces that do not use native NVMe multipath is refused as
+well. A storage that still lists the portal connects to it again. Namespaces of
+a subsystem that no storage uses then show fewer paths, but none as missing, as
+nothing tells how many paths they should have.
+
+Limits
+~~~~~~
+
+* Only the TCP transport is supported, without authentication or TLS.
+* The disk lists under *Node -> Disks* and for Ceph OSDs leave out namespaces
+ attached over TCP or RDMA, like iSCSI LUNs, as other nodes use them too.
+ *Node -> SAN* lists them.
+* NVMe/FC namespaces need no storage of this type, and the guided setups and
+ the cluster-wide status do not cover them. *Node -> SAN* lists them. Create
+ their volume group on the whole namespace under *Node -> Disks -> LVM*; with
+ *Add Storage* enabled, this adds a shared LVM storage.
+
+ifdef::wiki[]
+
+See Also
+~~~~~~~~
+
+* link:/wiki/Storage[Storage]
+
+endif::wiki[]
diff --git a/pvesm.adoc b/pvesm.adoc
index 8f1b24e..0bea1d2 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -79,6 +79,7 @@ nodes that can be accessed as RBD (RADOS Block Device).
|LVM-thin |lvmthin |block |no |yes |yes
|iSCSI/kernel |iscsi |block |yes^3^|yes^4^ |yes
|iSCSI/libiscsi |iscsidirect |block |yes^3^|yes^4^ |yes
+|NVMe-oF |nvmeof |block |yes^3^|yes^4^ |yes
|FC/SAS |native^6^ |block |yes^3^|yes^4^ |yes
|Ceph/RBD |rbd |block |yes |yes |yes
|ZFS over iSCSI |zfs |block |yes |yes |yes
@@ -96,11 +97,13 @@ TiB sized), these operations may take several minutes, or in extreme cases, even
hours. If your setup is affected, create and remove snapshots while the VM is
shut down, expecting a long task duration.
-^3^: With iSCSI, Fibre Channel (FC), or SAS block storage as shared storage in
-a cluster, LVM is used to split the LUN into virtual disks. A LUN is usually
-reachable over several paths; xref:storage_multipath[Multipath] describes how
-{pve} manages them in a cluster. FC and SAS LUNs need a
-xref:storage_multipath_entries[multipath entry].
+^3^: With iSCSI, NVMe over Fabrics (NVMe-oF), Fibre Channel (FC), or SAS block
+storage as shared storage in a cluster, LVM is used to split the LUN or
+namespace into virtual disks. A LUN is usually reachable over several paths;
+xref:storage_multipath[Multipath] describes how {pve} manages them in a cluster.
+FC and SAS LUNs need a xref:storage_multipath_entries[multipath entry].
+NVMe-oF namespaces use the kernel's native multipath instead, see
+xref:storage_nvmeof[NVMe over Fabrics].
^4^: Since {pve} 9, snapshots as a volume chain have been available for VMs.
These snapshots use separate volumes for the snapshot data and layer them. For
@@ -154,9 +157,10 @@ is available on all nodes, but it is physically different and can have
totally different content.
Add storage under *Datacenter -> Storage -> Add* in the web UI. For shared LVM
-on a xref:storage_multipath_setup[SAN LUN], use *Shared LVM on iSCSI* or
-*Shared LVM on Fibre Channel* there instead. It creates the storages that are
-needed and enables multipath for the LUN.
+on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace], use *Shared LVM on iSCSI*, *Shared
+LVM on Fibre Channel* or *Shared LVM on NVMe over Fabrics* there instead. It
+creates the storages that are needed and enables multipath for a LUN.
Storage Pools
@@ -507,6 +511,8 @@ See Also
* link:/wiki/Storage:_Multipath[Storage: Multipath]
+* link:/wiki/Storage:_NVMe_over_Fabrics[Storage: NVMe over Fabrics]
+
* link:/wiki/Storage:_LVM[Storage: LVM]
* link:/wiki/Storage:_LVM_Thin[Storage: LVM Thin]
@@ -551,6 +557,8 @@ include::pve-storage-iscsidirect.adoc[]
include::pve-storage-multipath.adoc[]
+include::pve-storage-nvmeof.adoc[]
+
include::pve-storage-rbd.adoc[]
include::pve-storage-cephfs.adoc[]
^ permalink raw reply related [relevance 19%]
* [PATCH v5 storage 12/26] api: add node-level NVMe over Fabrics status and controller removal
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (7 preceding siblings ...)
2026-11-23 13:32 20% ` [PATCH v5 storage 11/26] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
@ 2026-11-23 13:32 17% ` Thomas Lamprecht
2026-11-23 13:32 10% ` [PATCH v5 storage 13/26] multipath: report the NVMe host NQN of each node Thomas Lamprecht
` (10 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
The host NQN for the access rules of an array and the controllers of a
node are only visible with nvme-cli on a shell. Add the API module for
/nodes/{node}/san/nvmeof with the host identity and the fabrics
controllers with their subsystem, portal, state and storage. The
namespaces of all subsystems are counted in one pass for that list, as a
node can have a thousand controllers, for example with a storage plugin
that uses a subsystem per guest disk.
Removing a portal or the storage leaves its controllers connected, so
add the removal of a controller. It is refused if a namespace would lose
its last usable path while it is mounted, also in another mount
namespace, has holders, is a swap area, is open in a process or is
referenced by a storage. An opener that is gone within a second, like an
LVM scan, does not count. A controller that is no usable path itself,
such as one that keeps reconnecting to a deleted subsystem, only needs
the local checks, as the check of the storage references reads the
namespace.
As paths can fail or recover and namespaces appear while these checks
run, the paths, the namespaces and the controller are checked again
right before the removal. A controller with namespaces outside of native
NVMe multipath is refused, as they lack the head devices that these
checks go by. The caller can pass the subsystem and portal it listed, to
refuse a controller number that the kernel reused meanwhile.
Reading needs Sys.Audit on the node or Datastore.Allocate on /storage,
the removal Sys.Modify on '/'.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 200 +++++++++++++++++++++
src/PVE/API2/SAN/Node.pm | 8 +-
src/PVE/Diskmanage.pm | 18 +-
src/PVE/NVMeOF.pm | 230 ++++++++++++++++++++++---
src/test/Makefile | 3 +-
src/test/run_nvmeof_api_tests.pl | 287 +++++++++++++++++++++++++++++++
src/test/run_nvmeof_tests.pl | 8 +
src/test/run_san_api_tests.pl | 2 +-
9 files changed, 723 insertions(+), 34 deletions(-)
create mode 100644 src/PVE/API2/NVMeOF.pm
create mode 100755 src/test/run_nvmeof_api_tests.pl
diff --git a/src/PVE/API2/Makefile b/src/PVE/API2/Makefile
index 70ff1ec4..07773db1 100644
--- a/src/PVE/API2/Makefile
+++ b/src/PVE/API2/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Disks.pm ${DESTDIR}${PERLDIR}/PVE/API2/Disks.pm
install -D -m 0644 ISCSI.pm ${DESTDIR}${PERLDIR}/PVE/API2/ISCSI.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/API2/NVMeOF.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/API2/Multipath.pm
make -C Storage install
make -C Disks install
diff --git a/src/PVE/API2/NVMeOF.pm b/src/PVE/API2/NVMeOF.pm
new file mode 100644
index 00000000..9205d084
--- /dev/null
+++ b/src/PVE/API2/NVMeOF.pm
@@ -0,0 +1,200 @@
+package PVE::API2::NVMeOF;
+
+use v5.36;
+
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTHandler;
+use PVE::RPCEnvironment;
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+use base qw(PVE::RESTHandler);
+
+my $read_permissions = {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+};
+my $controller_schema = {
+ description => 'The fabrics controller name, for example nvme3.',
+ type => 'string',
+ pattern => 'nvme[0-9]+',
+};
+
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ method => 'GET',
+ proxyto => 'node',
+ permissions => { user => 'all' },
+ description => 'Node NVMe over Fabrics index.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => { type => 'object', properties => { name => { type => 'string' } } },
+ links => [{ rel => 'child', href => '{name}' }],
+ },
+ code => sub { return [{ name => 'status' }, { name => 'controller' }] },
+});
+
+__PACKAGE__->register_method({
+ name => 'status',
+ path => 'status',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'Report the NVMe host identity and nvme-cli availability.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ supported => { type => 'boolean', description => 'Whether nvme-cli is installed.' },
+ 'host-nqn' => {
+ type => 'string',
+ optional => 1,
+ description => 'The host NQN for target access control.',
+ },
+ 'host-id' =>
+ { type => 'string', optional => 1, description => 'The persistent host UUID.' },
+ error => {
+ type => 'string',
+ optional => 1,
+ description => 'Why the host identity is unavailable.',
+ },
+ },
+ },
+ code => sub {
+ my $res = { supported => PVE::NVMeOF::is_supported() };
+ my $host = eval { PVE::NVMeOF::host_identity() };
+ if (my $error = $@) {
+ chomp $error;
+ $res->{error} = $error;
+ } else {
+ $res->{'host-nqn'} = $host->{nqn};
+ $res->{'host-id'} = $host->{id};
+ }
+ return $res;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'controllers',
+ path => 'controller',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'List connected NVMe over Fabrics controllers and their states.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ controller => $controller_schema,
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ transport => { type => 'string', description => 'The controller transport.' },
+ portal => {
+ type => 'string',
+ description => 'The controller address and port, if applicable.',
+ },
+ state => {
+ type => 'string',
+ description => 'The controller state, such as live or connecting.',
+ },
+ namespaces => {
+ type => 'integer',
+ description => 'The number of namespaces of the subsystem, counted by the'
+ . ' devices that native NVMe multipath creates for them.',
+ },
+ 'used-by-storage' => {
+ type => 'string',
+ optional => 1,
+ description => 'An NVMe over Fabrics storage using the subsystem.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my $cfg = PVE::Storage::config();
+ my %owners;
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $owners{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
+ }
+ my $controllers = PVE::NVMeOF::controllers();
+ my $counts = PVE::NVMeOF::namespace_counts();
+ my @rows;
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ my $nqn = $ctrl->{subsystem};
+ push @rows,
+ {
+ controller => $name,
+ subsysnqn => $nqn,
+ transport => $ctrl->{transport},
+ portal => PVE::NVMeOF::format_path($ctrl),
+ state => $ctrl->{state},
+ namespaces => $counts->{$nqn} // 0,
+ defined($owners{$nqn}) ? ('used-by-storage' => $owners{$nqn}) : (),
+ };
+ }
+ return \@rows;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'disconnect',
+ path => 'controller/{controller}',
+ method => 'DELETE',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/', ['Sys.Modify']] },
+ description => 'Disconnect one fabrics controller. Refuse when a namespace in use has no'
+ . ' other usable path. A storage still listing the portal reconnects it on activation.',
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ controller => $controller_schema,
+ subsysnqn => {
+ type => 'string',
+ maxLength => 223,
+ optional => 1,
+ description => 'Refuse unless the controller still has this subsystem NQN.',
+ },
+ portal => {
+ type => 'string',
+ maxLength => 128,
+ optional => 1,
+ description => 'Refuse unless the controller still has this portal.',
+ },
+ },
+ },
+ returns => { type => 'string', description => 'The task identifier.' },
+ code => sub($param) {
+ my $rpcenv = PVE::RPCEnvironment::get();
+ return $rpcenv->fork_worker(
+ 'nvmedisconnect',
+ $param->{controller},
+ $rpcenv->get_user(),
+ sub {
+ PVE::NVMeOF::disconnect_guarded(
+ $param->{controller},
+ { subsysnqn => $param->{subsysnqn}, portal => $param->{portal} },
+ );
+ },
+ );
+ },
+});
+
+1;
diff --git a/src/PVE/API2/SAN/Node.pm b/src/PVE/API2/SAN/Node.pm
index 4b96caf5..260c95f7 100644
--- a/src/PVE/API2/SAN/Node.pm
+++ b/src/PVE/API2/SAN/Node.pm
@@ -10,6 +10,7 @@ use PVE::Storage;
use PVE::Storage::SAN;
use PVE::API2::ISCSI;
+use PVE::API2::NVMeOF;
use base qw(PVE::RESTHandler);
@@ -18,6 +19,11 @@ __PACKAGE__->register_method({
path => 'iscsi',
});
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::NVMeOF",
+ path => 'nvmeof',
+});
+
__PACKAGE__->register_method({
name => 'index',
path => '',
@@ -42,7 +48,7 @@ __PACKAGE__->register_method({
links => [{ rel => 'child', href => "{name}" }],
},
code => sub {
- return [map { +{ name => $_ } } qw(iscsi luns)];
+ return [map { +{ name => $_ } } qw(iscsi luns nvmeof)];
},
});
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 2790aedf..8cee0bff 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -971,6 +971,15 @@ sub get_multipath_disks {
return $disklist;
}
+# 'change' is transient; paths in 'inaccessible' or 'persistent-loss' cannot serve IO even on a live
+# controller
+sub nvme_path_is_usable {
+ my ($path) = @_;
+ my $ana = $path->{'ana-state'};
+ return $path->{state} eq 'live'
+ && (!defined($ana) || $ana eq 'optimized' || $ana eq 'non-optimized');
+}
+
# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
# single-controller devices lack these children and are omitted.
sub get_nvme_path_status {
@@ -1006,15 +1015,8 @@ sub get_nvme_path_status {
my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
$entry->{'ana-state'} = $ana if defined($ana);
- # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
- # cannot serve IO even on a live controller
- my $usable = $state eq 'live'
- && (!defined($ana)
- || $ana eq 'optimized'
- || $ana eq 'non-optimized');
-
my $status = $res->{$head} //= { active => 0, paths => [] };
- $status->{active}++ if $usable;
+ $status->{active}++ if nvme_path_is_usable($entry);
push @{ $status->{paths} }, $entry;
},
);
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index 9744e471..2f18e254 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -4,7 +4,8 @@ use v5.36;
use Cwd qw(abs_path);
use Digest::SHA qw(sha1_hex);
-use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
+use Errno qw(EBUSY ENOENT);
+use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC O_EXCL O_RDONLY);
use File::Basename qw(basename);
use File::Path qw(make_path);
use JSON qw(decode_json);
@@ -12,6 +13,7 @@ use POSIX qw(ceil);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use Time::HiRes ();
+use PVE::Cluster;
use PVE::JSONSchema;
use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
@@ -24,6 +26,7 @@ our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
our $HOSTID_FILE = '/etc/nvme/hostid';
our $RUN_DIR = '/run/pve/nvmeof';
our $LOCK_WAIT = 10;
+our $SWAPS = '/proc/swaps';
# no control characters, which could reach logs and the arguments of nvme-cli
our $NQN_PATTERN = 'nqn\.[^\s\x00-\x1f\x7f,=]+';
our $DISCOVERY_NQN = 'nqn.2014-08.org.nvmexpress.discovery';
@@ -175,34 +178,58 @@ sub path_controller($controllers, $path) {
return undef;
}
-sub namespaces($subsystem) {
- my $res = {};
+# Calls $code with the subsystem NQN and the device name of each namespace of this node, or only
+# of those of the subsystem $only.
+my sub foreach_namespace($code, $only = undef) {
my $dir = "$SYSFS/class/nvme-subsystem";
- dir_glob_foreach(
- $dir,
- 'nvme-subsys[0-9]+',
- sub($subsys, @) {
- # one that cannot be read could be this subsystem, whose namespaces must not look gone
- my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn")
- // die "cannot read the NQN of NVMe subsystem '$subsys'\n";
- return if $nqn ne $subsystem;
- dir_glob_foreach(
- "$dir/$subsys",
- 'nvme[0-9]+n[0-9]+',
- sub($dev, @) {
- # a failed read must not look like a namespace that is gone
- my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid")
- // die "cannot read the WWID of namespace '$dev'\n";
- my $size = file_read_firstline("$SYSFS/block/$dev/size")
- // die "cannot read the size of namespace '$dev'\n";
- $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
- },
- );
+ # For one subsystem, the caller goes by which namespaces are missing, so a directory that cannot
+ # be read must not look empty. One that is gone is.
+ my $entries = sub($path, $pattern) {
+ my $dh;
+ if (!opendir($dh, $path)) {
+ return () if $! == ENOENT || !defined($only);
+ die "cannot read '$path' - $!\n";
+ }
+ my @res = sort grep { /\A$pattern\z/ } readdir($dh);
+ closedir($dh);
+ return @res;
+ };
+ for my $subsys ($entries->($dir, 'nvme-subsys[0-9]+')) {
+ # one that cannot be read could be the subsystem asked for, whose namespaces must not
+ # look gone
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn");
+ if (!defined($nqn)) {
+ die "cannot read the NQN of NVMe subsystem '$subsys'\n" if defined($only);
+ next;
+ }
+ next if defined($only) && $nqn ne $only;
+ $code->($nqn, $_) for $entries->("$dir/$subsys", 'nvme[0-9]+n[0-9]+');
+ }
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ foreach_namespace(
+ sub($nqn, $dev) {
+ # a failed read must not look like a namespace that is gone
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid")
+ // die "cannot read the WWID of namespace '$dev'\n";
+ my $size = file_read_firstline("$SYSFS/block/$dev/size")
+ // die "cannot read the size of namespace '$dev'\n";
+ $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
},
+ $subsystem,
);
return $res;
}
+# The number of namespaces of each subsystem of this node, from one pass over the subsystems.
+sub namespace_counts() {
+ my $res = {};
+ foreach_namespace(sub($nqn, @) { $res->{$nqn}++ });
+ return $res;
+}
+
# $limit sets the time the operation may take in all, including the wait for the lock.
sub with_lock($code, $limit = undef) {
my $total = $LOCK_WAIT + 35;
@@ -379,4 +406,161 @@ sub discover($portal) {
die "discovery at portal '$portal' failed - $error";
}
+# A swap area on a namespace has no holder, mount or file descriptor of a process.
+my sub is_swap($device) {
+ my %rdevs = map {
+ my $rdev = (stat($_))[6];
+ defined($rdev) ? ($rdev => 1) : ()
+ } ($device, glob("${device}p[0-9]*"));
+ for my $line (split(/\n/, PVE::Tools::file_get_contents($SWAPS))) {
+ my ($swap) = split(/\s+/, $line);
+ next if !defined($swap) || $swap !~ m!^/!;
+ return 1 if $swap =~ m!^\Q$device\E(?:p[0-9]+)?$!;
+ my $rdev = (stat($swap))[6];
+ return 1 if defined($rdev) && $rdevs{$rdev};
+ }
+ return 0;
+}
+
+# A mount in another mount namespace, like that of a container, is not in /proc/mounts here and has
+# no holder, but it claims the device exclusively, as holders and swap do.
+sub is_claimed($device) {
+ sysopen(my $fh, $device, O_RDONLY | O_EXCL) and return 0;
+ return $! == EBUSY;
+}
+
+# The expected subsystem and portal refuse a controller that replaced the one the caller listed.
+sub disconnect_guarded($controller, $expected = {}) {
+ my ($name) = $controller =~ /\A(nvme[0-9]+)\z/;
+ die "invalid controller name '$controller'\n" if !defined($name);
+ # A namespace that would lose its last usable path gets checked for use, which takes a while on
+ # a subsystem with many. A task runs this, which holds no lock on the storage configuration.
+ return with_lock(
+ sub {
+ require PVE::Storage;
+ require PVE::Storage::SAN;
+ my $ctrl = controllers()->{$name}
+ // die "'$name' is not an NVMe over Fabrics controller\n";
+ if (
+ (
+ defined($expected->{subsysnqn})
+ && $expected->{subsysnqn} ne $ctrl->{subsystem}
+ )
+ || (defined($expected->{portal}) && $expected->{portal} ne format_path($ctrl))
+ ) {
+ die
+ "controller '$name' is no longer connected to the listed subsystem and portal\n";
+ }
+ # Without native multipath a namespace is a device of its controller and has no head
+ # device, which the checks below go by. Its name can carry the number of the subsystem.
+ my $own_devices = sub {
+ my $found = 0;
+ dir_glob_foreach(
+ "$SYSFS/class/nvme-fabrics/ctl/$name",
+ 'nvme[0-9]+n[0-9]+',
+ sub { $found = 1 },
+ );
+ return $found;
+ };
+ die "cannot disconnect '$name' - its namespaces do not use native NVMe multipath\n"
+ if $own_devices->();
+ my $namespaces = namespaces($ctrl->{subsystem});
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %heads = map { $_ => 1 } keys %$namespaces;
+ for my $head (keys %$status) {
+ $heads{$head} = 1
+ if grep { $_->{device} eq "/dev/$name" } $status->{$head}->{paths}->@*;
+ }
+ PVE::Cluster::cfs_update(1);
+ my $cfg = PVE::Storage::config();
+ my (%relied, %referenced);
+ for my $head (sort keys %heads) {
+ my $paths = $status->{$head}->{paths} // [];
+ my @others = grep { $_->{device} ne "/dev/$name" } @$paths;
+ if (grep { PVE::Diskmanage::nvme_path_is_usable($_) } @others) {
+ $relied{$head} = 1;
+ next;
+ }
+ my $ns = $namespaces->{$head};
+ if (!defined($ns)) {
+ die
+ "cannot disconnect '$name' - namespace '$head' has no device on this node"
+ . " to check for use\n";
+ }
+ my $device = "/dev/$head";
+ if (
+ PVE::Diskmanage::is_mounted($device)
+ || PVE::Diskmanage::has_holder($device)
+ || is_swap($device)
+ || is_claimed($device)
+ ) {
+ die
+ "cannot disconnect '$name' - namespace '$head' is in use and has no other"
+ . " usable path\n";
+ }
+ # an opener that is gone within a second, like an LVM scan of the status pass, is no
+ # use of the namespace
+ my $opener;
+ for my $try (1 .. 4) {
+ Time::HiRes::usleep(300_000) if $try > 1;
+ $opener = PVE::Diskmanage::device_opener($device, glob("${device}p[0-9]*"));
+ last if !defined($opener);
+ }
+ if (defined($opener)) {
+ die
+ "cannot disconnect '$name' - process $opener has namespace '$head' open and"
+ . " it has no other usable path\n";
+ }
+ # The check of the storage references reads the namespace. Removing a path that is not
+ # usable either costs no usable path, and a reconnecting one cannot be read.
+ next if !grep {
+ $_->{device} eq "/dev/$name" && PVE::Diskmanage::nvme_path_is_usable($_)
+ } @$paths;
+ eval {
+ PVE::Storage::SAN::assert_lun_unreferenced(
+ $cfg,
+ { devpath => $device, wwid => $ns->{wwid} },
+ );
+ };
+ die "cannot disconnect '$name' - $@" if $@;
+ $referenced{$head} = 1;
+ }
+ # The checks take a while, in which a path can fail or recover, a namespace can appear
+ # and the controller number can pass to a new controller, so look again right before
+ # the removal. That narrows what can change unseen, but cannot rule it out.
+ my $changed =
+ "cannot disconnect '$name' - the paths of the subsystem changed meanwhile\n";
+ $status = PVE::Diskmanage::get_nvme_path_status();
+ for my $head (sort keys %$status) {
+ my @paths = ($status->{$head}->{paths} // [])->@*;
+ my ($own) = grep { $_->{device} eq "/dev/$name" } @paths;
+ next if !$own;
+ next if grep {
+ $_->{device} ne "/dev/$name" && PVE::Diskmanage::nvme_path_is_usable($_)
+ } @paths;
+ # it loses its last usable path, which the checks above have to have covered
+ die $changed
+ if $relied{$head}
+ || !$heads{$head}
+ || (PVE::Diskmanage::nvme_path_is_usable($own) && !$referenced{$head});
+ }
+ my $now_namespaces = namespaces($ctrl->{subsystem});
+ my $wwids = sub($res) {
+ join(',', map { "$_=$res->{$_}->{wwid}" } sort keys %$res);
+ };
+ die $changed if $wwids->($now_namespaces) ne $wwids->($namespaces);
+ die $changed if $own_devices->();
+ my $now = controllers()->{$name};
+ die "cannot disconnect '$name' - the controller changed meanwhile\n"
+ if !$now
+ || grep { ($now->{$_} // '') ne ($ctrl->{$_} // '') }
+ qw(subsystem transport traddr trsvcid);
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command([$NVME, 'disconnect', '--device', "/dev/$name"], timeout => 30);
+ return;
+ },
+ 300,
+ );
+}
+
1;
diff --git a/src/test/Makefile b/src/test/Makefile
index ee639e5f..eab91494 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -121,6 +121,7 @@ test_disk_api: run_disk_api_tests.pl
test_storage_create: run_storage_create_tests.pl
./run_storage_create_tests.pl
-test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_api_tests.pl run_nvmeof_taint_tests.pl
./run_nvmeof_tests.pl
+ ./run_nvmeof_api_tests.pl
perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_api_tests.pl b/src/test/run_nvmeof_api_tests.pl
new file mode 100755
index 00000000..888c8dba
--- /dev/null
+++ b/src/test/run_nvmeof_api_tests.pl
@@ -0,0 +1,287 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use File::Path qw(make_path remove_tree);
+use File::Temp qw(tempdir);
+use Test::MockModule;
+use Test::More;
+
+use PVE::API2::NVMeOF;
+use PVE::Storage::SAN;
+
+my $sys = tempdir('nvmeof-api-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::SYSFS = $sys;
+local $PVE::NVMeOF::SWAPS = "$sys/swaps";
+PVE::Tools::file_set_contents($PVE::NVMeOF::SWAPS, "Filename Type Size Used Priority\n");
+
+subtest 'last-path disconnect is checked inside serialization' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $san = Test::MockModule->new('PVE::Storage::SAN');
+ my $cluster = Test::MockModule->new('PVE::Cluster');
+ our $locked;
+ my ($commands, $checks, $mounted, $busy, $headless) = (0, 0, 0, 0, 0);
+ my $own = { device => '/dev/nvme1', state => 'live' };
+ my $other = { device => '/dev/nvme2', state => 'live', 'ana-state' => 'optimized' };
+ $nvme->mock(with_lock =>
+ sub { die "NVMe over Fabrics is busy\n" if $busy; local $locked = 1; $_[0]->() });
+ $nvme->mock(
+ controllers => sub {
+ ok($locked, 'controller snapshot is locked');
+ { nvme1 => { subsystem => 'nqn.test' } };
+ },
+ );
+ $nvme->mock(namespaces => sub { $headless ? {} : { nvme0n1 => { wwid => 'eui.abc' } } });
+ $nvme->mock(is_supported => sub { 1 });
+ my @statuses;
+ $disk->mock(
+ get_nvme_path_status =>
+ sub { shift(@statuses) // { nvme0n1 => { paths => [$own, $other] } } },
+ );
+ $disk->mock(is_mounted => sub { $mounted });
+ $disk->mock(has_holder => sub { 0 });
+ my $claimed = 0;
+ $nvme->mock(is_claimed => sub { $claimed });
+ my ($opener, $opens);
+ $disk->mock(device_opener => sub { $opens++; ref($opener) ? shift(@$opener) : $opener });
+ my $hires = Test::MockModule->new('Time::HiRes');
+ $hires->redefine(usleep => sub { });
+ $cluster->mock(cfs_update => sub { ok($locked, 'configuration refreshed under lock') });
+ $storage->mock(config => sub { { ids => {} } });
+ $san->mock(
+ assert_lun_unreferenced => sub { $checks++; die "storage uses this namespace\n" });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'deletion keeps the lock');
+ is($opts{timeout}, 30, 'deletion is bounded');
+ is_deeply(
+ $cmd,
+ ['/usr/sbin/nvme', 'disconnect', '--device', '/dev/nvme1'],
+ 'only the selected controller is removed',
+ );
+ $commands++;
+ },
+ );
+ for my $ana ('optimized', 'non-optimized') {
+ $other->{'ana-state'} = $ana;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ }
+ is($commands, 2, 'another usable path permits removal');
+ is($checks, 0, 'no usage probe when another path is usable');
+ @statuses = (
+ { nvme0n1 => { paths => [$own, $other] } },
+ { nvme0n1 => { paths => [$own, { %$other, state => 'connecting' }] } },
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/paths of the subsystem changed/, 'a path that fails meanwhile refuses');
+ @statuses = (
+ { nvme0n1 => { paths => [$own, $other] } },
+ { nvme0n1 => { paths => [$own, $other] }, nvme0n2 => { paths => [$own] } },
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/paths of the subsystem changed/, 'so does a path of another namespace');
+ # the controller reconnects while the checks skip the storage references of its namespace
+ @statuses = (
+ { nvme0n1 => { paths => [{ device => '/dev/nvme1', state => 'connecting' }] } },
+ { nvme0n1 => { paths => [{ device => '/dev/nvme1', state => 'live' }] } },
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/paths of the subsystem changed/, 'so does the last path that recovers');
+ my $calls = 0;
+ $nvme->mock(
+ namespaces => sub {
+ my $res = { nvme0n1 => { wwid => 'eui.abc' } };
+ $res->{nvme0n2} = { wwid => 'eui.new' } if $calls++;
+ return $res;
+ },
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/paths of the subsystem changed/, 'and a namespace that appears');
+ $calls = 0;
+ $nvme->mock(
+ namespaces => sub {
+ make_path("$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1") if $calls++;
+ return { nvme0n1 => { wwid => 'eui.abc' } };
+ },
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/paths of the subsystem changed/, 'or a device of the controller alone');
+ remove_tree("$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1");
+ $nvme->mock(namespaces => sub { $headless ? {} : { nvme0n1 => { wwid => 'eui.abc' } } });
+ my $replaced = 0;
+ $nvme->mock(
+ controllers => sub {
+ { nvme1 => { subsystem => $replaced++ ? 'nqn.other' : 'nqn.test' } };
+ },
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/controller changed meanwhile/, 'and a controller replaced meanwhile');
+ $replaced = 0;
+ $nvme->mock(
+ controllers => sub {
+ { nvme1 => { subsystem => 'nqn.test', transport => $replaced++ ? 'rdma' : 'tcp' } };
+ },
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/controller changed meanwhile/, 'also over another transport');
+ $nvme->mock(
+ controllers => sub {
+ ok($locked, 'controller snapshot is locked');
+ { nvme1 => { subsystem => 'nqn.test' } };
+ },
+ );
+ is($commands, 2, 'none of these disconnects');
+ for my $ana ('inaccessible', 'persistent-loss', 'change') {
+ $other->{'ana-state'} = $ana;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, "$ana does not protect an in-use namespace");
+ }
+ $other = { device => '/dev/nvme2', state => 'connecting', 'ana-state' => 'optimized' };
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, 'reconnecting is not a usable path');
+ is($commands, 2, 'refusals never delete');
+ $own->{state} = 'connecting';
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 3, 'a controller that is no usable path either needs no storage check');
+ $opener = '4711 (kvm)';
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like(
+ $@,
+ qr/process 4711 \(kvm\) has namespace/,
+ 'but a process that has the namespace open refuses',
+ );
+ $opener = ['4711 (lvs)'];
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 4, 'an opener that is gone again shortly does not refuse');
+ $opener = undef;
+ $own->{state} = 'live';
+ $san->mock(assert_lun_unreferenced => sub { $checks++ });
+ $mounted = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'local mount refuses');
+ $mounted = 0;
+ PVE::Tools::file_set_contents(
+ $PVE::NVMeOF::SWAPS,
+ "Filename Type Size Used Priority\n/dev/nvme0n1p2 partition 1024 0 -2\n",
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'a swap area on the namespace refuses');
+ PVE::Tools::file_set_contents($PVE::NVMeOF::SWAPS, "Filename Type Size Used Priority\n");
+ $claimed = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'a claim, like a mount of a container, refuses');
+ $claimed = 0;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1', { subsysnqn => 'nqn.other' }) };
+ like($@, qr/no longer connected to the listed subsystem/, 'a replaced controller refuses');
+ $opener = '4711 (kvm)';
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/process 4711 \(kvm\) has namespace 'nvme0n1' open/,
+ 'an open namespace refuses');
+ $opener = undef;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 5, 'unused namespace can lose its final path');
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1",
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme0c1n1",
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/do not use native NVMe multipath/, 'a namespace without head device refuses');
+ is($commands, 5, 'and nothing is disconnected');
+ remove_tree("$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1");
+ make_path("$sys/class/nvme-fabrics/ctl/nvme1/nvme3n2");
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/do not use native NVMe multipath/, 'also when named after the subsystem');
+ remove_tree("$sys/class/nvme-fabrics/ctl/nvme1/nvme3n2");
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 6, 'the path device of native multipath does not');
+ $headless = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/has no device/, 'uncheckable namespace refuses');
+ $busy = 1;
+ $nvme->mock(controllers => sub { die "must not count paths\n" });
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is busy/, 'ongoing deletion blocks another snapshot');
+ eval { PVE::NVMeOF::disconnect_guarded('../nvme1') };
+ like($@, qr/invalid controller/, 'invalid controller refused before locking');
+};
+
+subtest 'node API contract' => sub {
+ my $api = 'PVE::API2::NVMeOF';
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ $storage->mock(
+ config =>
+ sub { { ids => { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } } } },
+ );
+ $nvme->mock(is_supported => sub { 0 });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'uuid' } });
+ my $status = $api->status({ node => 'n1' });
+ is($status->{supported}, 0, 'availability means nvme-cli, not identity or version');
+ is($status->{'host-nqn'}, 'nqn.host', 'host identity shown independently');
+ $nvme->mock(is_supported => sub { 1 });
+ $nvme->mock(host_identity => sub { die "missing host identity\n" });
+ $status = $api->status({ node => 'n1' });
+ is_deeply(
+ $status,
+ { supported => 1, error => 'missing host identity' },
+ 'identity error does not hide installed tools',
+ );
+ $nvme->mock(
+ controllers => sub { {
+ nvme1 => {
+ subsystem => 'nqn.test',
+ transport => 'tcp',
+ traddr => '192.0.2.1',
+ trsvcid => 4420,
+ state => 'connecting',
+ },
+ } },
+ );
+ $nvme->mock(
+ namespaces => sub { die "must not walk the subsystems for each controller\n" },
+ namespace_counts => sub { { 'nqn.test' => 2, 'nqn.other' => 5 } },
+ );
+ my $rows = $api->controllers({ node => 'n1' });
+ is($rows->[0]->{namespaces}, 2, 'namespaces counted for the subsystem of the controller');
+ is($rows->[0]->{'used-by-storage'}, 'fabric', 'controller attributed');
+ is($rows->[0]->{state}, 'connecting', 'kernel state remains visible');
+
+ for my $pair (['status', $status], ['controllers', $rows]) {
+ my $method = $api->map_method_by_name($pair->[0]);
+ eval { PVE::JSONSchema::validate($pair->[1], $method->{returns}) };
+ is($@, '', "$pair->[0] schema");
+ ok($method->{protected} && $method->{proxyto} eq 'node', 'protected and node-proxied');
+ }
+ is(
+ $api->map_method_by_name('disconnect')->{path},
+ 'controller/{controller}',
+ 'REST-shaped deletion',
+ );
+ eval {
+ PVE::JSONSchema::validate(
+ { node => 'n1', controller => 'nvme1', subsysnqn => 'testsubsys' },
+ $api->map_method_by_name('disconnect')->{parameters},
+ );
+ };
+ is($@, '', 'the listed subsystem name is taken as is, also when it is no NQN');
+ my $rpc = Test::MockModule->new('PVE::RPCEnvironment');
+ {
+
+ package NVMeTestRPC;
+ sub get_user { 'root@pam' }
+ sub fork_worker { $_[4]->(); return 'UPID:test' }
+ }
+ $rpc->mock(get => sub { bless {}, 'NVMeTestRPC' });
+ my $removed;
+ $nvme->mock(disconnect_guarded => sub { $removed = $_[0] });
+ is(
+ $api->disconnect({ node => 'n1', controller => 'nvme1' }),
+ 'UPID:test',
+ 'API returns task identifier',
+ );
+ is($removed, 'nvme1', 'task calls guarded disconnect');
+};
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index be1a5eeb..02fccb46 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -289,9 +289,17 @@ subtest 'sysfs topology' => sub {
eval { PVE::NVMeOF::namespaces('nqn.test') };
like($@, qr/cannot read the WWID/, 'an unreadable namespace is an error, not a gone one');
file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ make_path(map { "$sys/class/nvme-subsystem/nvme-subsys1/nvme1n$_" } 1 .. 3);
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys1/subsysnqn", "nqn.other\n");
+ is_deeply(
+ PVE::NVMeOF::namespace_counts(),
+ { 'nqn.test' => 1, 'nqn.other' => 3 },
+ 'namespaces counted per subsystem',
+ );
make_path("$sys/class/nvme-subsystem/nvme-subsys9");
eval { PVE::NVMeOF::namespaces('nqn.test') };
like($@, qr/cannot read the NQN/, 'so is a subsystem that could be the one asked for');
+ is(scalar(keys PVE::NVMeOF::namespace_counts()->%*), 2, 'the counts leave it out');
rmdir("$sys/class/nvme-subsystem/nvme-subsys9");
};
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
index 73938a7e..2ae7b2b4 100755
--- a/src/test/run_san_api_tests.pl
+++ b/src/test/run_san_api_tests.pl
@@ -109,7 +109,7 @@ is_deeply(
);
is_deeply(
PVE::API2::SAN::Node->index({ node => 'test' }),
- [{ name => 'iscsi' }, { name => 'luns' }],
+ [{ name => 'iscsi' }, { name => 'luns' }, { name => 'nvmeof' }],
'node SAN index',
);
for my $case (
^ permalink raw reply related [relevance 17%]
* [PATCH v5 storage 14/26] multipath: report NVMe over Fabrics namespaces in the cluster status
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (9 preceding siblings ...)
2026-11-23 13:32 10% ` [PATCH v5 storage 13/26] multipath: report the NVMe host NQN of each node Thomas Lamprecht
@ 2026-11-23 13:32 17% ` Thomas Lamprecht
2026-11-23 13:32 5% ` [PATCH v5 storage 15/26] d/control: break pve-manager versions without namespace notifications Thomas Lamprecht
` (8 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the LUNs that multipathd handles on
each node. The namespaces of an NVMe over Fabrics storage use the
native multipath of the kernel and were missing from it, so a lost
path or a node without access to a namespace only showed in the LUN
list of that node.
Let each node report the namespaces of the subsystems such a storage
names, with the path counts its LUN list already shows, and expect
them on the nodes of the storage like the LUNs of an iSCSI storage.
They do not depend on multipathd, so a node without it reports them
as well and only the state of its maps stays unknown. A node that
cannot list its namespaces marks its report, so that they show as
unknown there instead of missing.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/SAN/Cluster.pm | 33 +++++---
src/PVE/Multipath/Status.pm | 64 +++++++++++++--
src/test/run_multipath_api_tests.pl | 120 +++++++++++++++++++++++++++-
3 files changed, 196 insertions(+), 21 deletions(-)
diff --git a/src/PVE/API2/SAN/Cluster.pm b/src/PVE/API2/SAN/Cluster.pm
index ac372d65..322f2fc4 100644
--- a/src/PVE/API2/SAN/Cluster.pm
+++ b/src/PVE/API2/SAN/Cluster.pm
@@ -43,9 +43,9 @@ my $lun_node_schema = {
properties => {
state => {
$state_schema->%*,
- description => "The health of the map on the node from its paths, 'missing' if the"
- . " node should have the map but does not list it, or 'unknown' if the node has no"
- . " current report that covers the map.",
+ description => "The health of the map or NVMe namespace on the node from its paths,"
+ . " 'missing' if the node should have it but does not list it, or 'unknown' if the"
+ . " node has no current report that covers it.",
},
name => {
type => 'string',
@@ -56,20 +56,21 @@ my $lun_node_schema = {
type => 'integer',
minimum => 0,
optional => 1,
- description => 'The size of the map in bytes.',
+ description => 'The size of the map or namespace in bytes.',
},
'paths-active' => {
type => 'integer',
minimum => 0,
optional => 1,
description => 'The number of active paths of the map whose checker state is ready,'
- . ' ghost, or not reported.',
+ . ' ghost, or not reported. For an NVMe namespace, the number of its paths over a'
+ . ' live controller whose ANA state is optimized, non-optimized, or not reported.',
},
'paths-total' => {
type => 'integer',
minimum => 0,
optional => 1,
- description => 'The number of paths of the map.',
+ description => 'The number of paths of the map or namespace.',
},
'paths-expected' => {
type => 'integer',
@@ -77,7 +78,8 @@ my $lun_node_schema = {
optional => 1,
description => 'The number of paths the LUN should have on the node: the highest of'
. ' the count of its multipath entry and, for each managed iSCSI storage of the'
- . ' LUN, the number of its portals.',
+ . ' LUN, the number of its portals. For an NVMe namespace, the number of portals'
+ . ' of its NVMe over Fabrics storage.',
},
},
};
@@ -156,8 +158,8 @@ __PACKAGE__->register_method({
luns => {
type => 'array',
description =>
- "One entry per LUN, identified by its WWID, with the state of its"
- . " map on each node and the overall cluster state.",
+ "One entry per LUN or NVMe namespace, identified by its WWID, with its"
+ . " path health on each node and the overall cluster state.",
items => {
type => 'object',
additionalProperties => 0,
@@ -165,6 +167,12 @@ __PACKAGE__->register_method({
wwid => { type => 'string', description => 'The LUN WWID.' },
explicit =>
{ type => 'boolean', description => 'An explicit entry exists.' },
+ native => {
+ type => 'boolean',
+ optional => 1,
+ description => 'An NVMe namespace, which uses the native'
+ . ' multipath of the kernel.',
+ },
name => {
type => 'string',
optional => 1,
@@ -177,8 +185,9 @@ __PACKAGE__->register_method({
optional => 1,
description =>
'The storage that uses the LUN: as its base volume or through'
- . ' the volume group on it, or as an iSCSI storage that serves'
- . ' the LUNs of its target as images.',
+ . ' the volume group on it, or as an iSCSI or NVMe over Fabrics'
+ . ' storage that serves the LUNs of its target or subsystem as'
+ . ' images.',
},
'multipath-storage' => {
type => 'string',
@@ -199,7 +208,7 @@ __PACKAGE__->register_method({
},
nodes => {
type => 'object',
- description => "Map health keyed by node name.",
+ description => "Path health keyed by node name.",
additionalProperties => $lun_node_schema,
},
},
diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm
index 1b85e108..7a1e2130 100644
--- a/src/PVE/Multipath/Status.pm
+++ b/src/PVE/Multipath/Status.pm
@@ -9,6 +9,7 @@ use MIME::Base64 qw(decode_base64 encode_base64);
use PVE::Cluster;
use PVE::INotify;
+use PVE::Diskmanage;
use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
@@ -37,6 +38,44 @@ sub worst_state(@states) {
return $worst;
}
+# Namespaces use the native multipath of the kernel, so their state does not depend on multipathd.
+my sub namespace_luns($pv_vgs) {
+ require PVE::Storage;
+ my $cfg = PVE::Storage::config();
+ my @storages = grep {
+ $cfg->{ids}->{$_}->{type} eq 'nvmeof'
+ && PVE::Storage::storage_check_enabled($cfg, $_, undef, 1)
+ } sort keys $cfg->{ids}->%*;
+ # reading the paths walks all NVMe namespaces of the node, also those of other plugins
+ return [] if !@storages;
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %luns;
+ for my $sid (@storages) {
+ my $scfg = $cfg->{ids}->{$sid};
+ my $expected = eval { scalar(PVE::NVMeOF::storage_paths($scfg)->@*) };
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ for my $name (sort keys %$namespaces) {
+ my $wwid = $namespaces->{$name}->{wwid};
+ next if $luns{$wwid};
+ my $paths = $status->{$name} // { active => 0, paths => [] };
+ my $total = scalar($paths->{paths}->@*);
+ my $lun = $luns{$wwid} = {
+ wwid => $wwid,
+ native => 1,
+ size => $namespaces->{$name}->{size},
+ storages => [$sid],
+ 'paths-total' => $total,
+ 'paths-active' => $paths->{active},
+ state => PVE::Multipath::derive_health($paths->{active}, $total, $expected),
+ };
+ $lun->{'paths-expected'} = $expected if defined($expected);
+ my $vg = ($pv_vgs // {})->{"/dev/$name"};
+ $lun->{vgname} = $vg if defined($vg);
+ }
+ }
+ return [map { $luns{$_} } sort keys %luns];
+}
+
sub publish($report) {
my $node = PVE::INotify::nodename();
my $now = time();
@@ -68,11 +107,11 @@ sub update_node_status() {
require PVE::NVMeOF;
my $host = eval { PVE::NVMeOF::host_identity() };
$report->{'nvme-host-nqn'} = $host->{nqn} if $host;
+ require PVE::Storage::LVMPlugin;
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
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();
- require PVE::Storage::LVMPlugin;
- my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
# A node can have many maps that something else set up, for example a storage plugin with
# one LUN per guest disk. Only the maps that the node manages, that are the base volume of a
# storage or hold its volume group get a row, the others are counted.
@@ -134,8 +173,15 @@ sub update_node_status() {
if (my $error = $@) {
chomp $error;
$report->{error} = $error;
- delete $report->{luns};
+ $report->{luns} = [];
}
+ my $namespaces = eval { namespace_luns($pv_vgs) };
+ if (my $error = $@) {
+ warn "multipath: cannot query NVMe namespaces - $error";
+ # a consumer must not take the namespaces as gone
+ $report->{'namespaces-unknown'} = 1;
+ }
+ push $report->{luns}->@*, @$namespaces if $namespaces;
eval { publish($report) };
warn "multipath: cannot publish node status - $@" if $@;
return $report;
@@ -152,7 +198,7 @@ sub cluster_status() {
my %reports = map { $_ => decode_report($raw->{$_}) // {} } @$all_nodes;
my %reported = map { $_->{wwid} => 1 }
grep { defined($_->{wwid}) } map { ($_->{luns} // [])->@* } values %reports;
- my (%nodes, %luns, %expected, %observed, %vg_owner, %disabled_owner);
+ my (%nodes, %luns, %expected, %observed, %vg_owner, %lists, %disabled_owner);
# the nodes that list a map because the configuration names it for them
my (%managed, %unhinted);
my $storage_nodes = sub($scfg) {
@@ -178,7 +224,6 @@ sub cluster_status() {
$vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
next if $scfg->{type} ne 'lvm';
my $base = PVE::Multipath::parse_base_volume($scfg->{base}) // next;
- next if $base->{kind} eq 'nvme'; # a namespace, which has no map
# A base volume by its SCSI name is a map only if its iSCSI storage requests maps. The name
# can also be another by-id link of the LUN, so only a WWID that a node reports counts.
my $map = $requests_maps->($base->{storage}) && $reported{ $base->{wwid} };
@@ -190,6 +235,7 @@ sub cluster_status() {
next;
}
$luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $luns{$wwid}->{native} = 1 if $base->{kind} eq 'nvme';
$luns{$wwid}->{'used-by-storage'} //= $sid;
$managed{$wwid}->{$_} = 1 for @$all_nodes;
$luns{$wwid}->{'multipath-storage'} //= $base->{storage}
@@ -206,11 +252,13 @@ sub cluster_status() {
$entry->{$_} = $report->{$_} for grep { defined($report->{$_}) } @keys;
$entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok';
$unhinted{$node} = 1 if $report->{'vgs-unknown'};
- next if $entry->{state} ne 'ok';
+ # the node lists its namespaces, also if it is unavailable for its maps
+ $lists{$node} = 1 if $report->{luns} && !$report->{'namespaces-unknown'};
for my $lun (($report->{luns} // [])->@*) {
my $wwid = $lun->{wwid} // next;
my $row = $luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $row->{native} = 1 if $lun->{native};
$row->{$_} //= $lun->{$_} for grep { defined($lun->{$_}) } qw(name size);
my $owner = defined($lun->{vgname}) ? $vg_owner{ $lun->{vgname} } : undef;
$row->{'used-by-storage'} //= $owner if defined($owner);
@@ -244,10 +292,10 @@ sub cluster_status() {
if ($observed{$wwid}->{$node}) {
$row->{nodes}->{$node} = $observed{$wwid}->{$node};
} elsif ($expected{$wwid}->{$node}) {
- my $listed = $nodes{$node}->{state} eq 'ok';
+ my $listed = $row->{native} ? $lists{$node} : $nodes{$node}->{state} eq 'ok';
# without the hint file of LVM a node leaves a map out that it only knows through
# the volume group of a storage
- $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node};
+ $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node} && !$row->{native};
$row->{nodes}->{$node} = { state => $listed ? 'missing' : 'unknown' };
}
}
diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl
index a91332df..85ddce7b 100755
--- a/src/test/run_multipath_api_tests.pl
+++ b/src/test/run_multipath_api_tests.pl
@@ -686,7 +686,12 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
my $status = Test::MockModule->new('PVE::Multipath::Status');
my $mp = Test::MockModule->new('PVE::Multipath');
my $iscsi = Test::MockModule->new('PVE::Storage::ISCSIPlugin');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $disks = Test::MockModule->new('PVE::Diskmanage');
my ($report, @order);
+ my $ids = {};
+ $storage->mock(config => sub { { ids => $ids } });
+ $disks->mock(get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
$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' } });
@@ -728,6 +733,58 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
is($report->{luns}->[0]->{'paths-expected'}, 3, 'expected count reported');
is($report->{luns}->[0]->{state}, 'degraded', 'fewer paths than expected');
ok(!exists($report->{supported}), 'the report has no separate "supported" field');
+
+ $ids->{nvme} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test:sub',
+ portals => '192.0.2.1,192.0.2.2',
+ };
+ $nvme->mock(
+ namespaces => sub($nqn) {
+ return $nqn eq 'nqn.test:sub'
+ ? { nvme1n1 => { wwid => 'uuid.1', size => 4096 } }
+ : {};
+ },
+ );
+ my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+ $lvm->mock(cached_pv_volume_groups => sub { { '/dev/nvme1n1' => 'vgns' } });
+ my $namespace = {
+ wwid => 'uuid.1',
+ native => 1,
+ size => 4096,
+ storages => ['nvme'],
+ vgname => 'vgns',
+ 'paths-total' => 1,
+ 'paths-active' => 1,
+ 'paths-expected' => 2,
+ state => 'degraded',
+ };
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}->[1], $namespace, 'namespace with fewer paths than portals');
+ $mp->mock(is_running => sub { 0 });
+ PVE::Multipath::Status::update_node_status();
+ is(
+ $report->{error},
+ 'multipathd is not running or does not respond',
+ 'stopped daemon still reported',
+ );
+ is_deeply($report->{luns}, [$namespace], 'namespaces do not need multipathd');
+ ok(!$report->{'namespaces-unknown'}, 'which the node could list');
+ {
+ local $ids->{nvme}->{disable} = 1;
+ $disks->mock(get_nvme_path_status => sub { die "walked the NVMe paths\n" });
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}, [], 'a disabled storage reports no namespaces');
+ ok(!$report->{'namespaces-unknown'}, 'and reads no NVMe paths for them');
+ $disks->mock(
+ get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
+ }
+ $nvme->mock(namespaces => sub { die "sysfs gone\n" });
+ {
+ local $SIG{__WARN__} = sub { };
+ PVE::Multipath::Status::update_node_status();
+ }
+ ok($report->{'namespaces-unknown'}, 'a failed namespace query marks the report');
};
subtest 'API returns final node and LUN states' => sub {
@@ -764,12 +821,31 @@ subtest 'API returns final node and LUN states' => sub {
'paths-active' => 2,
storages => ['scoped'],
},
+ {
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'optimal',
+ 'paths-total' => 2,
+ 'paths-active' => 2,
+ storages => ['nvme'],
+ },
],
}),
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' }),
+ n5 => encode_report({
+ time => $NOW,
+ error => 'multipath-tools is not installed',
+ luns => [{
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'degraded',
+ 'paths-total' => 2,
+ 'paths-active' => 1,
+ storages => ['nvme'],
+ }],
+ }),
);
$cluster->mock(get_node_kv => sub { \%raw });
my $entries = { '3600a' => { type => 'wwid' } };
@@ -787,6 +863,8 @@ subtest 'API returns final node and LUN states' => sub {
{ type => 'iscsi', 'managed-multipath' => 1, nodes => { departed => 1 } },
lvmgone => { type => 'lvm', base => 'gone:0.0.0.dm-uuid-mpath-3600e' },
scoped => { type => 'iscsi', 'managed-multipath' => 1, nodes => { n2 => 1 } },
+ nvme => { type => 'nvmeof', subsysnqn => 'nqn.test:sub' },
+ lvmns => { type => 'lvm', base => 'nvme:nvme-uuid.2', nodes => { n5 => 1 } },
},
} },
);
@@ -848,6 +926,46 @@ subtest 'API returns final node and LUN states' => sub {
'an entry for other nodes does not change that',
);
}
+ my $namespace = $lun{'uuid.1'};
+ ok($namespace->{native}, 'namespace marked as native');
+ ok(!exists($namespace->{'multipath-storage'}), 'a namespace has no requested map');
+ is_deeply(
+ { map { $_ => $namespace->{nodes}->{$_}->{state} } keys $namespace->{nodes}->%* },
+ {
+ n1 => 'optimal',
+ n2 => 'missing',
+ n3 => 'unknown',
+ n4 => 'unknown',
+ n5 => 'degraded',
+ },
+ 'namespace state of a node without multipathd counts',
+ );
+ is($lun->{nodes}->{n5}->{state}, 'unknown', 'no map state from a node without multipathd');
+ is_deeply(
+ $lun{'uuid.2'},
+ {
+ wwid => 'uuid.2',
+ explicit => 0,
+ native => 1,
+ 'used-by-storage' => 'lvmns',
+ state => 'missing',
+ nodes => { n5 => { state => 'missing' } },
+ },
+ 'base namespace that a node without multipathd does not report',
+ );
+ $raw{n5} = encode_report({ time => $NOW, error => 'too many LUNs to report' });
+ $res = PVE::API2::SAN::Cluster->status({});
+ %lun = map { $_->{wwid} => $_ } $res->{luns}->@*;
+ is($lun{'uuid.2'}->{nodes}->{n5}->{state}, 'unknown', 'node without a list');
+ {
+ local $raw{n2} = encode_report({ time => $NOW, luns => [], 'namespaces-unknown' => 1 });
+ my %unlisted = map { $_->{wwid} => $_ } PVE::API2::SAN::Cluster->status({})->{luns}->@*;
+ is(
+ $unlisted{'uuid.1'}->{nodes}->{n2}->{state},
+ 'unknown',
+ 'a node that could not query its namespaces does not miss them',
+ );
+ }
eval {
PVE::JSONSchema::validate(
$res,
^ permalink raw reply related [relevance 17%]
* [PATCH v5 manager 24/26] ui: san: show that a namespace uses native multipath
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (16 preceding siblings ...)
2026-11-23 13:32 13% ` [PATCH v5 manager 22/26] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
@ 2026-11-23 13:32 12% ` Thomas Lamprecht
2026-11-23 13:32 13% ` [PATCH v5 manager 25/26] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
2026-11-23 13:32 13% ` [PATCH v5 manager 26/26] d/control: bump versioned dependencies for NVMe over Fabrics Thomas Lamprecht
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the namespaces of NVMe over Fabrics
storages too. They use the native multipath of the kernel, with neither
an entry nor a storage that requests a map, so the Multipath column
would call them unmanaged. Show "Native" for them, as the LUN list of a
node does, and name them as namespaces in Paths by Node and in the wipe
dialog.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/SAN.js | 16 ++++++++++++++--
www/manager6/window/SANLunState.js | 8 ++++----
www/manager6/window/SANLunWipe.js | 24 ++++++++++++++++--------
3 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index e30b5ef48..fdf2935bf 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -15,6 +15,7 @@ Ext.define('pve-san-status', {
'name',
'explicit',
'multipath-storage',
+ 'native',
'nodes',
'size',
'used-by-storage',
@@ -118,6 +119,7 @@ Ext.define('PVE.dc.SANView', {
Ext.create('PVE.window.SANLunState', {
wwid: rec.get('wwid'),
name: rec.get('name'),
+ nvme: !!rec.get('native'),
autoShow: true,
});
let setupItem = (type) => ({
@@ -258,7 +260,11 @@ Ext.define('PVE.dc.SANView', {
disabled: !canModify,
handler: function (button) {
let lun = button.up('grid').getSelection()[0];
- let wwid = lun?.get('explicit') ? undefined : lun?.get('wwid');
+ // a namespace uses native multipath, which takes no entry
+ let wwid =
+ lun?.get('explicit') || lun?.get('native')
+ ? undefined
+ : lun?.get('wwid');
edit({ wwid, isCreate: true });
},
},
@@ -381,7 +387,13 @@ Ext.define('PVE.dc.SANView', {
width: 170,
renderer: (value, md, rec) => {
let storage = rec.get('multipath-storage');
- let kind = value ? 'manual' : storage ? 'storage' : 'unmanaged';
+ let kind = rec.get('native')
+ ? 'native'
+ : value
+ ? 'manual'
+ : storage
+ ? 'storage'
+ : 'unmanaged';
return Ext.htmlEncode(PVE.SANUtils.multipathText(kind, storage));
},
},
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index 5dfce247a..f84940fd8 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -23,12 +23,12 @@ Ext.define('PVE.window.SANLunState', {
let title = me.nvme
? gettext('Storage {0}: Namespace State')
: gettext('Storage {0}: LUN State');
+ let pathsTitle = me.nvme
+ ? gettext('Namespace {0}: Paths by Node')
+ : gettext('LUN {0}: Paths by Node');
me.title = me.storage
? Ext.String.format(title, me.storage)
- : Ext.String.format(
- gettext('LUN {0}: Paths by Node'),
- Ext.htmlEncode(me.name || me.wwid),
- );
+ : Ext.String.format(pathsTitle, Ext.htmlEncode(me.name || me.wwid));
// The other nodes set up the LUN of a new storage with their next status updates.
let pendingUntil = me.storage ? Date.now() + 60000 : 0;
let rstore = Ext.create('Proxmox.data.UpdateStore', {
diff --git a/www/manager6/window/SANLunWipe.js b/www/manager6/window/SANLunWipe.js
index 5a9d287e7..c75adcd5c 100644
--- a/www/manager6/window/SANLunWipe.js
+++ b/www/manager6/window/SANLunWipe.js
@@ -1,6 +1,5 @@
Ext.define('PVE.window.SANLunWipe', {
extend: 'Proxmox.window.Edit',
- title: gettext('Wipe LUN'),
onlineHelp: 'storage_multipath',
width: 550,
isCreate: true,
@@ -12,6 +11,8 @@ Ext.define('PVE.window.SANLunWipe', {
let me = this;
let lun = me.lun;
let name = lun.name || lun.wwid;
+ let nvme = lun.multipath === 'native';
+ me.title = nvme ? gettext('Wipe Namespace') : gettext('Wipe LUN');
me.url = `/nodes/${me.node}/disks/wipedisk`;
me.extraRequestParams = { disk: lun['by-id'] };
me.items = [
@@ -20,9 +21,13 @@ Ext.define('PVE.window.SANLunWipe', {
cls: 'pmx-hint',
html: Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'Wipe LUN {0} using node "{1}"? All data on the LUN will be lost, for every host that accesses it!',
- ),
+ nvme
+ ? gettext(
+ 'Wipe namespace {0} using node "{1}"? All data on the namespace will be lost, for every host that accesses it!',
+ )
+ : gettext(
+ 'Wipe LUN {0} using node "{1}"? All data on the LUN will be lost, for every host that accesses it!',
+ ),
name,
me.node,
),
@@ -42,12 +47,15 @@ Ext.define('PVE.window.SANLunWipe', {
// the checks before the wipe see the storages of the cluster and the users of the LUN
// on this node, not what another host does with it
xtype: 'proxmoxcheckbox',
- boxLabel: gettext('No other host uses the LUN'),
+ boxLabel: nvme
+ ? gettext('No other host uses the namespace')
+ : gettext('No other host uses the LUN'),
submitValue: false,
getErrors: function () {
- return this.getValue()
- ? []
- : [gettext('Confirm that no other host uses the LUN.')];
+ let error = nvme
+ ? gettext('Confirm that no other host uses the namespace.')
+ : gettext('Confirm that no other host uses the LUN.');
+ return this.getValue() ? [] : [error];
},
},
{
^ permalink raw reply related [relevance 12%]
* [PATCH v5 manager 22/26] ui: node san: list NVMe over Fabrics controllers
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (15 preceding siblings ...)
2026-11-23 13:32 19% ` [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 13% ` Thomas Lamprecht
2026-11-23 13:32 12% ` [PATCH v5 manager 24/26] ui: san: show that a namespace uses native multipath Thomas Lamprecht
` (2 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
Add a view below Node > SAN with the controllers of a node, one per
connected portal, with their transport, state and storage, and the host
NQN of the node. A controller can be disconnected there, for example
after its portal was removed from the storage, which the node refuses
for the last usable path of a namespace in use. The controllers come
from sysfs, so the view lists them also without nvme-cli, which only
Disconnect needs.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/SANUtils.js | 5 +
www/manager6/Utils.js | 1 +
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 175 +++++++++++++++++++++++++
5 files changed, 190 insertions(+), 1 deletion(-)
create mode 100644 www/manager6/node/NVMeOFControllers.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index f2fc80279..f3591e1c8 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -253,6 +253,7 @@ JSSRC= \
node/ISCSITargets.js \
node/LVM.js \
node/LVMThin.js \
+ node/NVMeOFControllers.js \
node/SANLuns.js \
node/StatusView.js \
node/Subscription.js \
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index bd1c87324..96e099059 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -132,6 +132,11 @@ Ext.define('PVE.SANUtils', {
'logged-in': ['check-circle good', gettext('Connected')],
recovering: ['exclamation-circle warning', gettext('Reconnecting')],
'not-connected': ['times-circle faded', gettext('Not connected')],
+ live: ['check-circle good', gettext('Connected')],
+ connecting: ['exclamation-circle warning', gettext('Reconnecting')],
+ resetting: ['exclamation-circle warning', gettext('Reconnecting')],
+ deleting: ['times-circle faded', gettext('Disconnecting')],
+ 'deleting (no IO)': ['times-circle faded', gettext('Disconnecting')],
}[state];
let [icon, label] = display ?? ['question-circle faded', state];
return `<i class="fa fa-fw fa-${icon}"></i> ${Ext.htmlEncode(text ?? label)}`;
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index d508d0469..fc3667f51 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -2276,6 +2276,7 @@ Ext.define('PVE.Utils', {
lvmthinremove: ['Thinpool', gettext('Remove')],
migrateall: ['', gettext('Bulk migrate VMs and Containers')],
move_volume: ['CT', gettext('Move Volume')],
+ nvmedisconnect: ['NVMe-oF', gettext('Disconnect')],
'pbs-download': ['VM/CT', gettext('File Restore Download')],
pull_file: ['CT', gettext('Pull file')],
push_file: ['CT', gettext('Push file')],
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index c85183766..830e8542a 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -398,7 +398,7 @@ Ext.define('PVE.node.Config', {
);
}
- // the LUN and iSCSI reads of the node accept either privilege
+ // the LUN, iSCSI and NVMe over Fabrics reads of the node accept either privilege
if (caps.nodes['Sys.Audit'] || caps.storage['Datastore.Allocate']) {
me.items.push(
{
@@ -414,6 +414,13 @@ Ext.define('PVE.node.Config', {
iconCls: 'fa fa-bullseye',
groups: ['san'],
},
+ {
+ xtype: 'pveNVMeOFControllerList',
+ title: 'NVMe over Fabrics',
+ itemId: 'san-nvmeof',
+ iconCls: 'fa fa-plug',
+ groups: ['san'],
+ },
);
}
diff --git a/www/manager6/node/NVMeOFControllers.js b/www/manager6/node/NVMeOFControllers.js
new file mode 100644
index 000000000..cc62d3419
--- /dev/null
+++ b/www/manager6/node/NVMeOFControllers.js
@@ -0,0 +1,175 @@
+Ext.define('PVE.node.NVMeOFControllerList', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'pveNVMeOFControllerList',
+ onlineHelp: 'storage_nvmeof',
+ emptyText: gettext('No NVMe over Fabrics controllers found'),
+ viewConfig: { enableTextSelection: true },
+ store: {
+ fields: [
+ 'controller',
+ 'transport',
+ 'subsysnqn',
+ 'portal',
+ 'state',
+ 'namespaces',
+ 'used-by-storage',
+ ],
+ sorters: ['subsysnqn', 'portal'],
+ },
+ columns: [
+ { text: gettext('Controller'), dataIndex: 'controller', width: 85 },
+ {
+ text: gettext('Subsystem'),
+ dataIndex: 'subsysnqn',
+ flex: 3,
+ minWidth: 200,
+ renderer: Ext.htmlEncode,
+ },
+ {
+ text: gettext('Transport'),
+ dataIndex: 'transport',
+ width: 90,
+ // the transport of the controller, named as for the paths of a namespace
+ renderer: (value) => PVE.SANUtils.renderSanTransport(value && `nvme-${value}`),
+ },
+ { text: gettext('Portal'), dataIndex: 'portal', width: 150, renderer: Ext.htmlEncode },
+ {
+ text: gettext('State'),
+ dataIndex: 'state',
+ width: 120,
+ renderer: PVE.SANUtils.renderState,
+ },
+ {
+ text: gettext('Storage'),
+ dataIndex: 'used-by-storage',
+ flex: 1,
+ minWidth: 120,
+ renderer: Ext.htmlEncode,
+ },
+ {
+ text: gettext('Namespaces'),
+ tooltip: gettext('Namespaces of the subsystem that use native NVMe multipath'),
+ dataIndex: 'namespaces',
+ width: 100,
+ },
+ ],
+
+ reload: function () {
+ let me = this;
+ let load = (path, success) =>
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${me.nodename}/san/nvmeof/${path}`,
+ method: 'GET',
+ waitMsgTarget: me.getView(),
+ failure: (response) =>
+ Proxmox.Utils.setErrorMask(me.getView(), response.htmlStatus),
+ success: (response) => !me.destroyed && success(response.result.data),
+ });
+ load('status', function (status) {
+ me.down('#hostnqn').setValue(status['host-nqn'] || '');
+ me.supported = !!status.supported;
+ let error = status.supported
+ ? status.error
+ : gettext('nvme-cli is not installed on this node.');
+ // the controllers come from sysfs, which needs neither nvme-cli nor a host identity
+ let warning = me.down('#warning');
+ warning.setHtml(
+ error
+ ? `<i class="fa fa-fw fa-exclamation-triangle warning"></i> ${Ext.htmlEncode(error)}`
+ : '',
+ );
+ warning.setHidden(!error);
+ load('controller', function (controllers) {
+ Proxmox.Utils.setErrorMask(me.getView(), false);
+ me.getStore().setData(controllers);
+ });
+ });
+ },
+
+ listeners: {
+ activate: function () {
+ this.reload();
+ },
+ },
+
+ initComponent: function () {
+ let me = this;
+ me.nodename = me.pveSelNode.data.node;
+ me.dockedItems = [
+ {
+ xtype: 'toolbar',
+ dock: 'top',
+ items: [
+ {
+ text: gettext('Reload'),
+ iconCls: 'fa fa-refresh',
+ handler: () => me.reload(),
+ },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Disconnect'),
+ iconCls: 'fa fa-unlink',
+ disabled: true,
+ dangerous: true,
+ // the disconnect uses nvme-cli
+ enableFn: () =>
+ !!Ext.state.Manager.get('GuiCap').dc['Sys.Modify'] && me.supported,
+ confirmMsg: (rec) =>
+ Ext.String.format(
+ gettext(
+ 'Disconnect controller {0} from portal {1}? A storage that still lists that portal connects to it again.',
+ ),
+ Ext.htmlEncode(rec.get('controller')),
+ Ext.htmlEncode(rec.get('portal')),
+ ),
+ handler: (button, event, rec) =>
+ Proxmox.Utils.API2Request({
+ // refused if the kernel reused the controller number meanwhile
+ url:
+ `/nodes/${me.nodename}/san/nvmeof/controller/${rec.get('controller')}?` +
+ Ext.Object.toQueryString({
+ subsysnqn: rec.get('subsysnqn'),
+ portal: rec.get('portal'),
+ }),
+ method: 'DELETE',
+ waitMsgTarget: me,
+ failure: (response) =>
+ Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+ success: (response) =>
+ Ext.create('Proxmox.window.TaskProgress', {
+ upid: response.result.data,
+ autoShow: true,
+ taskDone: () => !me.destroyed && me.reload(),
+ }),
+ }),
+ },
+ ],
+ },
+ {
+ // a host NQN does not fit next to the buttons on a narrow screen
+ xtype: 'toolbar',
+ dock: 'top',
+ items: [
+ {
+ xtype: 'displayfield',
+ itemId: 'hostnqn',
+ fieldLabel: gettext('Host NQN'),
+ },
+ {
+ iconCls: 'fa fa-clipboard',
+ tooltip: gettext('Copy to Clipboard'),
+ handler: () => PVE.Utils.copyToClipboard(me.down('#hostnqn').getValue()),
+ },
+ ],
+ },
+ {
+ xtype: 'component',
+ itemId: 'warning',
+ dock: 'top',
+ padding: 5,
+ hidden: true,
+ },
+ ];
+ me.callParent();
+ },
+});
^ permalink raw reply related [relevance 13%]
* [PATCH v5 manager 25/26] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (17 preceding siblings ...)
2026-11-23 13:32 12% ` [PATCH v5 manager 24/26] ui: san: show that a namespace uses native multipath Thomas Lamprecht
@ 2026-11-23 13:32 13% ` Thomas Lamprecht
2026-11-23 13:32 13% ` [PATCH v5 manager 26/26] d/control: bump versioned dependencies for NVMe over Fabrics Thomas Lamprecht
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
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');
^ permalink raw reply related [relevance 13%]
* [PATCH v5 storage 11/26] api: san luns: attribute NVMe namespaces to storage
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (6 preceding siblings ...)
2026-11-23 13:32 11% ` [PATCH v5 storage 10/26] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
@ 2026-11-23 13:32 20% ` Thomas Lamprecht
2026-11-23 13:32 17% ` [PATCH v5 storage 12/26] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
` (11 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
The SAN LUN inventory lists NVMe namespaces with their subsystem, but
without relation to an NVMe over Fabrics storage. Expect one path per
portal of the storage that connects the subsystem of a namespace, so
that a namespace with fewer paths shows as degraded.
A namespace counts as used by the LVM storage that has it as base
volume, else by the storage of its subsystem if that one serves the
namespaces as images.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/SAN/Node.pm | 9 ++++---
src/PVE/Storage/SAN.pm | 19 ++++++++++++--
src/test/run_san_lun_scan_tests.pl | 41 ++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/src/PVE/API2/SAN/Node.pm b/src/PVE/API2/SAN/Node.pm
index 08a7473b..4b96caf5 100644
--- a/src/PVE/API2/SAN/Node.pm
+++ b/src/PVE/API2/SAN/Node.pm
@@ -118,8 +118,9 @@ __PACKAGE__->register_method({
'paths-expected' => {
description => "The number of paths the LUN should have on this node: the"
. " highest of the count of its multipath entry and, for each managed"
- . " iSCSI storage of the LUN, the number of its portals. Absent if no"
- . " count is known.",
+ . " iSCSI storage of the LUN, the number of its portals. For a namespace"
+ . " of an NVMe over Fabrics storage, the number of its portals. Absent if"
+ . " no count is known.",
type => 'integer',
optional => 1,
},
@@ -198,8 +199,8 @@ __PACKAGE__->register_method({
},
'used-by-storage' => {
description => "The storage that uses the LUN: as its base volume or"
- . " through the volume group on it, or as an iSCSI storage that serves the"
- . " LUNs of its target as images.",
+ . " through the volume group on it, or as an iSCSI or NVMe over Fabrics"
+ . " storage that serves the LUNs of its target or subsystem as images.",
type => 'string',
optional => 1,
},
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index 595c3b55..5e7065fc 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -16,6 +16,7 @@ use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
use PVE::Multipath::Identity;
+use PVE::NVMeOF;
use PVE::Storage;
use PVE::Storage::LVMPlugin;
@@ -42,7 +43,9 @@ sub scan_luns($cfg) {
PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
- my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %targets, %paths, %unmapped);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %nvme_owner, %nvme_paths);
+ my (%targets, %paths);
+ my %unmapped;
my $wanted =
PVE::Multipath::Generator::wanted_wwids($mpcfg, PVE::INotify::nodename(), $derived);
@@ -58,6 +61,11 @@ sub scan_luns($cfg) {
if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
my $base = PVE::Multipath::parse_base_volume($scfg->{base});
$base_owner{ $base->{wwid} } //= $sid if $base;
+ next if $scfg->{type} ne 'nvmeof';
+ $nvme_owner{ $scfg->{subsysnqn} } //= $sid;
+ # only a storage in use on this node expects its paths here
+ $nvme_paths{ $scfg->{subsysnqn} } //= $sid
+ if PVE::Storage::storage_check_enabled($cfg, $sid, undef, 1);
}
my %rows;
@@ -102,6 +110,10 @@ sub scan_luns($cfg) {
$row->{'nvme-subsystem'} = $nqn;
my $nsid = file_read_firstline("/sys/block/$name/nsid");
$row->{'nvme-nsid'} = int($nsid) if defined($nsid) && $nsid =~ /^\d+$/;
+ if (my $sid = $nvme_paths{$nqn}) {
+ $row->{'paths-expected'} =
+ scalar(PVE::NVMeOF::storage_paths($cfg->{ids}->{$sid})->@*);
+ }
}
}
for my $key (qw(transport vendor model serial)) {
@@ -208,9 +220,12 @@ sub scan_luns($cfg) {
$row->{'paths-expected'},
);
}
+ my $nvme = $nvme_owner{ $row->{'nvme-subsystem'} // '' };
+ undef $nvme if $nvme && !PVE::Storage::san_storage_serves_images($cfg->{ids}->{$nvme});
my ($target) =
map { $target_owner{$_} // () } sort keys(($targets{ $row->{wwid} } // {})->%*);
- my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target;
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target
+ // $nvme;
$row->{'used-by-storage'} = $owner if defined($owner);
}
return [map { $rows{$_} } sort keys %rows];
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
index 7119c88a..7fd9563b 100755
--- a/src/test/run_san_lun_scan_tests.pl
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -329,6 +329,12 @@ is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id lin
$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
$scan->mock(file_read_firstline => sub { $_[0] =~ m{/nsid$} ? 1 : 'eui.0123456789abcdef' });
$disk->mock(read_subsysnqn => sub { 'nqn.test' });
+$cfg->{ids}->{fabric} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,192.0.2.2',
+ content => { images => 1 },
+};
$scan->unmock('stable_path');
$scan->mock(abs_path => sub { '/dev/nvme0n1' });
$rows = PVE::Storage::SAN::scan_luns($cfg);
@@ -346,6 +352,41 @@ eval { PVE::JSONSchema::validate($rows, $schema) };
is($@, '', 'native row matches the API schema');
is($rows->[0]->{'nvme-subsystem'}, 'nqn.test', 'subsystem NQN exposed');
is($rows->[0]->{'nvme-nsid'}, 1, 'namespace ID exposed');
+is($rows->[0]->{'used-by-storage'}, 'fabric', 'a storage serving the namespaces uses them');
+is($rows->[0]->{'paths-expected'}, 2, 'one expected path per configured portal');
+
+for my $count (1, 3) {
+ $config->mock(
+ read_config => sub { {
+ ids => { 'eui.0123456789abcdef' => { type => 'wwid', 'paths-expected' => $count } },
+ } },
+ );
+ my $entry = PVE::Storage::SAN::scan_luns($cfg);
+ is($entry->[0]->{'paths-expected'}, 2, "a multipath entry does not change it ($count)");
+}
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+{
+ local $cfg->{ids}->{fabric}->{content} = { none => 1 };
+ my $plain = PVE::Storage::SAN::scan_luns($cfg);
+ is($plain->[0]->{'used-by-storage'}, undef, 'a connection storage does not');
+ is($plain->[0]->{'paths-expected'}, 2, 'but still tells the expected paths');
+}
+{
+ local $cfg->{ids}->{fabric}->{disable} = 1;
+ my $disabled = PVE::Storage::SAN::scan_luns($cfg);
+ is($disabled->[0]->{'paths-expected'}, undef, 'a disabled storage expects no paths');
+ is($disabled->[0]->{'used-by-storage'}, 'fabric', 'but still uses the namespaces');
+}
+{
+ local $cfg->{ids}->{fabric}->{nodes} = { other => 1 };
+ my $elsewhere = PVE::Storage::SAN::scan_luns($cfg);
+ is($elsewhere->[0]->{'paths-expected'}, undef, 'nor a storage of other nodes');
+}
+for my $base (qw(fabric nvme-fabric)) {
+ $cfg->{ids}->{data}->{base} = "$base:nvme-eui.0123456789abcdef";
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is($rows->[0]->{'used-by-storage'}, 'data', "LVM base consumer takes precedence ($base)");
+}
$disk->mock(is_partition => sub { 1 });
ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
^ permalink raw reply related [relevance 20%]
* [PATCH v5 storage 09/26] api: scan: add NVMe over Fabrics discovery
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (4 preceding siblings ...)
2026-11-23 13:32 18% ` [PATCH v5 storage 08/26] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
@ 2026-11-23 13:32 15% ` Thomas Lamprecht
2026-11-23 13:32 11% ` [PATCH v5 storage 10/26] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
` (13 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
Setting up an NVMe over Fabrics storage needs the NQN of the
subsystem and its portals. Add /nodes/{node}/scan/nvmeof, which asks
the discovery service at a portal for the NVMe/TCP subsystems it
offers to the node and lists them with their portals.
Without a port, it tries the discovery port 8009 and then the I/O
port 4420, where Linux targets answer discovery too. The scan needs
Datastore.Allocate on /storage, like the iSCSI scan.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 49 ++++++++++++++++
src/PVE/NVMeOF.pm | 66 ++++++++++++++++++++++
src/test/run_nvmeof_taint_tests.pl | 5 ++
src/test/run_nvmeof_tests.pl | 90 ++++++++++++++++++++++++++++++
src/test/run_san_api_tests.pl | 2 +-
5 files changed, 211 insertions(+), 1 deletion(-)
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index f37e7d4e..c6263994 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -6,6 +6,7 @@ use warnings;
# NOTE: This API endpoints are mounted by pve-manager's API2::Node module and pvesm CLI
use PVE::JSONSchema qw(get_standard_option);
+use PVE::NVMeOF;
use PVE::RESTHandler;
use PVE::SafeSyslog;
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'lvmthin' },
{ method => 'nfs' },
+ { method => 'nvmeof' },
{ method => 'pbs' },
{ method => 'zfs' },
];
@@ -300,6 +302,53 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'nvmeofscan',
+ path => 'nvmeof',
+ method => 'GET',
+ description =>
+ 'List the NVMe over TCP subsystems offered to this node by a discovery controller.',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/storage', ['Datastore.Allocate']] },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ portal => {
+ description => 'IPv4 or bracketed IPv6 discovery address with an optional port.'
+ . ' Without a port, try 8009 then 4420.',
+ type => 'string',
+ format => 'pve-storage-nvme-portal',
+ },
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ portals => {
+ type => 'string',
+ description => 'The discovered TCP portals, comma separated.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+ my $res = PVE::NVMeOF::discover($param->{portal});
+ return [
+ map { {
+ subsysnqn => $_,
+ portals => join(',', map { PVE::NVMeOF::format_path($_) } $res->{$_}->@*),
+ } } sort keys %$res
+ ];
+ },
+});
+
__PACKAGE__->register_method({
name => 'lvmscan',
path => 'lvm',
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index 2be6d8e7..9744e471 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -7,11 +7,13 @@ use Digest::SHA qw(sha1_hex);
use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
use File::Basename qw(basename);
use File::Path qw(make_path);
+use JSON qw(decode_json);
use POSIX qw(ceil);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use Time::HiRes ();
use PVE::JSONSchema;
+use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
use PVE::Diskmanage;
@@ -313,4 +315,68 @@ sub connect_path($scfg, $path, $limit = undef) {
return $res;
}
+sub parse_discovery_log($raw) {
+ my $log = decode_json($raw);
+ die "invalid NVMe discovery log\n"
+ if ref($log) ne 'HASH' || ref($log->{records}) ne 'ARRAY';
+ my (%seen, %res);
+ for my $record ($log->{records}->@*) {
+ next
+ if ($record->{subtype} // '') ne 'nvme subsystem' || ($record->{trtype} // '') ne 'tcp';
+ # the log pads the address fields with spaces, which not every nvme-cli removes
+ my ($nqn_raw, $addr, $port) =
+ map { my $v = $_ // ''; $v =~ s/^\s+|\s+$//g; $v }
+ $record->@{qw(subnqn traddr trsvcid)};
+ my $nqn = subsystem_nqn($nqn_raw) // next;
+ my $path = parse_portal(($addr =~ /:/ ? "[$addr]" : $addr) . ":$port") // next;
+ next if $seen{$nqn}->{ format_path($path) }++;
+ push $res{$nqn}->@*, $path;
+ }
+ return \%res;
+}
+
+sub discover($portal) {
+ my $path = parse_portal($portal) // die "invalid portal '$portal'\n";
+ my @ports = $portal =~ /:[0-9]+$/ ? ($path->{trsvcid}) : (8009, 4420);
+ # a missing prerequisite fails on every port, so report it as it is
+ assert_support();
+ my $host = host_identity();
+ my $error;
+ for my $port (@ports) {
+ # keep the error of a port that answered rather than "no answer" from the other port
+ if (!PVE::Network::tcp_ping($path->{traddr}, $port, 2)) {
+ $error //= "no answer from portal\n";
+ next;
+ }
+ my $result = eval {
+ with_lock(sub {
+ my $out = '';
+ run_command(
+ [
+ $NVME,
+ 'discover',
+ '--transport=tcp',
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $port,
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--output-format=json',
+ ],
+ timeout => 30,
+ errmsg => 'nvme discover',
+ outfunc => sub($line) { $out .= "$line\n" },
+ );
+ return parse_discovery_log($out);
+ });
+ };
+ return $result if !$@;
+ $error = $@;
+ }
+ die "discovery at portal '$portal' failed - $error";
+}
+
1;
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
index 6fd37410..ef332633 100755
--- a/src/test/run_nvmeof_taint_tests.pl
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -40,6 +40,7 @@ $nvme->mock(
'all connect operands are validated and untainted',
);
PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ $opts{outfunc}->('{"records":[]}') if $opts{outfunc};
},
);
my $path = PVE::NVMeOF::parse_portal($portal);
@@ -55,6 +56,10 @@ for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.disc
eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
}
+my $net = Test::MockModule->new('PVE::Network');
+$net->mock(tcp_ping => sub { 1 });
+eval { PVE::NVMeOF::discover($portal) };
+is($@, '', 'discovery can execute with file-backed host identity in taint mode');
file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
eval { PVE::NVMeOF::host_identity() };
like($@, qr/nonzero UUID/, 'zero host ID refused');
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index b9bed005..fe9bdace 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -5,6 +5,7 @@ use lib qw(..);
use Fcntl qw(:flock);
use File::Path qw(make_path remove_tree);
use File::Temp qw(tempdir);
+use JSON qw(encode_json);
use POSIX ();
use Test::MockModule;
use Test::More;
@@ -13,6 +14,7 @@ use Time::HiRes ();
use PVE::Tools qw(file_set_contents);
use PVE::API2::Storage::Config;
+use PVE::API2::Storage::Scan;
use PVE::NVMeOF;
use PVE::Storage;
@@ -601,4 +603,92 @@ subtest 'the connection check has a time limit too' => sub {
is($pings, 0, 'which the check does not ping');
};
+subtest 'TCP discovery, fallback and API result' => sub {
+ my $record = {
+ subtype => 'nvme subsystem',
+ trtype => 'tcp',
+ subnqn => 'nqn.test',
+ traddr => '192.0.2.1',
+ trsvcid => '4420',
+ };
+ my $raw = encode_json({
+ records =>
+ [$record, $record, { %$record, trtype => 'rdma' }, { %$record, trsvcid => 70000 }],
+ });
+ is_deeply(
+ PVE::NVMeOF::parse_discovery_log($raw),
+ { 'nqn.test' => [{ traddr => '192.0.2.1', trsvcid => 4420 }] },
+ 'TCP only, unique valid portals',
+ );
+ my $padded =
+ { %$record, traddr => '192.0.2.1' . (' ' x 10), trsvcid => '4420' . (' ' x 28) };
+ is_deeply(
+ PVE::NVMeOF::parse_discovery_log(encode_json({ records => [$padded] })),
+ { 'nqn.test' => [{ traddr => '192.0.2.1', trsvcid => 4420 }] },
+ 'padded address fields',
+ );
+ for my $bad ('garbage', '{}', '[]') {
+ eval { PVE::NVMeOF::parse_discovery_log($bad) };
+ ok($@, 'malformed discovery is not an empty success');
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my (@ports, @commands);
+ our $locked;
+ $nvme->mock(with_lock => sub { local $locked = 1; $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'id' } });
+ $net->mock(tcp_ping => sub { push @ports, $_[1]; $_[1] != 8009 });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'discovery holds the NVMe lock');
+ is($opts{timeout}, 30, 'discovery command timeout');
+ push @commands, $cmd;
+ $opts{outfunc}->($raw);
+ },
+ );
+ my $rows = PVE::API2::Storage::Scan->nvmeofscan({ node => 'n1', portal => '192.0.2.1' });
+ is_deeply(\@ports, [8009, 4420], 'unspecified port tries discovery then I/O port');
+ is_deeply($rows, [{ subsysnqn => 'nqn.test', portals => '192.0.2.1:4420' }], 'API shape');
+ eval {
+ PVE::JSONSchema::validate(
+ $rows,
+ PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns},
+ );
+ };
+ is($@, '', 'API schema accepts result');
+ @ports = ();
+ PVE::NVMeOF::discover('[2001:db8::1]:4421');
+ is_deeply(\@ports, [4421], 'explicit port does not fall back');
+ # the discovery port answers but refuses, the I/O port does not answer
+ $net->mock(tcp_ping => sub { $_[1] == 8009 });
+ $nvme->mock(run_command => sub { die "host not allowed\n" });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - host not allowed$/, 'the error of the answering port is kept');
+ $net->mock(tcp_ping => sub { $_[1] == 4420 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - host not allowed$/, 'also if the other port answers');
+ $net->mock(tcp_ping => sub { 0 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - no answer from portal$/, 'without any answer');
+ $nvme->mock(assert_support => sub { die "nvme-cli is not installed\n" });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ is($@, "nvme-cli is not installed\n", 'a missing prerequisite is reported as it is');
+ # nvme-cli itself writes its diagnostic to stderr and exits with an error
+ $nvme->unmock('run_command');
+ $nvme->mock(assert_support => sub { });
+ my $cli = "$dir/nvme-refusing";
+ file_set_contents($cli, "#!/bin/sh\necho 'host not allowed' >&2\nexit 1\n", 0755);
+ {
+ local $PVE::NVMeOF::NVME = $cli;
+ $net->mock(tcp_ping => sub { $_[1] == 8009 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like(
+ $@,
+ qr/failed - nvme discover: host not allowed$/,
+ 'with the diagnostic of nvme-cli',
+ );
+ }
+};
+
done_testing();
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
index faa29fc3..73938a7e 100755
--- a/src/test/run_san_api_tests.pl
+++ b/src/test/run_san_api_tests.pl
@@ -104,7 +104,7 @@ is_deeply(
);
is_deeply(
[map { $_->{method} } PVE::API2::Storage::Scan->index({ node => 'test' })->@*],
- [qw(cifs iscsi lvm lvmthin nfs pbs zfs)],
+ [qw(cifs iscsi lvm lvmthin nfs nvmeof pbs zfs)],
'scan index lists the discovery scans',
);
is_deeply(
^ permalink raw reply related [relevance 15%]
* [PATCH v5 storage 13/26] multipath: report the NVMe host NQN of each node
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (8 preceding siblings ...)
2026-11-23 13:32 17% ` [PATCH v5 storage 12/26] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
@ 2026-11-23 13:32 10% ` Thomas Lamprecht
2026-11-23 13:32 17% ` [PATCH v5 storage 14/26] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
` (9 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
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');
^ permalink raw reply related [relevance 10%]
* [PATCH v5 manager 26/26] d/control: bump versioned dependencies for NVMe over Fabrics
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (18 preceding siblings ...)
2026-11-23 13:32 13% ` [PATCH v5 manager 25/26] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
@ 2026-11-23 13:32 13% ` Thomas Lamprecht
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
The web UI uses the node API below /nodes/{node}/san/nvmeof of
libpve-storage-perl 9.1.23, and its help links need the NVMe over
Fabrics chapter from pve-docs and pve-doc-generator 9.2.21.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
debian/control | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/debian/control b/debian/control
index 6e4e6aad8..5180893a8 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@ Build-Depends: debhelper-compat (= 13),
libpve-network-api-perl (>= 1.6.11),
libpve-notify-perl,
libpve-rs-perl (>= 0.16.4),
- libpve-storage-perl (>= 9.1.22),
+ libpve-storage-perl (>= 9.1.23),
libtemplate-perl,
libtest-mockmodule-perl,
lintian,
@@ -25,7 +25,7 @@ Build-Depends: debhelper-compat (= 13),
proxmox-widget-toolkit (>= 4.1.4),
pve-cluster (>= 9.1.13),
pve-container,
- pve-doc-generator (>= 9.2.16),
+ pve-doc-generator (>= 9.2.21),
qemu-server (>= 9.2.17),
sq,
unzip,
@@ -69,7 +69,7 @@ Depends: apt (>= 1.5~),
libpve-network-perl (>= 1.6.11),
libpve-notify-perl (>= 9.1.12),
libpve-rs-perl (>= 0.16.4),
- libpve-storage-perl (>= 9.1.22),
+ libpve-storage-perl (>= 9.1.23),
librados2-perl (>= 1.3-1),
libtemplate-perl,
liburi-perl,
@@ -88,7 +88,7 @@ Depends: apt (>= 1.5~),
proxmox-widget-toolkit (>= 5.2.18),
pve-cluster (>= 9.1.13),
pve-container (>= 6.1.25),
- pve-docs (>= 9.2.20),
+ pve-docs (>= 9.2.21),
pve-firewall,
pve-ha-manager (>= 5.2.7),
pve-i18n (>= 3.2.0~),
^ permalink raw reply related [relevance 13%]
* [PATCH v5 manager 18/26] ui: storage: add NVMe over Fabrics storage
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (12 preceding siblings ...)
2026-11-23 13:32 19% ` [PATCH v5 docs 16/26] storage: document NVMe over Fabrics storages Thomas Lamprecht
@ 2026-11-23 13:32 18% ` Thomas Lamprecht
2026-11-23 13:32 20% ` [PATCH v5 manager 19/26] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
` (5 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
Show NVMe over Fabrics storages with their subsystem in the storage
list, and add a dialog for them. The dialog lists the subsystems that a
discovery portal reports and fills in the portals of the selected one,
which can be changed. Without a discovery portal, the subsystem and its
portals can be entered as they are. As in the iSCSI dialog, the
discovery can run on another node, since the node serving the web UI
may not be allowed on the array. The node of the discovery is then
preselected as the node of the storage.
The subsystem selector builds on the iSCSI target selector, which now
lets a subclass set its store fields and sort key.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/Utils.js | 6 ++
www/manager6/dc/StorageView.js | 14 ++-
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/NVMeOFEdit.js | 162 +++++++++++++++++++++++++++++
5 files changed, 184 insertions(+), 4 deletions(-)
create mode 100644 www/manager6/storage/NVMeOFEdit.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 1ee82e9a9..dddf17590 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -380,6 +380,7 @@ JSSRC= \
storage/LvmThinEdit.js \
storage/BTRFSEdit.js \
storage/NFSEdit.js \
+ storage/NVMeOFEdit.js \
storage/PBSEdit.js \
storage/RBDEdit.js \
storage/StatusView.js \
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index faf621bc5..d508d0469 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -886,6 +886,12 @@ Ext.define('PVE.Utils', {
faIcon: 'building',
backups: false,
},
+ nvmeof: {
+ name: 'NVMe over Fabrics',
+ ipanel: 'NVMeOFInputPanel',
+ faIcon: 'building',
+ backups: false,
+ },
cephfs: {
name: 'CephFS',
ipanel: 'CephFSInputPanel',
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index baad3990f..6afea33ce 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -68,8 +68,9 @@ Ext.define(
});
},
- // What a storage is on: the volume group or pool for the types without path or target.
- storageLocation: function ({ type, vgname, thinpool, pool, target, path }) {
+ // What a storage is on: the volume group, pool or subsystem for the types without path or
+ // target.
+ storageLocation: function ({ type, vgname, thinpool, pool, subsysnqn, target, path }) {
switch (type) {
case 'lvm':
return vgname;
@@ -77,6 +78,8 @@ Ext.define(
return vgname && thinpool ? `${vgname}/${thinpool}` : vgname;
case 'zfspool':
return pool;
+ case 'nvmeof':
+ return subsysnqn;
default:
return target || path;
}
@@ -208,6 +211,13 @@ Ext.define(
),
'lun target',
],
+ nvmeof: [
+ 'san',
+ gettext(
+ 'Connect to an NVMe/TCP subsystem, to use its namespaces directly or as base of an LVM storage.',
+ ),
+ 'nvme tcp subsystem namespace',
+ ],
zfs: [
'san',
gettext(
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index ad18282d8..0dd77247d 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -5,6 +5,7 @@ Ext.define('PVE.storage.IScsiScan', {
queryParam: 'portal',
valueField: 'target',
displayField: 'target',
+ scanFields: ['target', 'portal'],
matchFieldWidth: false,
allowBlank: false,
@@ -56,13 +57,13 @@ Ext.define('PVE.storage.IScsiScan', {
}
let store = Ext.create('Ext.data.Store', {
- fields: ['target', 'portal'],
+ fields: me.scanFields,
proxy: {
type: 'proxmox',
url: `${me.apiBaseUrl}${me.nodename}${me.apiSuffix}`,
},
});
- store.sort('target', 'ASC');
+ store.sort(me.valueField, 'ASC');
Ext.apply(me, {
store: store,
diff --git a/www/manager6/storage/NVMeOFEdit.js b/www/manager6/storage/NVMeOFEdit.js
new file mode 100644
index 000000000..84dd6f635
--- /dev/null
+++ b/www/manager6/storage/NVMeOFEdit.js
@@ -0,0 +1,162 @@
+Ext.define('PVE.storage.NVMeOFScan', {
+ extend: 'PVE.storage.IScsiScan',
+ alias: 'widget.pveNVMeOFScan',
+
+ valueField: 'subsysnqn',
+ displayField: 'subsysnqn',
+ scanFields: ['subsysnqn', 'portals'],
+
+ listConfig: {
+ width: 650,
+ columns: [
+ {
+ dataIndex: 'subsysnqn',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+ emptyText: PVE.Utils.renderNotFound(gettext('Subsystem')),
+ },
+
+ config: {
+ apiSuffix: '/scan/nvmeof',
+ },
+});
+
+Ext.define('PVE.storage.NVMeOFInputPanel', {
+ extend: 'PVE.panel.StorageBase',
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ onlineHelp: 'storage_nvmeof',
+
+ namespaceContent: 'images',
+
+ onGetValues: function (values) {
+ let me = this;
+
+ values.content = values.namespaces ? me.namespaceContent : 'none';
+ delete values.namespaces;
+
+ return me.callParent([values]);
+ },
+
+ // a storage can be restricted to some volume types, keep its content types then
+ setValues: function (values) {
+ let me = this;
+
+ values.namespaces = PVE.Utils.contentAllows(values.content, 'vm-vol');
+ if (values.namespaces) {
+ me.namespaceContent = Ext.Array.from(values.content).join(',');
+ }
+ me.callParent([values]);
+ },
+
+ column1: [
+ {
+ xtype: 'textfield',
+ name: 'discovery-portal',
+ fieldLabel: gettext('Discovery Portal'),
+ // without discovery, the subsystem and portals can be entered as they are
+ allowBlank: true,
+ submitValue: false,
+ cbind: {
+ hidden: '{!isCreate}',
+ disabled: '{!isCreate}',
+ },
+ listeners: {
+ // The subsystem and the I/O portals of a previous discovery go at once, also its
+ // pending request. The next discovery waits until the portal is typed.
+ change: function (field, value) {
+ let panel = field.up('inputpanel');
+ let scan = panel.lookup('subsystemScan');
+ scan.setPortal('');
+ scan.setHideTrigger(true);
+ scan.setValue('');
+ scan.getStore().removeAll();
+ panel.down('field[name=portals]')?.setValue('');
+ // a pasted portal can come with spaces around it
+ let typed = (value ?? '').trim();
+ let portal = typed && !PVE.SANUtils.portalIncomplete(typed) ? typed : '';
+ field.discovery ??= new Ext.util.DelayedTask();
+ field.discovery.delay(500, () => {
+ if (portal && !scan.destroyed) {
+ scan.setHideTrigger(false);
+ scan.setPortal(portal);
+ }
+ });
+ },
+ destroy: (field) => field.discovery?.cancel(),
+ },
+ },
+ {
+ xtype: 'checkbox',
+ name: 'namespaces',
+ boxLabel: gettext('Use namespaces directly'),
+ },
+ ],
+
+ // NQNs and portal lists are longer than a column is wide
+ columnB: [
+ {
+ cbind: {
+ xtype: (get) => (get('isCreate') ? 'pveNVMeOFScan' : 'displayfield'),
+ hideTrigger: '{isCreate}',
+ },
+ // an NQN can also be typed, if the array offers no discovery
+ editable: true,
+ notFoundIsValid: true,
+ // the list needs a discovery portal
+ expand: function () {
+ if (this.portal) {
+ this.self.prototype.expand.call(this);
+ }
+ },
+ name: 'subsysnqn',
+ value: '',
+ fieldLabel: gettext('Subsystem'),
+ // shown when editing; an NQN wraps best at the line end, not at its first hyphen
+ fieldStyle: 'word-break: break-all;',
+ allowBlank: false,
+ reference: 'subsystemScan',
+ listeners: {
+ change: function (field, value) {
+ let rec = field
+ .getStore?.()
+ .findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ field
+ .up('inputpanel')
+ .down('field[name=portals]')
+ .setValue(rec.get('portals'));
+ }
+ },
+ nodechanged: function (value) {
+ this.up('inputpanel').lookup('storageNodeRestriction').setValue(value);
+ },
+ },
+ },
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ allowBlank: false,
+ },
+ ],
+
+ advancedColumn1: [
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'fast-io-fail-tmo',
+ fieldLabel: gettext('Fail I/O After (s)'),
+ minValue: -1,
+ emptyText: '120',
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Applies to newly connected paths. -1 disables the timeout.'),
+ },
+ },
+ ],
+});
^ permalink raw reply related [relevance 18%]
* [PATCH v5 manager 19/26] ui: lvm: offer NVMe over Fabrics storages as base storage
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (13 preceding siblings ...)
2026-11-23 13:32 18% ` [PATCH v5 manager 18/26] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-23 13:32 20% ` Thomas Lamprecht
2026-11-23 13:32 19% ` [PATCH v5 manager 21/26] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
` (4 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
A namespace of an NVMe over Fabrics storage can hold the volume group
of an LVM storage like an iSCSI LUN, so list such storages in the base
storage selector as well and name the type of each. One that offers its
namespaces as guest disks is left out, as it cannot be a base storage.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/StorageView.js | 4 ++--
www/manager6/storage/LVMEdit.js | 20 ++++++++++++++++----
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 6afea33ce..5f4f519be 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -250,9 +250,9 @@ Ext.define(
lvm: [
'local',
gettext(
- 'Use an existing volume group, or create one on a LUN of an iSCSI storage.',
+ 'Use an existing volume group, or create one on an iSCSI LUN or NVMe/TCP namespace.',
),
- 'san lun shared',
+ 'san lun shared nvme namespace',
],
lvmthin: ['local', gettext('Use an existing LVM thin pool.'), ''],
zfspool: ['local', gettext('Use an existing ZFS pool or dataset.'), 'zpool'],
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 688130b19..e4c218a37 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -70,10 +70,21 @@ Ext.define('PVE.storage.BaseStorageSelector', {
let store = Ext.create('Ext.data.Store', {
autoLoad: {
addRecords: true,
- params: {
- type: 'iscsi',
- },
},
+ filters: [
+ {
+ filterFn: (rec) => {
+ let type = rec.get('type');
+ // one that offers its namespaces as guest disks cannot be a base
+ let direct =
+ type === 'nvmeof' &&
+ /(^|,)(images|vm-vol)(,|$)/.test(rec.get('content') ?? '');
+ return (
+ !rec.get('storage') || (['iscsi', 'nvmeof'].includes(type) && !direct)
+ );
+ },
+ },
+ ],
fields: [
'storage',
'type',
@@ -82,7 +93,8 @@ Ext.define('PVE.storage.BaseStorageSelector', {
name: 'text',
convert: function (value, record) {
if (record.data.storage) {
- return record.data.storage + ' (iSCSI)';
+ let type = PVE.Utils.format_storage_type(record.data.type);
+ return `${record.data.storage} (${type})`;
} else {
return me.existingGroupsText;
}
^ permalink raw reply related [relevance 20%]
* [PATCH v5 storage 15/26] d/control: break pve-manager versions without namespace notifications
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (10 preceding siblings ...)
2026-11-23 13:32 17% ` [PATCH v5 storage 14/26] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
@ 2026-11-23 13:32 5% ` Thomas Lamprecht
2026-11-23 13:32 19% ` [PATCH v5 docs 16/26] storage: document NVMe over Fabrics storages Thomas Lamprecht
` (7 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
The report of a node lists the namespaces of NVMe over Fabrics storages
and marks a report whose namespaces could not be listed. The pvestatd
of pve-manager before 9.2.38 does not know that mark, so it would take
such namespaces as gone and clear their alerts.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
debian/control | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/control b/debian/control
index 8acbeddf..9a460e4f 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Architecture: all
Breaks: libpve-guest-common-perl (<< 4.0-3),
libpve-http-server-perl (<< 4.0-3),
pve-container (<< 6.1.22),
- pve-manager (<< 9.2.36),
+ pve-manager (<< 9.2.38),
qemu-server (<< 9.2.17),
Depends: bzip2,
ceph-common (>= 12.2~),
^ permalink raw reply related [relevance 5%]
* [PATCH v5 storage 03/26] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
2026-11-23 13:31 13% ` [PATCH v5 storage 01/26] api: config: activate a new storage without holding the lock Thomas Lamprecht
2026-11-23 13:31 10% ` [PATCH v5 storage 02/26] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
@ 2026-11-23 13:31 16% ` Thomas Lamprecht
2026-11-23 13:31 15% ` [PATCH v5 storage 05/26] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
` (16 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:31 UTC (permalink / raw)
To: pve-devel
The disk list for local disk setup leaves out iSCSI LUNs, which storages
connect for use on several nodes. Namespaces attached over TCP or RDMA
are the same kind of device, but were listed, so Node > Disks offered
them for a ZFS pool, a directory, a volume group or a Ceph OSD, while
other nodes could use the same namespace.
Leave these namespaces out of the list for local disk setup, and also a
namespace whose transport cannot be read, like one whose last controller
is gone. The SAN views still list those attached over TCP or RDMA. For a
subsystem with controllers of several transports, a fabric one counts,
whatever their order. The partitions go with their namespace, so the
checks before local disk setup refuse both as not a valid local disk,
and removing a directory or ZFS pool on one with the cleanup of its
disks refuses as for an iSCSI LUN. Namespaces attached over Fibre
Channel stay listed, as Fibre Channel LUNs do, since a volume group
created under Node > Disks is how these get a shared LVM storage.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 30 ++++--
.../multipath/disklist_expected.json | 16 ----
.../nvme_smart/nvme0n1/device/transport | 1 +
src/test/disklist_test.pm | 94 +++++++++++++++++--
4 files changed, 109 insertions(+), 32 deletions(-)
create mode 100644 src/test/disk_tests/nvme_smart/nvme0n1/device/transport
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index a23ffe98..d70647c8 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -555,23 +555,27 @@ sub read_subsysnqn {
}
# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
-# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+# its controller, or from the controllers of its subsystem for native NVMe multipath setups. Of
+# several transports, one over a fabric wins, independent of the order of the controllers.
sub get_nvme_transport {
my ($sysdir) = @_;
my $transport = file_read_firstline("$sysdir/device/transport");
return $transport if defined($transport);
+ my $found = {};
dir_glob_foreach(
"$sysdir/device",
'nvme\d+',
sub {
my ($controller) = @_;
- $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ my $value = file_read_firstline("$sysdir/device/$controller/transport");
+ $found->{$value} = 1 if defined($value);
},
);
- return $transport;
+ my ($first) = grep { $found->{$_} } (qw(tcp rdma fc), sort keys $found->%*);
+ return $first;
}
# SAS does not distinguish local from remote attachments, so it is not classified as remote.
@@ -614,7 +618,10 @@ sub mounted_paths {
sub get_disks {
my ($disks, $nosmart, $include_partitions, $san_inventory) = @_;
- # SAN inventory includes iSCSI session devices and skips usage probes that read devices.
+ # Only the SAN inventory includes iSCSI LUNs and NVMe namespaces attached over TCP or RDMA, or
+ # over an unknown transport, as storages connect them for use on several nodes. Fibre Channel
+ # devices stay listed, as local disk setup is how a volume group gets onto one. The SAN
+ # inventory skips usage probes that read devices.
my $disklist = {};
my $mounted = mounted_blockdevs();
@@ -679,15 +686,20 @@ sub get_disks {
return if !$san_inventory && is_iscsi_device($dev);
+ my $sysdir = "/sys/block/$dev";
+
+ my $nvme_transport;
+ if ($dev =~ m/^nvme/) {
+ $nvme_transport = get_nvme_transport($sysdir);
+ # like a namespace whose last controller is gone, which can be one over a network
+ return if !$san_inventory && !defined($nvme_transport);
+ }
+ return if !$san_inventory && ($nvme_transport // '') =~ /^(?:tcp|rdma)$/;
+
$udev_db //= get_udev_db() if ++$udev_queries > $udev_single;
my $data = get_udev_info("/sys/block/$dev", $udev_db) // return;
my $devpath = $data->{devpath};
- my $sysdir = "/sys/block/$dev";
-
- my $nvme_transport;
- $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
-
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
index ec442969..8098dd8d 100644
--- a/src/test/disk_tests/multipath/disklist_expected.json
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -87,21 +87,5 @@
"osdid-list": null,
"by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
"transport": "nvme-fc"
- },
- "nvme9n1": {
- "devpath": "/dev/nvme9n1",
- "size": 10737418240,
- "vendor": "FABVEND",
- "model": "FABRICS CTRL",
- "serial": "FAB1",
- "wwn": "uuid.10000000-0000-0000-0000-000000000001",
- "gpt": 0,
- "rpm": 0,
- "type": "nvme",
- "health": "UNKNOWN",
- "wearout": "N/A",
- "osdid": -1,
- "osdid-list": null,
- "transport": "nvme-tcp"
}
}
diff --git a/src/test/disk_tests/nvme_smart/nvme0n1/device/transport b/src/test/disk_tests/nvme_smart/nvme0n1/device/transport
new file mode 100644
index 00000000..30e0ba74
--- /dev/null
+++ b/src/test/disk_tests/nvme_smart/nvme0n1/device/transport
@@ -0,0 +1 @@
+pcie
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 38823f8b..fae8ce45 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -290,12 +290,63 @@ sub test_disk_list {
for my $transport (qw(tcp rdma fc pcie)) {
$smart_calls = 0;
$diskmanage_module->mock(get_nvme_transport => sub { $transport });
- PVE::Diskmanage::get_disks();
+ # with SMART, as the SAN inventory lists the namespaces of all transports
+ PVE::Diskmanage::get_disks(undef, 0, 0, 1);
$testcount++;
is($smart_calls, $transport eq 'pcie' ? 1 : 0, "SMART queries for $transport");
}
$diskmanage_module->unmock('get_smart_data');
- $diskmanage_module->unmock('get_nvme_transport');
+
+ for my $transport ('tcp', 'rdma', 'fc', 'pcie', undef) {
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ my $local = ($transport // '') =~ /^(?:fc|pcie)$/;
+ my $name = $transport // 'an unknown transport';
+ $testcount += 3;
+ is(
+ !!PVE::Diskmanage::get_disks()->{nvme0n1},
+ $local,
+ "disk list for local setup with $name",
+ );
+ ok(
+ PVE::Diskmanage::get_disks(undef, 1, 0, 1)->{nvme0n1},
+ "SAN inventory with $name",
+ );
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1') };
+ like(
+ $@,
+ $local ? qr/^$/ : qr/not a valid local disk/,
+ "local disk setup with $name",
+ );
+ }
+
+ $diskmanage_module->mock(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $sub) = @_;
+ return $sub->('nvme0n1p1') if $dir eq '/sys/block/nvme0n1';
+ return mocked_dir_glob_foreach(@_);
+ },
+ is_partition => sub { return $_[0] eq '/dev/nvme0n1p1' },
+ get_blockdev => sub { return '/dev/nvme0n1' },
+ );
+ for my $transport (qw(tcp rdma fc pcie)) {
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ my $local = $transport eq 'fc' || $transport eq 'pcie';
+ $testcount += 2;
+ is(
+ !!PVE::Diskmanage::get_disks(undef, 1, 1)->{nvme0n1p1},
+ $local,
+ "partition list for local setup with $transport",
+ );
+ # partitions have holders in these tests, so a listed one counts as used
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1p1') };
+ like(
+ $@,
+ $local ? qr/already in use/ : qr/not a valid local disk/,
+ "local disk setup on a partition with $transport",
+ );
+ }
+ $diskmanage_module->mock(dir_glob_foreach => \&mocked_dir_glob_foreach);
+ $diskmanage_module->unmock($_) for qw(is_partition get_blockdev get_nvme_transport);
}
if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
@@ -342,7 +393,8 @@ sub test_disk_list {
$udev_single_queries = 0;
my $listed = PVE::Diskmanage::get_disks();
$testcount++;
- is(scalar(keys %$listed), 6, 'all disks listed');
+ is(scalar(keys %$listed), 5,
+ 'all disks listed but the namespace attached over TCP');
$testcount++;
is(
$udev_single_queries,
@@ -350,8 +402,8 @@ sub test_disk_list {
'the database replaces the queries after the first disks',
);
- # six disks: 240 block devices are just enough to ask about each of them on its own
- for my $count (240, 239) {
+ # five disks: 200 block devices are just enough to ask about each of them on its own
+ for my $count (200, 199) {
$diskmanage_module->mock(
get_lsblk_info => sub {
return { map { ("/dev/dm-$_" => {}) } 1 .. $count };
@@ -363,10 +415,38 @@ sub test_disk_list {
$testcount++;
is(
$udev_single_queries,
- $count == 240 ? 6 : 5,
- "single queries for six disks among $count block devices",
+ $count == 200 ? 5 : 4,
+ "single queries for five disks among $count block devices",
);
}
+
+ my $san = PVE::Diskmanage::get_disks(undef, 1, 0, 1);
+ $testcount++;
+ is($san->{nvme9n1}->{transport}, 'nvme-tcp', 'SAN inventory lists it');
+
+ # a second controller of the subsystem over Fibre Channel, listed before or after
+ for my $order ([qw(nvme4 nvme5)], [qw(nvme5 nvme4)]) {
+ $diskmanage_module->mock(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $sub) = @_;
+ return mocked_dir_glob_foreach(@_)
+ if $dir ne '/sys/block/nvme9n1/device';
+ $sub->($_) for $order->@*;
+ },
+ file_read_firstline => sub {
+ return 'fc' if $_[0] eq '/sys/block/nvme9n1/device/nvme4/transport';
+ return mocked_file_read_firstline(@_);
+ },
+ );
+ $testcount++;
+ is(
+ PVE::Diskmanage::get_nvme_transport('/sys/block/nvme9n1'),
+ 'tcp',
+ "TCP wins over Fibre Channel listed as $order->[0], $order->[1]",
+ );
+ }
+ $diskmanage_module->mock(dir_glob_foreach => \&mocked_dir_glob_foreach);
+ $diskmanage_module->mock(file_read_firstline => \&mocked_file_read_firstline);
}
done_testing($testcount);
^ permalink raw reply related [relevance 16%]
* [PATCH v5 storage 08/26] lvm: allow a volume group on an NVMe over Fabrics namespace
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (3 preceding siblings ...)
2026-11-23 13:31 15% ` [PATCH v5 storage 05/26] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
@ 2026-11-23 13:32 18% ` Thomas Lamprecht
2026-11-23 13:32 15% ` [PATCH v5 storage 09/26] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
` (14 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
An LVM storage only accepts an iSCSI LUN as base volume. Accept a
namespace of an NVMe over Fabrics storage too. Adding such an LVM
storage connects the subsystem, waits for the namespace and creates
the volume group on it, and activating it on another node connects
that node first.
The creation treats the namespace like any SAN LUN: it takes the
cluster-wide lock of the LUN and refuses a namespace that another
storage references. A namespace that is not recognized as one, for
example as its last path is gone, is refused rather than taken as a
local disk. A base storage that offers its namespaces as guest disks is
refused, also for an existing volume group, as a guest could otherwise
get the namespace of the group as its disk.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 24 +++++++++++++++----
src/test/run_san_nvme_tests.pl | 42 ++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index b759554c..dd267b34 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -427,7 +427,13 @@ sub lvm_create_volume_group {
my ($device, $vgname, $shared, $guard) = @_;
require PVE::Storage::SAN;
my $lun = PVE::Storage::SAN::lun_for_device($device);
- return create_volume_group($device, $vgname, undef, $guard) if !$lun;
+ if (!$lun) {
+ # a namespace whose transport cannot be read, like one without a path, is no local disk
+ die "cannot use '$device' - it is not recognized as a SAN LUN, for example as it has no"
+ . " path\n"
+ if $guard && $guard->{'san-only'};
+ return create_volume_group($device, $vgname, undef, $guard);
+ }
PVE::Storage::SAN::with_lun_lock(
$lun,
sub { create_volume_group($device, $vgname, $lun, $guard) },
@@ -1355,9 +1361,12 @@ sub on_add_hook {
my $basecfg = PVE::Storage::storage_config($cfg, $baseid, 1);
die "base storage ID '$baseid' does not exist\n" if !$basecfg;
- # we only support iscsi for now
- die "unsupported base type '$basecfg->{type}'"
- if $basecfg->{type} ne 'iscsi';
+ die "unsupported base storage type '$basecfg->{type}' - expected iscsi or nvmeof\n"
+ if $basecfg->{type} ne 'iscsi' && $basecfg->{type} ne 'nvmeof';
+ # with direct use, a guest can get the namespace as disk, also with an existing group on it
+ die "storage '$baseid' offers its namespaces as disk images - if no guest uses them"
+ . " directly, set its content to 'none'\n"
+ if $basecfg->{type} eq 'nvmeof' && PVE::Storage::san_storage_serves_images($basecfg);
# Managed multipath requires the coalesced map or a partition of it, never a transient
# single-path PV.
@@ -1399,7 +1408,12 @@ sub on_add_hook {
$path,
$scfg->{vgname},
$scfg->{shared},
- { check_storage => $check_target, exempt => $storeid },
+ {
+ check_storage => $check_target,
+ exempt => $storeid,
+ # the volumes of an NVMe over Fabrics storage are whole namespaces
+ 'san-only' => $basecfg->{type} eq 'nvmeof',
+ },
);
}
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 61872a60..86690318 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -149,4 +149,46 @@ is_deeply(
);
is_deeply(\@opens, [$link], 'VG creation holds the native by-id device');
+$cfg->{ids} = { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test', content => { none => 1 } } };
+my @activation;
+my $add = sub {
+ PVE::Storage::LVMPlugin->on_add_hook(
+ 'data',
+ { base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'data', shared => 1 },
+ );
+};
+$storage->mock(path => sub { $link });
+$storage->mock(activate_storage => sub { push @activation, 'storage' });
+$storage->mock(activate_volumes => sub { push @activation, 'volume' });
+$lvm->mock(
+ lvm_create_volume_group => sub {
+ is($_[0], $link, 'add hook passes native base');
+ is($_[3]->{exempt}, 'data', 'add hook exempts new storage');
+ ok($_[3]->{'san-only'}, 'and takes the namespace only as SAN LUN');
+ },
+);
+$add->();
+is_deeply(\@activation, ['storage', 'volume'], 'LVM activates the NVMe base before creation');
+$lvm->unmock('lvm_create_volume_group');
+
+# an existing volume group of the same name is taken over without writes
+@order = ();
+$lvm->mock(lvm_pv_info => sub { { vgname => 'data', in_use => 1 } });
+$add->();
+is_deeply(\@order, [qw(lock unlock)], 'an existing volume group is taken over');
+$lvm->mock(lvm_pv_info => sub { undef });
+
+@activation = ();
+$cfg->{ids}->{fabric}->{content} = { images => 1 };
+eval { $add->() };
+like($@, qr/offers its namespaces as disk images/, 'a base with direct use refuses');
+is_deeply(\@activation, [], 'before it activates anything');
+$cfg->{ids}->{fabric}->{content} = { none => 1 };
+
+@order = ();
+$disk->mock(get_nvme_transport => sub { undef });
+eval { $add->() };
+like($@, qr/not recognized as a SAN LUN/, 'a namespace without transport is no local disk');
+is_deeply(\@order, [], 'and nothing is written to it');
+
done_testing();
^ permalink raw reply related [relevance 18%]
* [PATCH v5 storage 01/26] api: config: activate a new storage without holding the lock
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
@ 2026-11-23 13:31 13% ` Thomas Lamprecht
2026-11-23 13:31 10% ` [PATCH v5 storage 02/26] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
` (18 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:31 UTC (permalink / raw)
To: pve-devel
Adding a storage activates it, to report a problem right away, while it
holds the lock on the storage configuration. For a storage that connects
over the network, like an iSCSI target or an NVMe over Fabrics
subsystem, this can wait for unreachable portals, which blocks every
other change to the storage configuration in the cluster meanwhile. An
LVM storage on such a base also activates the base storage and volume in
its add hook, with the configuration locked.
Activate a new storage once the configuration is written and the lock
released. Another activation, like the one of pvestatd, can then run at
the same time, so a failed one is retried once. If it still fails, take
the lock again to remove the storage, unless it changed or became the
base of another storage meanwhile, and report the error as before. Other
nodes can see the storage for that time, and keep what their activations
connected or mounted.
Activate the base storage and volume of an LVM storage on an iSCSI or
NVMe over Fabrics base before taking the lock. With all paths answering,
the add hook then finds them active and does not wait for the network
with the configuration locked.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
ApiChangeLog | 11 +++
src/PVE/API2/Storage/Config.pm | 69 +++++++++++----
src/test/Makefile | 4 +
src/test/run_storage_create_tests.pl | 120 +++++++++++++++++++++++++++
4 files changed, 189 insertions(+), 15 deletions(-)
create mode 100755 src/test/run_storage_create_tests.pl
diff --git a/ApiChangeLog b/ApiChangeLog
index e8fe58e8..40c3bea3 100644
--- a/ApiChangeLog
+++ b/ApiChangeLog
@@ -131,6 +131,17 @@ Future changes should be documented in here.
`cluster_lock_storage()`, and must not rely on the guest staying locked while it runs. This
depends on the version of pve-storage, not on the API version.
+* Activate a new storage after releasing the configuration lock
+
+ Adding a storage calls `activate_storage()` once its section is written and the lock on the
+ storage configuration is released, so that waiting for a network does not block other changes to
+ the configuration. As another activation can run at the same time, a failed one is retried once.
+ If it still fails, the section is removed again, unless it changed or became the base of another
+ storage meanwhile. Other nodes can activate the storage meanwhile and keep what they connected or
+ mounted. The base storage and volume of an LVM storage on an iSCSI or NVMe over Fabrics base are
+ activated before the lock is taken, so that `on_add_hook()` usually finds them active. This
+ depends on the version of pve-storage, not on the API version.
+
## Version 16:
* Add `volname_for_format()`, `get_parsed_format()`, `volname_with_format()`, `is_valid_format()` and
diff --git a/src/PVE/API2/Storage/Config.pm b/src/PVE/API2/Storage/Config.pm
index ce41c927..47d57282 100755
--- a/src/PVE/API2/Storage/Config.pm
+++ b/src/PVE/API2/Storage/Config.pm
@@ -274,7 +274,21 @@ __PACKAGE__->register_method({
assert_cluster_knows_content_types($opts->{content});
- my $returned_config;
+ # An LVM storage on a SAN base activates the base in its add hook. Connecting it can wait
+ # for the network, which must not happen while the configuration is locked, so activate it
+ # before. With all paths answering, the hook then finds it active.
+ if ($type eq 'lvm' && (my $base = $opts->{base})) {
+ my ($baseid) = PVE::Storage::parse_volume_id($base, 1);
+ my $cfg = PVE::Storage::config();
+ my $basecfg =
+ defined($baseid) ? PVE::Storage::storage_config($cfg, $baseid, 1) : undef;
+ if ($basecfg && ($basecfg->{type} eq 'iscsi' || $basecfg->{type} eq 'nvmeof')) {
+ PVE::Storage::activate_storage($cfg, $baseid);
+ PVE::Storage::activate_volumes($cfg, [$base]);
+ }
+ }
+
+ my ($returned_config, $written, $added);
PVE::Storage::lock_storage_config(
sub {
my $cfg = PVE::Storage::config();
@@ -293,25 +307,50 @@ __PACKAGE__->register_method({
. " in Proxmox VE 9. Use 'create-base-path' or 'create-subdirs' instead.\n";
}
- eval {
- # try to activate if enabled on local node,
- # we only do this to detect errors/problems sooner
- if (PVE::Storage::storage_check_enabled($cfg, $storeid, undef, 1)) {
- PVE::Storage::activate_storage($cfg, $storeid);
- }
- };
- if (my $err = $@) {
- eval { $plugin->on_delete_hook($storeid, $opts) };
- warn "$@\n" if $@;
- die $err;
- }
-
PVE::Storage::write_config($cfg);
-
+ $written = $cfg;
+ $added = PVE::Storage::config()->{ids}->{$storeid};
},
"create storage failed",
);
+ # The activation only reports a problem early. It can wait for the network, so it runs
+ # without the lock. Another activation, like the one of pvestatd, can run at the same time,
+ # and a mount or connect that lost that race fails, so a failure is retried once. If it
+ # still fails, the storage is removed again, unless it changed or got used meanwhile.
+ if (PVE::Storage::storage_check_enabled($written, $storeid, undef, 1)) {
+ eval { PVE::Storage::activate_storage($written, $storeid) };
+ if (my $err = $@) {
+ sleep(1);
+ eval { PVE::Storage::activate_storage($written, $storeid) };
+ if ($@) {
+ my $removed;
+ eval {
+ local $Storable::canonical = 1;
+ PVE::Storage::lock_storage_config(
+ sub {
+ my $cfg = PVE::Storage::config();
+ my $scfg = $cfg->{ids}->{$storeid} // return;
+ return if Storable::freeze($scfg) ne Storable::freeze($added);
+ return if PVE::Storage::storage_is_used($cfg, $storeid);
+ delete $cfg->{ids}->{$storeid};
+ PVE::Storage::write_config($cfg);
+ $removed = 1;
+ eval { $plugin->on_delete_hook($storeid, $opts) };
+ warn "$@\n" if $@;
+ },
+ "removing it failed",
+ );
+ };
+ die "create storage failed: $err" if $removed;
+ chomp(my $kept = $@);
+ chomp($err);
+ die "storage '$storeid' was added, but its activation failed - $err"
+ . ($kept ? " ($kept)" : '') . "\n";
+ }
+ }
+ }
+
my $res = {
storage => $storeid,
type => $type,
diff --git a/src/test/Makefile b/src/test/Makefile
index 3b902c43..500f9493 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -25,6 +25,7 @@ test: \
test_san_lun_scan \
test_san_taint \
test_sensitive_properties \
+ test_storage_create \
test_volume_access \
test_zfspoolplugin \
@@ -115,3 +116,6 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
+
+test_storage_create: run_storage_create_tests.pl
+ ./run_storage_create_tests.pl
diff --git a/src/test/run_storage_create_tests.pl b/src/test/run_storage_create_tests.pl
new file mode 100755
index 00000000..2aacbab7
--- /dev/null
+++ b/src/test/run_storage_create_tests.pl
@@ -0,0 +1,120 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use Test::MockModule;
+use Test::More;
+
+use PVE::API2::Storage::Config;
+use PVE::Storage;
+use PVE::Storage::LVMPlugin;
+
+# Adding a storage must not wait for its connection while the configuration is locked.
+
+my $raw = "iscsi: san\n\tportal 192.0.2.1\n\ttarget iqn.2026-01.test:a\n\tcontent none\n\n"
+ . "dir: local\n\tpath /var/lib/vz\n\tcontent iso\n";
+our $locked;
+my (@events, @failures, $during, $lock_fails);
+my $storage = Test::MockModule->new('PVE::Storage');
+$storage->mock(
+ lock_storage_config => sub($code, $errmsg) {
+ push @events, 'lock';
+ die "$errmsg: got lock request timeout\n" if $lock_fails;
+ local $locked = 1;
+ $code->();
+ push @events, 'unlock';
+ },
+ 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($cfg, $storeid, @) {
+ push @events, "activate $storeid" . ($locked ? ' locked' : '');
+ $during->() if $during;
+ die shift(@failures) if @failures;
+ },
+ activate_volumes => sub($cfg, $vols, @) {
+ push @events, "volumes @$vols" . ($locked ? ' locked' : '');
+ },
+);
+my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+$lvm->mock(on_add_hook => sub { push @events, 'hook' . ($locked ? ' locked' : ''); return });
+
+my $add = sub(%param) {
+ @events = ();
+ return eval { PVE::API2::Storage::Config->create({%param}); 1 } ? '' : $@;
+};
+my $dir = sub($storeid) { (type => 'dir', storage => $storeid, path => "/srv/$storeid") };
+
+is($add->($dir->('plain')), '', 'added');
+is_deeply(\@events, [qw(lock unlock), 'activate plain'], 'activated after the lock');
+
+@failures = ("mount busy\n");
+is($add->($dir->('raced')), '', 'a failure that another activation caused');
+is_deeply(\@events, [qw(lock unlock), ('activate raced') x 2], 'is tried once more');
+
+@failures = ("no answer\n", "still no answer\n");
+like($add->($dir->('broken')), qr/^create storage failed: no answer$/, 'a failure fails');
+is_deeply(
+ \@events,
+ [qw(lock unlock), ('activate broken') x 2, qw(lock unlock)],
+ 'and takes the lock again',
+);
+unlike($raw, qr/broken/, 'to remove the storage');
+like($raw, qr/plain/, 'but not another one');
+
+@failures = ("no answer\n", "still no answer\n");
+$during = sub { $raw =~ s{(dir: changed\n)}{$1\tdisable 1\n} if $raw !~ /disable 1/ };
+like($add->($dir->('changed')), qr/was added, but its activation failed/, 'a changed storage');
+like($raw, qr/changed/, 'is kept');
+
+@failures = ("no answer\n", "still no answer\n");
+$during =
+ sub { $raw .= "\nlvm: onit\n\tvgname vg\n\tbase used:0.0.1.scsi-3600\n" if $raw !~ /onit/ };
+like($add->($dir->('used')), qr/was added, but its activation failed/, 'so is one in use');
+like($raw, qr/dir: used/, 'as base of another one');
+$during = undef;
+
+@failures = ("no answer\n", "still no answer\n");
+my $calls = 0;
+$storage->mock(
+ lock_storage_config => sub($code, $errmsg) {
+ push @events, 'lock';
+ die "$errmsg: got lock request timeout\n" if $calls++;
+ local $locked = 1;
+ $code->();
+ push @events, 'unlock';
+ },
+);
+like(
+ $add->($dir->('stuck')),
+ qr/activation failed - no answer \(removing it failed: got lock request timeout\)/,
+ 'a removal without the lock reports both errors',
+);
+like($raw, qr/dir: stuck/, 'and keeps the storage');
+$storage->mock(
+ lock_storage_config => sub($code, $errmsg) {
+ push @events, 'lock';
+ local $locked = 1;
+ $code->();
+ push @events, 'unlock';
+ },
+);
+
+my $base = 'san:0.0.1.scsi-36001405aabbccddeeff00112233445566';
+is(
+ $add->(type => 'lvm', storage => 'shared', vgname => 'vg', base => $base, shared => 1),
+ '',
+ 'an LVM storage on a base volume is added',
+);
+is_deeply(
+ \@events,
+ ['activate san', "volumes $base", 'lock', 'hook locked', 'unlock', 'activate shared'],
+ 'its base is activated before the lock',
+);
+$add->(type => 'lvm', storage => 'other', vgname => 'vg2', base => 'local:iso/x.iso');
+is_deeply(
+ \@events,
+ ['lock', 'hook locked', 'unlock', 'activate other'],
+ 'but not a base that is no SAN storage',
+);
+
+done_testing();
^ permalink raw reply related [relevance 13%]
* [PATCH v5 storage 10/26] pvesm: add a scan command for NVMe over Fabrics
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
` (5 preceding siblings ...)
2026-11-23 13:32 15% ` [PATCH v5 storage 09/26] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
@ 2026-11-23 13:32 11% ` Thomas Lamprecht
2026-11-23 13:32 20% ` [PATCH v5 storage 11/26] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
` (12 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:32 UTC (permalink / raw)
To: pve-devel
Add 'pvesm scan nvmeof <portal>', which prints the subsystems a
portal offers to the node with their portals, like the iSCSI scan
prints targets. That gives the values for a new storage on the
command line, with the usual output formats for scripts.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/CLI/pvesm.pm | 13 +++++++++++++
src/test/run_nvmeof_tests.pl | 12 ++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 070c1596..05da60d8 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -737,6 +737,19 @@ our $cmddef = {
$print_api_result,
$PVE::RESTHandler::standard_output_options,
],
+ nvmeof => [
+ "PVE::API2::Storage::Scan",
+ 'nvmeofscan',
+ ['portal'],
+ { node => $nodename },
+ sub {
+ my ($data, $schema, $options) = @_;
+ PVE::CLIFormatter::print_api_result(
+ $data, $schema, [qw(subsysnqn portals)], $options,
+ );
+ },
+ $PVE::RESTHandler::standard_output_options,
+ ],
'san-luns' => [
"PVE::API2::SAN::Node",
'luns',
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index fe9bdace..be1a5eeb 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -15,6 +15,7 @@ use PVE::Tools qw(file_set_contents);
use PVE::API2::Storage::Config;
use PVE::API2::Storage::Scan;
+use PVE::CLI::pvesm;
use PVE::NVMeOF;
use PVE::Storage;
@@ -689,6 +690,17 @@ subtest 'TCP discovery, fallback and API result' => sub {
'with the diagnostic of nvme-cli',
);
}
+ my $formatter = Test::MockModule->new('PVE::CLIFormatter');
+ my $schema = PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns};
+ $formatter->mock(
+ print_api_result => sub {
+ is($_[0], $rows, 'CLI forwards complete discovery rows');
+ is($_[1], $schema, 'CLI forwards discovery schema');
+ is($_[3]->{'output-format'}, 'json', 'CLI supports structured output');
+ },
+ );
+ $PVE::CLI::pvesm::cmddef->{scan}->{nvmeof}->[4]
+ ->($rows, $schema, { 'output-format' => 'json' });
};
done_testing();
^ permalink raw reply related [relevance 11%]
* applied: [PATCH v5 storage,docs,manager 00/26] NVMe over Fabrics storage
@ 2026-11-23 13:31 11% Thomas Lamprecht
2026-11-23 13:31 13% ` [PATCH v5 storage 01/26] api: config: activate a new storage without holding the lock Thomas Lamprecht
` (19 more replies)
0 siblings, 20 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:31 UTC (permalink / raw)
To: pve-devel
This has been already applied in the current form, sorry for the noise,
but I figured this is the cleaner way than replying to v4 with an
exhaustive list of changes.
A storage type for NVMe subsystems reached over TCP, on top of the
applied SAN series [0]: namespaces as base volumes of shared LVM, or
directly as raw VM disks, using the kernel's native NVMe multipath.
This is a deliberately small first version: TCP only, without
authentication or TLS, so access relies on the target's host NQN list
and a dedicated storage network. The plugin connects missing portals and
never disconnects controllers on config change or removal; disconnecting
a controller is an explicit per-node action. The kernel handles path
reconnection, and the SAN series provides LUN inventory, guided setup,
and pre-write guards.
Two operational prerequisites:
- Cloned nodes need distinct /etc/nvme/hostnqn and /etc/nvme/hostid
before connecting.
- All cluster nodes must be upgraded to pve-manager 9.2.38 before
adding the first nvmeof storage, as older nodes drop unknown storage
types when writing storage.cfg; creating the first one is refused
until all nodes are online on 9.2.38+.
What it adds:
- Storage type 'nvmeof' (subsysnqn + TCP portals, one storage per
subsystem, isolated properties, volumes as nvme-<wwid>,
ctrl_loss_tmo=-1, configurable fast-io-fail-tmo defaulting to 120s).
- Shared LVM support with nvmeof volumes as base, discovery via
/nodes/{node}/scan/nvmeof and 'pvesm scan nvmeof', and nvme-cli as a
Recommends of libpve-storage-perl.
- /nodes/{node}/san/nvmeof for host identity, controller listing, and
guarded per-controller disconnect (refused if a namespace in use or
referenced by a storage would lose its last usable path).
- Cluster-wide SAN status and pvestatd path notifications covering
nvmeof namespaces (without requiring multipathd), plus pvereport
output and documentation.
- Web UI: guided "Shared LVM on NVMe over Fabrics" setup, nvmeof
storage dialog with discovery, Node > SAN > NVMe over Fabrics
controller view, host NQN column, and native multipath state display.
Changes since v4 [1], mostly from its automated review:
- New first patch: do not activate a new storage with the storage
configuration locked (see below).
- Volumes & guards: only accept namespaces that native multipath joins
(a namespace device of a single controller is refused); refuse SAN
reference checks when the subsystem NQN cannot be read; refuse an
LVM base storage that serves its namespaces as disk images, also
when reusing an existing VG, and an unidentifiable namespace instead
of treating it as a local disk; the LVM dialog hides such bases.
- Activation: take liveness from the controller state after a connect,
and report that no controller is live, instead of "not online", when
every portal already has a non-live controller.
- Disconnect: recheck paths (including a last path that recovered),
namespace heads by WWID, controller-owned devices and the controller
identity right before removal; walks over a subsystem refuse an
unreadable sysfs directory instead of treating it as empty.
- Wipe: separate messages for a partition of a network namespace, an
unknown transport, and a transport that changed meanwhile.
- Web UI: the controller list explains its namespace count, and the
portal trim moved before the NVMe-oF setup, as a fix of the existing
iSCSI one.
- Docs: direct use and LVM on the same subsystem exclude each other,
discovery ports (8009, then 4420), the multipath prerequisite on the
target side, and that the guided setup needs discovery.
- Smaller: shared node and transport helpers, clearer errors and
commit messages.
The first patch is a generic fix: adding a storage activated it while
holding the cluster-wide storage.cfg lock, so an unreachable iSCSI or
NVMe over Fabrics portal blocked every other storage configuration
change meanwhile. The activation now runs once the configuration is
written, retried once as pvestatd may activate the new storage at the
same time, and a storage that still fails is removed again. An LVM
storage on such a base gets its base activated before the lock.
Tested as v4, and for these changes on the nested cluster against Linux
nvmet and the NetApp AFF A20: activation and paths of all namespaces
through the new head check, Disconnect of a redundant controller and
refusal of the last path on both targets, and the guided setup end to
end with the release packages on all six nodes; the rest by unit tests.
The ZFS-over-NVMe/TCP plugin on the list [2] ships its own initiator;
isolated properties prevent option clashes, and connect helpers can be
shared later. Leaving NVMe/FC partition wipes and Ceph OSDs on NVMe/FC
aligned with Fibre Channel LUNs is left for a SAN-wide follow-up.
[0]: https://lore.proxmox.com/pve-devel/20261119194655.3163258-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20261123020041.3728085-1-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20261005002609.571-1-joaquinvarela@neatech.ar/
pve-storage:
Thomas Lamprecht (15):
api: config: activate a new storage without holding the lock
diskmanage: skip SMART queries for NVMe fabric namespaces
diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only
api: disks: refuse a local wipe of a network NVMe namespace
nvmeof: add a storage for NVMe over Fabrics subsystems
d/control: bump pve-common for plain parameter error names
api: config: check the cluster version before the first nvmeof storage
lvm: allow a volume group on an NVMe over Fabrics namespace
api: scan: add NVMe over Fabrics discovery
pvesm: add a scan command for NVMe over Fabrics
api: san luns: attribute NVMe namespaces to storage
api: add node-level NVMe over Fabrics status and controller removal
multipath: report the NVMe host NQN of each node
multipath: report NVMe over Fabrics namespaces in the cluster status
d/control: break pve-manager versions without namespace notifications
ApiChangeLog | 20 +-
debian/control | 5 +-
src/PVE/API2/Disks.pm | 23 +
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 200 +++++
src/PVE/API2/SAN/Cluster.pm | 38 +-
src/PVE/API2/SAN/Node.pm | 17 +-
src/PVE/API2/Storage/Config.pm | 74 +-
src/PVE/API2/Storage/Scan.pm | 49 ++
src/PVE/CLI/pvesm.pm | 13 +
src/PVE/Diskmanage.pm | 58 +-
src/PVE/Makefile | 1 +
src/PVE/Multipath/Status.pm | 69 +-
src/PVE/NVMeOF.pm | 566 ++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/LVMPlugin.pm | 24 +-
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 307 ++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 34 +-
src/test/Makefile | 10 +
src/test/disk_api_test.pm | 26 +-
.../multipath/disklist_expected.json | 16 -
.../nvme_smart/nvme0n1/device/transport | 1 +
src/test/disklist_test.pm | 104 ++-
src/test/run_multipath_api_tests.pl | 132 +++-
src/test/run_nvmeof_api_tests.pl | 287 +++++++
src/test/run_nvmeof_taint_tests.pl | 67 ++
src/test/run_nvmeof_tests.pl | 714 ++++++++++++++++++
src/test/run_san_api_tests.pl | 4 +-
src/test/run_san_lun_scan_tests.pl | 41 +
src/test/run_san_nvme_tests.pl | 65 ++
src/test/run_storage_create_tests.pl | 120 +++
33 files changed, 2991 insertions(+), 100 deletions(-)
pve-docs:
Thomas Lamprecht (1):
storage: document NVMe over Fabrics storages
notifications.adoc | 5 +-
pve-gui.adoc | 12 ++-
pve-intro.adoc | 3 +-
pve-storage-lvm.adoc | 10 +-
pve-storage-multipath.adoc | 3 +-
pve-storage-nvmeof.adoc | 207 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 24 +++--
7 files changed, 243 insertions(+), 21 deletions(-)
pve-manager:
Thomas Lamprecht (10):
report: add the NVMe over Fabrics host NQN and subsystems
ui: storage: add NVMe over Fabrics storage
ui: lvm: offer NVMe over Fabrics storages as base storage
ui: storage: SAN setup: ignore spaces around a typed portal
ui: storage: add a guided setup for shared LVM on NVMe over Fabrics
ui: node san: list NVMe over Fabrics controllers
ui: san: show the NVMe host NQN of each node
ui: san: show that a namespace uses native multipath
pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps
d/control: bump versioned dependencies for NVMe over Fabrics
PVE/MultipathNotification.pm | 21 +-
PVE/Report.pm | 6 +
PVE/Service/pvestatd.pm | 16 +-
debian/control | 8 +-
test/MultipathNotification_test.pl | 28 ++-
www/manager6/Makefile | 4 +-
www/manager6/SANUtils.js | 7 +-
www/manager6/Utils.js | 7 +
www/manager6/dc/SAN.js | 49 +++-
www/manager6/dc/StorageView.js | 23 +-
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 175 +++++++++++++
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/LVMEdit.js | 20 +-
www/manager6/storage/NVMeOFEdit.js | 162 ++++++++++++
www/manager6/storage/wizard/LunSelect.js | 35 ++-
www/manager6/storage/wizard/NodeIdentities.js | 57 +++--
.../storage/wizard/{IScsi.js => Target.js} | 236 +++++++++++++-----
www/manager6/storage/wizard/Wizard.js | 62 +++--
www/manager6/window/SANLunState.js | 38 ++-
www/manager6/window/SANLunWipe.js | 24 +-
21 files changed, 805 insertions(+), 187 deletions(-)
^ permalink raw reply [relevance 11%]
* [PATCH v5 storage 02/26] diskmanage: skip SMART queries for NVMe fabric namespaces
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
2026-11-23 13:31 13% ` [PATCH v5 storage 01/26] api: config: activate a new storage without holding the lock Thomas Lamprecht
@ 2026-11-23 13:31 10% ` Thomas Lamprecht
2026-11-23 13:31 16% ` [PATCH v5 storage 03/26] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only Thomas Lamprecht
` (17 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 13:31 UTC (permalink / raw)
To: pve-devel
The disk list queries the SMART health of every disk. For an NVMe
namespace attached over TCP, RDMA or Fibre Channel, the query goes to
the target and can stall the listing while a path recovers. Skip it for
these transports, also for namespaces connected by hand. Local NVMe
drives are queried as before.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 4 +++-
src/test/disklist_test.pm | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 77f1a0ec..a23ffe98 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -709,7 +709,9 @@ sub get_disks {
}
my ($health, $wearout) = ('UNKNOWN', 'N/A');
- if (!$nosmart) {
+ # SMART queries over fabrics can stall while a path recovers.
+ my $remote_nvme = is_remote_transport('nvme-' . ($nvme_transport // ''));
+ if (!$nosmart && !$remote_nvme) {
eval {
my $smartdata = get_smart_data($devpath, !is_ssdlike($type));
$health = $smartdata->{health} if $smartdata->{health};
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index f79c59d3..38823f8b 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -284,6 +284,20 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if ($testcasedir eq 'nvme_smart') {
+ my $smart_calls;
+ $diskmanage_module->mock(get_smart_data => sub { $smart_calls++; return {} });
+ for my $transport (qw(tcp rdma fc pcie)) {
+ $smart_calls = 0;
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ PVE::Diskmanage::get_disks();
+ $testcount++;
+ is($smart_calls, $transport eq 'pcie' ? 1 : 0, "SMART queries for $transport");
+ }
+ $diskmanage_module->unmock('get_smart_data');
+ $diskmanage_module->unmock('get_nvme_transport');
+ }
+
if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
my $status = PVE::Multipath::path_status_by_wwid();
my $expected_status =
^ permalink raw reply related [relevance 10%]
* superseded: [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (15 preceding siblings ...)
2026-11-22 1:25 14% ` [PATCH v3 manager 18/18] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
@ 2026-11-23 2:02 6% ` Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 2:02 UTC (permalink / raw)
To: pve-devel
Superseded-by: https://lore.proxmox.com/pve-devel/20261123020041.3728085-1-t.lamprecht@proxmox.com/
^ permalink raw reply [relevance 6%]
* [PATCH v4 manager 19/25] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (13 preceding siblings ...)
2026-11-23 1:47 20% ` [PATCH v4 manager 18/25] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
@ 2026-11-23 1:47 19% ` Thomas Lamprecht
2026-11-23 1:47 13% ` [PATCH v4 manager 20/25] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
` (4 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
Add a guided setup for shared LVM on a namespace of an NVMe over Fabrics
subsystem, with the same steps as for iSCSI. Datacenter > Storage > Add
and the SAN view list it next to the other setups. It connects to a
subsystem found at a discovery portal and shows the host NQNs of the
nodes for the access rules of the array.
The target step is shared with iSCSI, as only the storage type, its
scan and the node identities differ. A reused NVMe over Fabrics storage
keeps its I/O portals, which the step shows read-only. The portals that
the step suggests leave out the default I/O port of such a storage, so
that the discovery also tries the discovery port.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 2 +-
www/manager6/SANUtils.js | 2 +-
www/manager6/dc/SAN.js | 4 +-
www/manager6/dc/StorageView.js | 5 +
www/manager6/storage/wizard/LunSelect.js | 35 ++-
www/manager6/storage/wizard/NodeIdentities.js | 57 +++--
.../storage/wizard/{IScsi.js => Target.js} | 232 +++++++++++++-----
www/manager6/storage/wizard/Wizard.js | 62 +++--
www/manager6/window/SANLunState.js | 30 ++-
9 files changed, 299 insertions(+), 130 deletions(-)
rename www/manager6/storage/wizard/{IScsi.js => Target.js} (60%)
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index dddf17590..f2fc80279 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -393,7 +393,7 @@ JSSRC= \
storage/wizard/Wizard.js \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
- storage/wizard/IScsi.js \
+ storage/wizard/Target.js \
storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index 992265162..bd1c87324 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -237,7 +237,7 @@ Ext.define('PVE.SANUtils', {
},
openSetup: function (type, reloadCallback) {
- let wizard = type === 'fc' ? 'FibreChannel' : 'IScsi';
+ let wizard = { fc: 'FibreChannel', nvmeof: 'NVMeOF' }[type] ?? 'IScsi';
Ext.create(`PVE.storage.wizard.${wizard}`, { autoShow: true, reloadCallback });
},
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index eea8aea65..2f624cbd2 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -112,7 +112,7 @@ Ext.define('PVE.dc.SANView', {
autoShow: true,
});
let setupItem = (type) => ({
- text: type === 'fc' ? gettext('Fibre Channel') : 'iSCSI',
+ text: type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
iconCls: `fa fa-fw fa-${type === 'fc' ? 'plug' : 'building'}`,
disabled: !PVE.SANUtils.canSetup(type),
handler: () => PVE.SANUtils.openSetup(type, reload),
@@ -121,7 +121,7 @@ Ext.define('PVE.dc.SANView', {
{
text: gettext('Add Shared LVM'),
disabled: !PVE.SANUtils.canSetup('iscsi'),
- menu: [setupItem('iscsi'), setupItem('fc')],
+ menu: [setupItem('iscsi'), setupItem('fc'), setupItem('nvmeof')],
},
{
text: gettext('Multipath Overrides'),
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 5f4f519be..4182b4c12 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -201,6 +201,11 @@ Ext.define(
gettext('Set up shared LVM on a Fibre Channel LUN with multipath.'),
'san lun multipath lvm fc guided',
),
+ setup(
+ 'nvmeof',
+ gettext('Set up shared LVM on a namespace of an NVMe/TCP subsystem.'),
+ 'san nvme namespace lvm tcp guided',
+ ),
];
let types = {
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index 36a9a3804..7fd814bf0 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -30,10 +30,11 @@ Ext.define('PVE.storage.wizard.LunSelect', {
// The scan names one target per LUN, also for a LUN reached through several. The content
// listing has the LUNs of the connection, and a LUN that shows up later is listed once the
// scan names the target of the connection for it.
+ let targetKey = wizard.wizardType === 'nvmeof' ? 'nvme-subsystem' : 'iscsi-target';
let filter = {
id: 'connection',
filterFn: (rec) =>
- rec.get('iscsi-target') === connection.target ||
+ rec.get(targetKey) === connection.target ||
(me.connectionWwids ?? []).includes(rec.get('wwid')),
};
me.store.addFilter(filter);
@@ -45,7 +46,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
success: function (response) {
if (!me.destroyed) {
me.connectionWwids = response.result.data
- .map((entry) => entry.volid.match(/\.dm-uuid-mpath-(.+)$/)?.[1])
+ .map((entry) => entry.volid.match(/(?:\.dm-uuid-mpath-|:nvme-)(.+)$/)?.[1])
.filter(Boolean);
me.store.addFilter(filter);
}
@@ -74,7 +75,9 @@ Ext.define('PVE.storage.wizard.LunSelect', {
// the setup refuses a LUN with data, so do not offer one
let hasData = (row) => row.usage === 'lvm' || row.usage === 'other';
let blocked = (row) => inUse(row) || hasData(row);
- let noLunsText = gettext('No LUNs found. Check connections and array access.');
+ let noLunsText = me.nvme
+ ? gettext('No namespaces found. Check connections and array access.')
+ : gettext('No LUNs found. Check connections and array access.');
let updateSelection = function () {
let row = me.getSelection();
me.down('#selection').setValue(row && !blocked(row) ? row.wwid : '');
@@ -91,9 +94,13 @@ Ext.define('PVE.storage.wizard.LunSelect', {
xtype: 'component',
cls: 'pmx-hint',
margin: '0 0 10 0',
- html: gettext(
- 'LUNs with known data or users cannot be selected. To keep the volume group on a LUN, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a LUN, stop its users on all hosts and wipe it under Node > SAN first.',
- ),
+ html: me.nvme
+ ? gettext(
+ 'Namespaces with known data or users cannot be selected. To keep the volume group on a namespace, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a namespace, stop its users on all hosts and wipe it under Node > SAN first.',
+ )
+ : gettext(
+ 'LUNs with known data or users cannot be selected. To keep the volume group on a LUN, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a LUN, stop its users on all hosts and wipe it under Node > SAN first.',
+ ),
},
...(me.rescanNote
? [
@@ -126,6 +133,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
renderer: Ext.htmlEncode,
},
{ text: 'LUN', dataIndex: 'iscsi-lun', width: 60 },
+ { text: 'NSID', dataIndex: 'nvme-nsid', width: 60 },
{
text: gettext('Model'),
dataIndex: 'model',
@@ -144,6 +152,8 @@ Ext.define('PVE.storage.wizard.LunSelect', {
dataIndex: 'multipath',
width: 170,
renderer: PVE.SANUtils.renderSanLunMultipath,
+ // native NVMe multipath needs no setup per namespace
+ hidden: me.nvme,
},
{
text: gettext('Used By'),
@@ -189,9 +199,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
searchchange: function (field, query) {
let grid = me.down('grid');
if (grid?.rendered) {
- grid.setEmptyText(
- query ? gettext('No LUNs match the search.') : noLunsText,
- );
+ let noMatch = me.nvme
+ ? gettext('No namespaces match the search.')
+ : gettext('No LUNs match the search.');
+ grid.setEmptyText(query ? noMatch : noLunsText);
}
},
},
@@ -206,8 +217,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let search = me.down('pveRecordSearchField');
me.on('activate', function () {
search.setTargetStore(me.store);
- if (me.up('window').wizardType === 'fc') {
- me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ let type = me.up('window').wizardType;
+ me.down('gridcolumn[dataIndex=iscsi-lun]').setHidden(type !== 'iscsi');
+ me.down('gridcolumn[dataIndex=nvme-nsid]').setHidden(type !== 'nvmeof');
+ if (type === 'fc') {
me.store.addFilter({
id: 'transport',
filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')),
diff --git a/www/manager6/storage/wizard/NodeIdentities.js b/www/manager6/storage/wizard/NodeIdentities.js
index 0a54f7ce1..36d37e164 100644
--- a/www/manager6/storage/wizard/NodeIdentities.js
+++ b/www/manager6/storage/wizard/NodeIdentities.js
@@ -1,32 +1,21 @@
Ext.define('pve-san-node-identity', {
extend: 'Ext.data.Model',
idProperty: 'node',
- fields: ['node', 'state', 'iscsi-initiator-name'],
+ fields: ['node', 'state', 'iscsi-initiator-name', 'nvme-host-nqn'],
});
-// The nodes with their initiator names, to allow them on the array, and to select the nodes that
-// use the target. The node serving the web UI sets up the volume group, so it stays selected.
+// The nodes with their iSCSI initiator names or NVMe host NQNs, to allow them on the array, and to
+// select the nodes that use the target. The node serving the web UI sets up the volume group, so it
+// stays selected.
Ext.define('PVE.storage.wizard.NodeIdentities', {
extend: 'Ext.grid.Panel',
xtype: 'pveStorageWizardNodeIdentities',
height: 220,
selModel: { selType: 'checkboxmodel', mode: 'SIMPLE' },
viewConfig: { enableTextSelection: true },
- columns: [
- { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
- {
- text: gettext('Multipath Setup'),
- dataIndex: 'state',
- width: 175,
- renderer: PVE.SANUtils.renderState,
- },
- {
- text: gettext('Initiator Name'),
- dataIndex: 'iscsi-initiator-name',
- flex: 1,
- renderer: Ext.htmlEncode,
- },
- ],
+
+ // the identity of a node that the array allows
+ identity: 'iscsi-initiator-name',
getSelectedNodes: function () {
return this.getSelection()
@@ -62,6 +51,24 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
initComponent: function () {
let me = this;
+ let nvme = me.identity === 'nvme-host-nqn';
+ me.columns = [
+ { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
+ {
+ text: gettext('Multipath Setup'),
+ dataIndex: 'state',
+ width: 175,
+ renderer: PVE.SANUtils.renderState,
+ // the state of multipathd, which native NVMe multipath does not use
+ hidden: nvme,
+ },
+ {
+ text: nvme ? gettext('Host NQN') : gettext('Initiator Name'),
+ dataIndex: me.identity,
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ];
me.rstore = Ext.create('Proxmox.data.UpdateStore', {
storeid: 'san-wizard-identities',
model: 'pve-san-node-identity',
@@ -90,19 +97,23 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
me.tbar = [
{
xtype: 'tbtext',
- text: gettext(
- 'Select the nodes that will use the target and allow their initiator names on the array.',
- ),
+ text: nvme
+ ? gettext(
+ 'Select the nodes that will use the subsystem and allow their host NQNs on the array.',
+ )
+ : gettext(
+ 'Select the nodes that will use the target and allow their initiator names on the array.',
+ ),
},
'->',
{
- text: gettext('Copy Initiator Names'),
+ text: nvme ? gettext('Copy Host NQNs') : gettext('Copy Initiator Names'),
iconCls: 'fa fa-clipboard',
handler: () =>
PVE.Utils.copyToClipboard(
me
.getSelection()
- .map((rec) => rec.get('iscsi-initiator-name'))
+ .map((rec) => rec.get(me.identity))
.filter(Boolean)
.join('\n'),
),
diff --git a/www/manager6/storage/wizard/IScsi.js b/www/manager6/storage/wizard/Target.js
similarity index 60%
rename from www/manager6/storage/wizard/IScsi.js
rename to www/manager6/storage/wizard/Target.js
index dc61490fc..2b9c3a5fc 100644
--- a/www/manager6/storage/wizard/IScsi.js
+++ b/www/manager6/storage/wizard/Target.js
@@ -1,16 +1,21 @@
-Ext.define('PVE.storage.wizard.IScsiTarget', {
+// The step of a guided setup that connects to the target of an iSCSI or the subsystem of an NVMe
+// over Fabrics array, through a storage of that type.
+Ext.define('PVE.storage.wizard.Target', {
extend: 'Proxmox.panel.InputPanel',
- xtype: 'pveStorageWizardIScsiTarget',
- onlineHelp: 'storage_open_iscsi',
+ xtype: 'pveStorageWizardTarget',
- // The iSCSI storage the target already has, which the setup uses instead of adding one.
+ storageType: 'iscsi',
+
+ // The storage the target already has, which the setup uses instead of adding one.
existingConnection: function () {
let me = this;
let target = me.down('field[name=target]').getValue();
- return me.storages?.find((entry) => entry.type === 'iscsi' && entry.target === target);
+ return me.storages?.find(
+ (entry) => entry.type === me.storageType && entry[me.targetKey] === target,
+ );
},
- // The ID of the iSCSI storage the setup adds, named after the storage on the LUN by default.
+ // The ID of the storage the setup adds, named after the storage on the LUN by default.
newConnectionId: function () {
let me = this;
let id = me.down('field[name=storage]').getValue();
@@ -21,8 +26,9 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
// step and Next both use it, so that the note does not promise what Next then refuses.
reuseConflict: function (selectedNodes) {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let target = me.down('field[name=target]').getValue();
- let users = (me.storages ?? []).filter((entry) => entry.target === target);
+ let users = (me.storages ?? []).filter((entry) => entry[me.targetKey] === target);
if (!users.length) {
return undefined;
}
@@ -30,30 +36,46 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
let format = (text, ...args) => Ext.String.format(text, ...args);
if (users.length !== 1) {
return format(
- gettext(
- 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
- ),
+ nvme
+ ? gettext(
+ 'Storages {0} use this subsystem. The setup can only reuse a subsystem that one storage uses.',
+ )
+ : gettext(
+ 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
+ ),
users.map((entry) => entry.storage).join(', '),
);
- } else if (base.type !== 'iscsi') {
+ } else if (base.type !== me.storageType) {
return format(
- gettext(
- 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses this subsystem. The setup can only reuse an NVMe over Fabrics storage.',
+ )
+ : gettext(
+ 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
+ ),
base.storage,
);
} else if (`${base.content ?? ''}` !== 'none') {
return format(
- gettext(
- 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses the namespaces of this subsystem directly. If no guest uses them, clear Use namespaces directly in its edit dialog, otherwise use another subsystem.',
+ )
+ : gettext(
+ 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
+ ),
base.storage,
);
} else if (base.disable) {
return format(
- gettext(
- 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" connects to this subsystem, but it is disabled. Enable that storage first.',
+ )
+ : gettext(
+ 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
+ ),
base.storage,
);
}
@@ -61,17 +83,17 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
if (baseNodes.length && !baseNodes.includes(Proxmox.NodeName)) {
return format(
gettext(
- 'iSCSI storage "{0}" is not available on node "{1}". Open the web UI on one of its nodes.',
+ 'Storage "{0}" is not available on node "{1}". Open the web UI on one of its nodes.',
),
base.storage,
Proxmox.NodeName,
);
} else if (baseNodes.length && selectedNodes.some((node) => !baseNodes.includes(node))) {
return format(
- gettext('iSCSI storage "{0}" is not available on all selected nodes.'),
+ gettext('Storage "{0}" is not available on all selected nodes.'),
base.storage,
);
- } else if (!base['managed-multipath']) {
+ } else if (!nvme && !base['managed-multipath']) {
return format(
gettext(
'Enable Multipath in the edit dialog of storage "{0}" before using it here.',
@@ -94,6 +116,14 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
field.setReadOnly(!!existing);
let id = me.down('field[name=storage]').getValue();
field.setEmptyText(id ? `${id}-base` : '');
+ // a reused storage keeps its own portals
+ let portals = me.down('field[name=portals]');
+ if (portals) {
+ if (existing) {
+ portals.setValue(existing.portals);
+ }
+ portals.setReadOnly(!!existing);
+ }
// the nodes of a storage that the setup uses are the default selection
let identities = me.down('pveStorageWizardNodeIdentities');
@@ -112,19 +142,32 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
note.setHidden(!conflict);
},
- // The portals of the enabled iSCSI storages, to discover the target of another LUN through one
- // of them.
+ // The portals of the enabled storages of the type, to discover the target of another LUN
+ // through one of them. An NVMe over Fabrics storage lists the I/O portals of its subsystem,
+ // whose default port would skip the discovery port 8009, so the suggestion leaves it out.
updatePortalSuggestions: function () {
let me = this;
let users = new Map();
- for (const { type, portal, storage, disable } of me.storages ?? []) {
- if (['iscsi', 'iscsidirect'].includes(type) && portal && !disable) {
- users.set(portal, [...(users.get(portal) ?? []), storage]);
+ for (const { type, portal, portals, storage, disable } of me.storages ?? []) {
+ let list = [];
+ if (disable) {
+ continue;
+ } else if (me.storageType === 'nvmeof' && type === 'nvmeof') {
+ // as the storage splits its list
+ list = `${portals ?? ''}`
+ .split(/[\s,;]+/)
+ .filter(Boolean)
+ .map((entry) => entry.replace(/:4420$/, ''));
+ } else if (me.storageType === 'iscsi' && ['iscsi', 'iscsidirect'].includes(type)) {
+ list = portal ? [portal] : [];
+ }
+ for (const entry of new Set(list)) {
+ users.set(entry, [...(users.get(entry) ?? []), storage]);
}
}
let suggestions = [...users.keys()]
.sort()
- .map((portal) => ({ portal, storages: users.get(portal).sort().join(', ') }));
+ .map((entry) => ({ portal: entry, storages: users.get(entry).sort().join(', ') }));
let field = me.down('field[name=portal]');
field.getStore().setData(suggestions);
field.setHideTrigger(!suggestions.length);
@@ -132,13 +175,16 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
onSubmit: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let wizard = me.up('window');
let values = me.getValues();
// a disabled target field counts as valid, while the portal waits for its discovery
let target = me.down('field[name=target]');
if (!values.target || target.discoveredPortal !== values.portal) {
wizard.showError(
- gettext('Select a target once the targets of this portal are listed.'),
+ nvme
+ ? gettext('Select a subsystem once the subsystems of this portal are listed.')
+ : gettext('Select a target once the targets of this portal are listed.'),
);
return;
}
@@ -180,9 +226,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
// the step showed which storage it reuses, if any, which must still hold
if (me.existingConnection()?.storage !== shown) {
wizard.showError(
- gettext(
- 'The iSCSI storage of this target changed in the meantime. Check this step, then retry.',
- ),
+ nvme
+ ? gettext(
+ 'The NVMe over Fabrics storage of this subsystem changed in the meantime. Check this step, then retry.',
+ )
+ : gettext(
+ 'The iSCSI storage of this target changed in the meantime. Check this step, then retry.',
+ ),
);
return;
}
@@ -210,25 +260,35 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
if (restricted.length) {
nodes = (selectedNodes.length ? selectedNodes : restricted).join(',');
}
- connected({ storage: base.storage, target: base.target, nodes });
+ connected({ storage: base.storage, target: base[me.targetKey], nodes });
return;
}
let params = {
- type: 'iscsi',
+ type: me.storageType,
storage: me.newConnectionId(),
- portal: values.portal,
- target: values.target,
content: 'none',
- 'managed-multipath': 1,
+ ...(nvme
+ ? // the storage configuration does not keep outer spaces, so neither may the
+ // copy that the cleanup compares
+ { subsysnqn: values.target, portals: values.portals.trim() }
+ : {
+ portal: values.portal,
+ target: values.target,
+ 'managed-multipath': 1,
+ }),
};
if (nodes) {
params.nodes = nodes;
}
if (params.storage === values.storage) {
wizard.showError(
- gettext(
- 'The storage for guest disks and the iSCSI storage need different IDs. Change the iSCSI Storage ID under Advanced.',
- ),
+ nvme
+ ? gettext(
+ 'The storage for guest disks and the NVMe over Fabrics storage need different IDs. Change the NVMe over Fabrics Storage ID under Advanced.',
+ )
+ : gettext(
+ 'The storage for guest disks and the iSCSI storage need different IDs. Change the iSCSI Storage ID under Advanced.',
+ ),
);
return;
}
@@ -236,9 +296,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
wizard.showError(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'The ID "{0}" for the iSCSI storage is already in use. Set another one under Advanced.',
- ),
+ nvme
+ ? gettext(
+ 'The ID "{0}" for the NVMe over Fabrics storage is already in use. Set another one under Advanced.',
+ )
+ : gettext(
+ 'The ID "{0}" for the iSCSI storage is already in use. Set another one under Advanced.',
+ ),
params.storage,
),
),
@@ -258,9 +322,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
initComponent: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
+ me.targetKey = nvme ? 'subsysnqn' : 'target';
+ me.onlineHelp = nvme ? 'storage_nvmeof' : 'storage_open_iscsi';
+ let targetLabel = nvme ? gettext('Subsystem') : gettext('Target');
let common = PVE.panel.StorageBase.commonFields(true);
// wide enough for the longest label of the step
- let labelWidth = 150;
+ let labelWidth = nvme ? 200 : 150;
let update = () => me.updateConnectionField();
let discovery = new Ext.util.DelayedTask(function () {
let portal = me.down('field[name=portal]').getValue();
@@ -288,7 +356,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
{
xtype: 'combobox',
name: 'portal',
- fieldLabel: gettext('Portal'),
+ fieldLabel: nvme ? gettext('Discovery Portal') : gettext('Portal'),
labelWidth,
allowBlank: false,
queryMode: 'local',
@@ -315,6 +383,8 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
let target = me.down('field[name=target]');
target.setValue('');
target.disable();
+ // and the I/O portals of its subsystem
+ me.down('field[name=portals]')?.setValue('');
// an answer for the previous portal would select one of its targets
target.setPortal('');
discovery.delay(500);
@@ -322,46 +392,76 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
},
{
- xtype: 'pveIScsiScan',
+ xtype: nvme ? 'pveNVMeOFScan' : 'pveIScsiScan',
name: 'target',
- fieldLabel: gettext('Target'),
+ fieldLabel: targetLabel,
labelWidth,
disabled: true,
showNodeSelector: false,
nodename: Proxmox.NodeName,
- listeners: { change: update },
+ listeners: {
+ change: function (field, value) {
+ // the I/O portals that the discovery reported for the subsystem
+ let rec =
+ nvme &&
+ field.getStore().findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ me.down('field[name=portals]').setValue(rec.get('portals'));
+ }
+ update();
+ },
+ },
listConfig: {
width: 650,
- emptyText: PVE.Utils.renderNotFound(gettext('iSCSI Target')),
+ emptyText: PVE.Utils.renderNotFound(
+ nvme ? gettext('Subsystem') : gettext('iSCSI Target'),
+ ),
columns: [
{
- text: gettext('Target'),
- dataIndex: 'target',
+ text: targetLabel,
+ dataIndex: me.targetKey,
flex: 1,
renderer: Ext.htmlEncode,
},
{
text: gettext('Portals'),
- dataIndex: 'portal',
+ dataIndex: nvme ? 'portals' : 'portal',
width: 220,
renderer: Ext.htmlEncode,
},
],
},
},
+ ...(nvme
+ ? [
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ labelWidth,
+ allowBlank: false,
+ },
+ ]
+ : []),
{
xtype: 'component',
itemId: 'connectionNote',
margin: '0 0 10 0',
hidden: true,
},
- { xtype: 'pveStorageWizardNodeIdentities', listeners: { nodeschange: update } },
+ {
+ xtype: 'pveStorageWizardNodeIdentities',
+ identity: nvme ? 'nvme-host-nqn' : 'iscsi-initiator-name',
+ listeners: { nodeschange: update },
+ },
];
me.advancedItems = [
{
...common.id,
name: 'connection',
- fieldLabel: gettext('iSCSI Storage ID'),
+ fieldLabel: nvme
+ ? gettext('NVMe over Fabrics Storage ID')
+ : gettext('iSCSI Storage ID'),
labelWidth,
allowBlank: true,
},
@@ -391,12 +491,15 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
});
+// Both add the LVM storage the same way; only the volume ID that names its base differs.
Ext.define('PVE.storage.wizard.IScsi', {
extend: 'PVE.storage.wizard.SAN',
wizardType: 'iscsi',
createStorage: function (values, lun) {
let me = this;
+ let nvme = me.wizardType === 'nvmeof';
+ let suffix = nvme ? `:nvme-${lun.wwid}` : `.dm-uuid-mpath-${lun.wwid}`;
let fail = (response) => me.showError(response.htmlStatus);
Proxmox.Utils.API2Request({
url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(me.connection.storage)}/content`,
@@ -408,14 +511,16 @@ Ext.define('PVE.storage.wizard.IScsi', {
if (me.destroyed) {
return;
}
- let volume = response.result.data.find((entry) =>
- entry.volid.endsWith(`.dm-uuid-mpath-${lun.wwid}`),
- );
+ let volume = response.result.data.find((entry) => entry.volid.endsWith(suffix));
if (!volume) {
me.showError(
- gettext(
- 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
- ),
+ nvme
+ ? gettext(
+ 'The selected namespace is not available yet. Check Node > SAN, then retry.',
+ )
+ : gettext(
+ 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
+ ),
);
return;
}
@@ -424,3 +529,8 @@ Ext.define('PVE.storage.wizard.IScsi', {
});
},
});
+
+Ext.define('PVE.storage.wizard.NVMeOF', {
+ extend: 'PVE.storage.wizard.IScsi',
+ wizardType: 'nvmeof',
+});
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index 97b1405f5..6a9d3227c 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -10,8 +10,8 @@ Ext.define('PVE.storage.wizard.SAN', {
type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
),
- // Removes the iSCSI storage that a closed setup added if it still has the settings of the
- // setup and no storage uses it, and calls done in any case.
+ // Removes the iSCSI or NVMe over Fabrics storage that a closed setup added if it still has
+ // the settings of the setup and no storage uses it, and calls done in any case.
removeAddedConnection: function (connection, done) {
let id = connection.storage;
// the storage list adds these to the configuration of a storage
@@ -29,7 +29,7 @@ Ext.define('PVE.storage.wizard.SAN', {
gettext('Error'),
Ext.htmlEncode(
Ext.String.format(
- gettext('Could not remove iSCSI storage "{0}" of the closed setup'),
+ gettext('Could not remove storage "{0}" of the closed setup'),
id,
),
) + `: ${response.htmlStatus}`,
@@ -45,7 +45,7 @@ Ext.define('PVE.storage.wizard.SAN', {
let own = storages.find((entry) => entry.storage === id);
let created = connection.created;
let unchanged =
- own?.type === 'iscsi' &&
+ own?.type === created.type &&
keys(own).join() === keys(created).join() &&
keys(own).every((key) => text(key, own[key]) === text(key, created[key]));
let used = storages.some((entry) => `${entry.base ?? ''}`.startsWith(`${id}:`));
@@ -169,7 +169,7 @@ Ext.define('PVE.storage.wizard.SAN', {
};
},
- // Removes an iSCSI storage that the setup added for a storage it did not add, then reloads.
+ // Removes a connection storage that the setup added for a storage it did not add, then reloads.
cleanUp: function () {
let me = this;
let done = () => me.reloadCallback?.();
@@ -225,6 +225,7 @@ Ext.define('PVE.storage.wizard.SAN', {
storage: values.storage,
nodes: params.nodes,
fc: me.wizardType === 'fc',
+ nvme: me.wizardType === 'nvmeof',
autoShow: true,
});
};
@@ -233,6 +234,9 @@ Ext.define('PVE.storage.wizard.SAN', {
multipathSummary: function (lun) {
let me = this;
+ if (me.wizardType === 'nvmeof') {
+ return PVE.SANUtils.multipathText('native');
+ }
// an explicit entry takes precedence, also for a LUN of the iSCSI storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
@@ -257,7 +261,9 @@ Ext.define('PVE.storage.wizard.SAN', {
...(connection
? [
[
- gettext('iSCSI Storage'),
+ me.wizardType === 'nvmeof'
+ ? gettext('NVMe over Fabrics Storage')
+ : gettext('iSCSI Storage'),
connection.created
? Ext.String.format(
gettext('{0}, added by this setup'),
@@ -302,10 +308,15 @@ Ext.define('PVE.storage.wizard.SAN', {
me.down('#action').setHtml(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- // TRANSLATORS: {0} is the label of the Finish button.
- '{0} creates the volume group "{1}" on this LUN and adds it as shared LVM storage "{2}".',
- ),
+ me.wizardType === 'nvmeof'
+ ? gettext(
+ // TRANSLATORS: {0} is the label of the Finish button.
+ '{0} creates the volume group "{1}" on this namespace and adds it as shared LVM storage "{2}".',
+ )
+ : gettext(
+ // TRANSLATORS: {0} is the label of the Finish button.
+ '{0} creates the volume group "{1}" on this LUN and adds it as shared LVM storage "{2}".',
+ ),
gettext('Finish'),
values.vgname,
values.storage,
@@ -350,10 +361,13 @@ Ext.define('PVE.storage.wizard.SAN', {
initComponent: function () {
let me = this;
- if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ if (!['iscsi', 'fc', 'nvmeof'].includes(me.wizardType)) {
throw 'no SAN storage type specified';
}
- let iscsi = me.wizardType === 'iscsi';
+ // the iSCSI and NVMe over Fabrics setups connect to the array with a storage first
+ let target = me.wizardType !== 'fc';
+ let nvme = me.wizardType === 'nvmeof';
+ let onlineHelp = nvme ? 'storage_nvmeof' : 'storage_multipath';
me.subject = PVE.storage.wizard.SAN.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
let common = PVE.panel.StorageBase.commonFields(true);
@@ -369,9 +383,9 @@ Ext.define('PVE.storage.wizard.SAN', {
let settings = {
xtype: 'inputpanel',
title: gettext('Storage'),
- onlineHelp: 'storage_multipath',
+ onlineHelp,
items: [
- ...(iscsi
+ ...(target
? []
: [
{
@@ -389,29 +403,31 @@ Ext.define('PVE.storage.wizard.SAN', {
],
advancedItems: [
vgname,
- ...(iscsi
+ ...(target
? []
: [{ ...common.nodes, validator: PVE.storage.wizard.SAN.validateNodes }]),
],
itemId: 'settings',
};
me.items = [
- ...(iscsi
+ ...(target
? [
{
- xtype: 'pveStorageWizardIScsiTarget',
- title: gettext('Target'),
+ xtype: 'pveStorageWizardTarget',
+ storageType: me.wizardType,
+ title: nvme ? gettext('Subsystem') : gettext('Target'),
itemId: 'target',
},
]
: []),
{
xtype: 'pveStorageWizardLunSelect',
- title: 'LUN',
+ title: nvme ? gettext('Namespace') : 'LUN',
itemId: 'luns',
- onlineHelp: 'storage_multipath',
+ nvme,
+ onlineHelp,
// the nodes only see a newly mapped Fibre Channel LUN after a rescan
- rescanNote: iscsi
+ rescanNote: target
? undefined
: Ext.String.format(
gettext(
@@ -460,14 +476,14 @@ Ext.define('PVE.storage.wizard.SAN', {
me.down('#settings').on('activate', followId);
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (iscsi && tab === me.down('#luns')) {
+ if (target && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- if (iscsi) {
+ if (target) {
me.down('#submit').setText(gettext('Next'));
}
me.on('destroy', () => !me.writing && me.cleanUp());
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index d257e99ba..5dfce247a 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -20,8 +20,11 @@ Ext.define('PVE.window.SANLunState', {
if (!me.wwid) {
throw 'no LUN specified';
}
+ let title = me.nvme
+ ? gettext('Storage {0}: Namespace State')
+ : gettext('Storage {0}: LUN State');
me.title = me.storage
- ? Ext.String.format(gettext('Storage {0}: LUN State'), me.storage)
+ ? Ext.String.format(title, me.storage)
: Ext.String.format(
gettext('LUN {0}: Paths by Node'),
Ext.htmlEncode(me.name || me.wwid),
@@ -56,13 +59,17 @@ Ext.define('PVE.window.SANLunState', {
sortAfterUpdate: true,
});
let added = Ext.String.format(gettext('Storage "{0}" was added.'), me.storage);
- let missingAdvice = me.fc
+ let missingAdvice = me.nvme
? gettext(
- 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and zoning on the array, then rescan the Fibre Channel hosts on {0}.',
+ 'The namespace is missing on {0}, so guests on this storage cannot run there. Check the host access to the subsystem on the array.',
)
- : gettext(
- 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and initiator access on the array.',
- );
+ : me.fc
+ ? gettext(
+ 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and zoning on the array, then rescan the Fibre Channel hosts on {0}.',
+ )
+ : gettext(
+ 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and initiator access on the array.',
+ );
let updateAdvice = function () {
if (me.destroyed || !me.storage) {
return;
@@ -79,7 +86,12 @@ Ext.define('PVE.window.SANLunState', {
let text = [
added,
waiting &&
- Ext.String.format(gettext('Waiting for a LUN report from: {0}.'), waiting),
+ Ext.String.format(
+ me.nvme
+ ? gettext('Waiting for a namespace report from: {0}.')
+ : gettext('Waiting for a LUN report from: {0}.'),
+ waiting,
+ ),
missing && Ext.String.format(missingAdvice, missing),
];
me.down('#advice').setHtml(Ext.htmlEncode(text.filter(Boolean).join(' ')));
@@ -97,7 +109,9 @@ Ext.define('PVE.window.SANLunState', {
flex: 1,
store,
disableSelection: true,
- emptyText: gettext('No node reported this LUN yet.'),
+ emptyText: me.nvme
+ ? gettext('No node reported this namespace yet.')
+ : gettext('No node reported this LUN yet.'),
columns: [
{
text: gettext('Node'),
^ permalink raw reply related [relevance 19%]
* [PATCH v4 storage 04/25] nvmeof: add a storage for NVMe over Fabrics subsystems
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
2026-11-23 1:47 8% ` [PATCH v4 storage 01/25] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-23 1:47 15% ` [PATCH v4 storage 02/25] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only Thomas Lamprecht
@ 2026-11-23 1:47 15% ` Thomas Lamprecht
2026-11-23 1:47 16% ` [PATCH v4 storage 07/25] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
` (16 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
NVMe/TCP namespaces need a manual nvme-cli setup on every node so far.
Add a storage type that connects one subsystem through each configured
portal and offers its namespaces as raw volumes. Native NVMe multipath
joins the paths and the kernel reconnects lost ones. Only one storage
may use a subsystem, as the LUN list, the controller list and the node
status attribute a subsystem to one storage.
The activation fails if no controller is live after connecting the
missing portals, also if none was missing, so that adding a storage
tells why. As adding a storage holds the lock of the configuration, it
tries no further portal after 15 seconds once a controller is live, or
after 45 seconds without one, and leaves the rest to the next
activation. A portal whose connect failed is retried after a minute, but
not one that only waited for another fabrics operation, and adding a
storage forgets those failures. The package nvme-cli is only
recommended, as no other storage type needs it.
The plugin isolates its properties, so names like 'portals' belong to
this storage type alone, and a third-party plugin that declares one of
them is still loaded. As the first in-tree plugin that isolates, it
makes the storage API check the parameters for adding and updating a
storage of any type against the options of that type alone, apart from
the sensitive properties of plugins that do not isolate theirs.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
ApiChangeLog | 9 +-
debian/control | 1 +
src/PVE/Makefile | 1 +
src/PVE/NVMeOF.pm | 306 ++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 300 ++++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 13 +
src/test/Makefile | 5 +
src/test/run_nvmeof_taint_tests.pl | 62 ++++
src/test/run_nvmeof_tests.pl | 543 +++++++++++++++++++++++++++++
src/test/run_san_nvme_tests.pl | 16 +
13 files changed, 1256 insertions(+), 5 deletions(-)
create mode 100644 src/PVE/NVMeOF.pm
create mode 100644 src/PVE/Storage/NVMeOFPlugin.pm
create mode 100755 src/test/run_nvmeof_taint_tests.pl
create mode 100755 src/test/run_nvmeof_tests.pl
diff --git a/ApiChangeLog b/ApiChangeLog
index e8fe58e8..91931d3e 100644
--- a/ApiChangeLog
+++ b/ApiChangeLog
@@ -101,10 +101,11 @@ Future changes should be documented in here.
declares a property of that name is then not loaded until it renames it, so prefer names that
are specific to the plugin, for example prefixed with its type.
- As soon as one such plugin is installed, the API checks the parameters for adding and updating a
- storage against the options of its type alone, for all storage types. Only the sensitive
- properties of a plugin that does not isolate its own are still accepted without being listed in
- its `options()`, by their own names: an alias that only another plugin declares for one is not.
+ Since the in-tree 'nvmeof' plugin isolates its properties, the API checks the parameters for
+ adding and updating a storage against the options of its type alone, for all storage types,
+ also for plugins of older API versions. Only the sensitive properties of a plugin that does not
+ isolate its own are still accepted without being listed in its `options()`, by their own names:
+ an alias that only another plugin declares for one is not.
Set 'sensitive-properties' in an isolating plugin, even if empty. Without it, the fallback list of
version 11 also applies to the plugin's own properties of these names.
diff --git a/debian/control b/debian/control
index fdcf8117..b5c2f529 100644
--- a/debian/control
+++ b/debian/control
@@ -55,6 +55,7 @@ Depends: bzip2,
${misc:Depends},
${perl:Depends},
Recommends: multipath-tools,
+ nvme-cli,
pve-esxi-import-tools (>= 0.6.0),
skopeo,
zfsutils-linux (>= 2.4.1-pve2),
diff --git a/src/PVE/Makefile b/src/PVE/Makefile
index 13fecbf8..238eefd4 100644
--- a/src/PVE/Makefile
+++ b/src/PVE/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Storage.pm ${DESTDIR}${PERLDIR}/PVE/Storage.pm
install -D -m 0644 Diskmanage.pm ${DESTDIR}${PERLDIR}/PVE/Diskmanage.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/NVMeOF.pm
install -D -m 0644 ISCSI/Topology.pm ${DESTDIR}${PERLDIR}/PVE/ISCSI/Topology.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/Multipath.pm
install -D -m 0644 Multipath/Config.pm ${DESTDIR}${PERLDIR}/PVE/Multipath/Config.pm
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
new file mode 100644
index 00000000..c705835c
--- /dev/null
+++ b/src/PVE/NVMeOF.pm
@@ -0,0 +1,306 @@
+package PVE::NVMeOF;
+
+use v5.36;
+
+use Digest::SHA qw(sha1_hex);
+use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
+use File::Path qw(make_path);
+use POSIX qw(ceil);
+use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
+use Time::HiRes ();
+
+use PVE::JSONSchema;
+use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
+
+use PVE::Diskmanage;
+
+our $NVME = '/usr/sbin/nvme';
+our $SYSFS = '/sys';
+our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
+our $HOSTID_FILE = '/etc/nvme/hostid';
+our $RUN_DIR = '/run/pve/nvmeof';
+our $LOCK_WAIT = 10;
+# no control characters, which could reach logs and the arguments of nvme-cli
+our $NQN_PATTERN = 'nqn\.[^\s\x00-\x1f\x7f,=]+';
+our $DISCOVERY_NQN = 'nqn.2014-08.org.nvmexpress.discovery';
+our $TIMED_OUT = "NVMe over Fabrics operation timed out - it may still be running\n";
+
+sub canonical_address($addr) {
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ return inet_ntop(AF_INET, $packed);
+ }
+ if (defined(my $packed = inet_pton(AF_INET6, $addr))) {
+ return inet_ntop(AF_INET, substr($packed, 12))
+ if substr($packed, 0, 12) eq ("\0" x 10) . "\xff\xff";
+ return inet_ntop(AF_INET6, $packed);
+ }
+ return lc($addr);
+}
+
+# Link-local IPv6 needs a node-specific interface and cannot identify a shared configured portal.
+sub parse_portal($portal) {
+ my ($addr, $port);
+ if ($portal =~ m/^\[([0-9a-fA-F:.]+)\](?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } elsif ($portal =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } else {
+ return undef;
+ }
+ return undef if defined($port) && ($port < 1 || $port > 65535);
+ $addr = canonical_address($addr);
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ my $multicast = (unpack('C', $packed) & 0xf0) == 0xe0;
+ return undef if $addr eq '0.0.0.0' || $addr eq '255.255.255.255' || $multicast;
+ } elsif (defined($packed = inet_pton(AF_INET6, $addr))) {
+ my $prefix = unpack('n', $packed);
+ return undef
+ if $addr eq '::' || ($prefix & 0xffc0) == 0xfe80 || ($prefix & 0xff00) == 0xff00;
+ } else {
+ return undef;
+ }
+ return { traddr => $addr, trsvcid => int($port // 4420) };
+}
+
+PVE::JSONSchema::register_format(
+ 'pve-storage-nvme-portal',
+ sub($portal, $noerr = undef) {
+ return $portal if parse_portal($portal);
+ return undef if $noerr;
+ die "value is not an IPv4 address or a bracketed IPv6 address with optional port\n";
+ },
+);
+
+sub format_path($path) {
+ # an IPv6 address, not the address of a Fibre Channel port, which has a colon too
+ my $ipv6 = $path->{traddr} =~ /:/ && $path->{traddr} =~ /^[0-9a-fA-F:.]+$/;
+ my $addr = $ipv6 ? "[$path->{traddr}]" : $path->{traddr};
+ return defined($path->{trsvcid}) ? "$addr:$path->{trsvcid}" : $addr;
+}
+
+sub storage_paths($scfg) {
+ return [map { parse_portal($_) // die "invalid portal '$_'\n" }
+ PVE::Tools::split_list($scfg->{portals})];
+}
+
+sub host_identity() {
+ my ($nqn) = (file_read_firstline($HOSTNQN_FILE) // '') =~ /\A($NQN_PATTERN)\z/;
+ my ($id) = (file_read_firstline($HOSTID_FILE) // '') =~
+ /\A([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\z/i;
+ if (!defined($nqn) || length($nqn) > 223) {
+ die "invalid or missing NVMe host NQN in '$HOSTNQN_FILE' - install nvme-cli and check the"
+ . " host identity\n";
+ }
+ die "invalid or missing NVMe host ID in '$HOSTID_FILE' - expected a nonzero UUID\n"
+ if !defined($id) || $id =~ /^[0-]+$/;
+ return { nqn => $nqn, id => lc($id) };
+}
+
+sub is_supported() { return -x $NVME ? 1 : 0 }
+
+sub assert_support() {
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command(['modprobe', 'nvme-tcp'], timeout => 10)
+ if !-e "$SYSFS/module/nvme_tcp";
+ my $multipath = file_read_firstline("$SYSFS/module/nvme_core/parameters/multipath") // '';
+ die "native NVMe multipath is disabled - enable nvme_core.multipath\n" if $multipath ne 'Y';
+}
+
+sub controllers() {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-fabrics/ctl";
+ dir_glob_foreach(
+ $dir,
+ 'nvme[0-9]+',
+ sub($name, @) {
+ my $address = file_read_firstline("$dir/$name/address") // return;
+ my %address = map { split(/=/, $_, 2) } grep { /=/ } split(/,/, $address);
+ return if !defined($address{traddr});
+ $res->{$name} = {
+ transport => file_read_firstline("$dir/$name/transport") // '',
+ subsystem => PVE::Diskmanage::read_subsysnqn("$dir/$name/subsysnqn") // '',
+ state => file_read_firstline("$dir/$name/state") // 'unknown',
+ traddr => canonical_address($address{traddr}),
+ trsvcid => $address{trsvcid},
+ };
+ },
+ );
+ return $res;
+}
+
+sub subsystem_controllers($subsystem) {
+ my $controllers = controllers();
+ return {
+ map { $_ => $controllers->{$_} } grep {
+ $controllers->{$_}->{subsystem} eq $subsystem
+ && $controllers->{$_}->{transport} eq 'tcp'
+ } keys %$controllers
+ };
+}
+
+# The NQN of a subsystem, untainted, or undef if it is invalid or the one of the discovery service.
+sub subsystem_nqn($nqn) {
+ my ($res) = ($nqn // '') =~ /\A($NQN_PATTERN)\z/;
+ return undef if !defined($res) || length($res) > 223 || $res eq $DISCOVERY_NQN;
+ return $res;
+}
+
+sub namespace_wwid($dev) {
+ return file_read_firstline("$SYSFS/block/$dev/wwid");
+}
+
+sub has_live_controller($controllers) {
+ return scalar(grep { $_->{state} eq 'live' } values %$controllers);
+}
+
+sub path_controller($controllers, $path) {
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ if ($ctrl->{traddr} eq $path->{traddr} && ($ctrl->{trsvcid} // '') eq $path->{trsvcid}) {
+ return $name;
+ }
+ }
+ return undef;
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-subsystem";
+ dir_glob_foreach(
+ $dir,
+ 'nvme-subsys[0-9]+',
+ sub($subsys, @) {
+ # one that cannot be read could be this subsystem, whose namespaces must not look gone
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn")
+ // die "cannot read the NQN of NVMe subsystem '$subsys'\n";
+ return if $nqn ne $subsystem;
+ dir_glob_foreach(
+ "$dir/$subsys",
+ 'nvme[0-9]+n[0-9]+',
+ sub($dev, @) {
+ # a failed read must not look like a namespace that is gone
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid")
+ // die "cannot read the WWID of namespace '$dev'\n";
+ my $size = file_read_firstline("$SYSFS/block/$dev/size")
+ // die "cannot read the size of namespace '$dev'\n";
+ $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
+ },
+ );
+ },
+ );
+ return $res;
+}
+
+# $limit sets the time the operation may take in all, including the wait for the lock.
+sub with_lock($code, $limit = undef) {
+ my $total = $LOCK_WAIT + 35;
+ # an alarm counts whole seconds and none at zero
+ $total = ceil($limit) if defined($limit);
+ $total = 1 if $total < 1;
+ my ($res, $timeout) = PVE::Tools::run_fork_with_timeout(
+ $total,
+ sub {
+ make_path($RUN_DIR);
+ open(my $lock, '>>', "$RUN_DIR/fabrics.lock") or die "cannot open NVMe lock - $!\n";
+ # A busy lock fails the operation, so wait a while for it, but give up before the time
+ # limit, which counts as a hanging operation.
+ my $wait = $LOCK_WAIT < $total ? $LOCK_WAIT : $total - 1;
+ my $deadline = Time::HiRes::time() + $wait;
+ while (!flock($lock, LOCK_EX | LOCK_NB)) {
+ die "NVMe over Fabrics is busy - another operation is still running\n"
+ if Time::HiRes::time() >= $deadline;
+ Time::HiRes::usleep(100_000);
+ }
+ # Commands inherit the lock, so that it stays held until they exit, even if the caller
+ # timed out while one was stuck in the kernel.
+ my $flags = fcntl($lock, F_GETFD, 0) // die "cannot read NVMe lock flags - $!\n";
+ fcntl($lock, F_SETFD, $flags & ~FD_CLOEXEC)
+ or die "cannot inherit NVMe lock - $!\n";
+ return $code->();
+ },
+ );
+ die $TIMED_OUT if $timeout;
+ return $res;
+}
+
+my sub retry_file($scfg, $path) {
+ my ($key) =
+ sha1_hex(join(
+ "\0", $scfg->{subsysnqn}, format_path($path), $scfg->{'fast-io-fail-tmo'} // 120)) =~
+ /\A([0-9a-f]{40})\z/;
+ return "$RUN_DIR/retry/$key";
+}
+
+sub in_cooldown($scfg, $path) {
+ my $mtime = (stat(retry_file($scfg, $path)))[9] // return 0;
+ my $age = time() - $mtime;
+ return $age > -60 && $age < 60;
+}
+
+sub note_connect_failure($scfg, $path) {
+ make_path("$RUN_DIR/retry");
+ file_set_contents(retry_file($scfg, $path), '');
+}
+
+sub clear_connect_failures($scfg) {
+ unlink(retry_file($scfg, $_)) for storage_paths($scfg)->@*;
+}
+
+sub connect_path($scfg, $path, $limit = undef) {
+ my $nqn = subsystem_nqn($scfg->{subsysnqn}) // die "invalid subsystem NQN\n";
+ my ($fail) = ($scfg->{'fast-io-fail-tmo'} // 120) =~ /\A(-?[0-9]+)\z/;
+ die "invalid fast I/O fail timeout\n" if !defined($fail) || $fail < -1;
+ # A connect that hangs until the time limit failed too, but the process that would note it is
+ # gone by then.
+ my $res = eval {
+ with_lock(
+ sub {
+ return if path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ assert_support();
+ my $host = host_identity();
+ # only a failed attempt is a failure of the portal, not a busy lock
+ eval {
+ run_command(
+ [
+ $NVME,
+ 'connect',
+ '--transport=tcp',
+ '--nqn',
+ $nqn,
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $path->{trsvcid},
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--ctrl-loss-tmo=-1',
+ '--fast_io_fail_tmo',
+ $fail,
+ ],
+ timeout => 30,
+ errmsg => 'nvme connect',
+ );
+ # nvme-cli can exit successfully without having connected
+ die "no controller appeared\n"
+ if !path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ };
+ if (my $err = $@) {
+ note_connect_failure($scfg, $path);
+ die $err;
+ }
+ unlink(retry_file($scfg, $path));
+ return;
+ },
+ $limit,
+ );
+ };
+ if (my $err = $@) {
+ note_connect_failure($scfg, $path) if $err eq $TIMED_OUT;
+ die $err;
+ }
+ return $res;
+}
+
+1;
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index c640cd8e..c77a6755 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -33,6 +33,7 @@ use PVE::Storage::LvmThinPlugin;
use PVE::Storage::NFSPlugin;
use PVE::Storage::CIFSPlugin;
use PVE::Storage::ISCSIPlugin;
+use PVE::Storage::NVMeOFPlugin;
use PVE::Storage::RBDPlugin;
use PVE::Storage::CephFSPlugin;
use PVE::Storage::ISCSIDirectPlugin;
@@ -58,6 +59,7 @@ PVE::Storage::LvmThinPlugin->register();
PVE::Storage::NFSPlugin->register();
PVE::Storage::CIFSPlugin->register();
PVE::Storage::ISCSIPlugin->register();
+PVE::Storage::NVMeOFPlugin->register();
PVE::Storage::RBDPlugin->register();
PVE::Storage::CephFSPlugin->register();
PVE::Storage::ISCSIDirectPlugin->register();
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a2df83c0..7f2ff6c8 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -6,6 +6,7 @@ SOURCES= \
NFSPlugin.pm \
CIFSPlugin.pm \
ISCSIPlugin.pm \
+ NVMeOFPlugin.pm \
CephFSPlugin.pm \
RBDPlugin.pm \
ISCSIDirectPlugin.pm \
diff --git a/src/PVE/Storage/NVMeOFPlugin.pm b/src/PVE/Storage/NVMeOFPlugin.pm
new file mode 100644
index 00000000..77b7e541
--- /dev/null
+++ b/src/PVE/Storage/NVMeOFPlugin.pm
@@ -0,0 +1,300 @@
+package PVE::Storage::NVMeOFPlugin;
+
+use v5.36;
+
+use Cwd ();
+use Time::HiRes ();
+
+use PVE::Network;
+
+use PVE::Diskmanage;
+use PVE::NVMeOF;
+use PVE::Storage::Plugin;
+
+use base qw(PVE::Storage::Plugin);
+
+# Adding a storage activates it under the lock of the storage configuration, so no further portal is
+# tried after this many seconds once a controller is live, or after three times as long without one.
+# Later activations connect the rest.
+our $ACTIVATION_BUDGET = 15;
+
+sub type { return 'nvmeof' }
+
+sub plugindata {
+ return {
+ content => [{ images => 1, 'vm-vol' => 1, none => 1 }, { images => 1 }],
+ select_existing => 1,
+ 'isolate-properties' => 1,
+ 'advanced-properties' => {
+ 'fast-io-fail-tmo' => 1,
+ },
+ 'hidden-properties' => {
+ bwlimit => 1,
+ },
+ 'sensitive-properties' => {},
+ };
+}
+
+sub properties {
+ return {
+ subsysnqn => {
+ title => "Subsystem",
+ description => 'The NQN of the NVMe subsystem.',
+ type => 'string',
+ pattern => $PVE::NVMeOF::NQN_PATTERN,
+ maxLength => 223,
+ },
+ portals => {
+ title => "Portals",
+ description =>
+ 'TCP portals of the NVMe subsystem, as IPv4 or bracketed IPv6 addresses'
+ . ' with an optional port (default 4420).',
+ type => 'string',
+ format => 'pve-storage-nvme-portal-list',
+ },
+ 'fast-io-fail-tmo' => {
+ title => "Fail I/O After (s)",
+ description => 'Seconds before I/O through a reconnecting path fails. -1 disables'
+ . ' this timeout; I/O can remain queued while paths reconnect.',
+ type => 'integer',
+ minimum => -1,
+ default => 120,
+ },
+ };
+}
+
+sub options {
+ return {
+ subsysnqn => { fixed => 1 },
+ portals => {},
+ 'fast-io-fail-tmo' => { optional => 1 },
+ nodes => { optional => 1 },
+ disable => { optional => 1 },
+ content => { optional => 1 },
+ bwlimit => { optional => 1 },
+ };
+}
+
+my sub assert_valid_config($scfg) {
+ die "the discovery subsystem cannot be used as storage\n"
+ if $scfg->{subsysnqn} eq $PVE::NVMeOF::DISCOVERY_NQN;
+ my $paths = PVE::NVMeOF::storage_paths($scfg);
+ # the list format also accepts a list of separators only
+ die "no portal given\n" if !@$paths;
+ my %seen;
+ for my $path (@$paths) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ die "portal '$portal' is listed more than once\n" if $seen{$portal}++;
+ }
+}
+
+sub on_add_hook($class, $storeid, $scfg, %param) {
+ assert_valid_config($scfg);
+ # the LUN and controller lists and the node status attribute a subsystem to its one storage
+ my $ids = PVE::Storage::config()->{ids};
+ for my $sid (sort keys %$ids) {
+ next if $sid eq $storeid || $ids->{$sid}->{type} ne 'nvmeof';
+ die "storage '$sid' already uses this subsystem\n"
+ if $ids->{$sid}->{subsysnqn} eq $scfg->{subsysnqn};
+ }
+ # adding the storage again, for example once the array allows the node, tries all portals
+ PVE::NVMeOF::clear_connect_failures($scfg);
+ return;
+}
+
+sub on_update_hook_full($class, $storeid, $scfg, $update, $delete, $sensitive, @) {
+ my $merged = { %$scfg, %$update };
+ delete $merged->{$_} for ($delete // [])->@*;
+ # without the property, the default of the plugin applies, which serves images
+ $merged->{content} //= $class->plugindata()->{content}->[1];
+ assert_valid_config($merged);
+ # the namespace of a volume group must not become a disk image of a guest as well
+ if (
+ PVE::Storage::san_storage_serves_images($merged)
+ && !PVE::Storage::san_storage_serves_images($scfg)
+ ) {
+ my $ids = PVE::Storage::config()->{ids};
+ for my $sid (sort keys %$ids) {
+ die "storage '$sid' uses a namespace of this storage as base, so it cannot serve"
+ . " images\n"
+ if $ids->{$sid}->{type} eq 'lvm'
+ && ($ids->{$sid}->{base} // '') =~ /^\Q$storeid\E:/;
+ }
+ }
+ # a changed portal list, for example with a portal fixed and added again, tries all of them
+ PVE::NVMeOF::clear_connect_failures($merged) if exists($update->{portals});
+ return $class->SUPER::on_update_hook_full($storeid, $scfg, $update, $delete, $sensitive);
+}
+
+sub parse_volname($class, $volname) {
+ if ($volname =~ m!^(nvme-[a-zA-Z0-9_.:+-]+)$! && $volname !~ /-part[0-9]+$/) {
+ return ($class->guest_volume_vtype('raw'), $1, undef, undef, undef, undef, 'raw');
+ }
+ die "unable to parse NVMe over Fabrics volume name '$volname'\n";
+}
+
+# The name of a volume can be the by-id name of any NVMe device, also of a local disk or of a
+# namespace of another subsystem.
+sub assert_namespace($scfg, $volname, $real) {
+ my ($dev) = $real =~ m!^/dev/(nvme[0-9]+n[0-9]+)$!;
+ die "volume '$volname' is not an NVMe namespace\n" if !defined($dev);
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$PVE::NVMeOF::SYSFS/block/$dev/device/subsysnqn")
+ // '';
+ die "volume '$volname' is not part of subsystem '$scfg->{subsysnqn}'\n"
+ if $nqn ne $scfg->{subsysnqn};
+ # another by-id name of the subsystem, like model and serial, can name another namespace
+ my $wwid = PVE::NVMeOF::namespace_wwid($dev) // '';
+ die "volume '$volname' is not named after the WWID of its namespace\n"
+ if $volname ne "nvme-$wwid";
+}
+
+sub filesystem_path($class, $scfg, $volname, $snapname = undef, @) {
+ die "snapshot is not possible on NVMe over Fabrics storage\n" if defined($snapname);
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my $path = "/dev/disk/by-id/$name";
+ # not every user of a path activates the volume first, and the base volume of an LVM storage
+ # has no device before its storage connects
+ my $real = Cwd::realpath($path);
+ assert_namespace($scfg, $volname, $real) if defined($real) && -e $real;
+ return wantarray ? ($path, $vmid, $vtype) : $path;
+}
+
+sub create_base { die "can't create base images in NVMe over Fabrics storage\n" }
+sub clone_image { die "can't clone images in NVMe over Fabrics storage\n" }
+sub alloc_image { die "can't allocate space in NVMe over Fabrics storage\n" }
+sub free_image { die "can't free space in NVMe over Fabrics storage\n" }
+sub volume_resize { die "volume resize is not possible on NVMe over Fabrics storage\n" }
+
+sub list_volumes($class, $storeid, $scfg, $vmid = undef, $content_types = undef, @) {
+ my $res = $class->list_images($storeid, $scfg, $vmid);
+ $_->{content} = 'images' for @$res;
+ return $res;
+}
+
+sub list_images($class, $storeid, $scfg, $vmid = undef, $vollist = undef, $cache = undef, @) {
+ return [] if defined($vmid) && !$vollist;
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ my $res = [];
+ for my $dev (sort keys %$namespaces) {
+ my $ns = $namespaces->{$dev};
+ my $volid = "$storeid:nvme-$ns->{wwid}";
+ next if $vollist && !grep { $_ eq $volid } @$vollist;
+ push @$res,
+ {
+ volid => $volid,
+ format => 'raw',
+ size => $ns->{size},
+ vmid => 0,
+ };
+ }
+ return $res;
+}
+
+sub status($class, $storeid, $scfg, $cache = undef, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return (0, 0, 0, PVE::NVMeOF::has_live_controller($controllers) ? 1 : 0);
+}
+
+sub activate_storage($class, $storeid, $scfg, $cache = undef, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ my @missing = grep { !defined(PVE::NVMeOF::path_controller($controllers, $_)) }
+ PVE::NVMeOF::storage_paths($scfg)->@*;
+ if (!@missing) {
+ # the kernel reconnects them, but meanwhile the namespaces cannot be used
+ die "no controller of the subsystem is live, all are reconnecting\n"
+ if !PVE::NVMeOF::has_live_controller($controllers);
+ return;
+ }
+ # A missing prerequisite is no failure of a portal, so the portals stay eligible for the next
+ # attempt. A storage with a usable path still works, with fewer paths.
+ eval {
+ PVE::NVMeOF::assert_support();
+ PVE::NVMeOF::host_identity();
+ };
+ if (my $err = $@) {
+ die $err if !PVE::NVMeOF::has_live_controller($controllers);
+ warn "storage '$storeid': cannot connect to the other portals - $err";
+ return;
+ }
+ my @errors;
+ my $live = PVE::NVMeOF::has_live_controller($controllers);
+ my $start = Time::HiRes::time();
+ # The time limit also bounds an attempt that starts late, so that creating a storage ends well
+ # within the lock on the storage configuration it holds meanwhile.
+ my $left = sub { $start + ($live ? 1 : 3) * $ACTIVATION_BUDGET - Time::HiRes::time() };
+ for my $path (@missing) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ if ($left->() < 5) {
+ push @errors, "$portal: not tried within the time limit";
+ next;
+ }
+ if (PVE::NVMeOF::in_cooldown($scfg, $path)) {
+ push @errors, "$portal: failed less than a minute ago";
+ next;
+ }
+ eval {
+ if (!PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2)) {
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ die "no answer from portal\n";
+ }
+ PVE::NVMeOF::connect_path($scfg, $path, $left->());
+ };
+ if (my $err = $@) {
+ warn "storage '$storeid': connecting to '$portal' failed - $err";
+ chomp $err;
+ push @errors, "$portal: $err";
+ } else {
+ $live = 1;
+ }
+ }
+ # some paths are enough, but without a usable one the namespaces cannot be used
+ $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ if (!PVE::NVMeOF::has_live_controller($controllers)) {
+ die "cannot connect to any portal - " . join('; ', @errors) . "\n" if @errors;
+ die "no controller of the subsystem is live yet\n";
+ }
+ return;
+}
+
+sub deactivate_storage { return }
+
+sub check_connection($class, $storeid, $scfg, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return 1 if PVE::NVMeOF::has_live_controller($controllers);
+ # Creating a storage runs this check and the activation while it holds the configuration lock.
+ # The portals left untried go to the activation, which has a time limit of its own and skips
+ # those that just failed.
+ my $deadline = Time::HiRes::time() + $ACTIVATION_BUDGET;
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ return 1 if Time::HiRes::time() >= $deadline;
+ next if defined(PVE::NVMeOF::path_controller($controllers, $path));
+ next if PVE::NVMeOF::in_cooldown($scfg, $path);
+ return 1 if PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ }
+ return 0;
+}
+
+sub activate_volume($class, $storeid, $scfg, $volname, $snapname = undef, $cache = undef, @) {
+ my $path = $class->filesystem_path($scfg, $volname, $snapname);
+ # as for the multipath map of an iSCSI LUN, a status pass does not wait for the device
+ my $deadline = Time::HiRes::time() + ($cache && $cache->{status_only} ? 0 : 10);
+ while (!-b $path && Time::HiRes::time() < $deadline) {
+ last if !keys PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn})->%*;
+ Time::HiRes::usleep(250_000);
+ }
+ my $real = Cwd::realpath($path);
+ die "volume '$volname' is not available on this node\n" if !$real || !-b $real;
+ assert_namespace($scfg, $volname, $real);
+}
+
+sub volume_has_feature(
+ $class, $scfg, $feature, $storeid, $volname,
+ $snapname = undef,
+ $running = undef, @,
+) {
+ return 1 if $feature eq 'copy' && !defined($snapname);
+ return undef;
+}
+
+1;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index fe243679..7079a259 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -42,7 +42,7 @@ our @COMMON_TAR_FLAGS = qw(
);
our @SHARED_STORAGE = (
- 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs',
+ 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs', 'nvmeof',
);
our $QCOW2_PREALLOCATION = {
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index 0a9e441c..53c24c9e 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -302,6 +302,11 @@ sub lun_partitions($lun) {
}
sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
+ my $name = basename($lun->{devpath});
+ my $nqn =
+ $name =~ /^nvme\d+n\d+$/
+ ? PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn")
+ : undef;
my %vgs = map { $_ => 1 } PVE::Storage::LVMPlugin::lun_volume_groups(
[$lun->{devpath}, lun_partitions($lun)->@*],
)->@*;
@@ -324,6 +329,14 @@ sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
) {
die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this target\n";
}
+ if (
+ $type eq 'nvmeof'
+ && defined($nqn)
+ && $scfg->{subsysnqn} eq $nqn
+ && PVE::Storage::san_storage_serves_images($scfg)
+ ) {
+ die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this subsystem\n";
+ }
next if $type ne 'lvm' || !$scfg->{base};
my $base = PVE::Multipath::parse_base_volume($scfg->{base});
my $matches = $base
diff --git a/src/test/Makefile b/src/test/Makefile
index 3b902c43..ceabd991 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -17,6 +17,7 @@ test: \
test_lvmplugin \
test_multipath \
test_multipath_api \
+ test_nvmeof \
test_ovf \
test_plugin \
test_remote_command \
@@ -115,3 +116,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
+
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+ ./run_nvmeof_tests.pl
+ perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
new file mode 100755
index 00000000..6fd37410
--- /dev/null
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -T
+
+use v5.36;
+use lib qw(..);
+use File::Temp qw(tempdir);
+use Scalar::Util qw(tainted);
+use Test::MockModule;
+use Test::More;
+
+use PVE::Tools qw(file_get_contents file_set_contents);
+
+use PVE::NVMeOF;
+
+$ENV{PATH} = '/usr/sbin:/usr/bin:/sbin:/bin';
+delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+my $dir = tempdir('nvmeof-taint-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::HOSTNQN_FILE = "$dir/hostnqn";
+local $PVE::NVMeOF::HOSTID_FILE = "$dir/hostid";
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+file_set_contents($PVE::NVMeOF::HOSTNQN_FILE, "nqn.host\n");
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "12345678-1234-1234-1234-123456789abc\n");
+file_set_contents("$dir/config", "nqn.test\n192.0.2.1\n120\n");
+my ($nqn, $portal, $fail) = split(/\n/, file_get_contents("$dir/config"));
+ok(tainted($nqn), 'configuration input is tainted');
+my $nvme = Test::MockModule->new('PVE::NVMeOF');
+$nvme->mock(with_lock => sub { $_[0]->() });
+my $commands = 0;
+$nvme->mock(
+ subsystem_controllers => sub {
+ return $commands ? { nvme0 => { traddr => '192.0.2.1', trsvcid => 4420 } } : {};
+ },
+);
+$nvme->mock(assert_support => sub { });
+$nvme->mock(
+ run_command => sub($cmd, %opts) {
+ $commands++;
+ is(
+ scalar(grep { tainted($_) } @$cmd),
+ 0,
+ 'all connect operands are validated and untainted',
+ );
+ PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ },
+);
+my $path = PVE::NVMeOF::parse_portal($portal);
+eval { PVE::NVMeOF::connect_path({ subsysnqn => $nqn, 'fast-io-fail-tmo' => $fail }, $path) };
+is($@, '', 'connect command can execute in taint mode');
+is($commands, 1, 'one connect');
+PVE::NVMeOF::note_connect_failure({ subsysnqn => $nqn }, $path);
+ok(
+ PVE::NVMeOF::in_cooldown({ subsysnqn => $nqn }, $path),
+ 'cooldown accepts validated file-backed configuration',
+);
+for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.discovery') {
+ eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
+ like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
+}
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
+eval { PVE::NVMeOF::host_identity() };
+like($@, qr/nonzero UUID/, 'zero host ID refused');
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
new file mode 100755
index 00000000..fc2b7078
--- /dev/null
+++ b/src/test/run_nvmeof_tests.pl
@@ -0,0 +1,543 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use Fcntl qw(:flock);
+use File::Path qw(make_path remove_tree);
+use File::Temp qw(tempdir);
+use POSIX ();
+use Test::MockModule;
+use Test::More;
+use Time::HiRes ();
+
+use PVE::Tools qw(file_set_contents);
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+local $PVE::NVMeOF::SYSFS = "$dir/sys";
+my $class = 'PVE::Storage::NVMeOFPlugin';
+my $cfg = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,[2001:db8::2]:4421',
+ content => { none => 1 },
+};
+
+subtest 'configuration, portals and volumes' => sub {
+ is(PVE::Storage::Plugin->lookup('nvmeof'), $class, 'plugin registered');
+ is_deeply(
+ [sort keys $class->properties()->%*],
+ [qw(fast-io-fail-tmo portals subsysnqn)],
+ 'only three plugin-specific properties',
+ );
+ my sub nvmeof_schema($schema) {
+ my @types = map { ($_->{oneOf} // [])->@* } ($schema->{allOf} // [])->@*;
+ my ($nvmeof) = grep { $_->{'instance-type'} eq 'nvmeof' } @types;
+ return $nvmeof->{properties} // {};
+ }
+ my $create = nvmeof_schema(PVE::Storage::Plugin->createSchema());
+ is_deeply(
+ [sort grep { !$create->{$_}->{optional} } keys $create->%*],
+ [qw(portals subsysnqn)],
+ 'adding a storage requires the subsystem and the portals',
+ );
+ my $update = nvmeof_schema(PVE::Storage::Plugin->updateSchema());
+ ok($update->{portals} && !$update->{subsysnqn}, 'the subsystem cannot be changed');
+ my $parsed = PVE::Storage::Plugin->parse_config(
+ 'storage.cfg',
+ "nvmeof: fabric\n\tsubsysnqn nqn.test\n\tportals 192.0.2.1\n\tcontent none\n",
+ );
+ is($parsed->{ids}->{fabric}->{subsysnqn}, 'nqn.test', 'storage.cfg accepts the plugin');
+ is_deeply(
+ $parsed->{ids}->{fabric}->{content},
+ { none => 1 },
+ 'connection-only content parses',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ { traddr => '192.0.2.1', trsvcid => 4420 },
+ 'default I/O port',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('[2001:0db8::1]:4421'),
+ { traddr => '2001:db8::1', trsvcid => 4421 },
+ 'canonical IPv6',
+ );
+ is(
+ PVE::NVMeOF::format_path({ traddr => '2001:db8::1', trsvcid => 4421 }),
+ '[2001:db8::1]:4421',
+ 'an IPv6 portal in brackets',
+ );
+ is(
+ PVE::NVMeOF::format_path({ traddr => 'nn-0x2000:pn-0x2001' }),
+ 'nn-0x2000:pn-0x2001',
+ 'the address of a Fibre Channel port as it is',
+ );
+
+ for my $bad (
+ 'host.example', '1.2.3.4:0', '1.2.3.4:65536', '[fe80::1]', '[::]', '224.0.0.1',
+ ) {
+ ok(!PVE::NVMeOF::parse_portal($bad), "invalid portal $bad");
+ }
+ eval { $class->on_add_hook('fabric', { %$cfg, portals => '192.0.2.1,192.0.2.1:4420' }); };
+ like($@, qr/listed more than once/, 'duplicate portals refused');
+ eval { $class->on_add_hook('fabric', { %$cfg, portals => ',,' }); };
+ like($@, qr/no portal given/, 'a list without a portal refused');
+ eval {
+ $class->on_add_hook(
+ 'fabric',
+ { %$cfg, subsysnqn => 'nqn.2014-08.org.nvmexpress.discovery' },
+ );
+ };
+ like($@, qr/discovery subsystem/, 'discovery subsystem refused');
+ ok(!PVE::NVMeOF::subsystem_nqn("nqn.test\e[31m"),
+ 'an NQN with a control character refused');
+ ok(!PVE::NVMeOF::subsystem_nqn("nqn.test\x{2028}x"), 'so is one with a Unicode separator');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $ids = { fabric => $cfg, local => { type => 'dir' } };
+ $storage->mock(config => sub { { ids => $ids } });
+ my $first = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $first);
+ is(eval { $class->on_add_hook('fabric', $cfg); 1 }, 1, 'a storage is not in its own way');
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $first), 'adding it tries all portals again');
+ eval { $class->on_add_hook('second', {%$cfg}) };
+ like($@, qr/storage 'fabric' already uses this subsystem/, 'one storage per subsystem');
+ $ids->{vg} = { type => 'lvm', base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'vg' };
+ my $images = { content => { images => 1 } };
+ eval { $class->on_update_hook_full('fabric', $cfg, $images, [], {}) };
+ like(
+ $@,
+ qr/storage 'vg' uses a namespace/,
+ 'no direct use of a namespace with a volume group',
+ );
+ my $none = { %$cfg, content => { none => 1 } };
+ eval { $class->on_update_hook_full('fabric', $none, {}, ['content'], {}) };
+ like($@, qr/storage 'vg' uses a namespace/, 'also not through the default content');
+ is(
+ eval { $class->on_update_hook_full('other', $cfg, $images, [], {}); 1 },
+ 1,
+ 'unless unused',
+ );
+ delete $ids->{vg};
+ PVE::NVMeOF::note_connect_failure($cfg, $first);
+ $class->on_update_hook_full('fabric', $cfg, { portals => $cfg->{portals} }, [], {});
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $first), 'a new portal list tries all portals again');
+ is(
+ scalar($class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef')),
+ '/dev/disk/by-id/nvme-eui.0123456789abcdef',
+ 'stable volume path',
+ );
+ {
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $nqn = 'nqn.other';
+ $disk->redefine(read_subsysnqn => sub { $nqn });
+ my $sysfs = Test::MockModule->new('PVE::NVMeOF');
+ $sysfs->redefine(namespace_wwid => sub { 'x' });
+ my $check = sub {
+ eval { PVE::Storage::NVMeOFPlugin::assert_namespace($cfg, @_) };
+ $@;
+ };
+ like($check->('nvme-x', '/dev/nvme0n1'), qr/not part of subsystem/, 'other subsystem');
+ like($check->('nvme-x', '/dev/sda'), qr/not an NVMe namespace/, 'other device type');
+ like($check->('nvme-x', '/dev/nvme0n1p1'), qr/not an NVMe namespace/, 'partition');
+ $nqn = 'nqn.test';
+ is($check->('nvme-x', '/dev/nvme0n1'), '', 'namespace of the subsystem');
+ like(
+ $check->('nvme-Vendor_Model_123_1', '/dev/nvme0n1'),
+ qr/not named after the WWID/,
+ 'another by-id name of a namespace of the subsystem',
+ );
+ my $cwd = Test::MockModule->new('Cwd');
+ $cwd->redefine(realpath => sub { $dir });
+ eval { $class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef') };
+ like($@, qr/not an NVMe namespace/, 'the path of an existing device is checked');
+ }
+
+ for my $bad ('nvme-../../sda', 'nvme-eui.abc-part1', 'sda') {
+ eval { $class->parse_volname($bad) };
+ like($@, qr/unable to parse/, "invalid volume $bad");
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ $nvme->mock(namespaces => sub { { nvme0n1 => { wwid => 'eui.abc', size => 4096 } } });
+ is(
+ $class->list_volumes('fabric', $cfg)->[0]->{volid},
+ 'fabric:nvme-eui.abc',
+ 'content none still offers bases',
+ );
+ is_deeply($class->list_images('fabric', $cfg, 100), [], 'namespaces have no VM owner');
+ $nvme->mock(subsystem_controllers => sub { {} });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test') };
+ like($@, qr/not available/,
+ 'missing namespace fails without waiting on absent controllers');
+ my ($now, $queries) = (0, 0);
+ my $clock = Test::MockModule->new('Time::HiRes');
+ $clock->redefine(time => sub { $now += 5 }, usleep => sub { });
+ $nvme->mock(subsystem_controllers => sub { $queries++; { nvme1 => {} } });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test', undef, {}) };
+ is($queries, 1, 'a missing namespace of a connected subsystem is waited for');
+ eval {
+ $class->activate_volume(
+ 'fabric',
+ $cfg,
+ 'nvme-nonexistent-test',
+ undef,
+ { status_only => 1 },
+ );
+ };
+ like($@, qr/not available/, 'in a status pass it fails as well');
+ is($queries, 1, 'but without a wait');
+ is(
+ ($class->parse_volname('nvme-eui.0123456789abcdef'))[0],
+ 'vm-vol',
+ 'namespaces are VM disks',
+ );
+};
+
+subtest 'sysfs topology' => sub {
+ my $sys = $PVE::NVMeOF::SYSFS;
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1",
+ "$sys/class/nvme-subsystem/nvme-subsys0/nvme0n1",
+ "$sys/block/nvme0n1",
+ );
+ my %attrs = (
+ address => 'traddr=192.0.2.1,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.test',
+ state => 'connecting',
+ );
+ file_set_contents("$sys/class/nvme-fabrics/ctl/nvme1/$_", "$attrs{$_}\n") for keys %attrs;
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys0/subsysnqn", "nqn.test\n");
+ file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ file_set_contents("$sys/block/nvme0n1/size", "8\n");
+ is(
+ PVE::NVMeOF::controllers()->{nvme1}->{state},
+ 'connecting',
+ 'reconnecting controller is still present',
+ );
+ is(
+ PVE::NVMeOF::path_controller(
+ PVE::NVMeOF::subsystem_controllers('nqn.test'),
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ ),
+ 'nvme1',
+ 'portal controller found',
+ );
+ is_deeply(
+ PVE::NVMeOF::namespaces('nqn.test'),
+ { nvme0n1 => { wwid => 'eui.abc', size => 4096 } },
+ 'namespace facts',
+ );
+ is_deeply(PVE::NVMeOF::namespaces('nqn.other'), {}, 'other subsystem excluded');
+ unlink("$sys/block/nvme0n1/wwid");
+ eval { PVE::NVMeOF::namespaces('nqn.test') };
+ like($@, qr/cannot read the WWID/, 'an unreadable namespace is an error, not a gone one');
+ file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ make_path("$sys/class/nvme-subsystem/nvme-subsys9");
+ eval { PVE::NVMeOF::namespaces('nqn.test') };
+ like($@, qr/cannot read the NQN/, 'so is a subsystem that could be the one asked for');
+ rmdir("$sys/class/nvme-subsystem/nvme-subsys9");
+};
+
+subtest 'serialized commands inherit the lock' => sub {
+ local $PVE::NVMeOF::LOCK_WAIT = 0;
+ my $script = join(
+ ' ',
+ 'my @held = grep { (readlink($_) // "") =~ /fabrics.lock$/ } glob("/proc/self/fd/*");',
+ 'die "not inherited" if !@held;',
+ 'open(my $fh, ">>", $ARGV[0]) or die $!;',
+ 'die "lock missing" if flock($fh, LOCK_EX|LOCK_NB);',
+ 'print "locked\\n";',
+ );
+ my $value = PVE::NVMeOF::with_lock(sub {
+ my $out = '';
+ PVE::Tools::run_command(
+ [
+ '/usr/bin/perl',
+ '-MFcntl=:flock',
+ '-e',
+ $script,
+ "$PVE::NVMeOF::RUN_DIR/fabrics.lock",
+ ],
+ timeout => 5,
+ outfunc => sub { $out .= $_[0] },
+ );
+ return $out;
+ });
+ is($value, 'locked', 'exec cannot acquire the lock held by its parent');
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or die $!;
+ flock($lock, LOCK_EX) or die $!;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'busy operation never enters callback');
+ close($lock);
+
+ my $tools = Test::MockModule->new('PVE::Tools');
+ my $timed_out = 1;
+ $tools->mock(run_fork_with_timeout => sub { return ($_[1]->(), $timed_out) });
+ my $retained;
+ eval {
+ PVE::NVMeOF::with_lock(sub {
+ my ($path) =
+ grep { (readlink($_) // '') =~ /fabrics.lock$/ } glob('/proc/self/fd/*');
+ my ($fd) = $path =~ m{/(\d+)$};
+ open($retained, '>&', $fd) or die $!;
+ return 1;
+ });
+ };
+ like($@, qr/timed out.*may still be running/, 'timeout does not claim deletion completed');
+ $timed_out = 0;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'retained descriptor keeps serialization after the caller returns');
+ close($retained);
+ is(PVE::NVMeOF::with_lock(sub { 1 }), 1, 'last descriptor close releases serialization');
+
+ my @timeouts;
+ $tools->mock(run_fork_with_timeout => sub { push @timeouts, $_[0]; return ($_[1]->(), 0) });
+ PVE::NVMeOF::with_lock(sub { 1 }, $_) for undef, 100, 4.2, 0.3;
+ my $hung = PVE::NVMeOF::storage_paths($cfg)->[0];
+ $tools->mock(run_fork_with_timeout => sub { return (undef, 1) });
+ eval { PVE::NVMeOF::connect_path($cfg, $hung) };
+ is($@, $PVE::NVMeOF::TIMED_OUT, 'a hanging connect times out');
+ ok(PVE::NVMeOF::in_cooldown($cfg, $hung), 'and arms the cooldown of its portal');
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ my $full = $PVE::NVMeOF::LOCK_WAIT + 35;
+ is_deeply(
+ \@timeouts, [$full, 100, 5, 1], 'a limit sets the time in whole seconds',
+ );
+};
+
+subtest 'a short hold of the lock does not fail a connect' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my $scfg = { %$cfg, subsysnqn => 'nqn.wait', portals => '192.0.2.3' };
+ my $ctl = "$PVE::NVMeOF::SYSFS/class/nvme-fabrics/ctl/nvme9";
+ $net->mock(tcp_ping => sub { 1 });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(
+ run_command => sub(@) {
+ my %attrs = (
+ address => 'traddr=192.0.2.3,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.wait',
+ state => 'live',
+ );
+ make_path($ctl);
+ file_set_contents("$ctl/$_", "$attrs{$_}\n") for keys %attrs;
+ },
+ );
+ pipe(my $held, my $signal) or die "pipe failed - $!\n";
+ my $holder = fork() // die "fork failed - $!\n";
+ if (!$holder) {
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or POSIX::_exit(1);
+ flock($lock, LOCK_EX) or POSIX::_exit(1);
+ syswrite($signal, '1');
+ Time::HiRes::sleep(0.5);
+ POSIX::_exit(0);
+ }
+ close($signal);
+ sysread($held, my $state, 1);
+ is($state, '1', 'another process holds the lock');
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ $class->activate_storage('wait', $scfg);
+ }
+ waitpid($holder, 0);
+ is($warning, '', 'the connect waits for the lock');
+ my $path = PVE::NVMeOF::storage_paths($scfg)->[0];
+ ok(!PVE::NVMeOF::in_cooldown($scfg, $path), 'and arms no cooldown');
+ is(
+ PVE::NVMeOF::path_controller(PVE::NVMeOF::subsystem_controllers('nqn.wait'), $path),
+ 'nvme9',
+ 'the portal is connected',
+ );
+ remove_tree($ctl);
+
+ local $PVE::NVMeOF::LOCK_WAIT = 0.2;
+ pipe($held, $signal) or die "pipe failed - $!\n";
+ $holder = fork() // die "fork failed - $!\n";
+ if (!$holder) {
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or POSIX::_exit(1);
+ flock($lock, LOCK_EX) or POSIX::_exit(1);
+ syswrite($signal, '1');
+ Time::HiRes::sleep(1);
+ POSIX::_exit(0);
+ }
+ close($signal);
+ sysread($held, $state, 1);
+ {
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('wait', $scfg) };
+ }
+ waitpid($holder, 0);
+ like($@, qr/NVMe over Fabrics is busy/, 'a longer hold fails the connect');
+ ok(!PVE::NVMeOF::in_cooldown($scfg, $path), 'but arms no cooldown for the portal');
+};
+
+subtest 'connect options, kernel reconnect and cooldown' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my @commands;
+ my $controllers = {};
+ my @limits;
+ $nvme->mock(with_lock => sub { push @limits, $_[1]; $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(subsystem_controllers => sub { $controllers });
+ my $appear = 1;
+ my ($now, $connect_secs) = (0, 0);
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ is($opts{timeout}, 30, 'bounded connect');
+ push @commands, $cmd;
+ $now += $connect_secs;
+ my %arg =
+ map { $cmd->[$_] => $cmd->[$_ + 1] } grep { $cmd->[$_] =~ /^--tr/ } 0 .. $#$cmd;
+ my $controller =
+ { traddr => $arg{'--traddr'}, trsvcid => $arg{'--trsvcid'}, state => 'live' };
+ $controllers->{ 'nvme' . scalar(@commands) } = $controller if $appear;
+ },
+ );
+ $net->mock(tcp_ping => sub { 1 });
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 2, 'one connect per missing portal');
+ ok(grep({ $_ eq '--ctrl-loss-tmo=-1' } $commands[0]->@*), 'kernel reconnects indefinitely');
+ is_deeply([@{ $commands[0] }[-2, -1]], ['--fast_io_fail_tmo', 120], 'fast failure default');
+ {
+ my $clock = Test::MockModule->new('Time::HiRes');
+ $clock->redefine(time => sub { $now });
+ my $activate = sub($secs) {
+ ($controllers, $connect_secs, @commands) = ({}, $secs);
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('fabric', $cfg) };
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ return scalar(@commands);
+ };
+ is($activate->(20), 1, 'with a live controller, a spent time budget leaves the rest');
+ $appear = 0;
+ is($activate->(20), 2, 'without one, a slow portal does not keep the next one out');
+ is($activate->(50), 1, 'but a very slow one does');
+ @limits = ();
+ is($activate->(40), 2, 'one that starts late is still tried');
+ is_deeply(\@limits, [45, 5], 'but only for the rest of the time limit');
+ ($appear, $connect_secs) = (1, 0);
+ }
+ @commands = ();
+ $controllers = {
+ nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' },
+ nvme2 => { traddr => '2001:db8::2', trsvcid => 4421, state => 'live' },
+ };
+ $class->activate_storage('fabric', $cfg);
+ is_deeply(\@commands, [],
+ 'existing controllers are never reconnected, regardless of state');
+ $controllers->{nvme2}->{state} = 'connecting';
+ eval { $class->activate_storage('fabric', $cfg) };
+ like($@, qr/all are reconnecting/, 'without a live one the activation fails');
+ is_deeply(\@commands, [], 'but leaves the reconnect to the kernel');
+ $controllers->{nvme2}->{state} = 'live';
+ $class->deactivate_storage('fabric', $cfg);
+ is_deeply(\@commands, [], 'deactivation does not remove controllers');
+ $controllers = {};
+ my $path = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $path);
+ ok(PVE::NVMeOF::in_cooldown($cfg, $path), 'failure starts cooldown');
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 1, 'only the other portal connects');
+ ($controllers, $appear) = ({}, 0);
+ my $other = PVE::NVMeOF::storage_paths($cfg)->[1];
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ eval { $class->activate_storage('fabric', $cfg) };
+ }
+ like($warning, qr/no controller appeared/, 'a connect without a controller is a failure');
+ ok(PVE::NVMeOF::in_cooldown($cfg, $other), 'which starts the cooldown too');
+ like(
+ $@,
+ qr/^cannot connect to any portal - .*failed less than a minute ago; .*no controller appeared/,
+ 'without any controller the activation fails with the reason of each portal',
+ );
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ $nvme->mock(assert_support => sub { die "nvme-cli is not installed\n" });
+ @commands = ();
+ eval { $class->activate_storage('fabric', $cfg) };
+ is($@, "nvme-cli is not installed\n", 'a missing prerequisite fails the activation');
+ is_deeply(\@commands, [], 'before any connect');
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $path), 'and without a cooldown');
+ $controllers = { nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'live' } };
+ $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ is(
+ eval { $class->activate_storage('fabric', $cfg); 1 },
+ 1,
+ 'but not with a usable path',
+ );
+ }
+ like($warning, qr/cannot connect to the other portals - nvme-cli/, 'which it warns about');
+ $nvme->mock(assert_support => sub { });
+ $controllers =
+ { nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' } };
+ {
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('fabric', $cfg) };
+ }
+ like(
+ $@,
+ qr/^cannot connect to any portal/,
+ 'a reconnecting path is not usable when the missing one fails',
+ );
+ # a connect that worked, but whose controller is not live yet
+ ($controllers, $now, $connect_secs) = ({}, 0, 0);
+ $net->mock(tcp_ping => sub { 1 });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ my %arg =
+ map { $cmd->[$_] => $cmd->[$_ + 1] } grep { $cmd->[$_] =~ /^--tr/ } 0 .. $#$cmd;
+ $controllers->{nvme7} =
+ { traddr => $arg{'--traddr'}, trsvcid => $arg{'--trsvcid'}, state => 'connecting' };
+ },
+ );
+ eval { $class->activate_storage('fabric', { %$cfg, portals => '192.0.2.7' }) };
+ is($@, "no controller of the subsystem is live yet\n", 'says so without an empty reason');
+};
+
+subtest 'the connection check has a time limit too' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my $clock = Test::MockModule->new('Time::HiRes');
+ my ($now, $pings) = (0, 0);
+ $clock->redefine(time => sub { $now });
+ $nvme->mock(subsystem_controllers => sub { {} });
+ $net->mock(tcp_ping => sub { $now += 2; $pings++; 0 });
+ my $scfg = { %$cfg, portals => join(',', map { "192.0.2.$_" } 1 .. 20) };
+ is($class->check_connection('many', $scfg), 1, 'untried portals go to the activation');
+ is($pings, 8, 'which the check leaves after its time limit');
+ ok(
+ PVE::NVMeOF::in_cooldown($scfg, PVE::NVMeOF::parse_portal('192.0.2.8')),
+ 'the failed ones cool down',
+ );
+ ($now, $pings) = (0, 0);
+ is($class->check_connection('many', $scfg), 1, 'a later pass skips the failed portals');
+ ok(
+ PVE::NVMeOF::in_cooldown($scfg, PVE::NVMeOF::parse_portal('192.0.2.16')),
+ 'and gets further',
+ );
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ $scfg->{portals} = '192.0.2.1,192.0.2.2';
+ ($now, $pings) = (0, 0);
+ is($class->check_connection('few', $scfg), 0, 'all tried and none answers');
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+};
+
+done_testing();
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 3245b774..2a9a2121 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -38,6 +38,7 @@ $storage->mock(config => sub { $cfg });
$disk->mock(verify_blockdev_path => sub { $device });
$disk->mock(is_partition => sub { 0 });
$disk->mock(get_nvme_transport => sub { 'fc' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
$disk->mock(is_iscsi_device => sub { 0 });
$disk->mock(is_mounted => sub { 0 });
$disk->mock(has_holder => sub { 0 });
@@ -86,6 +87,21 @@ for my $base (qw(fabric nvme-fabric)) {
eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
like($@, qr/base volume/, "native base reference on storage '$base' refuses");
}
+$cfg->{ids} =
+ { fabric =>
+ { type => 'nvmeof', subsysnqn => 'nqn.test', disable => 1, content => { images => 1 } } };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like(
+ $@,
+ qr/serves images from this subsystem/,
+ 'direct namespace image use refuses even when disabled',
+);
+$cfg->{ids}->{fabric}->{content} = { 'vm-vol' => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like($@, qr/serves images from this subsystem/, 'also when restricted to VM disks');
+$cfg->{ids}->{fabric}->{content} = { none => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+is($@, '', 'connection-only storage permits namespace initialization');
$cfg->{ids} = {};
@order = @opens = ();
$tools->mock(file_get_contents => sub { 1024 });
^ permalink raw reply related [relevance 15%]
* [PATCH v4 storage 11/25] api: add node-level NVMe over Fabrics status and controller removal
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (6 preceding siblings ...)
2026-11-23 1:47 20% ` [PATCH v4 storage 10/25] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
@ 2026-11-23 1:47 17% ` Thomas Lamprecht
2026-11-23 1:47 10% ` [PATCH v4 storage 12/25] multipath: report the NVMe host NQN of each node Thomas Lamprecht
` (11 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
The host NQN for the access rules of an array and the controllers of
a node are only visible with nvme-cli on a shell. Add the API module
for /nodes/{node}/san/nvmeof with the host identity and the fabrics
controllers with their subsystem, portal, state and storage. The
namespaces of all subsystems are counted in one pass for that list, as
a node can have a thousand controllers, for example with a storage
plugin that uses a subsystem per guest disk.
Removing a portal or the storage does not disconnect, so a controller
can be removed here, unless a namespace that is mounted, also in another
mount namespace, has holders, is a swap area, is open in a process or is
referenced by a storage would lose its last usable path. An opener that
is gone within a second, like an LVM scan, does not count. A controller
that is no usable path itself, such as one that keeps reconnecting to a
deleted subsystem, only needs the local checks, as the check of the
storage references reads the namespace. A controller with namespaces
outside of native NVMe multipath is refused, as they lack the head
devices that these checks go by. The caller can pass the subsystem and
portal it listed, to refuse a controller number that the kernel reused
meanwhile. Reading needs Sys.Audit on the node or Datastore.Allocate on
/storage, the removal Sys.Modify on '/'.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 200 ++++++++++++++++++++++++++++
src/PVE/API2/SAN/Node.pm | 8 +-
src/PVE/Diskmanage.pm | 18 +--
src/PVE/NVMeOF.pm | 172 +++++++++++++++++++++---
src/test/Makefile | 3 +-
src/test/run_nvmeof_api_tests.pl | 222 +++++++++++++++++++++++++++++++
src/test/run_nvmeof_tests.pl | 8 ++
src/test/run_san_api_tests.pl | 2 +-
9 files changed, 608 insertions(+), 26 deletions(-)
create mode 100644 src/PVE/API2/NVMeOF.pm
create mode 100755 src/test/run_nvmeof_api_tests.pl
diff --git a/src/PVE/API2/Makefile b/src/PVE/API2/Makefile
index 70ff1ec4..07773db1 100644
--- a/src/PVE/API2/Makefile
+++ b/src/PVE/API2/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Disks.pm ${DESTDIR}${PERLDIR}/PVE/API2/Disks.pm
install -D -m 0644 ISCSI.pm ${DESTDIR}${PERLDIR}/PVE/API2/ISCSI.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/API2/NVMeOF.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/API2/Multipath.pm
make -C Storage install
make -C Disks install
diff --git a/src/PVE/API2/NVMeOF.pm b/src/PVE/API2/NVMeOF.pm
new file mode 100644
index 00000000..9205d084
--- /dev/null
+++ b/src/PVE/API2/NVMeOF.pm
@@ -0,0 +1,200 @@
+package PVE::API2::NVMeOF;
+
+use v5.36;
+
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTHandler;
+use PVE::RPCEnvironment;
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+use base qw(PVE::RESTHandler);
+
+my $read_permissions = {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+};
+my $controller_schema = {
+ description => 'The fabrics controller name, for example nvme3.',
+ type => 'string',
+ pattern => 'nvme[0-9]+',
+};
+
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ method => 'GET',
+ proxyto => 'node',
+ permissions => { user => 'all' },
+ description => 'Node NVMe over Fabrics index.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => { type => 'object', properties => { name => { type => 'string' } } },
+ links => [{ rel => 'child', href => '{name}' }],
+ },
+ code => sub { return [{ name => 'status' }, { name => 'controller' }] },
+});
+
+__PACKAGE__->register_method({
+ name => 'status',
+ path => 'status',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'Report the NVMe host identity and nvme-cli availability.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ supported => { type => 'boolean', description => 'Whether nvme-cli is installed.' },
+ 'host-nqn' => {
+ type => 'string',
+ optional => 1,
+ description => 'The host NQN for target access control.',
+ },
+ 'host-id' =>
+ { type => 'string', optional => 1, description => 'The persistent host UUID.' },
+ error => {
+ type => 'string',
+ optional => 1,
+ description => 'Why the host identity is unavailable.',
+ },
+ },
+ },
+ code => sub {
+ my $res = { supported => PVE::NVMeOF::is_supported() };
+ my $host = eval { PVE::NVMeOF::host_identity() };
+ if (my $error = $@) {
+ chomp $error;
+ $res->{error} = $error;
+ } else {
+ $res->{'host-nqn'} = $host->{nqn};
+ $res->{'host-id'} = $host->{id};
+ }
+ return $res;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'controllers',
+ path => 'controller',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'List connected NVMe over Fabrics controllers and their states.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ controller => $controller_schema,
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ transport => { type => 'string', description => 'The controller transport.' },
+ portal => {
+ type => 'string',
+ description => 'The controller address and port, if applicable.',
+ },
+ state => {
+ type => 'string',
+ description => 'The controller state, such as live or connecting.',
+ },
+ namespaces => {
+ type => 'integer',
+ description => 'The number of namespaces of the subsystem, counted by the'
+ . ' devices that native NVMe multipath creates for them.',
+ },
+ 'used-by-storage' => {
+ type => 'string',
+ optional => 1,
+ description => 'An NVMe over Fabrics storage using the subsystem.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my $cfg = PVE::Storage::config();
+ my %owners;
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $owners{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
+ }
+ my $controllers = PVE::NVMeOF::controllers();
+ my $counts = PVE::NVMeOF::namespace_counts();
+ my @rows;
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ my $nqn = $ctrl->{subsystem};
+ push @rows,
+ {
+ controller => $name,
+ subsysnqn => $nqn,
+ transport => $ctrl->{transport},
+ portal => PVE::NVMeOF::format_path($ctrl),
+ state => $ctrl->{state},
+ namespaces => $counts->{$nqn} // 0,
+ defined($owners{$nqn}) ? ('used-by-storage' => $owners{$nqn}) : (),
+ };
+ }
+ return \@rows;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'disconnect',
+ path => 'controller/{controller}',
+ method => 'DELETE',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/', ['Sys.Modify']] },
+ description => 'Disconnect one fabrics controller. Refuse when a namespace in use has no'
+ . ' other usable path. A storage still listing the portal reconnects it on activation.',
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ controller => $controller_schema,
+ subsysnqn => {
+ type => 'string',
+ maxLength => 223,
+ optional => 1,
+ description => 'Refuse unless the controller still has this subsystem NQN.',
+ },
+ portal => {
+ type => 'string',
+ maxLength => 128,
+ optional => 1,
+ description => 'Refuse unless the controller still has this portal.',
+ },
+ },
+ },
+ returns => { type => 'string', description => 'The task identifier.' },
+ code => sub($param) {
+ my $rpcenv = PVE::RPCEnvironment::get();
+ return $rpcenv->fork_worker(
+ 'nvmedisconnect',
+ $param->{controller},
+ $rpcenv->get_user(),
+ sub {
+ PVE::NVMeOF::disconnect_guarded(
+ $param->{controller},
+ { subsysnqn => $param->{subsysnqn}, portal => $param->{portal} },
+ );
+ },
+ );
+ },
+});
+
+1;
diff --git a/src/PVE/API2/SAN/Node.pm b/src/PVE/API2/SAN/Node.pm
index 4b96caf5..260c95f7 100644
--- a/src/PVE/API2/SAN/Node.pm
+++ b/src/PVE/API2/SAN/Node.pm
@@ -10,6 +10,7 @@ use PVE::Storage;
use PVE::Storage::SAN;
use PVE::API2::ISCSI;
+use PVE::API2::NVMeOF;
use base qw(PVE::RESTHandler);
@@ -18,6 +19,11 @@ __PACKAGE__->register_method({
path => 'iscsi',
});
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::NVMeOF",
+ path => 'nvmeof',
+});
+
__PACKAGE__->register_method({
name => 'index',
path => '',
@@ -42,7 +48,7 @@ __PACKAGE__->register_method({
links => [{ rel => 'child', href => "{name}" }],
},
code => sub {
- return [map { +{ name => $_ } } qw(iscsi luns)];
+ return [map { +{ name => $_ } } qw(iscsi luns nvmeof)];
},
});
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 45a67578..07260023 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -971,6 +971,15 @@ sub get_multipath_disks {
return $disklist;
}
+# 'change' is transient; paths in 'inaccessible' or 'persistent-loss' cannot serve IO even on a live
+# controller
+sub nvme_path_is_usable {
+ my ($path) = @_;
+ my $ana = $path->{'ana-state'};
+ return $path->{state} eq 'live'
+ && (!defined($ana) || $ana eq 'optimized' || $ana eq 'non-optimized');
+}
+
# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
# single-controller devices lack these children and are omitted.
sub get_nvme_path_status {
@@ -1006,15 +1015,8 @@ sub get_nvme_path_status {
my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
$entry->{'ana-state'} = $ana if defined($ana);
- # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
- # cannot serve IO even on a live controller
- my $usable = $state eq 'live'
- && (!defined($ana)
- || $ana eq 'optimized'
- || $ana eq 'non-optimized');
-
my $status = $res->{$head} //= { active => 0, paths => [] };
- $status->{active}++ if $usable;
+ $status->{active}++ if nvme_path_is_usable($entry);
push @{ $status->{paths} }, $entry;
},
);
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index 5cb18c32..c6c3995d 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -3,13 +3,15 @@ package PVE::NVMeOF;
use v5.36;
use Digest::SHA qw(sha1_hex);
-use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
+use Errno qw(EBUSY);
+use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC O_EXCL O_RDONLY);
use File::Path qw(make_path);
use JSON qw(decode_json);
use POSIX qw(ceil);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use Time::HiRes ();
+use PVE::Cluster;
use PVE::JSONSchema;
use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
@@ -22,6 +24,7 @@ our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
our $HOSTID_FILE = '/etc/nvme/hostid';
our $RUN_DIR = '/run/pve/nvmeof';
our $LOCK_WAIT = 10;
+our $SWAPS = '/proc/swaps';
# no control characters, which could reach logs and the arguments of nvme-cli
our $NQN_PATTERN = 'nqn\.[^\s\x00-\x1f\x7f,=]+';
our $DISCOVERY_NQN = 'nqn.2014-08.org.nvmexpress.discovery';
@@ -165,31 +168,51 @@ sub path_controller($controllers, $path) {
return undef;
}
-sub namespaces($subsystem) {
- my $res = {};
+# Calls $code with the subsystem NQN and the device name of each namespace of this node, or only
+# of those of the subsystem $only.
+my sub foreach_namespace($code, $only = undef) {
my $dir = "$SYSFS/class/nvme-subsystem";
dir_glob_foreach(
$dir,
'nvme-subsys[0-9]+',
sub($subsys, @) {
- # one that cannot be read could be this subsystem, whose namespaces must not look gone
- my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn")
- // die "cannot read the NQN of NVMe subsystem '$subsys'\n";
- return if $nqn ne $subsystem;
+ # one that cannot be read could be the subsystem asked for, whose namespaces must not
+ # look gone
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn");
+ if (!defined($nqn)) {
+ die "cannot read the NQN of NVMe subsystem '$subsys'\n" if defined($only);
+ return;
+ }
+ return if defined($only) && $nqn ne $only;
dir_glob_foreach(
"$dir/$subsys",
'nvme[0-9]+n[0-9]+',
- sub($dev, @) {
- # a failed read must not look like a namespace that is gone
- my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid")
- // die "cannot read the WWID of namespace '$dev'\n";
- my $size = file_read_firstline("$SYSFS/block/$dev/size")
- // die "cannot read the size of namespace '$dev'\n";
- $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
- },
+ sub($dev, @) { $code->($nqn, $dev) },
);
},
);
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ foreach_namespace(
+ sub($nqn, $dev) {
+ # a failed read must not look like a namespace that is gone
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid")
+ // die "cannot read the WWID of namespace '$dev'\n";
+ my $size = file_read_firstline("$SYSFS/block/$dev/size")
+ // die "cannot read the size of namespace '$dev'\n";
+ $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
+ },
+ $subsystem,
+ );
+ return $res;
+}
+
+# The number of namespaces of each subsystem of this node, from one pass over the subsystems.
+sub namespace_counts() {
+ my $res = {};
+ foreach_namespace(sub($nqn, @) { $res->{$nqn}++ });
return $res;
}
@@ -369,4 +392,123 @@ sub discover($portal) {
die "discovery at portal '$portal' failed - $error";
}
+# A swap area on a namespace has no holder, mount or file descriptor of a process.
+my sub is_swap($device) {
+ my %rdevs = map {
+ my $rdev = (stat($_))[6];
+ defined($rdev) ? ($rdev => 1) : ()
+ } ($device, glob("${device}p[0-9]*"));
+ for my $line (split(/\n/, PVE::Tools::file_get_contents($SWAPS))) {
+ my ($swap) = split(/\s+/, $line);
+ next if !defined($swap) || $swap !~ m!^/!;
+ return 1 if $swap =~ m!^\Q$device\E(?:p[0-9]+)?$!;
+ my $rdev = (stat($swap))[6];
+ return 1 if defined($rdev) && $rdevs{$rdev};
+ }
+ return 0;
+}
+
+# A mount in another mount namespace, like that of a container, is not in /proc/mounts here and has
+# no holder, but it claims the device exclusively, as holders and swap do.
+sub is_claimed($device) {
+ sysopen(my $fh, $device, O_RDONLY | O_EXCL) and return 0;
+ return $! == EBUSY;
+}
+
+# The expected subsystem and portal refuse a controller that replaced the one the caller listed.
+sub disconnect_guarded($controller, $expected = {}) {
+ my ($name) = $controller =~ /\A(nvme[0-9]+)\z/;
+ die "invalid controller name '$controller'\n" if !defined($name);
+ # A namespace that would lose its last usable path gets checked for use, which takes a while on
+ # a subsystem with many. A task runs this, which holds no lock on the storage configuration.
+ return with_lock(
+ sub {
+ require PVE::Storage;
+ require PVE::Storage::SAN;
+ my $ctrl = controllers()->{$name}
+ // die "'$name' is not an NVMe over Fabrics controller\n";
+ if (
+ (
+ defined($expected->{subsysnqn})
+ && $expected->{subsysnqn} ne $ctrl->{subsystem}
+ )
+ || (defined($expected->{portal}) && $expected->{portal} ne format_path($ctrl))
+ ) {
+ die
+ "controller '$name' is no longer connected to the listed subsystem and portal\n";
+ }
+ # Without native multipath a namespace is a device of its controller and has no head
+ # device, which the checks below go by. Its name can carry the number of the subsystem.
+ my $local = 0;
+ dir_glob_foreach(
+ "$SYSFS/class/nvme-fabrics/ctl/$name",
+ 'nvme[0-9]+n[0-9]+',
+ sub { $local = 1 },
+ );
+ die "cannot disconnect '$name' - its namespaces do not use native NVMe multipath\n"
+ if $local;
+ my $namespaces = namespaces($ctrl->{subsystem});
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %heads = map { $_ => 1 } keys %$namespaces;
+ for my $head (keys %$status) {
+ $heads{$head} = 1
+ if grep { $_->{device} eq "/dev/$name" } $status->{$head}->{paths}->@*;
+ }
+ PVE::Cluster::cfs_update(1);
+ my $cfg = PVE::Storage::config();
+ for my $head (sort keys %heads) {
+ my $paths = $status->{$head}->{paths} // [];
+ my @others = grep { $_->{device} ne "/dev/$name" } @$paths;
+ next if grep { PVE::Diskmanage::nvme_path_is_usable($_) } @others;
+ my $ns = $namespaces->{$head};
+ if (!defined($ns)) {
+ die
+ "cannot disconnect '$name' - namespace '$head' has no device on this node"
+ . " to check for use\n";
+ }
+ my $device = "/dev/$head";
+ if (
+ PVE::Diskmanage::is_mounted($device)
+ || PVE::Diskmanage::has_holder($device)
+ || is_swap($device)
+ || is_claimed($device)
+ ) {
+ die
+ "cannot disconnect '$name' - namespace '$head' is in use and has no other"
+ . " usable path\n";
+ }
+ # an opener that is gone within a second, like an LVM scan of the status pass, is no
+ # use of the namespace
+ my $opener;
+ for my $try (1 .. 4) {
+ Time::HiRes::usleep(300_000) if $try > 1;
+ $opener = PVE::Diskmanage::device_opener($device, glob("${device}p[0-9]*"));
+ last if !defined($opener);
+ }
+ if (defined($opener)) {
+ die
+ "cannot disconnect '$name' - process $opener has namespace '$head' open and"
+ . " it has no other usable path\n";
+ }
+ # The check of the storage references reads the namespace. Removing a path that is not
+ # usable either costs no usable path, and a reconnecting one cannot be read.
+ next if !grep {
+ $_->{device} eq "/dev/$name" && PVE::Diskmanage::nvme_path_is_usable($_)
+ } @$paths;
+ eval {
+ PVE::Storage::SAN::assert_lun_unreferenced(
+ $cfg,
+ { devpath => $device, wwid => $ns->{wwid} },
+ );
+ };
+ die "cannot disconnect '$name' - $@" if $@;
+ }
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command([$NVME, 'disconnect', '--device', "/dev/$name"], timeout => 30);
+ return;
+ },
+ 300,
+ );
+}
+
1;
diff --git a/src/test/Makefile b/src/test/Makefile
index ceabd991..d323e8a1 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -117,6 +117,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
-test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_api_tests.pl run_nvmeof_taint_tests.pl
./run_nvmeof_tests.pl
+ ./run_nvmeof_api_tests.pl
perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_api_tests.pl b/src/test/run_nvmeof_api_tests.pl
new file mode 100755
index 00000000..c81078b1
--- /dev/null
+++ b/src/test/run_nvmeof_api_tests.pl
@@ -0,0 +1,222 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use File::Path qw(make_path remove_tree);
+use File::Temp qw(tempdir);
+use Test::MockModule;
+use Test::More;
+
+use PVE::API2::NVMeOF;
+use PVE::Storage::SAN;
+
+my $sys = tempdir('nvmeof-api-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::SYSFS = $sys;
+local $PVE::NVMeOF::SWAPS = "$sys/swaps";
+PVE::Tools::file_set_contents($PVE::NVMeOF::SWAPS, "Filename Type Size Used Priority\n");
+
+subtest 'last-path disconnect is checked inside serialization' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $san = Test::MockModule->new('PVE::Storage::SAN');
+ my $cluster = Test::MockModule->new('PVE::Cluster');
+ our $locked;
+ my ($commands, $checks, $mounted, $busy, $headless) = (0, 0, 0, 0, 0);
+ my $own = { device => '/dev/nvme1', state => 'live' };
+ my $other = { device => '/dev/nvme2', state => 'live', 'ana-state' => 'optimized' };
+ $nvme->mock(with_lock =>
+ sub { die "NVMe over Fabrics is busy\n" if $busy; local $locked = 1; $_[0]->() });
+ $nvme->mock(
+ controllers => sub {
+ ok($locked, 'controller snapshot is locked');
+ { nvme1 => { subsystem => 'nqn.test' } };
+ },
+ );
+ $nvme->mock(namespaces => sub { $headless ? {} : { nvme0n1 => { wwid => 'eui.abc' } } });
+ $nvme->mock(is_supported => sub { 1 });
+ $disk->mock(
+ get_nvme_path_status => sub { { nvme0n1 => { paths => [$own, $other] } } },
+ );
+ $disk->mock(is_mounted => sub { $mounted });
+ $disk->mock(has_holder => sub { 0 });
+ my $claimed = 0;
+ $nvme->mock(is_claimed => sub { $claimed });
+ my ($opener, $opens);
+ $disk->mock(device_opener => sub { $opens++; ref($opener) ? shift(@$opener) : $opener });
+ my $hires = Test::MockModule->new('Time::HiRes');
+ $hires->redefine(usleep => sub { });
+ $cluster->mock(cfs_update => sub { ok($locked, 'configuration refreshed under lock') });
+ $storage->mock(config => sub { { ids => {} } });
+ $san->mock(
+ assert_lun_unreferenced => sub { $checks++; die "storage uses this namespace\n" });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'deletion keeps the lock');
+ is($opts{timeout}, 30, 'deletion is bounded');
+ is_deeply(
+ $cmd,
+ ['/usr/sbin/nvme', 'disconnect', '--device', '/dev/nvme1'],
+ 'only the selected controller is removed',
+ );
+ $commands++;
+ },
+ );
+ for my $ana ('optimized', 'non-optimized') {
+ $other->{'ana-state'} = $ana;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ }
+ is($commands, 2, 'another usable path permits removal');
+ is($checks, 0, 'no usage probe when another path is usable');
+ for my $ana ('inaccessible', 'persistent-loss', 'change') {
+ $other->{'ana-state'} = $ana;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, "$ana does not protect an in-use namespace");
+ }
+ $other = { device => '/dev/nvme2', state => 'connecting', 'ana-state' => 'optimized' };
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, 'reconnecting is not a usable path');
+ is($commands, 2, 'refusals never delete');
+ $own->{state} = 'connecting';
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 3, 'a controller that is no usable path either needs no storage check');
+ $opener = '4711 (kvm)';
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like(
+ $@,
+ qr/process 4711 \(kvm\) has namespace/,
+ 'but a process that has the namespace open refuses',
+ );
+ $opener = ['4711 (lvs)'];
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 4, 'an opener that is gone again shortly does not refuse');
+ $opener = undef;
+ $own->{state} = 'live';
+ $san->mock(assert_lun_unreferenced => sub { $checks++ });
+ $mounted = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'local mount refuses');
+ $mounted = 0;
+ PVE::Tools::file_set_contents(
+ $PVE::NVMeOF::SWAPS,
+ "Filename Type Size Used Priority\n/dev/nvme0n1p2 partition 1024 0 -2\n",
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'a swap area on the namespace refuses');
+ PVE::Tools::file_set_contents($PVE::NVMeOF::SWAPS, "Filename Type Size Used Priority\n");
+ $claimed = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'a claim, like a mount of a container, refuses');
+ $claimed = 0;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1', { subsysnqn => 'nqn.other' }) };
+ like($@, qr/no longer connected to the listed subsystem/, 'a replaced controller refuses');
+ $opener = '4711 (kvm)';
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/process 4711 \(kvm\) has namespace 'nvme0n1' open/,
+ 'an open namespace refuses');
+ $opener = undef;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 5, 'unused namespace can lose its final path');
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1",
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme0c1n1",
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/do not use native NVMe multipath/, 'a namespace without head device refuses');
+ is($commands, 5, 'and nothing is disconnected');
+ remove_tree("$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1");
+ make_path("$sys/class/nvme-fabrics/ctl/nvme1/nvme3n2");
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/do not use native NVMe multipath/, 'also when named after the subsystem');
+ remove_tree("$sys/class/nvme-fabrics/ctl/nvme1/nvme3n2");
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 6, 'the path device of native multipath does not');
+ $headless = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/has no device/, 'uncheckable namespace refuses');
+ $busy = 1;
+ $nvme->mock(controllers => sub { die "must not count paths\n" });
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is busy/, 'ongoing deletion blocks another snapshot');
+ eval { PVE::NVMeOF::disconnect_guarded('../nvme1') };
+ like($@, qr/invalid controller/, 'invalid controller refused before locking');
+};
+
+subtest 'node API contract' => sub {
+ my $api = 'PVE::API2::NVMeOF';
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ $storage->mock(
+ config =>
+ sub { { ids => { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } } } },
+ );
+ $nvme->mock(is_supported => sub { 0 });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'uuid' } });
+ my $status = $api->status({ node => 'n1' });
+ is($status->{supported}, 0, 'availability means nvme-cli, not identity or version');
+ is($status->{'host-nqn'}, 'nqn.host', 'host identity shown independently');
+ $nvme->mock(is_supported => sub { 1 });
+ $nvme->mock(host_identity => sub { die "missing host identity\n" });
+ $status = $api->status({ node => 'n1' });
+ is_deeply(
+ $status,
+ { supported => 1, error => 'missing host identity' },
+ 'identity error does not hide installed tools',
+ );
+ $nvme->mock(
+ controllers => sub { {
+ nvme1 => {
+ subsystem => 'nqn.test',
+ transport => 'tcp',
+ traddr => '192.0.2.1',
+ trsvcid => 4420,
+ state => 'connecting',
+ },
+ } },
+ );
+ $nvme->mock(
+ namespaces => sub { die "must not walk the subsystems for each controller\n" },
+ namespace_counts => sub { { 'nqn.test' => 2, 'nqn.other' => 5 } },
+ );
+ my $rows = $api->controllers({ node => 'n1' });
+ is($rows->[0]->{namespaces}, 2, 'namespaces counted for the subsystem of the controller');
+ is($rows->[0]->{'used-by-storage'}, 'fabric', 'controller attributed');
+ is($rows->[0]->{state}, 'connecting', 'kernel state remains visible');
+
+ for my $pair (['status', $status], ['controllers', $rows]) {
+ my $method = $api->map_method_by_name($pair->[0]);
+ eval { PVE::JSONSchema::validate($pair->[1], $method->{returns}) };
+ is($@, '', "$pair->[0] schema");
+ ok($method->{protected} && $method->{proxyto} eq 'node', 'protected and node-proxied');
+ }
+ is(
+ $api->map_method_by_name('disconnect')->{path},
+ 'controller/{controller}',
+ 'REST-shaped deletion',
+ );
+ eval {
+ PVE::JSONSchema::validate(
+ { node => 'n1', controller => 'nvme1', subsysnqn => 'testsubsys' },
+ $api->map_method_by_name('disconnect')->{parameters},
+ );
+ };
+ is($@, '', 'the listed subsystem name is taken as is, also when it is no NQN');
+ my $rpc = Test::MockModule->new('PVE::RPCEnvironment');
+ {
+
+ package NVMeTestRPC;
+ sub get_user { 'root@pam' }
+ sub fork_worker { $_[4]->(); return 'UPID:test' }
+ }
+ $rpc->mock(get => sub { bless {}, 'NVMeTestRPC' });
+ my $removed;
+ $nvme->mock(disconnect_guarded => sub { $removed = $_[0] });
+ is(
+ $api->disconnect({ node => 'n1', controller => 'nvme1' }),
+ 'UPID:test',
+ 'API returns task identifier',
+ );
+ is($removed, 'nvme1', 'task calls guarded disconnect');
+};
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index 41755bb8..bdfb78ae 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -266,9 +266,17 @@ subtest 'sysfs topology' => sub {
eval { PVE::NVMeOF::namespaces('nqn.test') };
like($@, qr/cannot read the WWID/, 'an unreadable namespace is an error, not a gone one');
file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ make_path(map { "$sys/class/nvme-subsystem/nvme-subsys1/nvme1n$_" } 1 .. 3);
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys1/subsysnqn", "nqn.other\n");
+ is_deeply(
+ PVE::NVMeOF::namespace_counts(),
+ { 'nqn.test' => 1, 'nqn.other' => 3 },
+ 'namespaces counted per subsystem',
+ );
make_path("$sys/class/nvme-subsystem/nvme-subsys9");
eval { PVE::NVMeOF::namespaces('nqn.test') };
like($@, qr/cannot read the NQN/, 'so is a subsystem that could be the one asked for');
+ is(scalar(keys PVE::NVMeOF::namespace_counts()->%*), 2, 'the counts leave it out');
rmdir("$sys/class/nvme-subsystem/nvme-subsys9");
};
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
index 73938a7e..2ae7b2b4 100755
--- a/src/test/run_san_api_tests.pl
+++ b/src/test/run_san_api_tests.pl
@@ -109,7 +109,7 @@ is_deeply(
);
is_deeply(
PVE::API2::SAN::Node->index({ node => 'test' }),
- [{ name => 'iscsi' }, { name => 'luns' }],
+ [{ name => 'iscsi' }, { name => 'luns' }, { name => 'nvmeof' }],
'node SAN index',
);
for my $case (
^ permalink raw reply related [relevance 17%]
* [PATCH v4 docs 15/25] storage: document NVMe over Fabrics storages
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (10 preceding siblings ...)
2026-11-23 1:47 5% ` [PATCH v4 storage 14/25] d/control: break pve-manager versions without namespace notifications Thomas Lamprecht
@ 2026-11-23 1:47 19% ` Thomas Lamprecht
2026-11-23 1:47 18% ` [PATCH v4 manager 17/25] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
` (7 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
Add a chapter for the nvmeof storage type: prerequisites, setting up
shared LVM on a namespace with the guided setup or by hand, the
properties, checking and disconnecting paths, and the limits of the
storage type. The introduction lists it among the network storages, and
the LVM chapter names it next to iSCSI as base storage.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
notifications.adoc | 5 +-
pve-gui.adoc | 12 ++-
pve-intro.adoc | 3 +-
pve-storage-lvm.adoc | 10 +-
pve-storage-multipath.adoc | 3 +-
pve-storage-nvmeof.adoc | 200 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 24 +++--
7 files changed, 236 insertions(+), 21 deletions(-)
create mode 100644 pve-storage-nvmeof.adoc
diff --git a/notifications.adoc b/notifications.adoc
index 96ca47b..b5606a3 100644
--- a/notifications.adoc
+++ b/notifications.adoc
@@ -495,8 +495,9 @@ Notification Events
| `job-id` | Job ID
|=======================================================================
-A `multipath` notification groups affected LUNs on the same node. If any LUN
-in a problem notification is *Failed*, the severity is `error`.
+A `multipath` notification groups the affected LUNs and NVMe namespaces of a
+node. If any of them in a problem notification is *Failed*, the severity is
+`error`.
NOTE: Backup job notifications only have `job-id` set if the backup job
was executed automatically based on its schedule, but not if it was triggered
diff --git a/pve-gui.adoc b/pve-gui.adoc
index 9a1f70b..a514eca 100644
--- a/pve-gui.adoc
+++ b/pve-gui.adoc
@@ -233,10 +233,11 @@ On the datacenter level, you can access cluster-wide settings and information.
* *Options:* view and manage cluster-wide default settings.
* *Storage:* provides an interface for managing cluster storage. The *Add* menu
- offers guided setups for shared LVM on iSCSI and Fibre Channel LUNs.
+ offers guided setups for shared LVM on iSCSI and Fibre Channel LUNs and on
+ NVMe over Fabrics namespaces.
-* *SAN:* shows the state of the SAN LUNs on all nodes and manages the multipath
- configuration.
+* *SAN:* shows the state of the SAN LUNs and NVMe namespaces on all nodes and
+ manages the multipath configuration.
* *Backup:* schedule backup jobs. This operates cluster wide, so it doesn't
matter where the VMs/containers are on your cluster when scheduling.
@@ -288,8 +289,9 @@ The top header has useful buttons such as 'Reboot', 'Shutdown', 'Shell',
* *Disks:* get an overview of the attached disks, and manage how they are used.
-* *SAN:* get an overview of the SAN LUNs of the node, with their paths and
- usage. Below it, *iSCSI* shows the iSCSI targets and sessions.
+* *SAN:* get an overview of the SAN LUNs and NVMe namespaces of the node, with
+ their paths and usage. Below it, *iSCSI* shows the iSCSI targets and sessions,
+ and *NVMe over Fabrics* the connected controllers.
* *Ceph:* is only used if you have installed a Ceph server on your
host. In this case, you can manage your Ceph cluster and see the status
diff --git a/pve-intro.adoc b/pve-intro.adoc
index c2a0b6a..baec59f 100644
--- a/pve-intro.adoc
+++ b/pve-intro.adoc
@@ -103,9 +103,10 @@ the cluster have direct access to VM disk images.
The following network storage types are supported:
-* LVM group (network backing with iSCSI targets)
+* LVM group (network backing with iSCSI targets or NVMe over Fabrics)
* iSCSI target
* iSCSI LUNs (direct use)
+* NVMe over Fabrics subsystem
* NFS share
* CIFS share
* Ceph RBD
diff --git a/pve-storage-lvm.adoc b/pve-storage-lvm.adoc
index 92019fc..8b9564c 100644
--- a/pve-storage-lvm.adoc
+++ b/pve-storage-lvm.adoc
@@ -34,7 +34,8 @@ LVM volume group name. This must point to an existing volume group.
Base volume. This volume is automatically activated before accessing
the storage. This is mostly useful when the LVM volume group resides
-on a remote iSCSI server.
+on a remote iSCSI server or on an xref:storage_nvmeof[NVMe over Fabrics]
+namespace.
`saferemove`::
@@ -143,9 +144,10 @@ A benefit of LVM is that it can be used with shared storage.
For example, an iSCSI LUN. The backend implements proper cluster-wide locking if
the storage is marked as shared in the configuration.
-TIP: *Shared LVM on iSCSI* or *Shared LVM on Fibre Channel* in *Datacenter ->
-Storage -> Add* in the web UI creates a shared LVM storage on a SAN LUN, see
-xref:storage_multipath_setup[Multipath].
+TIP: *Shared LVM on iSCSI*, *Shared LVM on Fibre Channel* or *Shared LVM on NVMe
+over Fabrics* in *Datacenter -> Storage -> Add* in the web UI creates a shared
+LVM storage on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace].
NOTE: If you extend a shared volume group onto another device on one node, the
other nodes may only see the added physical volume after LVM has scanned their
diff --git a/pve-storage-multipath.adoc b/pve-storage-multipath.adoc
index 3e07eba..45ab3a8 100644
--- a/pve-storage-multipath.adoc
+++ b/pve-storage-multipath.adoc
@@ -15,7 +15,8 @@ Fibre Channel.
{pve} sets up the maps on all nodes and shows their state under *Datacenter ->
SAN*. An iSCSI storage with *Multipath* enabled requests the maps of its LUNs, a
Fibre Channel LUN needs a multipath entry. NVMe namespaces use the multipath
-support of the kernel instead and are not covered here.
+support of the kernel instead, see xref:storage_nvmeof[NVMe over Fabrics], and
+are not covered here.
Prerequisites
~~~~~~~~~~~~~
diff --git a/pve-storage-nvmeof.adoc b/pve-storage-nvmeof.adoc
new file mode 100644
index 0000000..9b2a285
--- /dev/null
+++ b/pve-storage-nvmeof.adoc
@@ -0,0 +1,200 @@
+[[storage_nvmeof]]
+NVMe over Fabrics Backend
+-------------------------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: NVMe over Fabrics
+endif::wiki[]
+
+Storage pool type: `nvmeof`
+
+NVMe over Fabrics (NVMe-oF) gives a node access to the namespaces of an NVMe
+subsystem on a storage array over TCP. Namespaces are the NVMe counterpart of
+LUNs. Use one as the base volume of a shared LVM storage, or use the namespaces
+directly as disk images.
+
+Each node connects one controller per portal of the storage. The kernel
+combines these paths into one device per namespace with its native NVMe
+multipath and reconnects lost paths on its own. `multipath-tools` is not
+involved.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+. Upgrade all nodes to `pve-manager` 9.2.38 or newer before adding the first
+ NVMe over Fabrics storage, also nodes that will not use it. A node without
+ support for this storage type removes such storages from the cluster-wide
+ storage configuration when it writes that configuration, for example when a
+ storage is added or edited on that node. Adding the first such storage is
+ refused while a node is offline or runs an older version.
+. Install `nvme-cli` on every participating node. The `libpve-storage-perl`
+ package recommends it, but installations without recommended packages need it
+ added separately. Its installation creates the node's host NQN in
+ `/etc/nvme/hostnqn` and host ID in `/etc/nvme/hostid`. Nodes cloned from one
+ image share them. Give each a new identity before it connects, with
+ `nvme gen-hostnqn > /etc/nvme/hostnqn` and `uuidgen > /etc/nvme/hostid`.
+. Allow each node's host NQN on the array. The names are shown under
+ *Datacenter -> SAN* and in the guided setup.
+. Present the same namespace to all intended nodes. Portals are IP addresses
+ that every node can reach; host names are not accepted.
+. Use a storage network that only trusted hosts can reach. The connections use
+ neither authentication nor TLS.
+. Keep native NVMe multipath enabled, which is the kernel default
+ (`nvme_core.multipath=Y`).
+
+[[storage_nvmeof_setup]]
+Setting Up Shared LVM
+~~~~~~~~~~~~~~~~~~~~~
+
+. On a node that can reach the array, select *Shared LVM on NVMe over Fabrics*
+ under *Datacenter -> Storage -> Add*. The *Add Shared LVM* menu of
+ *Datacenter -> SAN* has the same setup.
+. Enter the *ID* of the new storage, a discovery portal and the subsystem, and
+ check the portals. If no NVMe over Fabrics storage connects the nodes to that
+ subsystem yet, the setup adds one named after the ID with a `-base` suffix, or
+ as set under *Advanced*. This storage connects to the subsystem with `content
+ none`, while the LVM storage manages guest disks. Clear the nodes in the list
+ of host NQNs that should not use the storages. Continuing creates or reuses
+ the NVMe over Fabrics storage before you select a namespace.
+. Select the namespace after checking that no host uses it and that no data on
+ it must be kept. The volume group is named after the ID unless set under
+ *Advanced*.
+. Check the state of the namespace on each node of the storage, which the
+ setup shows once the storage is added, as described for LUNs in
+ xref:storage_multipath_setup[Multipath]. For a node that stays *Missing*,
+ check its access to the namespace on the array before placing guests on the
+ storage.
+
+The discovery fills in *Portals*. Some targets, such as the Linux kernel
+target, report only the portal that was asked: add the others to the list.
+With a single portal, the state of the namespace shows `1/1`, which has no path
+redundancy.
+Portals can also be changed later in the edit dialog of the NVMe over Fabrics
+storage; each node then connects new ones on its own.
+
+*Datacenter -> Storage -> Add -> NVMe over Fabrics* adds only the NVMe over
+Fabrics storage. Without a discovery portal, enter the subsystem NQN and its
+portals as they are. Enable *Use namespaces directly* there to use whole
+namespaces as guest disks, or add an *LVM* storage on a namespace later, with
+the NVMe over Fabrics storage as *Base storage*. With direct use, every
+namespace of the subsystem counts as in use by the storage, so no volume group
+can be created on one; keep it disabled on a storage that is the base of LVM
+storages. Disabling it later does not detach guest disks that use a namespace
+directly.
+
+To set it up by hand, run these commands on a node that can reach the array:
+
+----
+# pvesm scan nvmeof <portal>
+# pvesm add nvmeof <nvmeof-storage> --subsysnqn <nqn> --portals <portals> \
+ --content none
+# pvesm list <nvmeof-storage>
+# pvesm add lvm <storage> --vgname <vg> --base <volume-id> --shared 1
+----
+
+Use the complete volume ID from the listing, `<nvmeof-storage>:nvme-<wwid>`.
+Adding the LVM storage creates the volume group if it does not exist yet.
+Creating it is refused if the namespace holds data that {pve} recognizes, such
+as partitions, a file system or a volume group, or if another storage references
+it. To keep an existing volume group, add the LVM storage with its name. To
+discard the data of a namespace instead, stop its users on all hosts and wipe it
+as described for LUNs in xref:storage_multipath_setup[Multipath].
+
+Configuration
+~~~~~~~~~~~~~
+
+The backend supports the common storage properties `content`, `nodes`,
+`disable`, and the following NVMe over Fabrics specific properties:
+
+subsysnqn::
+
+The NQN of the NVMe subsystem. It cannot be changed later, and only one storage
+can use a subsystem.
+
+portals::
+
+Comma-separated list of the subsystem's TCP portals, one per path. Each is an
+IPv4 address or an IPv6 address in brackets, with an optional port (default
+4420).
+
+fast-io-fail-tmo::
+
+Seconds a path may be reconnecting before I/O sent to it fails. The default is
+120 seconds. If no usable path of a namespace remains, its I/O can fail once its
+paths have been reconnecting that long. With `-1`, I/O waits until a path
+returns. A change applies to newly connected controllers only.
+
+.Configuration Example (`/etc/pve/storage.cfg`)
+----
+nvmeof: fabric
+ subsysnqn nqn.2010-06.com.example:array1
+ portals 192.0.2.10,192.0.2.11
+ content none
+----
+
+.Storage features for backend `nvmeof`
+[width="100%",cols="m,m,3*d",options="header"]
+|==============================================================================
+|Content types |Image formats |Shared |Snapshots |Clones
+|images none |raw |yes |no |no
+|==============================================================================
+
+{pve} does not create or delete namespaces; manage them on the array. A volume
+is named `nvme-<wwid>` after its namespace, like its link in `/dev/disk/by-id/`.
+
+Checking and Disconnecting Paths
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Datacenter -> SAN* lists the namespaces of NVMe over Fabrics storages among the
+LUNs, with their state on each node of the storage and *Multipath* shown as
+*Native*, as does *Node -> SAN* for the namespaces of a node. Expand a namespace
+under *Node -> SAN* to inspect its paths. Its *State* counts the usable paths
+out of the portals of the storage, or out of the connected paths if more are
+connected, for example `1/2` while one of two paths is unusable, and shows
+*Failed* without a usable path. *Node -> SAN -> NVMe over Fabrics* lists the
+node's controllers, one per connected portal, with their *State*: *Connected*,
+or *Reconnecting* while the kernel retries a lost path. A node sends a
+xref:notification_events[multipath notification] when the paths of a namespace
+stay degraded or failed in two consecutive checks, and when they recover, under
+the same rules as for a LUN. This does not need `multipathd`.
+
+Each node of an enabled storage connects to the portals that it is not yet
+connected to. A portal that failed is retried after a minute. Removing a portal,
+or disabling or removing the storage, does not disconnect anything. To remove
+such a path, select its controller under *Node -> SAN -> NVMe over Fabrics* on
+each node and press *Disconnect*, or run
+`pvesh delete /nodes/<node>/san/nvmeof/controller/<controller>`. This is refused
+if a namespace that is mounted, in use by another device or as swap, open in a
+process such as a running guest, or referenced by a storage would lose its last
+usable path. If the controller is no usable path itself, such as one that keeps
+reconnecting to a deleted subsystem, the local uses are still checked, but not
+the storage references, as that check reads the namespace. While a namespace has
+no usable path, its I/O waits for `fast-io-fail-tmo`, so an LVM command of the
+status checks can keep it open that long, and Disconnect refuses until then. The
+process check does not find a process that opened the namespace through another
+device node, for example one in a container. A controller with namespaces that
+do not use native NVMe multipath is refused as well. A storage that still lists
+the portal connects to it again. Namespaces of a subsystem that no storage uses
+then show fewer paths, but none as missing, as nothing tells how many paths they
+should have.
+
+Limits
+~~~~~~
+
+* Only the TCP transport is supported, without authentication or TLS.
+* The disk lists under *Node -> Disks* and for Ceph OSDs leave out namespaces
+ attached over TCP or RDMA, like iSCSI LUNs, as other nodes use them too.
+ *Node -> SAN* lists them.
+* NVMe/FC namespaces need no storage of this type, and the guided setups and
+ the cluster-wide status do not cover them. *Node -> SAN* lists them. Create
+ their volume group on the whole namespace under *Node -> Disks -> LVM*; with
+ *Add Storage* enabled, this adds a shared LVM storage.
+
+ifdef::wiki[]
+
+See Also
+~~~~~~~~
+
+* link:/wiki/Storage[Storage]
+
+endif::wiki[]
diff --git a/pvesm.adoc b/pvesm.adoc
index 8f1b24e..0bea1d2 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -79,6 +79,7 @@ nodes that can be accessed as RBD (RADOS Block Device).
|LVM-thin |lvmthin |block |no |yes |yes
|iSCSI/kernel |iscsi |block |yes^3^|yes^4^ |yes
|iSCSI/libiscsi |iscsidirect |block |yes^3^|yes^4^ |yes
+|NVMe-oF |nvmeof |block |yes^3^|yes^4^ |yes
|FC/SAS |native^6^ |block |yes^3^|yes^4^ |yes
|Ceph/RBD |rbd |block |yes |yes |yes
|ZFS over iSCSI |zfs |block |yes |yes |yes
@@ -96,11 +97,13 @@ TiB sized), these operations may take several minutes, or in extreme cases, even
hours. If your setup is affected, create and remove snapshots while the VM is
shut down, expecting a long task duration.
-^3^: With iSCSI, Fibre Channel (FC), or SAS block storage as shared storage in
-a cluster, LVM is used to split the LUN into virtual disks. A LUN is usually
-reachable over several paths; xref:storage_multipath[Multipath] describes how
-{pve} manages them in a cluster. FC and SAS LUNs need a
-xref:storage_multipath_entries[multipath entry].
+^3^: With iSCSI, NVMe over Fabrics (NVMe-oF), Fibre Channel (FC), or SAS block
+storage as shared storage in a cluster, LVM is used to split the LUN or
+namespace into virtual disks. A LUN is usually reachable over several paths;
+xref:storage_multipath[Multipath] describes how {pve} manages them in a cluster.
+FC and SAS LUNs need a xref:storage_multipath_entries[multipath entry].
+NVMe-oF namespaces use the kernel's native multipath instead, see
+xref:storage_nvmeof[NVMe over Fabrics].
^4^: Since {pve} 9, snapshots as a volume chain have been available for VMs.
These snapshots use separate volumes for the snapshot data and layer them. For
@@ -154,9 +157,10 @@ is available on all nodes, but it is physically different and can have
totally different content.
Add storage under *Datacenter -> Storage -> Add* in the web UI. For shared LVM
-on a xref:storage_multipath_setup[SAN LUN], use *Shared LVM on iSCSI* or
-*Shared LVM on Fibre Channel* there instead. It creates the storages that are
-needed and enables multipath for the LUN.
+on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace], use *Shared LVM on iSCSI*, *Shared
+LVM on Fibre Channel* or *Shared LVM on NVMe over Fabrics* there instead. It
+creates the storages that are needed and enables multipath for a LUN.
Storage Pools
@@ -507,6 +511,8 @@ See Also
* link:/wiki/Storage:_Multipath[Storage: Multipath]
+* link:/wiki/Storage:_NVMe_over_Fabrics[Storage: NVMe over Fabrics]
+
* link:/wiki/Storage:_LVM[Storage: LVM]
* link:/wiki/Storage:_LVM_Thin[Storage: LVM Thin]
@@ -551,6 +557,8 @@ include::pve-storage-iscsidirect.adoc[]
include::pve-storage-multipath.adoc[]
+include::pve-storage-nvmeof.adoc[]
+
include::pve-storage-rbd.adoc[]
include::pve-storage-cephfs.adoc[]
^ permalink raw reply related [relevance 19%]
* [PATCH v4 storage 13/25] multipath: report NVMe over Fabrics namespaces in the cluster status
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (8 preceding siblings ...)
2026-11-23 1:47 10% ` [PATCH v4 storage 12/25] multipath: report the NVMe host NQN of each node Thomas Lamprecht
@ 2026-11-23 1:47 17% ` Thomas Lamprecht
2026-11-23 1:47 5% ` [PATCH v4 storage 14/25] d/control: break pve-manager versions without namespace notifications Thomas Lamprecht
` (9 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the LUNs that multipathd handles on
each node. The namespaces of an NVMe over Fabrics storage use the
native multipath of the kernel and were missing from it, so a lost
path or a node without access to a namespace only showed in the LUN
list of that node.
Let each node report the namespaces of the subsystems such a storage
names, with the path counts its LUN list already shows, and expect
them on the nodes of the storage like the LUNs of an iSCSI storage.
They do not depend on multipathd, so a node without it reports them
as well and only the state of its maps stays unknown. A node that
cannot list its namespaces marks its report, so that they show as
unknown there instead of missing.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/SAN/Cluster.pm | 33 +++++---
src/PVE/Multipath/Status.pm | 67 ++++++++++++++--
src/test/run_multipath_api_tests.pl | 120 +++++++++++++++++++++++++++-
3 files changed, 199 insertions(+), 21 deletions(-)
diff --git a/src/PVE/API2/SAN/Cluster.pm b/src/PVE/API2/SAN/Cluster.pm
index ac372d65..322f2fc4 100644
--- a/src/PVE/API2/SAN/Cluster.pm
+++ b/src/PVE/API2/SAN/Cluster.pm
@@ -43,9 +43,9 @@ my $lun_node_schema = {
properties => {
state => {
$state_schema->%*,
- description => "The health of the map on the node from its paths, 'missing' if the"
- . " node should have the map but does not list it, or 'unknown' if the node has no"
- . " current report that covers the map.",
+ description => "The health of the map or NVMe namespace on the node from its paths,"
+ . " 'missing' if the node should have it but does not list it, or 'unknown' if the"
+ . " node has no current report that covers it.",
},
name => {
type => 'string',
@@ -56,20 +56,21 @@ my $lun_node_schema = {
type => 'integer',
minimum => 0,
optional => 1,
- description => 'The size of the map in bytes.',
+ description => 'The size of the map or namespace in bytes.',
},
'paths-active' => {
type => 'integer',
minimum => 0,
optional => 1,
description => 'The number of active paths of the map whose checker state is ready,'
- . ' ghost, or not reported.',
+ . ' ghost, or not reported. For an NVMe namespace, the number of its paths over a'
+ . ' live controller whose ANA state is optimized, non-optimized, or not reported.',
},
'paths-total' => {
type => 'integer',
minimum => 0,
optional => 1,
- description => 'The number of paths of the map.',
+ description => 'The number of paths of the map or namespace.',
},
'paths-expected' => {
type => 'integer',
@@ -77,7 +78,8 @@ my $lun_node_schema = {
optional => 1,
description => 'The number of paths the LUN should have on the node: the highest of'
. ' the count of its multipath entry and, for each managed iSCSI storage of the'
- . ' LUN, the number of its portals.',
+ . ' LUN, the number of its portals. For an NVMe namespace, the number of portals'
+ . ' of its NVMe over Fabrics storage.',
},
},
};
@@ -156,8 +158,8 @@ __PACKAGE__->register_method({
luns => {
type => 'array',
description =>
- "One entry per LUN, identified by its WWID, with the state of its"
- . " map on each node and the overall cluster state.",
+ "One entry per LUN or NVMe namespace, identified by its WWID, with its"
+ . " path health on each node and the overall cluster state.",
items => {
type => 'object',
additionalProperties => 0,
@@ -165,6 +167,12 @@ __PACKAGE__->register_method({
wwid => { type => 'string', description => 'The LUN WWID.' },
explicit =>
{ type => 'boolean', description => 'An explicit entry exists.' },
+ native => {
+ type => 'boolean',
+ optional => 1,
+ description => 'An NVMe namespace, which uses the native'
+ . ' multipath of the kernel.',
+ },
name => {
type => 'string',
optional => 1,
@@ -177,8 +185,9 @@ __PACKAGE__->register_method({
optional => 1,
description =>
'The storage that uses the LUN: as its base volume or through'
- . ' the volume group on it, or as an iSCSI storage that serves'
- . ' the LUNs of its target as images.',
+ . ' the volume group on it, or as an iSCSI or NVMe over Fabrics'
+ . ' storage that serves the LUNs of its target or subsystem as'
+ . ' images.',
},
'multipath-storage' => {
type => 'string',
@@ -199,7 +208,7 @@ __PACKAGE__->register_method({
},
nodes => {
type => 'object',
- description => "Map health keyed by node name.",
+ description => "Path health keyed by node name.",
additionalProperties => $lun_node_schema,
},
},
diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm
index 1b85e108..baae32a6 100644
--- a/src/PVE/Multipath/Status.pm
+++ b/src/PVE/Multipath/Status.pm
@@ -9,6 +9,7 @@ use MIME::Base64 qw(decode_base64 encode_base64);
use PVE::Cluster;
use PVE::INotify;
+use PVE::Diskmanage;
use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
@@ -37,6 +38,47 @@ sub worst_state(@states) {
return $worst;
}
+# Namespaces use the native multipath of the kernel, so their state does not depend on multipathd.
+my sub namespace_luns($pv_vgs) {
+ require PVE::Storage;
+ my $cfg = PVE::Storage::config();
+ my $node = PVE::INotify::nodename();
+ my @storages = grep {
+ my $scfg = $cfg->{ids}->{$_};
+ $scfg->{type} eq 'nvmeof'
+ && !$scfg->{disable}
+ && (!$scfg->{nodes} || $scfg->{nodes}->{$node})
+ } sort keys $cfg->{ids}->%*;
+ # reading the paths walks all NVMe namespaces of the node, also those of other plugins
+ return [] if !@storages;
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %luns;
+ for my $sid (@storages) {
+ my $scfg = $cfg->{ids}->{$sid};
+ my $expected = eval { scalar(PVE::NVMeOF::storage_paths($scfg)->@*) };
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ for my $name (sort keys %$namespaces) {
+ my $wwid = $namespaces->{$name}->{wwid};
+ next if $luns{$wwid};
+ my $paths = $status->{$name} // { active => 0, paths => [] };
+ my $total = scalar($paths->{paths}->@*);
+ my $lun = $luns{$wwid} = {
+ wwid => $wwid,
+ native => 1,
+ size => $namespaces->{$name}->{size},
+ storages => [$sid],
+ 'paths-total' => $total,
+ 'paths-active' => $paths->{active},
+ state => PVE::Multipath::derive_health($paths->{active}, $total, $expected),
+ };
+ $lun->{'paths-expected'} = $expected if defined($expected);
+ my $vg = ($pv_vgs // {})->{"/dev/$name"};
+ $lun->{vgname} = $vg if defined($vg);
+ }
+ }
+ return [map { $luns{$_} } sort keys %luns];
+}
+
sub publish($report) {
my $node = PVE::INotify::nodename();
my $now = time();
@@ -68,11 +110,11 @@ sub update_node_status() {
require PVE::NVMeOF;
my $host = eval { PVE::NVMeOF::host_identity() };
$report->{'nvme-host-nqn'} = $host->{nqn} if $host;
+ require PVE::Storage::LVMPlugin;
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
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();
- require PVE::Storage::LVMPlugin;
- my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
# A node can have many maps that something else set up, for example a storage plugin with
# one LUN per guest disk. Only the maps that the node manages, that are the base volume of a
# storage or hold its volume group get a row, the others are counted.
@@ -134,8 +176,15 @@ sub update_node_status() {
if (my $error = $@) {
chomp $error;
$report->{error} = $error;
- delete $report->{luns};
+ $report->{luns} = [];
}
+ my $namespaces = eval { namespace_luns($pv_vgs) };
+ if (my $error = $@) {
+ warn "multipath: cannot query NVMe namespaces - $error";
+ # a consumer must not take the namespaces as gone
+ $report->{'namespaces-unknown'} = 1;
+ }
+ push $report->{luns}->@*, @$namespaces if $namespaces;
eval { publish($report) };
warn "multipath: cannot publish node status - $@" if $@;
return $report;
@@ -152,7 +201,7 @@ sub cluster_status() {
my %reports = map { $_ => decode_report($raw->{$_}) // {} } @$all_nodes;
my %reported = map { $_->{wwid} => 1 }
grep { defined($_->{wwid}) } map { ($_->{luns} // [])->@* } values %reports;
- my (%nodes, %luns, %expected, %observed, %vg_owner, %disabled_owner);
+ my (%nodes, %luns, %expected, %observed, %vg_owner, %lists, %disabled_owner);
# the nodes that list a map because the configuration names it for them
my (%managed, %unhinted);
my $storage_nodes = sub($scfg) {
@@ -178,7 +227,6 @@ sub cluster_status() {
$vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
next if $scfg->{type} ne 'lvm';
my $base = PVE::Multipath::parse_base_volume($scfg->{base}) // next;
- next if $base->{kind} eq 'nvme'; # a namespace, which has no map
# A base volume by its SCSI name is a map only if its iSCSI storage requests maps. The name
# can also be another by-id link of the LUN, so only a WWID that a node reports counts.
my $map = $requests_maps->($base->{storage}) && $reported{ $base->{wwid} };
@@ -190,6 +238,7 @@ sub cluster_status() {
next;
}
$luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $luns{$wwid}->{native} = 1 if $base->{kind} eq 'nvme';
$luns{$wwid}->{'used-by-storage'} //= $sid;
$managed{$wwid}->{$_} = 1 for @$all_nodes;
$luns{$wwid}->{'multipath-storage'} //= $base->{storage}
@@ -206,11 +255,13 @@ sub cluster_status() {
$entry->{$_} = $report->{$_} for grep { defined($report->{$_}) } @keys;
$entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok';
$unhinted{$node} = 1 if $report->{'vgs-unknown'};
- next if $entry->{state} ne 'ok';
+ # the node lists its namespaces, also if it is unavailable for its maps
+ $lists{$node} = 1 if $report->{luns} && !$report->{'namespaces-unknown'};
for my $lun (($report->{luns} // [])->@*) {
my $wwid = $lun->{wwid} // next;
my $row = $luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $row->{native} = 1 if $lun->{native};
$row->{$_} //= $lun->{$_} for grep { defined($lun->{$_}) } qw(name size);
my $owner = defined($lun->{vgname}) ? $vg_owner{ $lun->{vgname} } : undef;
$row->{'used-by-storage'} //= $owner if defined($owner);
@@ -244,10 +295,10 @@ sub cluster_status() {
if ($observed{$wwid}->{$node}) {
$row->{nodes}->{$node} = $observed{$wwid}->{$node};
} elsif ($expected{$wwid}->{$node}) {
- my $listed = $nodes{$node}->{state} eq 'ok';
+ my $listed = $row->{native} ? $lists{$node} : $nodes{$node}->{state} eq 'ok';
# without the hint file of LVM a node leaves a map out that it only knows through
# the volume group of a storage
- $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node};
+ $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node} && !$row->{native};
$row->{nodes}->{$node} = { state => $listed ? 'missing' : 'unknown' };
}
}
diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl
index a91332df..85ddce7b 100755
--- a/src/test/run_multipath_api_tests.pl
+++ b/src/test/run_multipath_api_tests.pl
@@ -686,7 +686,12 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
my $status = Test::MockModule->new('PVE::Multipath::Status');
my $mp = Test::MockModule->new('PVE::Multipath');
my $iscsi = Test::MockModule->new('PVE::Storage::ISCSIPlugin');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $disks = Test::MockModule->new('PVE::Diskmanage');
my ($report, @order);
+ my $ids = {};
+ $storage->mock(config => sub { { ids => $ids } });
+ $disks->mock(get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
$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' } });
@@ -728,6 +733,58 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
is($report->{luns}->[0]->{'paths-expected'}, 3, 'expected count reported');
is($report->{luns}->[0]->{state}, 'degraded', 'fewer paths than expected');
ok(!exists($report->{supported}), 'the report has no separate "supported" field');
+
+ $ids->{nvme} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test:sub',
+ portals => '192.0.2.1,192.0.2.2',
+ };
+ $nvme->mock(
+ namespaces => sub($nqn) {
+ return $nqn eq 'nqn.test:sub'
+ ? { nvme1n1 => { wwid => 'uuid.1', size => 4096 } }
+ : {};
+ },
+ );
+ my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+ $lvm->mock(cached_pv_volume_groups => sub { { '/dev/nvme1n1' => 'vgns' } });
+ my $namespace = {
+ wwid => 'uuid.1',
+ native => 1,
+ size => 4096,
+ storages => ['nvme'],
+ vgname => 'vgns',
+ 'paths-total' => 1,
+ 'paths-active' => 1,
+ 'paths-expected' => 2,
+ state => 'degraded',
+ };
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}->[1], $namespace, 'namespace with fewer paths than portals');
+ $mp->mock(is_running => sub { 0 });
+ PVE::Multipath::Status::update_node_status();
+ is(
+ $report->{error},
+ 'multipathd is not running or does not respond',
+ 'stopped daemon still reported',
+ );
+ is_deeply($report->{luns}, [$namespace], 'namespaces do not need multipathd');
+ ok(!$report->{'namespaces-unknown'}, 'which the node could list');
+ {
+ local $ids->{nvme}->{disable} = 1;
+ $disks->mock(get_nvme_path_status => sub { die "walked the NVMe paths\n" });
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}, [], 'a disabled storage reports no namespaces');
+ ok(!$report->{'namespaces-unknown'}, 'and reads no NVMe paths for them');
+ $disks->mock(
+ get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
+ }
+ $nvme->mock(namespaces => sub { die "sysfs gone\n" });
+ {
+ local $SIG{__WARN__} = sub { };
+ PVE::Multipath::Status::update_node_status();
+ }
+ ok($report->{'namespaces-unknown'}, 'a failed namespace query marks the report');
};
subtest 'API returns final node and LUN states' => sub {
@@ -764,12 +821,31 @@ subtest 'API returns final node and LUN states' => sub {
'paths-active' => 2,
storages => ['scoped'],
},
+ {
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'optimal',
+ 'paths-total' => 2,
+ 'paths-active' => 2,
+ storages => ['nvme'],
+ },
],
}),
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' }),
+ n5 => encode_report({
+ time => $NOW,
+ error => 'multipath-tools is not installed',
+ luns => [{
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'degraded',
+ 'paths-total' => 2,
+ 'paths-active' => 1,
+ storages => ['nvme'],
+ }],
+ }),
);
$cluster->mock(get_node_kv => sub { \%raw });
my $entries = { '3600a' => { type => 'wwid' } };
@@ -787,6 +863,8 @@ subtest 'API returns final node and LUN states' => sub {
{ type => 'iscsi', 'managed-multipath' => 1, nodes => { departed => 1 } },
lvmgone => { type => 'lvm', base => 'gone:0.0.0.dm-uuid-mpath-3600e' },
scoped => { type => 'iscsi', 'managed-multipath' => 1, nodes => { n2 => 1 } },
+ nvme => { type => 'nvmeof', subsysnqn => 'nqn.test:sub' },
+ lvmns => { type => 'lvm', base => 'nvme:nvme-uuid.2', nodes => { n5 => 1 } },
},
} },
);
@@ -848,6 +926,46 @@ subtest 'API returns final node and LUN states' => sub {
'an entry for other nodes does not change that',
);
}
+ my $namespace = $lun{'uuid.1'};
+ ok($namespace->{native}, 'namespace marked as native');
+ ok(!exists($namespace->{'multipath-storage'}), 'a namespace has no requested map');
+ is_deeply(
+ { map { $_ => $namespace->{nodes}->{$_}->{state} } keys $namespace->{nodes}->%* },
+ {
+ n1 => 'optimal',
+ n2 => 'missing',
+ n3 => 'unknown',
+ n4 => 'unknown',
+ n5 => 'degraded',
+ },
+ 'namespace state of a node without multipathd counts',
+ );
+ is($lun->{nodes}->{n5}->{state}, 'unknown', 'no map state from a node without multipathd');
+ is_deeply(
+ $lun{'uuid.2'},
+ {
+ wwid => 'uuid.2',
+ explicit => 0,
+ native => 1,
+ 'used-by-storage' => 'lvmns',
+ state => 'missing',
+ nodes => { n5 => { state => 'missing' } },
+ },
+ 'base namespace that a node without multipathd does not report',
+ );
+ $raw{n5} = encode_report({ time => $NOW, error => 'too many LUNs to report' });
+ $res = PVE::API2::SAN::Cluster->status({});
+ %lun = map { $_->{wwid} => $_ } $res->{luns}->@*;
+ is($lun{'uuid.2'}->{nodes}->{n5}->{state}, 'unknown', 'node without a list');
+ {
+ local $raw{n2} = encode_report({ time => $NOW, luns => [], 'namespaces-unknown' => 1 });
+ my %unlisted = map { $_->{wwid} => $_ } PVE::API2::SAN::Cluster->status({})->{luns}->@*;
+ is(
+ $unlisted{'uuid.1'}->{nodes}->{n2}->{state},
+ 'unknown',
+ 'a node that could not query its namespaces does not miss them',
+ );
+ }
eval {
PVE::JSONSchema::validate(
$res,
^ permalink raw reply related [relevance 17%]
* [PATCH v4 manager 23/25] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (16 preceding siblings ...)
2026-11-23 1:47 12% ` [PATCH v4 manager 22/25] ui: san: show that a namespace uses native multipath Thomas Lamprecht
@ 2026-11-23 1:48 13% ` Thomas Lamprecht
2026-11-23 1:48 13% ` [PATCH v4 manager 25/25] d/control: bump versioned dependencies for NVMe over Fabrics Thomas Lamprecht
2026-11-23 13:35 6% ` superseded: [PATCH v4 storage,docs,manager 00/25] NVMe over Fabrics storage Thomas Lamprecht
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:48 UTC (permalink / raw)
To: pve-devel
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. A report whose
namespaces could not be listed does not count for the absence of a
namespace, so that it is not taken as gone, but still for that of a
map, so that a failing query does not keep the alert of a removed map.
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');
^ permalink raw reply related [relevance 13%]
* [PATCH v4 manager 17/25] ui: storage: add NVMe over Fabrics storage
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (11 preceding siblings ...)
2026-11-23 1:47 19% ` [PATCH v4 docs 15/25] storage: document NVMe over Fabrics storages Thomas Lamprecht
@ 2026-11-23 1:47 18% ` Thomas Lamprecht
2026-11-23 1:47 20% ` [PATCH v4 manager 18/25] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
` (6 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
Show NVMe over Fabrics storages with their subsystem in the storage
list, and add a dialog for them. The dialog lists the subsystems that a
discovery portal reports and fills in the portals of the selected one,
which can be changed. Without a discovery portal, the subsystem and its
portals can be entered as they are. As in the iSCSI dialog, the
discovery can run on another node, since the node serving the web UI
may not be allowed on the array. The node of the discovery is then
preselected as the node of the storage.
The subsystem selector builds on the iSCSI target selector, which now
lets a subclass set its store fields and sort key.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/Utils.js | 6 ++
www/manager6/dc/StorageView.js | 14 ++-
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/NVMeOFEdit.js | 162 +++++++++++++++++++++++++++++
5 files changed, 184 insertions(+), 4 deletions(-)
create mode 100644 www/manager6/storage/NVMeOFEdit.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 1ee82e9a9..dddf17590 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -380,6 +380,7 @@ JSSRC= \
storage/LvmThinEdit.js \
storage/BTRFSEdit.js \
storage/NFSEdit.js \
+ storage/NVMeOFEdit.js \
storage/PBSEdit.js \
storage/RBDEdit.js \
storage/StatusView.js \
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index faf621bc5..d508d0469 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -886,6 +886,12 @@ Ext.define('PVE.Utils', {
faIcon: 'building',
backups: false,
},
+ nvmeof: {
+ name: 'NVMe over Fabrics',
+ ipanel: 'NVMeOFInputPanel',
+ faIcon: 'building',
+ backups: false,
+ },
cephfs: {
name: 'CephFS',
ipanel: 'CephFSInputPanel',
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index baad3990f..6afea33ce 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -68,8 +68,9 @@ Ext.define(
});
},
- // What a storage is on: the volume group or pool for the types without path or target.
- storageLocation: function ({ type, vgname, thinpool, pool, target, path }) {
+ // What a storage is on: the volume group, pool or subsystem for the types without path or
+ // target.
+ storageLocation: function ({ type, vgname, thinpool, pool, subsysnqn, target, path }) {
switch (type) {
case 'lvm':
return vgname;
@@ -77,6 +78,8 @@ Ext.define(
return vgname && thinpool ? `${vgname}/${thinpool}` : vgname;
case 'zfspool':
return pool;
+ case 'nvmeof':
+ return subsysnqn;
default:
return target || path;
}
@@ -208,6 +211,13 @@ Ext.define(
),
'lun target',
],
+ nvmeof: [
+ 'san',
+ gettext(
+ 'Connect to an NVMe/TCP subsystem, to use its namespaces directly or as base of an LVM storage.',
+ ),
+ 'nvme tcp subsystem namespace',
+ ],
zfs: [
'san',
gettext(
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index ad18282d8..0dd77247d 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -5,6 +5,7 @@ Ext.define('PVE.storage.IScsiScan', {
queryParam: 'portal',
valueField: 'target',
displayField: 'target',
+ scanFields: ['target', 'portal'],
matchFieldWidth: false,
allowBlank: false,
@@ -56,13 +57,13 @@ Ext.define('PVE.storage.IScsiScan', {
}
let store = Ext.create('Ext.data.Store', {
- fields: ['target', 'portal'],
+ fields: me.scanFields,
proxy: {
type: 'proxmox',
url: `${me.apiBaseUrl}${me.nodename}${me.apiSuffix}`,
},
});
- store.sort('target', 'ASC');
+ store.sort(me.valueField, 'ASC');
Ext.apply(me, {
store: store,
diff --git a/www/manager6/storage/NVMeOFEdit.js b/www/manager6/storage/NVMeOFEdit.js
new file mode 100644
index 000000000..84dd6f635
--- /dev/null
+++ b/www/manager6/storage/NVMeOFEdit.js
@@ -0,0 +1,162 @@
+Ext.define('PVE.storage.NVMeOFScan', {
+ extend: 'PVE.storage.IScsiScan',
+ alias: 'widget.pveNVMeOFScan',
+
+ valueField: 'subsysnqn',
+ displayField: 'subsysnqn',
+ scanFields: ['subsysnqn', 'portals'],
+
+ listConfig: {
+ width: 650,
+ columns: [
+ {
+ dataIndex: 'subsysnqn',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+ emptyText: PVE.Utils.renderNotFound(gettext('Subsystem')),
+ },
+
+ config: {
+ apiSuffix: '/scan/nvmeof',
+ },
+});
+
+Ext.define('PVE.storage.NVMeOFInputPanel', {
+ extend: 'PVE.panel.StorageBase',
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ onlineHelp: 'storage_nvmeof',
+
+ namespaceContent: 'images',
+
+ onGetValues: function (values) {
+ let me = this;
+
+ values.content = values.namespaces ? me.namespaceContent : 'none';
+ delete values.namespaces;
+
+ return me.callParent([values]);
+ },
+
+ // a storage can be restricted to some volume types, keep its content types then
+ setValues: function (values) {
+ let me = this;
+
+ values.namespaces = PVE.Utils.contentAllows(values.content, 'vm-vol');
+ if (values.namespaces) {
+ me.namespaceContent = Ext.Array.from(values.content).join(',');
+ }
+ me.callParent([values]);
+ },
+
+ column1: [
+ {
+ xtype: 'textfield',
+ name: 'discovery-portal',
+ fieldLabel: gettext('Discovery Portal'),
+ // without discovery, the subsystem and portals can be entered as they are
+ allowBlank: true,
+ submitValue: false,
+ cbind: {
+ hidden: '{!isCreate}',
+ disabled: '{!isCreate}',
+ },
+ listeners: {
+ // The subsystem and the I/O portals of a previous discovery go at once, also its
+ // pending request. The next discovery waits until the portal is typed.
+ change: function (field, value) {
+ let panel = field.up('inputpanel');
+ let scan = panel.lookup('subsystemScan');
+ scan.setPortal('');
+ scan.setHideTrigger(true);
+ scan.setValue('');
+ scan.getStore().removeAll();
+ panel.down('field[name=portals]')?.setValue('');
+ // a pasted portal can come with spaces around it
+ let typed = (value ?? '').trim();
+ let portal = typed && !PVE.SANUtils.portalIncomplete(typed) ? typed : '';
+ field.discovery ??= new Ext.util.DelayedTask();
+ field.discovery.delay(500, () => {
+ if (portal && !scan.destroyed) {
+ scan.setHideTrigger(false);
+ scan.setPortal(portal);
+ }
+ });
+ },
+ destroy: (field) => field.discovery?.cancel(),
+ },
+ },
+ {
+ xtype: 'checkbox',
+ name: 'namespaces',
+ boxLabel: gettext('Use namespaces directly'),
+ },
+ ],
+
+ // NQNs and portal lists are longer than a column is wide
+ columnB: [
+ {
+ cbind: {
+ xtype: (get) => (get('isCreate') ? 'pveNVMeOFScan' : 'displayfield'),
+ hideTrigger: '{isCreate}',
+ },
+ // an NQN can also be typed, if the array offers no discovery
+ editable: true,
+ notFoundIsValid: true,
+ // the list needs a discovery portal
+ expand: function () {
+ if (this.portal) {
+ this.self.prototype.expand.call(this);
+ }
+ },
+ name: 'subsysnqn',
+ value: '',
+ fieldLabel: gettext('Subsystem'),
+ // shown when editing; an NQN wraps best at the line end, not at its first hyphen
+ fieldStyle: 'word-break: break-all;',
+ allowBlank: false,
+ reference: 'subsystemScan',
+ listeners: {
+ change: function (field, value) {
+ let rec = field
+ .getStore?.()
+ .findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ field
+ .up('inputpanel')
+ .down('field[name=portals]')
+ .setValue(rec.get('portals'));
+ }
+ },
+ nodechanged: function (value) {
+ this.up('inputpanel').lookup('storageNodeRestriction').setValue(value);
+ },
+ },
+ },
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ allowBlank: false,
+ },
+ ],
+
+ advancedColumn1: [
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'fast-io-fail-tmo',
+ fieldLabel: gettext('Fail I/O After (s)'),
+ minValue: -1,
+ emptyText: '120',
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Applies to newly connected paths. -1 disables the timeout.'),
+ },
+ },
+ ],
+});
^ permalink raw reply related [relevance 18%]
* [PATCH v4 manager 20/25] ui: node san: list NVMe over Fabrics controllers
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (14 preceding siblings ...)
2026-11-23 1:47 19% ` [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 13% ` Thomas Lamprecht
2026-11-23 1:47 12% ` [PATCH v4 manager 22/25] ui: san: show that a namespace uses native multipath Thomas Lamprecht
` (3 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
Add a view below Node > SAN with the controllers of a node, one per
connected portal, with their transport, state and storage, and the host
NQN of the node. A controller can be disconnected there, for example
after its portal was removed from the storage, which the node refuses
for the last usable path of a namespace in use. The controllers come
from sysfs, so the view lists them also without nvme-cli, which only
Disconnect needs.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/SANUtils.js | 5 +
www/manager6/Utils.js | 1 +
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 170 +++++++++++++++++++++++++
5 files changed, 185 insertions(+), 1 deletion(-)
create mode 100644 www/manager6/node/NVMeOFControllers.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index f2fc80279..f3591e1c8 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -253,6 +253,7 @@ JSSRC= \
node/ISCSITargets.js \
node/LVM.js \
node/LVMThin.js \
+ node/NVMeOFControllers.js \
node/SANLuns.js \
node/StatusView.js \
node/Subscription.js \
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index bd1c87324..96e099059 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -132,6 +132,11 @@ Ext.define('PVE.SANUtils', {
'logged-in': ['check-circle good', gettext('Connected')],
recovering: ['exclamation-circle warning', gettext('Reconnecting')],
'not-connected': ['times-circle faded', gettext('Not connected')],
+ live: ['check-circle good', gettext('Connected')],
+ connecting: ['exclamation-circle warning', gettext('Reconnecting')],
+ resetting: ['exclamation-circle warning', gettext('Reconnecting')],
+ deleting: ['times-circle faded', gettext('Disconnecting')],
+ 'deleting (no IO)': ['times-circle faded', gettext('Disconnecting')],
}[state];
let [icon, label] = display ?? ['question-circle faded', state];
return `<i class="fa fa-fw fa-${icon}"></i> ${Ext.htmlEncode(text ?? label)}`;
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index d508d0469..fc3667f51 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -2276,6 +2276,7 @@ Ext.define('PVE.Utils', {
lvmthinremove: ['Thinpool', gettext('Remove')],
migrateall: ['', gettext('Bulk migrate VMs and Containers')],
move_volume: ['CT', gettext('Move Volume')],
+ nvmedisconnect: ['NVMe-oF', gettext('Disconnect')],
'pbs-download': ['VM/CT', gettext('File Restore Download')],
pull_file: ['CT', gettext('Pull file')],
push_file: ['CT', gettext('Push file')],
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index c85183766..830e8542a 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -398,7 +398,7 @@ Ext.define('PVE.node.Config', {
);
}
- // the LUN and iSCSI reads of the node accept either privilege
+ // the LUN, iSCSI and NVMe over Fabrics reads of the node accept either privilege
if (caps.nodes['Sys.Audit'] || caps.storage['Datastore.Allocate']) {
me.items.push(
{
@@ -414,6 +414,13 @@ Ext.define('PVE.node.Config', {
iconCls: 'fa fa-bullseye',
groups: ['san'],
},
+ {
+ xtype: 'pveNVMeOFControllerList',
+ title: 'NVMe over Fabrics',
+ itemId: 'san-nvmeof',
+ iconCls: 'fa fa-plug',
+ groups: ['san'],
+ },
);
}
diff --git a/www/manager6/node/NVMeOFControllers.js b/www/manager6/node/NVMeOFControllers.js
new file mode 100644
index 000000000..8592b2a3a
--- /dev/null
+++ b/www/manager6/node/NVMeOFControllers.js
@@ -0,0 +1,170 @@
+Ext.define('PVE.node.NVMeOFControllerList', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'pveNVMeOFControllerList',
+ onlineHelp: 'storage_nvmeof',
+ emptyText: gettext('No NVMe over Fabrics controllers found'),
+ viewConfig: { enableTextSelection: true },
+ store: {
+ fields: [
+ 'controller',
+ 'transport',
+ 'subsysnqn',
+ 'portal',
+ 'state',
+ 'namespaces',
+ 'used-by-storage',
+ ],
+ sorters: ['subsysnqn', 'portal'],
+ },
+ columns: [
+ { text: gettext('Controller'), dataIndex: 'controller', width: 85 },
+ {
+ text: gettext('Subsystem'),
+ dataIndex: 'subsysnqn',
+ flex: 3,
+ minWidth: 200,
+ renderer: Ext.htmlEncode,
+ },
+ {
+ text: gettext('Transport'),
+ dataIndex: 'transport',
+ width: 90,
+ // the transport of the controller, named as for the paths of a namespace
+ renderer: (value) => PVE.SANUtils.renderSanTransport(value && `nvme-${value}`),
+ },
+ { text: gettext('Portal'), dataIndex: 'portal', width: 150, renderer: Ext.htmlEncode },
+ {
+ text: gettext('State'),
+ dataIndex: 'state',
+ width: 120,
+ renderer: PVE.SANUtils.renderState,
+ },
+ {
+ text: gettext('Storage'),
+ dataIndex: 'used-by-storage',
+ flex: 1,
+ minWidth: 120,
+ renderer: Ext.htmlEncode,
+ },
+ { text: gettext('Namespaces'), dataIndex: 'namespaces', width: 100 },
+ ],
+
+ reload: function () {
+ let me = this;
+ let load = (path, success) =>
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${me.nodename}/san/nvmeof/${path}`,
+ method: 'GET',
+ waitMsgTarget: me.getView(),
+ failure: (response) =>
+ Proxmox.Utils.setErrorMask(me.getView(), response.htmlStatus),
+ success: (response) => !me.destroyed && success(response.result.data),
+ });
+ load('status', function (status) {
+ me.down('#hostnqn').setValue(status['host-nqn'] || '');
+ me.supported = !!status.supported;
+ let error = status.supported
+ ? status.error
+ : gettext('nvme-cli is not installed on this node.');
+ // the controllers come from sysfs, which needs neither nvme-cli nor a host identity
+ let warning = me.down('#warning');
+ warning.setHtml(
+ error
+ ? `<i class="fa fa-fw fa-exclamation-triangle warning"></i> ${Ext.htmlEncode(error)}`
+ : '',
+ );
+ warning.setHidden(!error);
+ load('controller', function (controllers) {
+ Proxmox.Utils.setErrorMask(me.getView(), false);
+ me.getStore().setData(controllers);
+ });
+ });
+ },
+
+ listeners: {
+ activate: function () {
+ this.reload();
+ },
+ },
+
+ initComponent: function () {
+ let me = this;
+ me.nodename = me.pveSelNode.data.node;
+ me.dockedItems = [
+ {
+ xtype: 'toolbar',
+ dock: 'top',
+ items: [
+ {
+ text: gettext('Reload'),
+ iconCls: 'fa fa-refresh',
+ handler: () => me.reload(),
+ },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Disconnect'),
+ iconCls: 'fa fa-unlink',
+ disabled: true,
+ dangerous: true,
+ // the disconnect uses nvme-cli
+ enableFn: () =>
+ !!Ext.state.Manager.get('GuiCap').dc['Sys.Modify'] && me.supported,
+ confirmMsg: (rec) =>
+ Ext.String.format(
+ gettext(
+ 'Disconnect controller {0} from portal {1}? A storage that still lists that portal connects to it again.',
+ ),
+ Ext.htmlEncode(rec.get('controller')),
+ Ext.htmlEncode(rec.get('portal')),
+ ),
+ handler: (button, event, rec) =>
+ Proxmox.Utils.API2Request({
+ // refused if the kernel reused the controller number meanwhile
+ url:
+ `/nodes/${me.nodename}/san/nvmeof/controller/${rec.get('controller')}?` +
+ Ext.Object.toQueryString({
+ subsysnqn: rec.get('subsysnqn'),
+ portal: rec.get('portal'),
+ }),
+ method: 'DELETE',
+ waitMsgTarget: me,
+ failure: (response) =>
+ Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+ success: (response) =>
+ Ext.create('Proxmox.window.TaskProgress', {
+ upid: response.result.data,
+ autoShow: true,
+ taskDone: () => !me.destroyed && me.reload(),
+ }),
+ }),
+ },
+ ],
+ },
+ {
+ // a host NQN does not fit next to the buttons on a narrow screen
+ xtype: 'toolbar',
+ dock: 'top',
+ items: [
+ {
+ xtype: 'displayfield',
+ itemId: 'hostnqn',
+ fieldLabel: gettext('Host NQN'),
+ },
+ {
+ iconCls: 'fa fa-clipboard',
+ tooltip: gettext('Copy to Clipboard'),
+ handler: () => PVE.Utils.copyToClipboard(me.down('#hostnqn').getValue()),
+ },
+ ],
+ },
+ {
+ xtype: 'component',
+ itemId: 'warning',
+ dock: 'top',
+ padding: 5,
+ hidden: true,
+ },
+ ];
+ me.callParent();
+ },
+});
^ permalink raw reply related [relevance 13%]
* [PATCH v4 manager 22/25] ui: san: show that a namespace uses native multipath
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (15 preceding siblings ...)
2026-11-23 1:47 13% ` [PATCH v4 manager 20/25] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
@ 2026-11-23 1:47 12% ` Thomas Lamprecht
2026-11-23 1:48 13% ` [PATCH v4 manager 23/25] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
` (2 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the namespaces of NVMe over Fabrics
storages too. They use the native multipath of the kernel, with neither
an entry nor a storage that requests a map, so the Multipath column
would call them unmanaged. Show "Native" for them, as the LUN list of a
node does, and name them as namespaces in Paths by Node and in the wipe
dialog.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/SAN.js | 16 ++++++++++++++--
www/manager6/window/SANLunState.js | 8 ++++----
www/manager6/window/SANLunWipe.js | 24 ++++++++++++++++--------
3 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index e30b5ef48..fdf2935bf 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -15,6 +15,7 @@ Ext.define('pve-san-status', {
'name',
'explicit',
'multipath-storage',
+ 'native',
'nodes',
'size',
'used-by-storage',
@@ -118,6 +119,7 @@ Ext.define('PVE.dc.SANView', {
Ext.create('PVE.window.SANLunState', {
wwid: rec.get('wwid'),
name: rec.get('name'),
+ nvme: !!rec.get('native'),
autoShow: true,
});
let setupItem = (type) => ({
@@ -258,7 +260,11 @@ Ext.define('PVE.dc.SANView', {
disabled: !canModify,
handler: function (button) {
let lun = button.up('grid').getSelection()[0];
- let wwid = lun?.get('explicit') ? undefined : lun?.get('wwid');
+ // a namespace uses native multipath, which takes no entry
+ let wwid =
+ lun?.get('explicit') || lun?.get('native')
+ ? undefined
+ : lun?.get('wwid');
edit({ wwid, isCreate: true });
},
},
@@ -381,7 +387,13 @@ Ext.define('PVE.dc.SANView', {
width: 170,
renderer: (value, md, rec) => {
let storage = rec.get('multipath-storage');
- let kind = value ? 'manual' : storage ? 'storage' : 'unmanaged';
+ let kind = rec.get('native')
+ ? 'native'
+ : value
+ ? 'manual'
+ : storage
+ ? 'storage'
+ : 'unmanaged';
return Ext.htmlEncode(PVE.SANUtils.multipathText(kind, storage));
},
},
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index 5dfce247a..f84940fd8 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -23,12 +23,12 @@ Ext.define('PVE.window.SANLunState', {
let title = me.nvme
? gettext('Storage {0}: Namespace State')
: gettext('Storage {0}: LUN State');
+ let pathsTitle = me.nvme
+ ? gettext('Namespace {0}: Paths by Node')
+ : gettext('LUN {0}: Paths by Node');
me.title = me.storage
? Ext.String.format(title, me.storage)
- : Ext.String.format(
- gettext('LUN {0}: Paths by Node'),
- Ext.htmlEncode(me.name || me.wwid),
- );
+ : Ext.String.format(pathsTitle, Ext.htmlEncode(me.name || me.wwid));
// The other nodes set up the LUN of a new storage with their next status updates.
let pendingUntil = me.storage ? Date.now() + 60000 : 0;
let rstore = Ext.create('Proxmox.data.UpdateStore', {
diff --git a/www/manager6/window/SANLunWipe.js b/www/manager6/window/SANLunWipe.js
index 5a9d287e7..c75adcd5c 100644
--- a/www/manager6/window/SANLunWipe.js
+++ b/www/manager6/window/SANLunWipe.js
@@ -1,6 +1,5 @@
Ext.define('PVE.window.SANLunWipe', {
extend: 'Proxmox.window.Edit',
- title: gettext('Wipe LUN'),
onlineHelp: 'storage_multipath',
width: 550,
isCreate: true,
@@ -12,6 +11,8 @@ Ext.define('PVE.window.SANLunWipe', {
let me = this;
let lun = me.lun;
let name = lun.name || lun.wwid;
+ let nvme = lun.multipath === 'native';
+ me.title = nvme ? gettext('Wipe Namespace') : gettext('Wipe LUN');
me.url = `/nodes/${me.node}/disks/wipedisk`;
me.extraRequestParams = { disk: lun['by-id'] };
me.items = [
@@ -20,9 +21,13 @@ Ext.define('PVE.window.SANLunWipe', {
cls: 'pmx-hint',
html: Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'Wipe LUN {0} using node "{1}"? All data on the LUN will be lost, for every host that accesses it!',
- ),
+ nvme
+ ? gettext(
+ 'Wipe namespace {0} using node "{1}"? All data on the namespace will be lost, for every host that accesses it!',
+ )
+ : gettext(
+ 'Wipe LUN {0} using node "{1}"? All data on the LUN will be lost, for every host that accesses it!',
+ ),
name,
me.node,
),
@@ -42,12 +47,15 @@ Ext.define('PVE.window.SANLunWipe', {
// the checks before the wipe see the storages of the cluster and the users of the LUN
// on this node, not what another host does with it
xtype: 'proxmoxcheckbox',
- boxLabel: gettext('No other host uses the LUN'),
+ boxLabel: nvme
+ ? gettext('No other host uses the namespace')
+ : gettext('No other host uses the LUN'),
submitValue: false,
getErrors: function () {
- return this.getValue()
- ? []
- : [gettext('Confirm that no other host uses the LUN.')];
+ let error = nvme
+ ? gettext('Confirm that no other host uses the namespace.')
+ : gettext('Confirm that no other host uses the LUN.');
+ return this.getValue() ? [] : [error];
},
},
{
^ permalink raw reply related [relevance 12%]
* [PATCH v4 storage 08/25] api: scan: add NVMe over Fabrics discovery
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (3 preceding siblings ...)
2026-11-23 1:47 16% ` [PATCH v4 storage 07/25] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
@ 2026-11-23 1:47 15% ` Thomas Lamprecht
2026-11-23 1:47 11% ` [PATCH v4 storage 09/25] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
` (14 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
Setting up an NVMe over Fabrics storage needs the NQN of the
subsystem and its portals. Add /nodes/{node}/scan/nvmeof, which asks
the discovery service at a portal for the NVMe/TCP subsystems it
offers to the node and lists them with their portals.
Without a port, it tries the discovery port 8009 and then the I/O
port 4420, where Linux targets answer discovery too. The scan needs
Datastore.Allocate on /storage, like the iSCSI scan.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 49 ++++++++++++++++
src/PVE/NVMeOF.pm | 66 ++++++++++++++++++++++
src/test/run_nvmeof_taint_tests.pl | 5 ++
src/test/run_nvmeof_tests.pl | 90 ++++++++++++++++++++++++++++++
src/test/run_san_api_tests.pl | 2 +-
5 files changed, 211 insertions(+), 1 deletion(-)
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index f37e7d4e..c6263994 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -6,6 +6,7 @@ use warnings;
# NOTE: This API endpoints are mounted by pve-manager's API2::Node module and pvesm CLI
use PVE::JSONSchema qw(get_standard_option);
+use PVE::NVMeOF;
use PVE::RESTHandler;
use PVE::SafeSyslog;
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'lvmthin' },
{ method => 'nfs' },
+ { method => 'nvmeof' },
{ method => 'pbs' },
{ method => 'zfs' },
];
@@ -300,6 +302,53 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'nvmeofscan',
+ path => 'nvmeof',
+ method => 'GET',
+ description =>
+ 'List the NVMe over TCP subsystems offered to this node by a discovery controller.',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/storage', ['Datastore.Allocate']] },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ portal => {
+ description => 'IPv4 or bracketed IPv6 discovery address with an optional port.'
+ . ' Without a port, try 8009 then 4420.',
+ type => 'string',
+ format => 'pve-storage-nvme-portal',
+ },
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ portals => {
+ type => 'string',
+ description => 'The discovered TCP portals, comma separated.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+ my $res = PVE::NVMeOF::discover($param->{portal});
+ return [
+ map { {
+ subsysnqn => $_,
+ portals => join(',', map { PVE::NVMeOF::format_path($_) } $res->{$_}->@*),
+ } } sort keys %$res
+ ];
+ },
+});
+
__PACKAGE__->register_method({
name => 'lvmscan',
path => 'lvm',
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index c705835c..5cb18c32 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -5,11 +5,13 @@ use v5.36;
use Digest::SHA qw(sha1_hex);
use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
use File::Path qw(make_path);
+use JSON qw(decode_json);
use POSIX qw(ceil);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use Time::HiRes ();
use PVE::JSONSchema;
+use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
use PVE::Diskmanage;
@@ -303,4 +305,68 @@ sub connect_path($scfg, $path, $limit = undef) {
return $res;
}
+sub parse_discovery_log($raw) {
+ my $log = decode_json($raw);
+ die "invalid NVMe discovery log\n"
+ if ref($log) ne 'HASH' || ref($log->{records}) ne 'ARRAY';
+ my (%seen, %res);
+ for my $record ($log->{records}->@*) {
+ next
+ if ($record->{subtype} // '') ne 'nvme subsystem' || ($record->{trtype} // '') ne 'tcp';
+ # the log pads the address fields with spaces, which not every nvme-cli removes
+ my ($nqn_raw, $addr, $port) =
+ map { my $v = $_ // ''; $v =~ s/^\s+|\s+$//g; $v }
+ $record->@{qw(subnqn traddr trsvcid)};
+ my $nqn = subsystem_nqn($nqn_raw) // next;
+ my $path = parse_portal(($addr =~ /:/ ? "[$addr]" : $addr) . ":$port") // next;
+ next if $seen{$nqn}->{ format_path($path) }++;
+ push $res{$nqn}->@*, $path;
+ }
+ return \%res;
+}
+
+sub discover($portal) {
+ my $path = parse_portal($portal) // die "invalid portal '$portal'\n";
+ my @ports = $portal =~ /:[0-9]+$/ ? ($path->{trsvcid}) : (8009, 4420);
+ # a missing prerequisite fails on every port, so report it as it is
+ assert_support();
+ my $host = host_identity();
+ my $error;
+ for my $port (@ports) {
+ # keep the error of a port that answered rather than "no answer" from the other port
+ if (!PVE::Network::tcp_ping($path->{traddr}, $port, 2)) {
+ $error //= "no answer from portal\n";
+ next;
+ }
+ my $result = eval {
+ with_lock(sub {
+ my $out = '';
+ run_command(
+ [
+ $NVME,
+ 'discover',
+ '--transport=tcp',
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $port,
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--output-format=json',
+ ],
+ timeout => 30,
+ errmsg => 'nvme discover',
+ outfunc => sub($line) { $out .= "$line\n" },
+ );
+ return parse_discovery_log($out);
+ });
+ };
+ return $result if !$@;
+ $error = $@;
+ }
+ die "discovery at portal '$portal' failed - $error";
+}
+
1;
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
index 6fd37410..ef332633 100755
--- a/src/test/run_nvmeof_taint_tests.pl
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -40,6 +40,7 @@ $nvme->mock(
'all connect operands are validated and untainted',
);
PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ $opts{outfunc}->('{"records":[]}') if $opts{outfunc};
},
);
my $path = PVE::NVMeOF::parse_portal($portal);
@@ -55,6 +56,10 @@ for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.disc
eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
}
+my $net = Test::MockModule->new('PVE::Network');
+$net->mock(tcp_ping => sub { 1 });
+eval { PVE::NVMeOF::discover($portal) };
+is($@, '', 'discovery can execute with file-backed host identity in taint mode');
file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
eval { PVE::NVMeOF::host_identity() };
like($@, qr/nonzero UUID/, 'zero host ID refused');
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index 566b0402..a69f8b1b 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -5,6 +5,7 @@ use lib qw(..);
use Fcntl qw(:flock);
use File::Path qw(make_path remove_tree);
use File::Temp qw(tempdir);
+use JSON qw(encode_json);
use POSIX ();
use Test::MockModule;
use Test::More;
@@ -13,6 +14,7 @@ use Time::HiRes ();
use PVE::Tools qw(file_set_contents);
use PVE::API2::Storage::Config;
+use PVE::API2::Storage::Scan;
use PVE::NVMeOF;
use PVE::Storage;
@@ -567,4 +569,92 @@ subtest 'the connection check has a time limit too' => sub {
unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
};
+subtest 'TCP discovery, fallback and API result' => sub {
+ my $record = {
+ subtype => 'nvme subsystem',
+ trtype => 'tcp',
+ subnqn => 'nqn.test',
+ traddr => '192.0.2.1',
+ trsvcid => '4420',
+ };
+ my $raw = encode_json({
+ records =>
+ [$record, $record, { %$record, trtype => 'rdma' }, { %$record, trsvcid => 70000 }],
+ });
+ is_deeply(
+ PVE::NVMeOF::parse_discovery_log($raw),
+ { 'nqn.test' => [{ traddr => '192.0.2.1', trsvcid => 4420 }] },
+ 'TCP only, unique valid portals',
+ );
+ my $padded =
+ { %$record, traddr => '192.0.2.1' . (' ' x 10), trsvcid => '4420' . (' ' x 28) };
+ is_deeply(
+ PVE::NVMeOF::parse_discovery_log(encode_json({ records => [$padded] })),
+ { 'nqn.test' => [{ traddr => '192.0.2.1', trsvcid => 4420 }] },
+ 'padded address fields',
+ );
+ for my $bad ('garbage', '{}', '[]') {
+ eval { PVE::NVMeOF::parse_discovery_log($bad) };
+ ok($@, 'malformed discovery is not an empty success');
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my (@ports, @commands);
+ our $locked;
+ $nvme->mock(with_lock => sub { local $locked = 1; $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'id' } });
+ $net->mock(tcp_ping => sub { push @ports, $_[1]; $_[1] != 8009 });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'discovery holds the NVMe lock');
+ is($opts{timeout}, 30, 'discovery command timeout');
+ push @commands, $cmd;
+ $opts{outfunc}->($raw);
+ },
+ );
+ my $rows = PVE::API2::Storage::Scan->nvmeofscan({ node => 'n1', portal => '192.0.2.1' });
+ is_deeply(\@ports, [8009, 4420], 'unspecified port tries discovery then I/O port');
+ is_deeply($rows, [{ subsysnqn => 'nqn.test', portals => '192.0.2.1:4420' }], 'API shape');
+ eval {
+ PVE::JSONSchema::validate(
+ $rows,
+ PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns},
+ );
+ };
+ is($@, '', 'API schema accepts result');
+ @ports = ();
+ PVE::NVMeOF::discover('[2001:db8::1]:4421');
+ is_deeply(\@ports, [4421], 'explicit port does not fall back');
+ # the discovery port answers but refuses, the I/O port does not answer
+ $net->mock(tcp_ping => sub { $_[1] == 8009 });
+ $nvme->mock(run_command => sub { die "host not allowed\n" });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - host not allowed$/, 'the error of the answering port is kept');
+ $net->mock(tcp_ping => sub { $_[1] == 4420 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - host not allowed$/, 'also if the other port answers');
+ $net->mock(tcp_ping => sub { 0 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - no answer from portal$/, 'without any answer');
+ $nvme->mock(assert_support => sub { die "nvme-cli is not installed\n" });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ is($@, "nvme-cli is not installed\n", 'a missing prerequisite is reported as it is');
+ # nvme-cli itself writes its diagnostic to stderr and exits with an error
+ $nvme->unmock('run_command');
+ $nvme->mock(assert_support => sub { });
+ my $cli = "$dir/nvme-refusing";
+ file_set_contents($cli, "#!/bin/sh\necho 'host not allowed' >&2\nexit 1\n", 0755);
+ {
+ local $PVE::NVMeOF::NVME = $cli;
+ $net->mock(tcp_ping => sub { $_[1] == 8009 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like(
+ $@,
+ qr/failed - nvme discover: host not allowed$/,
+ 'with the diagnostic of nvme-cli',
+ );
+ }
+};
+
done_testing();
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
index faa29fc3..73938a7e 100755
--- a/src/test/run_san_api_tests.pl
+++ b/src/test/run_san_api_tests.pl
@@ -104,7 +104,7 @@ is_deeply(
);
is_deeply(
[map { $_->{method} } PVE::API2::Storage::Scan->index({ node => 'test' })->@*],
- [qw(cifs iscsi lvm lvmthin nfs pbs zfs)],
+ [qw(cifs iscsi lvm lvmthin nfs nvmeof pbs zfs)],
'scan index lists the discovery scans',
);
is_deeply(
^ permalink raw reply related [relevance 15%]
* [PATCH v4 storage 10/25] api: san luns: attribute NVMe namespaces to storage
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (5 preceding siblings ...)
2026-11-23 1:47 11% ` [PATCH v4 storage 09/25] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
@ 2026-11-23 1:47 20% ` Thomas Lamprecht
2026-11-23 1:47 17% ` [PATCH v4 storage 11/25] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
` (12 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
The SAN LUN inventory lists NVMe namespaces with their subsystem, but
without relation to an NVMe over Fabrics storage. Expect one path per
portal of the storage that connects the subsystem of a namespace, so
that a namespace with fewer paths shows as degraded.
A namespace counts as used by the LVM storage that has it as base
volume, else by the storage of its subsystem if that one serves the
namespaces as images.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/SAN/Node.pm | 9 ++++---
src/PVE/Storage/SAN.pm | 19 ++++++++++++--
src/test/run_san_lun_scan_tests.pl | 41 ++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/src/PVE/API2/SAN/Node.pm b/src/PVE/API2/SAN/Node.pm
index 08a7473b..4b96caf5 100644
--- a/src/PVE/API2/SAN/Node.pm
+++ b/src/PVE/API2/SAN/Node.pm
@@ -118,8 +118,9 @@ __PACKAGE__->register_method({
'paths-expected' => {
description => "The number of paths the LUN should have on this node: the"
. " highest of the count of its multipath entry and, for each managed"
- . " iSCSI storage of the LUN, the number of its portals. Absent if no"
- . " count is known.",
+ . " iSCSI storage of the LUN, the number of its portals. For a namespace"
+ . " of an NVMe over Fabrics storage, the number of its portals. Absent if"
+ . " no count is known.",
type => 'integer',
optional => 1,
},
@@ -198,8 +199,8 @@ __PACKAGE__->register_method({
},
'used-by-storage' => {
description => "The storage that uses the LUN: as its base volume or"
- . " through the volume group on it, or as an iSCSI storage that serves the"
- . " LUNs of its target as images.",
+ . " through the volume group on it, or as an iSCSI or NVMe over Fabrics"
+ . " storage that serves the LUNs of its target or subsystem as images.",
type => 'string',
optional => 1,
},
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index 53c24c9e..f0ca5aef 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -16,6 +16,7 @@ use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
use PVE::Multipath::Identity;
+use PVE::NVMeOF;
use PVE::Storage;
use PVE::Storage::LVMPlugin;
@@ -42,7 +43,9 @@ sub scan_luns($cfg) {
PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
- my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %targets, %paths, %unmapped);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %nvme_owner, %nvme_paths);
+ my (%targets, %paths);
+ my %unmapped;
my $wanted =
PVE::Multipath::Generator::wanted_wwids($mpcfg, PVE::INotify::nodename(), $derived);
@@ -58,6 +61,11 @@ sub scan_luns($cfg) {
if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
my $base = PVE::Multipath::parse_base_volume($scfg->{base});
$base_owner{ $base->{wwid} } //= $sid if $base;
+ next if $scfg->{type} ne 'nvmeof';
+ $nvme_owner{ $scfg->{subsysnqn} } //= $sid;
+ # only a storage in use on this node expects its paths here
+ my $here = !$scfg->{nodes} || $scfg->{nodes}->{ PVE::INotify::nodename() };
+ $nvme_paths{ $scfg->{subsysnqn} } //= $sid if $here && !$scfg->{disable};
}
my %rows;
@@ -102,6 +110,10 @@ sub scan_luns($cfg) {
$row->{'nvme-subsystem'} = $nqn;
my $nsid = file_read_firstline("/sys/block/$name/nsid");
$row->{'nvme-nsid'} = int($nsid) if defined($nsid) && $nsid =~ /^\d+$/;
+ if (my $sid = $nvme_paths{$nqn}) {
+ $row->{'paths-expected'} =
+ scalar(PVE::NVMeOF::storage_paths($cfg->{ids}->{$sid})->@*);
+ }
}
}
for my $key (qw(transport vendor model serial)) {
@@ -208,9 +220,12 @@ sub scan_luns($cfg) {
$row->{'paths-expected'},
);
}
+ my $nvme = $nvme_owner{ $row->{'nvme-subsystem'} // '' };
+ undef $nvme if $nvme && !PVE::Storage::san_storage_serves_images($cfg->{ids}->{$nvme});
my ($target) =
map { $target_owner{$_} // () } sort keys(($targets{ $row->{wwid} } // {})->%*);
- my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target;
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target
+ // $nvme;
$row->{'used-by-storage'} = $owner if defined($owner);
}
return [map { $rows{$_} } sort keys %rows];
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
index 7119c88a..7fd9563b 100755
--- a/src/test/run_san_lun_scan_tests.pl
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -329,6 +329,12 @@ is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id lin
$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
$scan->mock(file_read_firstline => sub { $_[0] =~ m{/nsid$} ? 1 : 'eui.0123456789abcdef' });
$disk->mock(read_subsysnqn => sub { 'nqn.test' });
+$cfg->{ids}->{fabric} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,192.0.2.2',
+ content => { images => 1 },
+};
$scan->unmock('stable_path');
$scan->mock(abs_path => sub { '/dev/nvme0n1' });
$rows = PVE::Storage::SAN::scan_luns($cfg);
@@ -346,6 +352,41 @@ eval { PVE::JSONSchema::validate($rows, $schema) };
is($@, '', 'native row matches the API schema');
is($rows->[0]->{'nvme-subsystem'}, 'nqn.test', 'subsystem NQN exposed');
is($rows->[0]->{'nvme-nsid'}, 1, 'namespace ID exposed');
+is($rows->[0]->{'used-by-storage'}, 'fabric', 'a storage serving the namespaces uses them');
+is($rows->[0]->{'paths-expected'}, 2, 'one expected path per configured portal');
+
+for my $count (1, 3) {
+ $config->mock(
+ read_config => sub { {
+ ids => { 'eui.0123456789abcdef' => { type => 'wwid', 'paths-expected' => $count } },
+ } },
+ );
+ my $entry = PVE::Storage::SAN::scan_luns($cfg);
+ is($entry->[0]->{'paths-expected'}, 2, "a multipath entry does not change it ($count)");
+}
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+{
+ local $cfg->{ids}->{fabric}->{content} = { none => 1 };
+ my $plain = PVE::Storage::SAN::scan_luns($cfg);
+ is($plain->[0]->{'used-by-storage'}, undef, 'a connection storage does not');
+ is($plain->[0]->{'paths-expected'}, 2, 'but still tells the expected paths');
+}
+{
+ local $cfg->{ids}->{fabric}->{disable} = 1;
+ my $disabled = PVE::Storage::SAN::scan_luns($cfg);
+ is($disabled->[0]->{'paths-expected'}, undef, 'a disabled storage expects no paths');
+ is($disabled->[0]->{'used-by-storage'}, 'fabric', 'but still uses the namespaces');
+}
+{
+ local $cfg->{ids}->{fabric}->{nodes} = { other => 1 };
+ my $elsewhere = PVE::Storage::SAN::scan_luns($cfg);
+ is($elsewhere->[0]->{'paths-expected'}, undef, 'nor a storage of other nodes');
+}
+for my $base (qw(fabric nvme-fabric)) {
+ $cfg->{ids}->{data}->{base} = "$base:nvme-eui.0123456789abcdef";
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is($rows->[0]->{'used-by-storage'}, 'data', "LVM base consumer takes precedence ($base)");
+}
$disk->mock(is_partition => sub { 1 });
ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
^ permalink raw reply related [relevance 20%]
* [PATCH v4 manager 25/25] d/control: bump versioned dependencies for NVMe over Fabrics
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (17 preceding siblings ...)
2026-11-23 1:48 13% ` [PATCH v4 manager 23/25] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
@ 2026-11-23 1:48 13% ` Thomas Lamprecht
2026-11-23 13:35 6% ` superseded: [PATCH v4 storage,docs,manager 00/25] NVMe over Fabrics storage Thomas Lamprecht
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:48 UTC (permalink / raw)
To: pve-devel
The web UI uses the node API below /nodes/{node}/san/nvmeof of
libpve-storage-perl 9.1.23, and its help links need the NVMe over
Fabrics chapter from pve-docs and pve-doc-generator 9.2.21.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
debian/control | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/debian/control b/debian/control
index 6e4e6aad8..5180893a8 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@ Build-Depends: debhelper-compat (= 13),
libpve-network-api-perl (>= 1.6.11),
libpve-notify-perl,
libpve-rs-perl (>= 0.16.4),
- libpve-storage-perl (>= 9.1.22),
+ libpve-storage-perl (>= 9.1.23),
libtemplate-perl,
libtest-mockmodule-perl,
lintian,
@@ -25,7 +25,7 @@ Build-Depends: debhelper-compat (= 13),
proxmox-widget-toolkit (>= 4.1.4),
pve-cluster (>= 9.1.13),
pve-container,
- pve-doc-generator (>= 9.2.16),
+ pve-doc-generator (>= 9.2.21),
qemu-server (>= 9.2.17),
sq,
unzip,
@@ -69,7 +69,7 @@ Depends: apt (>= 1.5~),
libpve-network-perl (>= 1.6.11),
libpve-notify-perl (>= 9.1.12),
libpve-rs-perl (>= 0.16.4),
- libpve-storage-perl (>= 9.1.22),
+ libpve-storage-perl (>= 9.1.23),
librados2-perl (>= 1.3-1),
libtemplate-perl,
liburi-perl,
@@ -88,7 +88,7 @@ Depends: apt (>= 1.5~),
proxmox-widget-toolkit (>= 5.2.18),
pve-cluster (>= 9.1.13),
pve-container (>= 6.1.25),
- pve-docs (>= 9.2.20),
+ pve-docs (>= 9.2.21),
pve-firewall,
pve-ha-manager (>= 5.2.7),
pve-i18n (>= 3.2.0~),
^ permalink raw reply related [relevance 13%]
* [PATCH v4 storage,docs,manager 00/25] NVMe over Fabrics storage
@ 2026-11-23 1:47 11% Thomas Lamprecht
2026-11-23 1:47 8% ` [PATCH v4 storage 01/25] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
` (19 more replies)
0 siblings, 20 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
A storage type for NVMe subsystems reached over TCP, on top of the
applied SAN series [0]: namespaces as base volumes of shared LVM, or
directly as raw VM disks, using the kernel's native NVMe multipath.
This is a deliberately small first version: TCP only, without
authentication or TLS, so access relies on the target's host NQN list
and a dedicated storage network. The plugin connects missing portals and
never disconnects controllers on config change or removal; disconnecting
a controller is an explicit per-node action. The kernel handles path
reconnection, and the SAN series provides LUN inventory, guided setup,
and pre-write guards.
Two operational prerequisites:
- Cloned nodes need distinct /etc/nvme/hostnqn and /etc/nvme/hostid
before connecting.
- All cluster nodes must be upgraded to pve-manager 9.2.38 before
adding the first nvmeof storage, as older nodes drop unknown storage
types when writing storage.cfg; creating the first one is refused
until all nodes are online on 9.2.38+.
What it adds:
- Storage type 'nvmeof' (subsysnqn + TCP portals, one storage per
subsystem, isolated properties, volumes as nvme-<wwid>,
ctrl_loss_tmo=-1, configurable fast-io-fail-tmo defaulting to 120s).
- Shared LVM support with nvmeof volumes as base, discovery via
/nodes/{node}/scan/nvmeof and 'pvesm scan nvmeof', and nvme-cli as a
Recommends of libpve-storage-perl.
- /nodes/{node}/san/nvmeof for host identity, controller listing, and
guarded per-controller disconnect (refused if a namespace in use or
referenced by a storage would lose its last usable path).
- Cluster-wide SAN status and pvestatd path notifications covering
nvmeof namespaces (without requiring multipathd), plus pvereport
output and documentation.
- Web UI: guided "Shared LVM on NVMe over Fabrics" setup, nvmeof
storage dialog with discovery, Node > SAN > NVMe over Fabrics
controller view, host NQN column, and native multipath state display.
Changes since v3 [1]:
- Cluster version & packaging: refuse adding the first nvmeof storage
until all nodes run pve-manager 9.2.38+, and add versioned package
relations assuming the next releases: libpve-storage-perl 9.1.23
(depending on libpve-common-perl 9.2.14 and breaking pve-manager <<
9.2.38), pve-docs 9.2.21, and pve-manager 9.2.38.
- Local disk & wipe isolation: omit TCP/RDMA namespaces from Node >
Disks and Ceph OSD selection (keeping NVMe/FC listed for local LVM
setup), and refuse local wipe on TCP/RDMA namespaces, their
partitions, and detached namespaces without a controller.
- Activation & config hardening: bound activation connect attempts
(~45s without a live controller, ~15s once one is live) and
check_connection (15s); fail activation when all controllers are
reconnecting; keep busy-lock waits out of cooldown while arming
cooldown on hanging connects; clear cooldown on portal edits; refuse
enabling direct image use while an LVM storage uses the subsystem as
base; reject ASCII control chars in NQNs; trim padded discovery
fields; preserve nvme-cli diagnostics on errors.
- Disconnect hardening: also check exclusive claims (e.g. mounts in
other mount namespaces) and non-multipath namespaces numbered after
the subsystem, tolerate brief openers (<1s, e.g. LVM scans), and
give disconnect a 300s lock budget for large subsystems.
- Reporting & notifications: notify on namespaces even without
multipathd; treat unreadable sysfs attributes as incomplete rather
than absent; track absence per source (maps vs namespaces) and label
namespaces as such.
- Web UI & docs: clear stale discovery state immediately when the
discovery portal changes, ignore leading/trailing spaces on typed
portals (also in the shared iSCSI setup), improve narrow-screen
layout of the controller view, refine wipe/edit wording, and update
the storage chapter and cluster API docs.
Tested on a six-node nested cluster against Linux nvmet and a NetApp
AFF A20 (two portals each): both guided setups, live migrations, single
and dual path cuts under write I/O with namespace notifications across
all nodes, restricted users, cluster-version refusal during upgrade,
local disk/wipe exclusions, and removal via wipe + Disconnect in the
web UI. Remaining edge cases (time limits, brief openers, detached
namespaces, multipathd-free notifications, etc.) are covered by unit
tests.
The ZFS-over-NVMe/TCP plugin on the list [2] ships its own initiator;
isolated properties prevent option clashes, and connect helpers can be
shared later. Leaving NVMe/FC partition wipes and Ceph OSDs on NVMe/FC
aligned with Fibre Channel LUNs is left for a SAN-wide follow-up.
[0]: https://lore.proxmox.com/pve-devel/20261119194655.3163258-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20261122012605.1848824-1-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20261005002609.571-1-joaquinvarela@neatech.ar/
pve-storage:
Thomas Lamprecht (14):
diskmanage: skip SMART queries for NVMe fabric namespaces
diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only
api: disks: refuse a local wipe of a network NVMe namespace
nvmeof: add a storage for NVMe over Fabrics subsystems
d/control: bump pve-common for plain parameter error names
api: config: check the cluster version before the first nvmeof storage
lvm: allow a volume group on an NVMe over Fabrics namespace
api: scan: add NVMe over Fabrics discovery
pvesm: add a scan command for NVMe over Fabrics
api: san luns: attribute NVMe namespaces to storage
api: add node-level NVMe over Fabrics status and controller removal
multipath: report the NVMe host NQN of each node
multipath: report NVMe over Fabrics namespaces in the cluster status
d/control: break pve-manager versions without namespace notifications
ApiChangeLog | 9 +-
debian/control | 5 +-
src/PVE/API2/Disks.pm | 14 +
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 200 ++++++
src/PVE/API2/SAN/Cluster.pm | 38 +-
src/PVE/API2/SAN/Node.pm | 17 +-
src/PVE/API2/Storage/Config.pm | 5 +
src/PVE/API2/Storage/Scan.pm | 49 ++
src/PVE/CLI/pvesm.pm | 13 +
src/PVE/Diskmanage.pm | 58 +-
src/PVE/Makefile | 1 +
src/PVE/Multipath/Status.pm | 72 +-
src/PVE/NVMeOF.pm | 514 +++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/LVMPlugin.pm | 3 +-
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 300 ++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 32 +-
src/test/Makefile | 6 +
src/test/disk_api_test.pm | 20 +-
.../multipath/disklist_expected.json | 16 -
.../nvme_smart/nvme0n1/device/transport | 1 +
src/test/disklist_test.pm | 104 ++-
src/test/run_multipath_api_tests.pl | 132 +++-
src/test/run_nvmeof_api_tests.pl | 222 ++++++
src/test/run_nvmeof_taint_tests.pl | 67 ++
src/test/run_nvmeof_tests.pl | 680 ++++++++++++++++++
src/test/run_san_api_tests.pl | 4 +-
src/test/run_san_lun_scan_tests.pl | 41 ++
src/test/run_san_nvme_tests.pl | 33 +
32 files changed, 2580 insertions(+), 82 deletions(-)
pve-docs:
Thomas Lamprecht (1):
storage: document NVMe over Fabrics storages
notifications.adoc | 5 +-
pve-gui.adoc | 12 ++-
pve-intro.adoc | 3 +-
pve-storage-lvm.adoc | 10 +-
pve-storage-multipath.adoc | 3 +-
pve-storage-nvmeof.adoc | 200 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 24 +++--
7 files changed, 236 insertions(+), 21 deletions(-)
pve-manager:
Thomas Lamprecht (10):
report: add the NVMe over Fabrics host NQN and subsystems
ui: storage: add NVMe over Fabrics storage
ui: lvm: offer NVMe over Fabrics storages as base storage
ui: storage: add a guided setup for shared LVM on NVMe over Fabrics
ui: node san: list NVMe over Fabrics controllers
ui: san: show the NVMe host NQN of each node
ui: san: show that a namespace uses native multipath
pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps
ui: storage: SAN setup: ignore spaces around a typed portal
d/control: bump versioned dependencies for NVMe over Fabrics
PVE/MultipathNotification.pm | 21 +-
PVE/Report.pm | 6 +
PVE/Service/pvestatd.pm | 16 +-
debian/control | 8 +-
test/MultipathNotification_test.pl | 28 ++-
www/manager6/Makefile | 4 +-
www/manager6/SANUtils.js | 7 +-
www/manager6/Utils.js | 7 +
www/manager6/dc/SAN.js | 49 +++-
www/manager6/dc/StorageView.js | 23 +-
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 170 +++++++++++++
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/LVMEdit.js | 12 +-
www/manager6/storage/NVMeOFEdit.js | 162 ++++++++++++
www/manager6/storage/wizard/LunSelect.js | 35 ++-
www/manager6/storage/wizard/NodeIdentities.js | 57 +++--
.../storage/wizard/{IScsi.js => Target.js} | 236 +++++++++++++-----
www/manager6/storage/wizard/Wizard.js | 62 +++--
www/manager6/window/SANLunState.js | 38 ++-
www/manager6/window/SANLunWipe.js | 24 +-
21 files changed, 792 insertions(+), 187 deletions(-)
^ permalink raw reply [relevance 11%]
* [PATCH v4 manager 18/25] ui: lvm: offer NVMe over Fabrics storages as base storage
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (12 preceding siblings ...)
2026-11-23 1:47 18% ` [PATCH v4 manager 17/25] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-23 1:47 20% ` Thomas Lamprecht
2026-11-23 1:47 19% ` [PATCH v4 manager 19/25] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
` (5 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
A namespace of an NVMe over Fabrics storage can hold the volume group
of an LVM storage like an iSCSI LUN, so list such storages in the base
storage selector as well and name the type of each.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/StorageView.js | 4 ++--
www/manager6/storage/LVMEdit.js | 12 ++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 6afea33ce..5f4f519be 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -250,9 +250,9 @@ Ext.define(
lvm: [
'local',
gettext(
- 'Use an existing volume group, or create one on a LUN of an iSCSI storage.',
+ 'Use an existing volume group, or create one on an iSCSI LUN or NVMe/TCP namespace.',
),
- 'san lun shared',
+ 'san lun shared nvme namespace',
],
lvmthin: ['local', gettext('Use an existing LVM thin pool.'), ''],
zfspool: ['local', gettext('Use an existing ZFS pool or dataset.'), 'zpool'],
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 688130b19..146dac12c 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -70,10 +70,13 @@ Ext.define('PVE.storage.BaseStorageSelector', {
let store = Ext.create('Ext.data.Store', {
autoLoad: {
addRecords: true,
- params: {
- type: 'iscsi',
- },
},
+ filters: [
+ {
+ filterFn: (rec) =>
+ !rec.get('storage') || ['iscsi', 'nvmeof'].includes(rec.get('type')),
+ },
+ ],
fields: [
'storage',
'type',
@@ -82,7 +85,8 @@ Ext.define('PVE.storage.BaseStorageSelector', {
name: 'text',
convert: function (value, record) {
if (record.data.storage) {
- return record.data.storage + ' (iSCSI)';
+ let type = PVE.Utils.format_storage_type(record.data.type);
+ return `${record.data.storage} (${type})`;
} else {
return me.existingGroupsText;
}
^ permalink raw reply related [relevance 20%]
* [PATCH v4 storage 12/25] multipath: report the NVMe host NQN of each node
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (7 preceding siblings ...)
2026-11-23 1:47 17% ` [PATCH v4 storage 11/25] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
@ 2026-11-23 1:47 10% ` Thomas Lamprecht
2026-11-23 1:47 17% ` [PATCH v4 storage 13/25] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
` (10 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
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');
^ permalink raw reply related [relevance 10%]
* [PATCH v4 storage 02/25] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
2026-11-23 1:47 8% ` [PATCH v4 storage 01/25] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
@ 2026-11-23 1:47 15% ` Thomas Lamprecht
2026-11-23 1:47 15% ` [PATCH v4 storage 04/25] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
` (17 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
The disk list for local disk setup leaves out iSCSI LUNs, which storages
connect for use on several nodes. Namespaces attached over TCP or RDMA
are the same kind of device, but were listed, so Node > Disks offered
them for a ZFS pool, a directory, a volume group or a Ceph OSD, while
other nodes could use the same namespace.
Leave them out unless the SAN inventory asks for them, so the SAN views
still show them, and also a namespace whose transport cannot be read,
like one whose last controller is gone. For a subsystem with controllers
of several transports, a fabric one counts, whatever their order. The
partitions go with their namespace, so the checks before local disk
setup refuse both as not a valid local disk, and removing a directory or
ZFS pool on one with the cleanup of its disks refuses as for an iSCSI
LUN. Namespaces attached over Fibre Channel stay listed, as Fibre
Channel LUNs do, since a volume group created under Node > Disks is how
these get a shared LVM storage.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 30 ++++--
.../multipath/disklist_expected.json | 16 ----
.../nvme_smart/nvme0n1/device/transport | 1 +
src/test/disklist_test.pm | 94 +++++++++++++++++--
4 files changed, 109 insertions(+), 32 deletions(-)
create mode 100644 src/test/disk_tests/nvme_smart/nvme0n1/device/transport
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index be3fb8fc..eb97eab7 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -555,23 +555,27 @@ sub read_subsysnqn {
}
# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
-# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+# its controller, or from the controllers of its subsystem for native NVMe multipath setups. Of
+# several transports, one over a fabric wins, independent of the order of the controllers.
sub get_nvme_transport {
my ($sysdir) = @_;
my $transport = file_read_firstline("$sysdir/device/transport");
return $transport if defined($transport);
+ my $found = {};
dir_glob_foreach(
"$sysdir/device",
'nvme\d+',
sub {
my ($controller) = @_;
- $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ my $value = file_read_firstline("$sysdir/device/$controller/transport");
+ $found->{$value} = 1 if defined($value);
},
);
- return $transport;
+ my ($first) = grep { $found->{$_} } (qw(tcp rdma fc), sort keys $found->%*);
+ return $first;
}
# SAS does not distinguish local from remote attachments, so it is not classified as remote.
@@ -614,7 +618,10 @@ sub mounted_paths {
sub get_disks {
my ($disks, $nosmart, $include_partitions, $san_inventory) = @_;
- # SAN inventory includes iSCSI session devices and skips usage probes that read devices.
+ # Only the SAN inventory includes iSCSI LUNs and NVMe namespaces attached over TCP or RDMA, or
+ # over an unknown transport, as storages connect them for use on several nodes. Fibre Channel
+ # devices stay listed, as local disk setup is how a volume group gets onto one. The SAN
+ # inventory skips usage probes that read devices.
my $disklist = {};
my $mounted = mounted_blockdevs();
@@ -679,15 +686,20 @@ sub get_disks {
return if !$san_inventory && is_iscsi_device($dev);
+ my $sysdir = "/sys/block/$dev";
+
+ my $nvme_transport;
+ if ($dev =~ m/^nvme/) {
+ $nvme_transport = get_nvme_transport($sysdir);
+ # like a namespace whose last controller is gone, which can be one over a network
+ return if !$san_inventory && !defined($nvme_transport);
+ }
+ return if !$san_inventory && ($nvme_transport // '') =~ /^(?:tcp|rdma)$/;
+
$udev_db //= get_udev_db() if ++$udev_queries > $udev_single;
my $data = get_udev_info("/sys/block/$dev", $udev_db) // return;
my $devpath = $data->{devpath};
- my $sysdir = "/sys/block/$dev";
-
- my $nvme_transport;
- $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
-
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
index ec442969..8098dd8d 100644
--- a/src/test/disk_tests/multipath/disklist_expected.json
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -87,21 +87,5 @@
"osdid-list": null,
"by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
"transport": "nvme-fc"
- },
- "nvme9n1": {
- "devpath": "/dev/nvme9n1",
- "size": 10737418240,
- "vendor": "FABVEND",
- "model": "FABRICS CTRL",
- "serial": "FAB1",
- "wwn": "uuid.10000000-0000-0000-0000-000000000001",
- "gpt": 0,
- "rpm": 0,
- "type": "nvme",
- "health": "UNKNOWN",
- "wearout": "N/A",
- "osdid": -1,
- "osdid-list": null,
- "transport": "nvme-tcp"
}
}
diff --git a/src/test/disk_tests/nvme_smart/nvme0n1/device/transport b/src/test/disk_tests/nvme_smart/nvme0n1/device/transport
new file mode 100644
index 00000000..30e0ba74
--- /dev/null
+++ b/src/test/disk_tests/nvme_smart/nvme0n1/device/transport
@@ -0,0 +1 @@
+pcie
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 38823f8b..fae8ce45 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -290,12 +290,63 @@ sub test_disk_list {
for my $transport (qw(tcp rdma fc pcie)) {
$smart_calls = 0;
$diskmanage_module->mock(get_nvme_transport => sub { $transport });
- PVE::Diskmanage::get_disks();
+ # with SMART, as the SAN inventory lists the namespaces of all transports
+ PVE::Diskmanage::get_disks(undef, 0, 0, 1);
$testcount++;
is($smart_calls, $transport eq 'pcie' ? 1 : 0, "SMART queries for $transport");
}
$diskmanage_module->unmock('get_smart_data');
- $diskmanage_module->unmock('get_nvme_transport');
+
+ for my $transport ('tcp', 'rdma', 'fc', 'pcie', undef) {
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ my $local = ($transport // '') =~ /^(?:fc|pcie)$/;
+ my $name = $transport // 'an unknown transport';
+ $testcount += 3;
+ is(
+ !!PVE::Diskmanage::get_disks()->{nvme0n1},
+ $local,
+ "disk list for local setup with $name",
+ );
+ ok(
+ PVE::Diskmanage::get_disks(undef, 1, 0, 1)->{nvme0n1},
+ "SAN inventory with $name",
+ );
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1') };
+ like(
+ $@,
+ $local ? qr/^$/ : qr/not a valid local disk/,
+ "local disk setup with $name",
+ );
+ }
+
+ $diskmanage_module->mock(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $sub) = @_;
+ return $sub->('nvme0n1p1') if $dir eq '/sys/block/nvme0n1';
+ return mocked_dir_glob_foreach(@_);
+ },
+ is_partition => sub { return $_[0] eq '/dev/nvme0n1p1' },
+ get_blockdev => sub { return '/dev/nvme0n1' },
+ );
+ for my $transport (qw(tcp rdma fc pcie)) {
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ my $local = $transport eq 'fc' || $transport eq 'pcie';
+ $testcount += 2;
+ is(
+ !!PVE::Diskmanage::get_disks(undef, 1, 1)->{nvme0n1p1},
+ $local,
+ "partition list for local setup with $transport",
+ );
+ # partitions have holders in these tests, so a listed one counts as used
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1p1') };
+ like(
+ $@,
+ $local ? qr/already in use/ : qr/not a valid local disk/,
+ "local disk setup on a partition with $transport",
+ );
+ }
+ $diskmanage_module->mock(dir_glob_foreach => \&mocked_dir_glob_foreach);
+ $diskmanage_module->unmock($_) for qw(is_partition get_blockdev get_nvme_transport);
}
if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
@@ -342,7 +393,8 @@ sub test_disk_list {
$udev_single_queries = 0;
my $listed = PVE::Diskmanage::get_disks();
$testcount++;
- is(scalar(keys %$listed), 6, 'all disks listed');
+ is(scalar(keys %$listed), 5,
+ 'all disks listed but the namespace attached over TCP');
$testcount++;
is(
$udev_single_queries,
@@ -350,8 +402,8 @@ sub test_disk_list {
'the database replaces the queries after the first disks',
);
- # six disks: 240 block devices are just enough to ask about each of them on its own
- for my $count (240, 239) {
+ # five disks: 200 block devices are just enough to ask about each of them on its own
+ for my $count (200, 199) {
$diskmanage_module->mock(
get_lsblk_info => sub {
return { map { ("/dev/dm-$_" => {}) } 1 .. $count };
@@ -363,10 +415,38 @@ sub test_disk_list {
$testcount++;
is(
$udev_single_queries,
- $count == 240 ? 6 : 5,
- "single queries for six disks among $count block devices",
+ $count == 200 ? 5 : 4,
+ "single queries for five disks among $count block devices",
);
}
+
+ my $san = PVE::Diskmanage::get_disks(undef, 1, 0, 1);
+ $testcount++;
+ is($san->{nvme9n1}->{transport}, 'nvme-tcp', 'SAN inventory lists it');
+
+ # a second controller of the subsystem over Fibre Channel, listed before or after
+ for my $order ([qw(nvme4 nvme5)], [qw(nvme5 nvme4)]) {
+ $diskmanage_module->mock(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $sub) = @_;
+ return mocked_dir_glob_foreach(@_)
+ if $dir ne '/sys/block/nvme9n1/device';
+ $sub->($_) for $order->@*;
+ },
+ file_read_firstline => sub {
+ return 'fc' if $_[0] eq '/sys/block/nvme9n1/device/nvme4/transport';
+ return mocked_file_read_firstline(@_);
+ },
+ );
+ $testcount++;
+ is(
+ PVE::Diskmanage::get_nvme_transport('/sys/block/nvme9n1'),
+ 'tcp',
+ "TCP wins over Fibre Channel listed as $order->[0], $order->[1]",
+ );
+ }
+ $diskmanage_module->mock(dir_glob_foreach => \&mocked_dir_glob_foreach);
+ $diskmanage_module->mock(file_read_firstline => \&mocked_file_read_firstline);
}
done_testing($testcount);
^ permalink raw reply related [relevance 15%]
* [PATCH v4 storage 14/25] d/control: break pve-manager versions without namespace notifications
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (9 preceding siblings ...)
2026-11-23 1:47 17% ` [PATCH v4 storage 13/25] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
@ 2026-11-23 1:47 5% ` Thomas Lamprecht
2026-11-23 1:47 19% ` [PATCH v4 docs 15/25] storage: document NVMe over Fabrics storages Thomas Lamprecht
` (8 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
The report of a node lists the namespaces of NVMe over Fabrics storages
and marks a report whose namespaces could not be listed. The pvestatd
of pve-manager before 9.2.38 does not know that mark, so it would take
such namespaces as gone and clear their alerts.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
debian/control | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/control b/debian/control
index 8acbeddf..9a460e4f 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Architecture: all
Breaks: libpve-guest-common-perl (<< 4.0-3),
libpve-http-server-perl (<< 4.0-3),
pve-container (<< 6.1.22),
- pve-manager (<< 9.2.36),
+ pve-manager (<< 9.2.38),
qemu-server (<< 9.2.17),
Depends: bzip2,
ceph-common (>= 12.2~),
^ permalink raw reply related [relevance 5%]
* [PATCH v4 storage 09/25] pvesm: add a scan command for NVMe over Fabrics
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (4 preceding siblings ...)
2026-11-23 1:47 15% ` [PATCH v4 storage 08/25] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
@ 2026-11-23 1:47 11% ` Thomas Lamprecht
2026-11-23 1:47 20% ` [PATCH v4 storage 10/25] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
` (13 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
Add 'pvesm scan nvmeof <portal>', which prints the subsystems a
portal offers to the node with their portals, like the iSCSI scan
prints targets. That gives the values for a new storage on the
command line, with the usual output formats for scripts.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/CLI/pvesm.pm | 13 +++++++++++++
src/test/run_nvmeof_tests.pl | 12 ++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 070c1596..05da60d8 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -737,6 +737,19 @@ our $cmddef = {
$print_api_result,
$PVE::RESTHandler::standard_output_options,
],
+ nvmeof => [
+ "PVE::API2::Storage::Scan",
+ 'nvmeofscan',
+ ['portal'],
+ { node => $nodename },
+ sub {
+ my ($data, $schema, $options) = @_;
+ PVE::CLIFormatter::print_api_result(
+ $data, $schema, [qw(subsysnqn portals)], $options,
+ );
+ },
+ $PVE::RESTHandler::standard_output_options,
+ ],
'san-luns' => [
"PVE::API2::SAN::Node",
'luns',
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index a69f8b1b..41755bb8 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -15,6 +15,7 @@ use PVE::Tools qw(file_set_contents);
use PVE::API2::Storage::Config;
use PVE::API2::Storage::Scan;
+use PVE::CLI::pvesm;
use PVE::NVMeOF;
use PVE::Storage;
@@ -655,6 +656,17 @@ subtest 'TCP discovery, fallback and API result' => sub {
'with the diagnostic of nvme-cli',
);
}
+ my $formatter = Test::MockModule->new('PVE::CLIFormatter');
+ my $schema = PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns};
+ $formatter->mock(
+ print_api_result => sub {
+ is($_[0], $rows, 'CLI forwards complete discovery rows');
+ is($_[1], $schema, 'CLI forwards discovery schema');
+ is($_[3]->{'output-format'}, 'json', 'CLI supports structured output');
+ },
+ );
+ $PVE::CLI::pvesm::cmddef->{scan}->{nvmeof}->[4]
+ ->($rows, $schema, { 'output-format' => 'json' });
};
done_testing();
^ permalink raw reply related [relevance 11%]
* [PATCH v4 storage 07/25] lvm: allow a volume group on an NVMe over Fabrics namespace
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-23 1:47 15% ` [PATCH v4 storage 04/25] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
@ 2026-11-23 1:47 16% ` Thomas Lamprecht
2026-11-23 1:47 15% ` [PATCH v4 storage 08/25] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
` (15 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
An LVM storage only accepts an iSCSI LUN as base volume. Accept a
namespace of an NVMe over Fabrics storage too. Adding such an LVM
storage connects the subsystem, waits for the namespace and creates
the volume group on it, and activating it on another node connects
that node first.
The creation treats the namespace like any SAN LUN: it takes the
cluster-wide lock of the LUN and refuses a namespace that another
storage references.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 3 +--
src/test/run_san_nvme_tests.pl | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index b759554c..224f1c68 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -1355,9 +1355,8 @@ sub on_add_hook {
my $basecfg = PVE::Storage::storage_config($cfg, $baseid, 1);
die "base storage ID '$baseid' does not exist\n" if !$basecfg;
- # we only support iscsi for now
die "unsupported base type '$basecfg->{type}'"
- if $basecfg->{type} ne 'iscsi';
+ if $basecfg->{type} ne 'iscsi' && $basecfg->{type} ne 'nvmeof';
# Managed multipath requires the coalesced map or a partition of it, never a transient
# single-path PV.
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 2a9a2121..15ede8be 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -142,4 +142,21 @@ is_deeply(
);
is_deeply(\@opens, [$link], 'VG creation holds the native by-id device');
+$cfg->{ids} = { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } };
+my @activation;
+$storage->mock(path => sub { $link });
+$storage->mock(activate_storage => sub { push @activation, 'storage' });
+$storage->mock(activate_volumes => sub { push @activation, 'volume' });
+$lvm->mock(
+ lvm_create_volume_group => sub {
+ is($_[0], $link, 'add hook passes native base');
+ is($_[3]->{exempt}, 'data', 'add hook exempts new storage');
+ },
+);
+PVE::Storage::LVMPlugin->on_add_hook(
+ 'data',
+ { base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'data', shared => 1 },
+);
+is_deeply(\@activation, ['storage', 'volume'], 'LVM activates the NVMe base before creation');
+
done_testing();
^ permalink raw reply related [relevance 16%]
* [PATCH v4 storage 01/25] diskmanage: skip SMART queries for NVMe fabric namespaces
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
@ 2026-11-23 1:47 8% ` Thomas Lamprecht
2026-11-23 1:47 15% ` [PATCH v4 storage 02/25] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only Thomas Lamprecht
` (18 subsequent siblings)
19 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-23 1:47 UTC (permalink / raw)
To: pve-devel
The disk list queries the SMART health of every disk. For an NVMe
namespace attached over TCP, RDMA or Fibre Channel, the query goes to
the target and can stall the listing while a path recovers. Skip it for
these transports, also for namespaces connected by hand. Local NVMe
drives are queried as before.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 4 +++-
src/test/disklist_test.pm | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 77f1a0ec..be3fb8fc 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -709,7 +709,9 @@ sub get_disks {
}
my ($health, $wearout) = ('UNKNOWN', 'N/A');
- if (!$nosmart) {
+ # SMART queries over fabrics can stall while a path recovers.
+ my $remote_nvme = ($nvme_transport // '') =~ /^(?:tcp|rdma|fc)$/;
+ if (!$nosmart && !$remote_nvme) {
eval {
my $smartdata = get_smart_data($devpath, !is_ssdlike($type));
$health = $smartdata->{health} if $smartdata->{health};
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index f79c59d3..38823f8b 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -284,6 +284,20 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if ($testcasedir eq 'nvme_smart') {
+ my $smart_calls;
+ $diskmanage_module->mock(get_smart_data => sub { $smart_calls++; return {} });
+ for my $transport (qw(tcp rdma fc pcie)) {
+ $smart_calls = 0;
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ PVE::Diskmanage::get_disks();
+ $testcount++;
+ is($smart_calls, $transport eq 'pcie' ? 1 : 0, "SMART queries for $transport");
+ }
+ $diskmanage_module->unmock('get_smart_data');
+ $diskmanage_module->unmock('get_nvme_transport');
+ }
+
if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
my $status = PVE::Multipath::path_status_by_wwid();
my $expected_status =
^ permalink raw reply related [relevance 8%]
* superseded: [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (15 preceding siblings ...)
2026-11-18 20:42 9% ` [PATCH v2 manager 17/17] ui: dc: san: show that a namespace uses native multipath Thomas Lamprecht
@ 2026-11-22 14:52 6% ` Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 14:52 UTC (permalink / raw)
To: pve-devel
Superseded-by: https://lore.proxmox.com/all/20261122012605.1848824-1-t.lamprecht@proxmox.com/
^ permalink raw reply [relevance 6%]
* [PATCH v3 manager 14/18] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (11 preceding siblings ...)
2026-11-22 1:25 20% ` [PATCH v3 manager 13/18] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
@ 2026-11-22 1:25 19% ` Thomas Lamprecht
2026-11-22 1:25 13% ` [PATCH v3 manager 15/18] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
` (3 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
Add a guided setup for shared LVM on a namespace of an NVMe over Fabrics
subsystem, with the same steps as for iSCSI. Datacenter > Storage > Add
and the SAN view list it next to the other setups. It connects to a
subsystem found at a discovery portal and shows the host NQNs of the
nodes for the access rules of the array.
The target step is shared with iSCSI, as only the storage type, its
scan and the node identities differ. A reused NVMe over Fabrics storage
keeps its I/O portals, which the step shows read-only. The portals that
the step suggests leave out the default I/O port of such a storage, so
that the discovery also tries the discovery port.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 2 +-
www/manager6/SANUtils.js | 2 +-
www/manager6/dc/SAN.js | 4 +-
www/manager6/dc/StorageView.js | 5 +
www/manager6/storage/wizard/LunSelect.js | 35 ++-
www/manager6/storage/wizard/NodeIdentities.js | 57 +++--
.../storage/wizard/{IScsi.js => Target.js} | 232 +++++++++++++-----
www/manager6/storage/wizard/Wizard.js | 60 +++--
www/manager6/window/SANLunState.js | 30 ++-
9 files changed, 298 insertions(+), 129 deletions(-)
rename www/manager6/storage/wizard/{IScsi.js => Target.js} (59%)
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index dddf17590..f2fc80279 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -393,7 +393,7 @@ JSSRC= \
storage/wizard/Wizard.js \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
- storage/wizard/IScsi.js \
+ storage/wizard/Target.js \
storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index ce63fbeda..d28285d22 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -237,7 +237,7 @@ Ext.define('PVE.SANUtils', {
},
openSetup: function (type, reloadCallback) {
- let wizard = type === 'fc' ? 'FibreChannel' : 'IScsi';
+ let wizard = { fc: 'FibreChannel', nvmeof: 'NVMeOF' }[type] ?? 'IScsi';
Ext.create(`PVE.storage.wizard.${wizard}`, { autoShow: true, reloadCallback });
},
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index eea8aea65..2f624cbd2 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -112,7 +112,7 @@ Ext.define('PVE.dc.SANView', {
autoShow: true,
});
let setupItem = (type) => ({
- text: type === 'fc' ? gettext('Fibre Channel') : 'iSCSI',
+ text: type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
iconCls: `fa fa-fw fa-${type === 'fc' ? 'plug' : 'building'}`,
disabled: !PVE.SANUtils.canSetup(type),
handler: () => PVE.SANUtils.openSetup(type, reload),
@@ -121,7 +121,7 @@ Ext.define('PVE.dc.SANView', {
{
text: gettext('Add Shared LVM'),
disabled: !PVE.SANUtils.canSetup('iscsi'),
- menu: [setupItem('iscsi'), setupItem('fc')],
+ menu: [setupItem('iscsi'), setupItem('fc'), setupItem('nvmeof')],
},
{
text: gettext('Multipath Overrides'),
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 5f4f519be..4182b4c12 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -201,6 +201,11 @@ Ext.define(
gettext('Set up shared LVM on a Fibre Channel LUN with multipath.'),
'san lun multipath lvm fc guided',
),
+ setup(
+ 'nvmeof',
+ gettext('Set up shared LVM on a namespace of an NVMe/TCP subsystem.'),
+ 'san nvme namespace lvm tcp guided',
+ ),
];
let types = {
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index 36a9a3804..7fd814bf0 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -30,10 +30,11 @@ Ext.define('PVE.storage.wizard.LunSelect', {
// The scan names one target per LUN, also for a LUN reached through several. The content
// listing has the LUNs of the connection, and a LUN that shows up later is listed once the
// scan names the target of the connection for it.
+ let targetKey = wizard.wizardType === 'nvmeof' ? 'nvme-subsystem' : 'iscsi-target';
let filter = {
id: 'connection',
filterFn: (rec) =>
- rec.get('iscsi-target') === connection.target ||
+ rec.get(targetKey) === connection.target ||
(me.connectionWwids ?? []).includes(rec.get('wwid')),
};
me.store.addFilter(filter);
@@ -45,7 +46,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
success: function (response) {
if (!me.destroyed) {
me.connectionWwids = response.result.data
- .map((entry) => entry.volid.match(/\.dm-uuid-mpath-(.+)$/)?.[1])
+ .map((entry) => entry.volid.match(/(?:\.dm-uuid-mpath-|:nvme-)(.+)$/)?.[1])
.filter(Boolean);
me.store.addFilter(filter);
}
@@ -74,7 +75,9 @@ Ext.define('PVE.storage.wizard.LunSelect', {
// the setup refuses a LUN with data, so do not offer one
let hasData = (row) => row.usage === 'lvm' || row.usage === 'other';
let blocked = (row) => inUse(row) || hasData(row);
- let noLunsText = gettext('No LUNs found. Check connections and array access.');
+ let noLunsText = me.nvme
+ ? gettext('No namespaces found. Check connections and array access.')
+ : gettext('No LUNs found. Check connections and array access.');
let updateSelection = function () {
let row = me.getSelection();
me.down('#selection').setValue(row && !blocked(row) ? row.wwid : '');
@@ -91,9 +94,13 @@ Ext.define('PVE.storage.wizard.LunSelect', {
xtype: 'component',
cls: 'pmx-hint',
margin: '0 0 10 0',
- html: gettext(
- 'LUNs with known data or users cannot be selected. To keep the volume group on a LUN, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a LUN, stop its users on all hosts and wipe it under Node > SAN first.',
- ),
+ html: me.nvme
+ ? gettext(
+ 'Namespaces with known data or users cannot be selected. To keep the volume group on a namespace, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a namespace, stop its users on all hosts and wipe it under Node > SAN first.',
+ )
+ : gettext(
+ 'LUNs with known data or users cannot be selected. To keep the volume group on a LUN, add it under Datacenter > Storage > Add > LVM instead. To discard the data of a LUN, stop its users on all hosts and wipe it under Node > SAN first.',
+ ),
},
...(me.rescanNote
? [
@@ -126,6 +133,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
renderer: Ext.htmlEncode,
},
{ text: 'LUN', dataIndex: 'iscsi-lun', width: 60 },
+ { text: 'NSID', dataIndex: 'nvme-nsid', width: 60 },
{
text: gettext('Model'),
dataIndex: 'model',
@@ -144,6 +152,8 @@ Ext.define('PVE.storage.wizard.LunSelect', {
dataIndex: 'multipath',
width: 170,
renderer: PVE.SANUtils.renderSanLunMultipath,
+ // native NVMe multipath needs no setup per namespace
+ hidden: me.nvme,
},
{
text: gettext('Used By'),
@@ -189,9 +199,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
searchchange: function (field, query) {
let grid = me.down('grid');
if (grid?.rendered) {
- grid.setEmptyText(
- query ? gettext('No LUNs match the search.') : noLunsText,
- );
+ let noMatch = me.nvme
+ ? gettext('No namespaces match the search.')
+ : gettext('No LUNs match the search.');
+ grid.setEmptyText(query ? noMatch : noLunsText);
}
},
},
@@ -206,8 +217,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let search = me.down('pveRecordSearchField');
me.on('activate', function () {
search.setTargetStore(me.store);
- if (me.up('window').wizardType === 'fc') {
- me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ let type = me.up('window').wizardType;
+ me.down('gridcolumn[dataIndex=iscsi-lun]').setHidden(type !== 'iscsi');
+ me.down('gridcolumn[dataIndex=nvme-nsid]').setHidden(type !== 'nvmeof');
+ if (type === 'fc') {
me.store.addFilter({
id: 'transport',
filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')),
diff --git a/www/manager6/storage/wizard/NodeIdentities.js b/www/manager6/storage/wizard/NodeIdentities.js
index 0a54f7ce1..36d37e164 100644
--- a/www/manager6/storage/wizard/NodeIdentities.js
+++ b/www/manager6/storage/wizard/NodeIdentities.js
@@ -1,32 +1,21 @@
Ext.define('pve-san-node-identity', {
extend: 'Ext.data.Model',
idProperty: 'node',
- fields: ['node', 'state', 'iscsi-initiator-name'],
+ fields: ['node', 'state', 'iscsi-initiator-name', 'nvme-host-nqn'],
});
-// The nodes with their initiator names, to allow them on the array, and to select the nodes that
-// use the target. The node serving the web UI sets up the volume group, so it stays selected.
+// The nodes with their iSCSI initiator names or NVMe host NQNs, to allow them on the array, and to
+// select the nodes that use the target. The node serving the web UI sets up the volume group, so it
+// stays selected.
Ext.define('PVE.storage.wizard.NodeIdentities', {
extend: 'Ext.grid.Panel',
xtype: 'pveStorageWizardNodeIdentities',
height: 220,
selModel: { selType: 'checkboxmodel', mode: 'SIMPLE' },
viewConfig: { enableTextSelection: true },
- columns: [
- { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
- {
- text: gettext('Multipath Setup'),
- dataIndex: 'state',
- width: 175,
- renderer: PVE.SANUtils.renderState,
- },
- {
- text: gettext('Initiator Name'),
- dataIndex: 'iscsi-initiator-name',
- flex: 1,
- renderer: Ext.htmlEncode,
- },
- ],
+
+ // the identity of a node that the array allows
+ identity: 'iscsi-initiator-name',
getSelectedNodes: function () {
return this.getSelection()
@@ -62,6 +51,24 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
initComponent: function () {
let me = this;
+ let nvme = me.identity === 'nvme-host-nqn';
+ me.columns = [
+ { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
+ {
+ text: gettext('Multipath Setup'),
+ dataIndex: 'state',
+ width: 175,
+ renderer: PVE.SANUtils.renderState,
+ // the state of multipathd, which native NVMe multipath does not use
+ hidden: nvme,
+ },
+ {
+ text: nvme ? gettext('Host NQN') : gettext('Initiator Name'),
+ dataIndex: me.identity,
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ];
me.rstore = Ext.create('Proxmox.data.UpdateStore', {
storeid: 'san-wizard-identities',
model: 'pve-san-node-identity',
@@ -90,19 +97,23 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
me.tbar = [
{
xtype: 'tbtext',
- text: gettext(
- 'Select the nodes that will use the target and allow their initiator names on the array.',
- ),
+ text: nvme
+ ? gettext(
+ 'Select the nodes that will use the subsystem and allow their host NQNs on the array.',
+ )
+ : gettext(
+ 'Select the nodes that will use the target and allow their initiator names on the array.',
+ ),
},
'->',
{
- text: gettext('Copy Initiator Names'),
+ text: nvme ? gettext('Copy Host NQNs') : gettext('Copy Initiator Names'),
iconCls: 'fa fa-clipboard',
handler: () =>
PVE.Utils.copyToClipboard(
me
.getSelection()
- .map((rec) => rec.get('iscsi-initiator-name'))
+ .map((rec) => rec.get(me.identity))
.filter(Boolean)
.join('\n'),
),
diff --git a/www/manager6/storage/wizard/IScsi.js b/www/manager6/storage/wizard/Target.js
similarity index 59%
rename from www/manager6/storage/wizard/IScsi.js
rename to www/manager6/storage/wizard/Target.js
index 9ef89caef..37e2111c3 100644
--- a/www/manager6/storage/wizard/IScsi.js
+++ b/www/manager6/storage/wizard/Target.js
@@ -1,16 +1,21 @@
-Ext.define('PVE.storage.wizard.IScsiTarget', {
+// The step of a guided setup that connects to the target of an iSCSI or the subsystem of an NVMe
+// over Fabrics array, through a storage of that type.
+Ext.define('PVE.storage.wizard.Target', {
extend: 'Proxmox.panel.InputPanel',
- xtype: 'pveStorageWizardIScsiTarget',
- onlineHelp: 'storage_open_iscsi',
+ xtype: 'pveStorageWizardTarget',
- // The iSCSI storage the target already has, which the setup uses instead of adding one.
+ storageType: 'iscsi',
+
+ // The storage the target already has, which the setup uses instead of adding one.
existingConnection: function () {
let me = this;
let target = me.down('field[name=target]').getValue();
- return me.storages?.find((entry) => entry.type === 'iscsi' && entry.target === target);
+ return me.storages?.find(
+ (entry) => entry.type === me.storageType && entry[me.targetKey] === target,
+ );
},
- // The ID of the iSCSI storage the setup adds, named after the storage on the LUN by default.
+ // The ID of the storage the setup adds, named after the storage on the LUN by default.
newConnectionId: function () {
let me = this;
let id = me.down('field[name=storage]').getValue();
@@ -21,8 +26,9 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
// step and Next both use it, so that the note does not promise what Next then refuses.
reuseConflict: function (selectedNodes) {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let target = me.down('field[name=target]').getValue();
- let users = (me.storages ?? []).filter((entry) => entry.target === target);
+ let users = (me.storages ?? []).filter((entry) => entry[me.targetKey] === target);
if (!users.length) {
return undefined;
}
@@ -30,30 +36,46 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
let format = (text, ...args) => Ext.String.format(text, ...args);
if (users.length !== 1) {
return format(
- gettext(
- 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
- ),
+ nvme
+ ? gettext(
+ 'Storages {0} use this subsystem. The setup can only reuse a subsystem that one storage uses.',
+ )
+ : gettext(
+ 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
+ ),
users.map((entry) => entry.storage).join(', '),
);
- } else if (base.type !== 'iscsi') {
+ } else if (base.type !== me.storageType) {
return format(
- gettext(
- 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses this subsystem. The setup can only reuse an NVMe over Fabrics storage.',
+ )
+ : gettext(
+ 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
+ ),
base.storage,
);
} else if (`${base.content ?? ''}` !== 'none') {
return format(
- gettext(
- 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses the namespaces of this subsystem directly. If no guest uses them, clear Use namespaces directly in its edit dialog, otherwise use another subsystem.',
+ )
+ : gettext(
+ 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
+ ),
base.storage,
);
} else if (base.disable) {
return format(
- gettext(
- 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" connects to this subsystem, but it is disabled. Enable that storage first.',
+ )
+ : gettext(
+ 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
+ ),
base.storage,
);
}
@@ -61,17 +83,17 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
if (baseNodes.length && !baseNodes.includes(Proxmox.NodeName)) {
return format(
gettext(
- 'iSCSI storage "{0}" is not available on node "{1}". Open the web UI on one of its nodes.',
+ 'Storage "{0}" is not available on node "{1}". Open the web UI on one of its nodes.',
),
base.storage,
Proxmox.NodeName,
);
} else if (baseNodes.length && selectedNodes.some((node) => !baseNodes.includes(node))) {
return format(
- gettext('iSCSI storage "{0}" is not available on all selected nodes.'),
+ gettext('Storage "{0}" is not available on all selected nodes.'),
base.storage,
);
- } else if (!base['managed-multipath']) {
+ } else if (!nvme && !base['managed-multipath']) {
return format(
gettext(
'Enable Multipath in the edit dialog of storage "{0}" before using it here.',
@@ -94,6 +116,14 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
field.setReadOnly(!!existing);
let id = me.down('field[name=storage]').getValue();
field.setEmptyText(id ? `${id}-base` : '');
+ // a reused storage keeps its own portals
+ let portals = me.down('field[name=portals]');
+ if (portals) {
+ if (existing) {
+ portals.setValue(existing.portals);
+ }
+ portals.setReadOnly(!!existing);
+ }
// the nodes of a storage that the setup uses are the default selection
let identities = me.down('pveStorageWizardNodeIdentities');
@@ -112,19 +142,32 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
note.setHidden(!conflict);
},
- // The portals of the enabled iSCSI storages, to discover the target of another LUN through one
- // of them.
+ // The portals of the enabled storages of the type, to discover the target of another LUN
+ // through one of them. An NVMe over Fabrics storage lists the I/O portals of its subsystem,
+ // whose default port would skip the discovery port 8009, so the suggestion leaves it out.
updatePortalSuggestions: function () {
let me = this;
let users = new Map();
- for (const { type, portal, storage, disable } of me.storages ?? []) {
- if (['iscsi', 'iscsidirect'].includes(type) && portal && !disable) {
- users.set(portal, [...(users.get(portal) ?? []), storage]);
+ for (const { type, portal, portals, storage, disable } of me.storages ?? []) {
+ let list = [];
+ if (disable) {
+ continue;
+ } else if (me.storageType === 'nvmeof' && type === 'nvmeof') {
+ // as the storage splits its list
+ list = `${portals ?? ''}`
+ .split(/[\s,;]+/)
+ .filter(Boolean)
+ .map((entry) => entry.replace(/:4420$/, ''));
+ } else if (me.storageType === 'iscsi' && ['iscsi', 'iscsidirect'].includes(type)) {
+ list = portal ? [portal] : [];
+ }
+ for (const entry of new Set(list)) {
+ users.set(entry, [...(users.get(entry) ?? []), storage]);
}
}
let suggestions = [...users.keys()]
.sort()
- .map((portal) => ({ portal, storages: users.get(portal).sort().join(', ') }));
+ .map((entry) => ({ portal: entry, storages: users.get(entry).sort().join(', ') }));
let field = me.down('field[name=portal]');
field.getStore().setData(suggestions);
field.setHideTrigger(!suggestions.length);
@@ -132,13 +175,16 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
onSubmit: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let wizard = me.up('window');
let values = me.getValues();
// a disabled target field counts as valid, while the portal waits for its discovery
let target = me.down('field[name=target]');
if (!values.target || target.discoveredPortal !== values.portal) {
wizard.showError(
- gettext('Select a target once the targets of this portal are listed.'),
+ nvme
+ ? gettext('Select a subsystem once the subsystems of this portal are listed.')
+ : gettext('Select a target once the targets of this portal are listed.'),
);
return;
}
@@ -180,9 +226,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
// the step showed which storage it reuses, if any, which must still hold
if (me.existingConnection()?.storage !== shown) {
wizard.showError(
- gettext(
- 'The iSCSI storage of this target changed in the meantime. Check this step, then retry.',
- ),
+ nvme
+ ? gettext(
+ 'The NVMe over Fabrics storage of this subsystem changed in the meantime. Check this step, then retry.',
+ )
+ : gettext(
+ 'The iSCSI storage of this target changed in the meantime. Check this step, then retry.',
+ ),
);
return;
}
@@ -210,25 +260,35 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
if (restricted.length) {
nodes = (selectedNodes.length ? selectedNodes : restricted).join(',');
}
- connected({ storage: base.storage, target: base.target, nodes });
+ connected({ storage: base.storage, target: base[me.targetKey], nodes });
return;
}
let params = {
- type: 'iscsi',
+ type: me.storageType,
storage: me.newConnectionId(),
- portal: values.portal,
- target: values.target,
content: 'none',
- 'managed-multipath': 1,
+ ...(nvme
+ ? // the storage configuration does not keep outer spaces, so neither may the
+ // copy that the cleanup compares
+ { subsysnqn: values.target, portals: values.portals.trim() }
+ : {
+ portal: values.portal,
+ target: values.target,
+ 'managed-multipath': 1,
+ }),
};
if (nodes) {
params.nodes = nodes;
}
if (params.storage === values.storage) {
wizard.showError(
- gettext(
- 'The storage for guest disks and the iSCSI storage need different IDs. Change the iSCSI Storage ID under Advanced.',
- ),
+ nvme
+ ? gettext(
+ 'The storage for guest disks and the NVMe over Fabrics storage need different IDs. Change the NVMe over Fabrics Storage ID under Advanced.',
+ )
+ : gettext(
+ 'The storage for guest disks and the iSCSI storage need different IDs. Change the iSCSI Storage ID under Advanced.',
+ ),
);
return;
}
@@ -236,9 +296,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
wizard.showError(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'The ID "{0}" for the iSCSI storage is already in use. Set another one under Advanced.',
- ),
+ nvme
+ ? gettext(
+ 'The ID "{0}" for the NVMe over Fabrics storage is already in use. Set another one under Advanced.',
+ )
+ : gettext(
+ 'The ID "{0}" for the iSCSI storage is already in use. Set another one under Advanced.',
+ ),
params.storage,
),
),
@@ -258,9 +322,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
initComponent: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
+ me.targetKey = nvme ? 'subsysnqn' : 'target';
+ me.onlineHelp = nvme ? 'storage_nvmeof' : 'storage_open_iscsi';
+ let targetLabel = nvme ? gettext('Subsystem') : gettext('Target');
let common = PVE.panel.StorageBase.commonFields(true);
// wide enough for the longest label of the step
- let labelWidth = 150;
+ let labelWidth = nvme ? 200 : 150;
let update = () => me.updateConnectionField();
let discovery = new Ext.util.DelayedTask(function () {
let portal = me.down('field[name=portal]').getValue();
@@ -285,7 +353,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
{
xtype: 'combobox',
name: 'portal',
- fieldLabel: gettext('Portal'),
+ fieldLabel: nvme ? gettext('Discovery Portal') : gettext('Portal'),
labelWidth,
allowBlank: false,
queryMode: 'local',
@@ -312,51 +380,83 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
let target = me.down('field[name=target]');
target.setValue('');
target.disable();
+ // and the I/O portals of its subsystem
+ me.down('field[name=portals]')?.setValue('');
discovery.delay(500);
},
},
},
{
- xtype: 'pveIScsiScan',
+ xtype: nvme ? 'pveNVMeOFScan' : 'pveIScsiScan',
name: 'target',
- fieldLabel: gettext('Target'),
+ fieldLabel: targetLabel,
labelWidth,
disabled: true,
showNodeSelector: false,
nodename: Proxmox.NodeName,
- listeners: { change: update },
+ listeners: {
+ change: function (field, value) {
+ // the I/O portals that the discovery reported for the subsystem
+ let rec =
+ nvme &&
+ field.getStore().findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ me.down('field[name=portals]').setValue(rec.get('portals'));
+ }
+ update();
+ },
+ },
listConfig: {
width: 650,
- emptyText: PVE.Utils.renderNotFound(gettext('iSCSI Target')),
+ emptyText: PVE.Utils.renderNotFound(
+ nvme ? gettext('Subsystem') : gettext('iSCSI Target'),
+ ),
columns: [
{
- text: gettext('Target'),
- dataIndex: 'target',
+ text: targetLabel,
+ dataIndex: me.targetKey,
flex: 1,
renderer: Ext.htmlEncode,
},
{
text: gettext('Portals'),
- dataIndex: 'portal',
+ dataIndex: nvme ? 'portals' : 'portal',
width: 220,
renderer: Ext.htmlEncode,
},
],
},
},
+ ...(nvme
+ ? [
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ labelWidth,
+ allowBlank: false,
+ },
+ ]
+ : []),
{
xtype: 'component',
itemId: 'connectionNote',
margin: '0 0 10 0',
hidden: true,
},
- { xtype: 'pveStorageWizardNodeIdentities', listeners: { nodeschange: update } },
+ {
+ xtype: 'pveStorageWizardNodeIdentities',
+ identity: nvme ? 'nvme-host-nqn' : 'iscsi-initiator-name',
+ listeners: { nodeschange: update },
+ },
];
me.advancedItems = [
{
...common.id,
name: 'connection',
- fieldLabel: gettext('iSCSI Storage ID'),
+ fieldLabel: nvme
+ ? gettext('NVMe over Fabrics Storage ID')
+ : gettext('iSCSI Storage ID'),
labelWidth,
allowBlank: true,
},
@@ -386,12 +486,15 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
});
+// Both add the LVM storage on a volume of the connection storage, which only differs in its name.
Ext.define('PVE.storage.wizard.IScsi', {
extend: 'PVE.storage.wizard.SAN',
wizardType: 'iscsi',
createStorage: function (values, lun) {
let me = this;
+ let nvme = me.wizardType === 'nvmeof';
+ let suffix = nvme ? `:nvme-${lun.wwid}` : `.dm-uuid-mpath-${lun.wwid}`;
let fail = (response) => me.showError(response.htmlStatus);
Proxmox.Utils.API2Request({
url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(me.connection.storage)}/content`,
@@ -403,14 +506,16 @@ Ext.define('PVE.storage.wizard.IScsi', {
if (me.destroyed) {
return;
}
- let volume = response.result.data.find((entry) =>
- entry.volid.endsWith(`.dm-uuid-mpath-${lun.wwid}`),
- );
+ let volume = response.result.data.find((entry) => entry.volid.endsWith(suffix));
if (!volume) {
me.showError(
- gettext(
- 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
- ),
+ nvme
+ ? gettext(
+ 'The selected namespace is not available yet. Check Node > SAN, then retry.',
+ )
+ : gettext(
+ 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
+ ),
);
return;
}
@@ -419,3 +524,8 @@ Ext.define('PVE.storage.wizard.IScsi', {
});
},
});
+
+Ext.define('PVE.storage.wizard.NVMeOF', {
+ extend: 'PVE.storage.wizard.IScsi',
+ wizardType: 'nvmeof',
+});
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index 97b1405f5..d86d1cddd 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -10,8 +10,8 @@ Ext.define('PVE.storage.wizard.SAN', {
type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
),
- // Removes the iSCSI storage that a closed setup added if it still has the settings of the
- // setup and no storage uses it, and calls done in any case.
+ // Removes the iSCSI or NVMe over Fabrics storage that a closed setup added if it still has
+ // the settings of the setup and no storage uses it, and calls done in any case.
removeAddedConnection: function (connection, done) {
let id = connection.storage;
// the storage list adds these to the configuration of a storage
@@ -29,7 +29,7 @@ Ext.define('PVE.storage.wizard.SAN', {
gettext('Error'),
Ext.htmlEncode(
Ext.String.format(
- gettext('Could not remove iSCSI storage "{0}" of the closed setup'),
+ gettext('Could not remove storage "{0}" of the closed setup'),
id,
),
) + `: ${response.htmlStatus}`,
@@ -45,7 +45,7 @@ Ext.define('PVE.storage.wizard.SAN', {
let own = storages.find((entry) => entry.storage === id);
let created = connection.created;
let unchanged =
- own?.type === 'iscsi' &&
+ own?.type === created.type &&
keys(own).join() === keys(created).join() &&
keys(own).every((key) => text(key, own[key]) === text(key, created[key]));
let used = storages.some((entry) => `${entry.base ?? ''}`.startsWith(`${id}:`));
@@ -169,7 +169,7 @@ Ext.define('PVE.storage.wizard.SAN', {
};
},
- // Removes an iSCSI storage that the setup added for a storage it did not add, then reloads.
+ // Removes a connection storage that the setup added for a storage it did not add, then reloads.
cleanUp: function () {
let me = this;
let done = () => me.reloadCallback?.();
@@ -225,6 +225,7 @@ Ext.define('PVE.storage.wizard.SAN', {
storage: values.storage,
nodes: params.nodes,
fc: me.wizardType === 'fc',
+ nvme: me.wizardType === 'nvmeof',
autoShow: true,
});
};
@@ -233,6 +234,9 @@ Ext.define('PVE.storage.wizard.SAN', {
multipathSummary: function (lun) {
let me = this;
+ if (me.wizardType === 'nvmeof') {
+ return PVE.SANUtils.multipathText('native');
+ }
// an explicit entry takes precedence, also for a LUN of the iSCSI storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
@@ -257,7 +261,9 @@ Ext.define('PVE.storage.wizard.SAN', {
...(connection
? [
[
- gettext('iSCSI Storage'),
+ me.wizardType === 'nvmeof'
+ ? gettext('NVMe over Fabrics Storage')
+ : gettext('iSCSI Storage'),
connection.created
? Ext.String.format(
gettext('{0}, added by this setup'),
@@ -302,10 +308,15 @@ Ext.define('PVE.storage.wizard.SAN', {
me.down('#action').setHtml(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- // TRANSLATORS: {0} is the label of the Finish button.
- '{0} creates the volume group "{1}" on this LUN and adds it as shared LVM storage "{2}".',
- ),
+ me.wizardType === 'nvmeof'
+ ? gettext(
+ // TRANSLATORS: {0} is the label of the Finish button.
+ '{0} creates the volume group "{1}" on this namespace and adds it as shared LVM storage "{2}".',
+ )
+ : gettext(
+ // TRANSLATORS: {0} is the label of the Finish button.
+ '{0} creates the volume group "{1}" on this LUN and adds it as shared LVM storage "{2}".',
+ ),
gettext('Finish'),
values.vgname,
values.storage,
@@ -350,10 +361,13 @@ Ext.define('PVE.storage.wizard.SAN', {
initComponent: function () {
let me = this;
- if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ if (!['iscsi', 'fc', 'nvmeof'].includes(me.wizardType)) {
throw 'no SAN storage type specified';
}
- let iscsi = me.wizardType === 'iscsi';
+ // the iSCSI and NVMe over Fabrics setups connect to the array with a storage first
+ let target = me.wizardType !== 'fc';
+ let nvme = me.wizardType === 'nvmeof';
+ let onlineHelp = nvme ? 'storage_nvmeof' : 'storage_multipath';
me.subject = PVE.storage.wizard.SAN.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
let common = PVE.panel.StorageBase.commonFields(true);
@@ -369,9 +383,9 @@ Ext.define('PVE.storage.wizard.SAN', {
let settings = {
xtype: 'inputpanel',
title: gettext('Storage'),
- onlineHelp: 'storage_multipath',
+ onlineHelp,
items: [
- ...(iscsi
+ ...(target
? []
: [
{
@@ -389,17 +403,18 @@ Ext.define('PVE.storage.wizard.SAN', {
],
advancedItems: [
vgname,
- ...(iscsi
+ ...(target
? []
: [{ ...common.nodes, validator: PVE.storage.wizard.SAN.validateNodes }]),
],
itemId: 'settings',
};
me.items = [
- ...(iscsi
+ ...(target
? [
{
- xtype: 'pveStorageWizardIScsiTarget',
+ xtype: 'pveStorageWizardTarget',
+ storageType: me.wizardType,
title: gettext('Target'),
itemId: 'target',
},
@@ -407,11 +422,12 @@ Ext.define('PVE.storage.wizard.SAN', {
: []),
{
xtype: 'pveStorageWizardLunSelect',
- title: 'LUN',
+ title: nvme ? gettext('Namespace') : 'LUN',
itemId: 'luns',
- onlineHelp: 'storage_multipath',
+ nvme,
+ onlineHelp,
// the nodes only see a newly mapped Fibre Channel LUN after a rescan
- rescanNote: iscsi
+ rescanNote: target
? undefined
: Ext.String.format(
gettext(
@@ -460,14 +476,14 @@ Ext.define('PVE.storage.wizard.SAN', {
me.down('#settings').on('activate', followId);
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (iscsi && tab === me.down('#luns')) {
+ if (target && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- if (iscsi) {
+ if (target) {
me.down('#submit').setText(gettext('Next'));
}
me.on('destroy', () => !me.writing && me.cleanUp());
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index d257e99ba..5dfce247a 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -20,8 +20,11 @@ Ext.define('PVE.window.SANLunState', {
if (!me.wwid) {
throw 'no LUN specified';
}
+ let title = me.nvme
+ ? gettext('Storage {0}: Namespace State')
+ : gettext('Storage {0}: LUN State');
me.title = me.storage
- ? Ext.String.format(gettext('Storage {0}: LUN State'), me.storage)
+ ? Ext.String.format(title, me.storage)
: Ext.String.format(
gettext('LUN {0}: Paths by Node'),
Ext.htmlEncode(me.name || me.wwid),
@@ -56,13 +59,17 @@ Ext.define('PVE.window.SANLunState', {
sortAfterUpdate: true,
});
let added = Ext.String.format(gettext('Storage "{0}" was added.'), me.storage);
- let missingAdvice = me.fc
+ let missingAdvice = me.nvme
? gettext(
- 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and zoning on the array, then rescan the Fibre Channel hosts on {0}.',
+ 'The namespace is missing on {0}, so guests on this storage cannot run there. Check the host access to the subsystem on the array.',
)
- : gettext(
- 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and initiator access on the array.',
- );
+ : me.fc
+ ? gettext(
+ 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and zoning on the array, then rescan the Fibre Channel hosts on {0}.',
+ )
+ : gettext(
+ 'The LUN is missing on {0}, so guests on this storage cannot run there. Check the LUN mapping and initiator access on the array.',
+ );
let updateAdvice = function () {
if (me.destroyed || !me.storage) {
return;
@@ -79,7 +86,12 @@ Ext.define('PVE.window.SANLunState', {
let text = [
added,
waiting &&
- Ext.String.format(gettext('Waiting for a LUN report from: {0}.'), waiting),
+ Ext.String.format(
+ me.nvme
+ ? gettext('Waiting for a namespace report from: {0}.')
+ : gettext('Waiting for a LUN report from: {0}.'),
+ waiting,
+ ),
missing && Ext.String.format(missingAdvice, missing),
];
me.down('#advice').setHtml(Ext.htmlEncode(text.filter(Boolean).join(' ')));
@@ -97,7 +109,9 @@ Ext.define('PVE.window.SANLunState', {
flex: 1,
store,
disableSelection: true,
- emptyText: gettext('No node reported this LUN yet.'),
+ emptyText: me.nvme
+ ? gettext('No node reported this namespace yet.')
+ : gettext('No node reported this LUN yet.'),
columns: [
{
text: gettext('Node'),
^ permalink raw reply related [relevance 19%]
* [PATCH v3 storage 02/18] nvmeof: add a storage for NVMe over Fabrics subsystems
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
2026-11-22 1:25 8% ` [PATCH v3 storage 01/18] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
@ 2026-11-22 1:25 16% ` Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 03/18] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
` (14 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
NVMe/TCP namespaces need a manual nvme-cli setup on every node so far.
Add a storage type that connects one subsystem through each configured
portal and offers its namespaces as raw volumes. Native NVMe multipath
joins the paths and the kernel reconnects lost ones. Only one storage
may use a subsystem, as the LUN list, the controller list and the node
status attribute a subsystem to one storage.
The activation fails if no usable path exists after connecting the
missing portals, so that adding a storage tells why. As adding a
storage holds the lock of the configuration, it tries no further portal
after 15 seconds once a controller is live, and leaves the rest to the
next activation. A portal that failed is retried after a minute, and
adding a storage forgets those failures. Disk setup refuses namespaces
attached over a fabric, as for iSCSI LUNs, and nvme-cli is only
recommended, as no other storage type needs it.
The plugin isolates its properties, so names like 'portals' belong to
this storage type alone, and a third-party plugin that declares one of
them is still loaded. As the first in-tree plugin that isolates, it
makes the storage API check the parameters for adding and updating a
storage of any type against the options of that type alone. A
third-party plugin then has to list the sensitive properties it uses in
options(), as the API change log says.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
ApiChangeLog | 9 +-
debian/control | 1 +
src/PVE/Diskmanage.pm | 7 +-
src/PVE/Makefile | 1 +
src/PVE/NVMeOF.pm | 271 ++++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 266 +++++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 13 +
src/test/Makefile | 5 +
src/test/run_nvmeof_taint_tests.pl | 62 ++++
src/test/run_nvmeof_tests.pl | 446 +++++++++++++++++++++++++++++
src/test/run_san_nvme_tests.pl | 16 ++
14 files changed, 1096 insertions(+), 6 deletions(-)
create mode 100644 src/PVE/NVMeOF.pm
create mode 100644 src/PVE/Storage/NVMeOFPlugin.pm
create mode 100755 src/test/run_nvmeof_taint_tests.pl
create mode 100755 src/test/run_nvmeof_tests.pl
diff --git a/ApiChangeLog b/ApiChangeLog
index a51578a1..1816e18a 100644
--- a/ApiChangeLog
+++ b/ApiChangeLog
@@ -101,10 +101,11 @@ Future changes should be documented in here.
declares a property of that name is then not loaded until it renames it, so prefer names that
are specific to the plugin, for example prefixed with its type.
- As soon as one such plugin is installed, the API checks the parameters for adding and updating a
- storage against the options of its type alone, for all storage types. So every plugin has to
- list the sensitive properties that it uses in `options()`.
- Set 'sensitive-properties' in such a plugin, even if empty. Without it, the fallback list of
+ Since the in-tree 'nvmeof' plugin isolates its properties, the API checks the parameters for
+ adding and updating a storage against the options of its type alone, for all storage types,
+ also for plugins of older API versions. So every plugin has to list the sensitive properties
+ that it uses in `options()`.
+ Set 'sensitive-properties' in an isolating plugin, even if empty. Without it, the fallback list of
version 11 also applies to the plugin's own properties of these names.
* Pass the guest identity to backup providers
diff --git a/debian/control b/debian/control
index fdcf8117..b5c2f529 100644
--- a/debian/control
+++ b/debian/control
@@ -55,6 +55,7 @@ Depends: bzip2,
${misc:Depends},
${perl:Depends},
Recommends: multipath-tools,
+ nvme-cli,
pve-esxi-import-tools (>= 0.6.0),
skopeo,
zfsutils-linux (>= 2.4.1-pve2),
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index be3fb8fc..21857dc6 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -107,7 +107,12 @@ sub disk_is_used {
my $disklist = get_disks($dev, 1, 1);
- die "'$disk' is not a valid local disk\n" if !defined($disklist->{$dev});
+ my $entry = $disklist->{$dev};
+ die "'$disk' is not a valid local disk\n" if !defined($entry);
+ # a partition has the transport of its disk
+ my ($parent) = ($entry->{parent} // '') =~ m!^/dev/(.+)$!;
+ my $transport = (defined($parent) ? $disklist->{$parent} : $entry)->{transport} // '';
+ die "'$disk' is not a valid local disk\n" if $transport =~ /^nvme-(?:tcp|rdma|fc)$/;
return 1 if $disklist->{$dev}->{used};
return 0;
diff --git a/src/PVE/Makefile b/src/PVE/Makefile
index 13fecbf8..238eefd4 100644
--- a/src/PVE/Makefile
+++ b/src/PVE/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Storage.pm ${DESTDIR}${PERLDIR}/PVE/Storage.pm
install -D -m 0644 Diskmanage.pm ${DESTDIR}${PERLDIR}/PVE/Diskmanage.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/NVMeOF.pm
install -D -m 0644 ISCSI/Topology.pm ${DESTDIR}${PERLDIR}/PVE/ISCSI/Topology.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/Multipath.pm
install -D -m 0644 Multipath/Config.pm ${DESTDIR}${PERLDIR}/PVE/Multipath/Config.pm
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
new file mode 100644
index 00000000..45b3acfc
--- /dev/null
+++ b/src/PVE/NVMeOF.pm
@@ -0,0 +1,271 @@
+package PVE::NVMeOF;
+
+use v5.36;
+
+use Digest::SHA qw(sha1_hex);
+use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
+use File::Path qw(make_path);
+use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
+use Time::HiRes ();
+
+use PVE::JSONSchema;
+use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
+
+use PVE::Diskmanage;
+
+our $NVME = '/usr/sbin/nvme';
+our $SYSFS = '/sys';
+our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
+our $HOSTID_FILE = '/etc/nvme/hostid';
+our $RUN_DIR = '/run/pve/nvmeof';
+our $LOCK_WAIT = 10;
+our $NQN_PATTERN = 'nqn\.[^\s,=]+';
+our $DISCOVERY_NQN = 'nqn.2014-08.org.nvmexpress.discovery';
+
+sub canonical_address($addr) {
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ return inet_ntop(AF_INET, $packed);
+ }
+ if (defined(my $packed = inet_pton(AF_INET6, $addr))) {
+ return inet_ntop(AF_INET, substr($packed, 12))
+ if substr($packed, 0, 12) eq ("\0" x 10) . "\xff\xff";
+ return inet_ntop(AF_INET6, $packed);
+ }
+ return lc($addr);
+}
+
+# Link-local IPv6 needs a node-specific interface and cannot identify a shared configured portal.
+sub parse_portal($portal) {
+ my ($addr, $port);
+ if ($portal =~ m/^\[([0-9a-fA-F:.]+)\](?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } elsif ($portal =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } else {
+ return undef;
+ }
+ return undef if defined($port) && ($port < 1 || $port > 65535);
+ $addr = canonical_address($addr);
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ my $multicast = (unpack('C', $packed) & 0xf0) == 0xe0;
+ return undef if $addr eq '0.0.0.0' || $addr eq '255.255.255.255' || $multicast;
+ } elsif (defined($packed = inet_pton(AF_INET6, $addr))) {
+ my $prefix = unpack('n', $packed);
+ return undef
+ if $addr eq '::' || ($prefix & 0xffc0) == 0xfe80 || ($prefix & 0xff00) == 0xff00;
+ } else {
+ return undef;
+ }
+ return { traddr => $addr, trsvcid => int($port // 4420) };
+}
+
+PVE::JSONSchema::register_format(
+ 'pve-storage-nvme-portal',
+ sub($portal, $noerr = undef) {
+ return $portal if parse_portal($portal);
+ return undef if $noerr;
+ die "value is not an IPv4 address or a bracketed IPv6 address with optional port\n";
+ },
+);
+
+sub format_path($path) {
+ # an IPv6 address, not the address of a Fibre Channel port, which has a colon too
+ my $ipv6 = $path->{traddr} =~ /:/ && $path->{traddr} =~ /^[0-9a-fA-F:.]+$/;
+ my $addr = $ipv6 ? "[$path->{traddr}]" : $path->{traddr};
+ return defined($path->{trsvcid}) ? "$addr:$path->{trsvcid}" : $addr;
+}
+
+sub storage_paths($scfg) {
+ return [map { parse_portal($_) // die "invalid portal '$_'\n" }
+ PVE::Tools::split_list($scfg->{portals})];
+}
+
+sub host_identity() {
+ my ($nqn) = (file_read_firstline($HOSTNQN_FILE) // '') =~ /\A($NQN_PATTERN)\z/;
+ my ($id) = (file_read_firstline($HOSTID_FILE) // '') =~
+ /\A([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\z/i;
+ if (!defined($nqn) || length($nqn) > 223) {
+ die "invalid or missing NVMe host NQN in '$HOSTNQN_FILE' - install nvme-cli and check the"
+ . " host identity\n";
+ }
+ die "invalid or missing NVMe host ID in '$HOSTID_FILE' - expected a nonzero UUID\n"
+ if !defined($id) || $id =~ /^[0-]+$/;
+ return { nqn => $nqn, id => lc($id) };
+}
+
+sub is_supported() { return -x $NVME ? 1 : 0 }
+
+sub assert_support() {
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command(['modprobe', 'nvme-tcp'], timeout => 10)
+ if !-e "$SYSFS/module/nvme_tcp";
+ my $multipath = file_read_firstline("$SYSFS/module/nvme_core/parameters/multipath") // '';
+ die "native NVMe multipath is disabled - enable nvme_core.multipath\n" if $multipath ne 'Y';
+}
+
+sub controllers() {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-fabrics/ctl";
+ dir_glob_foreach(
+ $dir,
+ 'nvme[0-9]+',
+ sub($name, @) {
+ my $address = file_read_firstline("$dir/$name/address") // return;
+ my %address = map { split(/=/, $_, 2) } grep { /=/ } split(/,/, $address);
+ return if !defined($address{traddr});
+ $res->{$name} = {
+ transport => file_read_firstline("$dir/$name/transport") // '',
+ subsystem => PVE::Diskmanage::read_subsysnqn("$dir/$name/subsysnqn") // '',
+ state => file_read_firstline("$dir/$name/state") // 'unknown',
+ traddr => canonical_address($address{traddr}),
+ trsvcid => $address{trsvcid},
+ };
+ },
+ );
+ return $res;
+}
+
+sub subsystem_controllers($subsystem) {
+ my $controllers = controllers();
+ return {
+ map { $_ => $controllers->{$_} } grep {
+ $controllers->{$_}->{subsystem} eq $subsystem
+ && $controllers->{$_}->{transport} eq 'tcp'
+ } keys %$controllers
+ };
+}
+
+# The NQN of a subsystem, untainted, or undef if it is invalid or the one of the discovery service.
+sub subsystem_nqn($nqn) {
+ my ($res) = ($nqn // '') =~ /\A($NQN_PATTERN)\z/;
+ return undef if !defined($res) || length($res) > 223 || $res eq $DISCOVERY_NQN;
+ return $res;
+}
+
+sub namespace_wwid($dev) {
+ return file_read_firstline("$SYSFS/block/$dev/wwid");
+}
+
+sub has_live_controller($controllers) {
+ return scalar(grep { $_->{state} eq 'live' } values %$controllers);
+}
+
+sub path_controller($controllers, $path) {
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ if ($ctrl->{traddr} eq $path->{traddr} && ($ctrl->{trsvcid} // '') eq $path->{trsvcid}) {
+ return $name;
+ }
+ }
+ return undef;
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-subsystem";
+ dir_glob_foreach(
+ $dir,
+ 'nvme-subsys[0-9]+',
+ sub($subsys, @) {
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn") // return;
+ return if $nqn ne $subsystem;
+ dir_glob_foreach(
+ "$dir/$subsys",
+ 'nvme[0-9]+n[0-9]+',
+ sub($dev, @) {
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid") // return;
+ my $size = file_read_firstline("$SYSFS/block/$dev/size") // return;
+ $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
+ },
+ );
+ },
+ );
+ return $res;
+}
+
+sub with_lock($code) {
+ my ($res, $timeout) = PVE::Tools::run_fork_with_timeout(
+ $LOCK_WAIT + 35,
+ sub {
+ make_path($RUN_DIR);
+ open(my $lock, '>>', "$RUN_DIR/fabrics.lock") or die "cannot open NVMe lock - $!\n";
+ # a busy lock fails a connect and arms the cooldown of its portal, so wait a while
+ my $deadline = Time::HiRes::time() + $LOCK_WAIT;
+ while (!flock($lock, LOCK_EX | LOCK_NB)) {
+ die "NVMe over Fabrics is busy - another operation is still running\n"
+ if Time::HiRes::time() >= $deadline;
+ Time::HiRes::usleep(100_000);
+ }
+ # Commands inherit the lock, so that it stays held until they exit, even if the caller
+ # timed out while one was stuck in the kernel.
+ my $flags = fcntl($lock, F_GETFD, 0) // die "cannot read NVMe lock flags - $!\n";
+ fcntl($lock, F_SETFD, $flags & ~FD_CLOEXEC)
+ or die "cannot inherit NVMe lock - $!\n";
+ return $code->();
+ },
+ );
+ die "NVMe over Fabrics operation timed out - it may still be running\n" if $timeout;
+ return $res;
+}
+
+my sub retry_file($scfg, $path) {
+ my ($key) =
+ sha1_hex(join(
+ "\0", $scfg->{subsysnqn}, format_path($path), $scfg->{'fast-io-fail-tmo'} // 120)) =~
+ /\A([0-9a-f]{40})\z/;
+ return "$RUN_DIR/retry/$key";
+}
+
+sub in_cooldown($scfg, $path) {
+ my $mtime = (stat(retry_file($scfg, $path)))[9] // return 0;
+ my $age = time() - $mtime;
+ return $age > -60 && $age < 60;
+}
+
+sub note_connect_failure($scfg, $path) {
+ make_path("$RUN_DIR/retry");
+ file_set_contents(retry_file($scfg, $path), '');
+}
+
+sub clear_connect_failures($scfg) {
+ unlink(retry_file($scfg, $_)) for storage_paths($scfg)->@*;
+}
+
+sub connect_path($scfg, $path) {
+ my $nqn = subsystem_nqn($scfg->{subsysnqn}) // die "invalid subsystem NQN\n";
+ my ($fail) = ($scfg->{'fast-io-fail-tmo'} // 120) =~ /\A(-?[0-9]+)\z/;
+ die "invalid fast I/O fail timeout\n" if !defined($fail) || $fail < -1;
+ return with_lock(sub {
+ return if path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ assert_support();
+ my $host = host_identity();
+ run_command(
+ [
+ $NVME,
+ 'connect',
+ '--transport=tcp',
+ '--nqn',
+ $nqn,
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $path->{trsvcid},
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--ctrl-loss-tmo=-1',
+ '--fast_io_fail_tmo',
+ $fail,
+ ],
+ timeout => 30,
+ );
+ # nvme-cli can exit successfully without having connected
+ die "no controller appeared\n"
+ if !path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ unlink(retry_file($scfg, $path));
+ return;
+ });
+}
+
+1;
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index c640cd8e..c77a6755 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -33,6 +33,7 @@ use PVE::Storage::LvmThinPlugin;
use PVE::Storage::NFSPlugin;
use PVE::Storage::CIFSPlugin;
use PVE::Storage::ISCSIPlugin;
+use PVE::Storage::NVMeOFPlugin;
use PVE::Storage::RBDPlugin;
use PVE::Storage::CephFSPlugin;
use PVE::Storage::ISCSIDirectPlugin;
@@ -58,6 +59,7 @@ PVE::Storage::LvmThinPlugin->register();
PVE::Storage::NFSPlugin->register();
PVE::Storage::CIFSPlugin->register();
PVE::Storage::ISCSIPlugin->register();
+PVE::Storage::NVMeOFPlugin->register();
PVE::Storage::RBDPlugin->register();
PVE::Storage::CephFSPlugin->register();
PVE::Storage::ISCSIDirectPlugin->register();
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a2df83c0..7f2ff6c8 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -6,6 +6,7 @@ SOURCES= \
NFSPlugin.pm \
CIFSPlugin.pm \
ISCSIPlugin.pm \
+ NVMeOFPlugin.pm \
CephFSPlugin.pm \
RBDPlugin.pm \
ISCSIDirectPlugin.pm \
diff --git a/src/PVE/Storage/NVMeOFPlugin.pm b/src/PVE/Storage/NVMeOFPlugin.pm
new file mode 100644
index 00000000..76f73af0
--- /dev/null
+++ b/src/PVE/Storage/NVMeOFPlugin.pm
@@ -0,0 +1,266 @@
+package PVE::Storage::NVMeOFPlugin;
+
+use v5.36;
+
+use Cwd ();
+use Time::HiRes ();
+
+use PVE::Network;
+
+use PVE::Diskmanage;
+use PVE::NVMeOF;
+use PVE::Storage::Plugin;
+
+use base qw(PVE::Storage::Plugin);
+
+# Adding a storage activates it under the lock of the storage configuration, so once a controller
+# is live, no further portal is tried after this many seconds. Later activations connect the rest.
+our $ACTIVATION_BUDGET = 15;
+
+sub type { return 'nvmeof' }
+
+sub plugindata {
+ return {
+ content => [{ images => 1, 'vm-vol' => 1, none => 1 }, { images => 1 }],
+ select_existing => 1,
+ 'isolate-properties' => 1,
+ 'advanced-properties' => {
+ 'fast-io-fail-tmo' => 1,
+ },
+ 'hidden-properties' => {
+ bwlimit => 1,
+ },
+ 'sensitive-properties' => {},
+ };
+}
+
+sub properties {
+ return {
+ subsysnqn => {
+ title => "Subsystem",
+ description => 'The NQN of the NVMe subsystem.',
+ type => 'string',
+ pattern => $PVE::NVMeOF::NQN_PATTERN,
+ maxLength => 223,
+ },
+ portals => {
+ title => "Portals",
+ description =>
+ 'TCP portals of the NVMe subsystem, as IPv4 or bracketed IPv6 addresses'
+ . ' with an optional port (default 4420).',
+ type => 'string',
+ format => 'pve-storage-nvme-portal-list',
+ },
+ 'fast-io-fail-tmo' => {
+ title => "Fail I/O After (s)",
+ description => 'Seconds before I/O through a reconnecting path fails. -1 disables'
+ . ' this timeout; I/O can remain queued while paths reconnect.',
+ type => 'integer',
+ minimum => -1,
+ default => 120,
+ },
+ };
+}
+
+sub options {
+ return {
+ subsysnqn => { fixed => 1 },
+ portals => {},
+ 'fast-io-fail-tmo' => { optional => 1 },
+ nodes => { optional => 1 },
+ disable => { optional => 1 },
+ content => { optional => 1 },
+ bwlimit => { optional => 1 },
+ };
+}
+
+my sub assert_valid_config($scfg) {
+ die "the discovery subsystem cannot be used as storage\n"
+ if $scfg->{subsysnqn} eq $PVE::NVMeOF::DISCOVERY_NQN;
+ my $paths = PVE::NVMeOF::storage_paths($scfg);
+ # the list format also accepts a list of separators only
+ die "no portal given\n" if !@$paths;
+ my %seen;
+ for my $path (@$paths) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ die "portal '$portal' is listed more than once\n" if $seen{$portal}++;
+ }
+}
+
+sub on_add_hook($class, $storeid, $scfg, %param) {
+ assert_valid_config($scfg);
+ # the LUN and controller lists and the node status attribute a subsystem to its one storage
+ my $ids = PVE::Storage::config()->{ids};
+ for my $sid (sort keys %$ids) {
+ next if $sid eq $storeid || $ids->{$sid}->{type} ne 'nvmeof';
+ die "storage '$sid' already uses this subsystem\n"
+ if $ids->{$sid}->{subsysnqn} eq $scfg->{subsysnqn};
+ }
+ # adding the storage again, for example once the array allows the node, tries all portals
+ PVE::NVMeOF::clear_connect_failures($scfg);
+ return;
+}
+
+sub on_update_hook_full($class, $storeid, $scfg, $update, $delete, $sensitive, @) {
+ my $merged = { %$scfg, %$update };
+ delete $merged->{$_} for ($delete // [])->@*;
+ assert_valid_config($merged);
+ return $class->SUPER::on_update_hook_full($storeid, $scfg, $update, $delete, $sensitive);
+}
+
+sub parse_volname($class, $volname) {
+ if ($volname =~ m!^(nvme-[a-zA-Z0-9_.:+-]+)$! && $volname !~ /-part[0-9]+$/) {
+ return ($class->guest_volume_vtype('raw'), $1, undef, undef, undef, undef, 'raw');
+ }
+ die "unable to parse NVMe over Fabrics volume name '$volname'\n";
+}
+
+# The name of a volume can be the by-id name of any NVMe device, also of a local disk or of a
+# namespace of another subsystem.
+sub assert_namespace($scfg, $volname, $real) {
+ my ($dev) = $real =~ m!^/dev/(nvme[0-9]+n[0-9]+)$!;
+ die "volume '$volname' is not an NVMe namespace\n" if !defined($dev);
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$PVE::NVMeOF::SYSFS/block/$dev/device/subsysnqn")
+ // '';
+ die "volume '$volname' is not part of subsystem '$scfg->{subsysnqn}'\n"
+ if $nqn ne $scfg->{subsysnqn};
+ # another by-id name of the subsystem, like model and serial, can name another namespace
+ my $wwid = PVE::NVMeOF::namespace_wwid($dev) // '';
+ die "volume '$volname' is not named after the WWID of its namespace\n"
+ if $volname ne "nvme-$wwid";
+}
+
+sub filesystem_path($class, $scfg, $volname, $snapname = undef, @) {
+ die "snapshot is not possible on NVMe over Fabrics storage\n" if defined($snapname);
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my $path = "/dev/disk/by-id/$name";
+ # not every user of a path activates the volume first, and the base volume of an LVM storage
+ # has no device before its storage connects
+ my $real = Cwd::realpath($path);
+ assert_namespace($scfg, $volname, $real) if defined($real) && -e $real;
+ return wantarray ? ($path, $vmid, $vtype) : $path;
+}
+
+sub create_base { die "can't create base images in NVMe over Fabrics storage\n" }
+sub clone_image { die "can't clone images in NVMe over Fabrics storage\n" }
+sub alloc_image { die "can't allocate space in NVMe over Fabrics storage\n" }
+sub free_image { die "can't free space in NVMe over Fabrics storage\n" }
+sub volume_resize { die "volume resize is not possible on NVMe over Fabrics storage\n" }
+
+sub list_volumes($class, $storeid, $scfg, $vmid = undef, $content_types = undef, @) {
+ my $res = $class->list_images($storeid, $scfg, $vmid);
+ $_->{content} = 'images' for @$res;
+ return $res;
+}
+
+sub list_images($class, $storeid, $scfg, $vmid = undef, $vollist = undef, $cache = undef, @) {
+ return [] if defined($vmid) && !$vollist;
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ my $res = [];
+ for my $dev (sort keys %$namespaces) {
+ my $ns = $namespaces->{$dev};
+ my $volid = "$storeid:nvme-$ns->{wwid}";
+ next if $vollist && !grep { $_ eq $volid } @$vollist;
+ push @$res,
+ {
+ volid => $volid,
+ format => 'raw',
+ size => $ns->{size},
+ vmid => 0,
+ };
+ }
+ return $res;
+}
+
+sub status($class, $storeid, $scfg, $cache = undef, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return (0, 0, 0, PVE::NVMeOF::has_live_controller($controllers) ? 1 : 0);
+}
+
+sub activate_storage($class, $storeid, $scfg, $cache = undef, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ my @missing = grep { !defined(PVE::NVMeOF::path_controller($controllers, $_)) }
+ PVE::NVMeOF::storage_paths($scfg)->@*;
+ return if !@missing;
+ # Without these no path connects, which is no reason to wait before the next attempt. A storage
+ # with a usable path still works, with fewer paths.
+ eval {
+ PVE::NVMeOF::assert_support();
+ PVE::NVMeOF::host_identity();
+ };
+ if (my $err = $@) {
+ die $err if !PVE::NVMeOF::has_live_controller($controllers);
+ warn "storage '$storeid': cannot connect to the other portals - $err";
+ return;
+ }
+ my @errors;
+ my $live = PVE::NVMeOF::has_live_controller($controllers);
+ my $deadline = Time::HiRes::time() + $ACTIVATION_BUDGET;
+ for my $path (@missing) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ if ($live && Time::HiRes::time() >= $deadline) {
+ push @errors, "$portal: left for the next activation";
+ next;
+ }
+ if (PVE::NVMeOF::in_cooldown($scfg, $path)) {
+ push @errors, "$portal: failed less than a minute ago";
+ next;
+ }
+ eval {
+ die "no answer from portal\n"
+ if !PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::connect_path($scfg, $path);
+ };
+ if (my $err = $@) {
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ warn "storage '$storeid': connecting to '$portal' failed - $err";
+ chomp $err;
+ push @errors, "$portal: $err";
+ } else {
+ $live = 1;
+ }
+ }
+ # some paths are enough, but without a usable one the namespaces cannot be used
+ $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ die "cannot connect to any portal - " . join('; ', @errors) . "\n"
+ if !PVE::NVMeOF::has_live_controller($controllers);
+ return;
+}
+
+sub deactivate_storage { return }
+
+sub check_connection($class, $storeid, $scfg, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return 1 if PVE::NVMeOF::has_live_controller($controllers);
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ next if defined(PVE::NVMeOF::path_controller($controllers, $path));
+ next if PVE::NVMeOF::in_cooldown($scfg, $path);
+ return 1 if PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ }
+ return 0;
+}
+
+sub activate_volume($class, $storeid, $scfg, $volname, $snapname = undef, $cache = undef, @) {
+ my $path = $class->filesystem_path($scfg, $volname, $snapname);
+ # as for the multipath map of an iSCSI LUN, a status pass does not wait for the device
+ my $deadline = Time::HiRes::time() + ($cache && $cache->{status_only} ? 0 : 10);
+ while (!-b $path && Time::HiRes::time() < $deadline) {
+ last if !keys PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn})->%*;
+ Time::HiRes::usleep(250_000);
+ }
+ my $real = Cwd::realpath($path);
+ die "volume '$volname' is not available on this node\n" if !$real || !-b $real;
+ assert_namespace($scfg, $volname, $real);
+}
+
+sub volume_has_feature(
+ $class, $scfg, $feature, $storeid, $volname,
+ $snapname = undef,
+ $running = undef, @,
+) {
+ return 1 if $feature eq 'copy' && !defined($snapname);
+ return undef;
+}
+
+1;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index a97f361c..d61e78b6 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -42,7 +42,7 @@ our @COMMON_TAR_FLAGS = qw(
);
our @SHARED_STORAGE = (
- 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs',
+ 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs', 'nvmeof',
);
our $QCOW2_PREALLOCATION = {
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index 0a9e441c..53c24c9e 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -302,6 +302,11 @@ sub lun_partitions($lun) {
}
sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
+ my $name = basename($lun->{devpath});
+ my $nqn =
+ $name =~ /^nvme\d+n\d+$/
+ ? PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn")
+ : undef;
my %vgs = map { $_ => 1 } PVE::Storage::LVMPlugin::lun_volume_groups(
[$lun->{devpath}, lun_partitions($lun)->@*],
)->@*;
@@ -324,6 +329,14 @@ sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
) {
die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this target\n";
}
+ if (
+ $type eq 'nvmeof'
+ && defined($nqn)
+ && $scfg->{subsysnqn} eq $nqn
+ && PVE::Storage::san_storage_serves_images($scfg)
+ ) {
+ die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this subsystem\n";
+ }
next if $type ne 'lvm' || !$scfg->{base};
my $base = PVE::Multipath::parse_base_volume($scfg->{base});
my $matches = $base
diff --git a/src/test/Makefile b/src/test/Makefile
index 3b902c43..ceabd991 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -17,6 +17,7 @@ test: \
test_lvmplugin \
test_multipath \
test_multipath_api \
+ test_nvmeof \
test_ovf \
test_plugin \
test_remote_command \
@@ -115,3 +116,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
+
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+ ./run_nvmeof_tests.pl
+ perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
new file mode 100755
index 00000000..6fd37410
--- /dev/null
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -T
+
+use v5.36;
+use lib qw(..);
+use File::Temp qw(tempdir);
+use Scalar::Util qw(tainted);
+use Test::MockModule;
+use Test::More;
+
+use PVE::Tools qw(file_get_contents file_set_contents);
+
+use PVE::NVMeOF;
+
+$ENV{PATH} = '/usr/sbin:/usr/bin:/sbin:/bin';
+delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+my $dir = tempdir('nvmeof-taint-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::HOSTNQN_FILE = "$dir/hostnqn";
+local $PVE::NVMeOF::HOSTID_FILE = "$dir/hostid";
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+file_set_contents($PVE::NVMeOF::HOSTNQN_FILE, "nqn.host\n");
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "12345678-1234-1234-1234-123456789abc\n");
+file_set_contents("$dir/config", "nqn.test\n192.0.2.1\n120\n");
+my ($nqn, $portal, $fail) = split(/\n/, file_get_contents("$dir/config"));
+ok(tainted($nqn), 'configuration input is tainted');
+my $nvme = Test::MockModule->new('PVE::NVMeOF');
+$nvme->mock(with_lock => sub { $_[0]->() });
+my $commands = 0;
+$nvme->mock(
+ subsystem_controllers => sub {
+ return $commands ? { nvme0 => { traddr => '192.0.2.1', trsvcid => 4420 } } : {};
+ },
+);
+$nvme->mock(assert_support => sub { });
+$nvme->mock(
+ run_command => sub($cmd, %opts) {
+ $commands++;
+ is(
+ scalar(grep { tainted($_) } @$cmd),
+ 0,
+ 'all connect operands are validated and untainted',
+ );
+ PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ },
+);
+my $path = PVE::NVMeOF::parse_portal($portal);
+eval { PVE::NVMeOF::connect_path({ subsysnqn => $nqn, 'fast-io-fail-tmo' => $fail }, $path) };
+is($@, '', 'connect command can execute in taint mode');
+is($commands, 1, 'one connect');
+PVE::NVMeOF::note_connect_failure({ subsysnqn => $nqn }, $path);
+ok(
+ PVE::NVMeOF::in_cooldown({ subsysnqn => $nqn }, $path),
+ 'cooldown accepts validated file-backed configuration',
+);
+for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.discovery') {
+ eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
+ like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
+}
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
+eval { PVE::NVMeOF::host_identity() };
+like($@, qr/nonzero UUID/, 'zero host ID refused');
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
new file mode 100755
index 00000000..cdf228c0
--- /dev/null
+++ b/src/test/run_nvmeof_tests.pl
@@ -0,0 +1,446 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use Fcntl qw(:flock);
+use File::Path qw(make_path remove_tree);
+use File::Temp qw(tempdir);
+use POSIX ();
+use Test::MockModule;
+use Test::More;
+use Time::HiRes ();
+
+use PVE::Tools qw(file_set_contents);
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+local $PVE::NVMeOF::SYSFS = "$dir/sys";
+my $class = 'PVE::Storage::NVMeOFPlugin';
+my $cfg = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,[2001:db8::2]:4421',
+ content => { none => 1 },
+};
+
+subtest 'configuration, portals and volumes' => sub {
+ is(PVE::Storage::Plugin->lookup('nvmeof'), $class, 'plugin registered');
+ is_deeply(
+ [sort keys $class->properties()->%*],
+ [qw(fast-io-fail-tmo portals subsysnqn)],
+ 'only three plugin-specific properties',
+ );
+ my sub nvmeof_schema($schema) {
+ my @types = map { ($_->{oneOf} // [])->@* } ($schema->{allOf} // [])->@*;
+ my ($nvmeof) = grep { $_->{'instance-type'} eq 'nvmeof' } @types;
+ return $nvmeof->{properties} // {};
+ }
+ my $create = nvmeof_schema(PVE::Storage::Plugin->createSchema());
+ is_deeply(
+ [sort grep { !$create->{$_}->{optional} } keys $create->%*],
+ [qw(portals subsysnqn)],
+ 'adding a storage requires the subsystem and the portals',
+ );
+ my $update = nvmeof_schema(PVE::Storage::Plugin->updateSchema());
+ ok($update->{portals} && !$update->{subsysnqn}, 'the subsystem cannot be changed');
+ my $parsed = PVE::Storage::Plugin->parse_config(
+ 'storage.cfg',
+ "nvmeof: fabric\n\tsubsysnqn nqn.test\n\tportals 192.0.2.1\n\tcontent none\n",
+ );
+ is($parsed->{ids}->{fabric}->{subsysnqn}, 'nqn.test', 'storage.cfg accepts the plugin');
+ is_deeply(
+ $parsed->{ids}->{fabric}->{content},
+ { none => 1 },
+ 'connection-only content parses',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ { traddr => '192.0.2.1', trsvcid => 4420 },
+ 'default I/O port',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('[2001:0db8::1]:4421'),
+ { traddr => '2001:db8::1', trsvcid => 4421 },
+ 'canonical IPv6',
+ );
+ is(
+ PVE::NVMeOF::format_path({ traddr => '2001:db8::1', trsvcid => 4421 }),
+ '[2001:db8::1]:4421',
+ 'an IPv6 portal in brackets',
+ );
+ is(
+ PVE::NVMeOF::format_path({ traddr => 'nn-0x2000:pn-0x2001' }),
+ 'nn-0x2000:pn-0x2001',
+ 'the address of a Fibre Channel port as it is',
+ );
+
+ for my $bad (
+ 'host.example', '1.2.3.4:0', '1.2.3.4:65536', '[fe80::1]', '[::]', '224.0.0.1',
+ ) {
+ ok(!PVE::NVMeOF::parse_portal($bad), "invalid portal $bad");
+ }
+ eval { $class->on_add_hook('fabric', { %$cfg, portals => '192.0.2.1,192.0.2.1:4420' }); };
+ like($@, qr/listed more than once/, 'duplicate portals refused');
+ eval { $class->on_add_hook('fabric', { %$cfg, portals => ',,' }); };
+ like($@, qr/no portal given/, 'a list without a portal refused');
+ eval {
+ $class->on_add_hook(
+ 'fabric',
+ { %$cfg, subsysnqn => 'nqn.2014-08.org.nvmexpress.discovery' },
+ );
+ };
+ like($@, qr/discovery subsystem/, 'discovery subsystem refused');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $ids = { fabric => $cfg, local => { type => 'dir' } };
+ $storage->mock(config => sub { { ids => $ids } });
+ my $first = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $first);
+ is(eval { $class->on_add_hook('fabric', $cfg); 1 }, 1, 'a storage is not in its own way');
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $first), 'adding it tries all portals again');
+ eval { $class->on_add_hook('second', {%$cfg}) };
+ like($@, qr/storage 'fabric' already uses this subsystem/, 'one storage per subsystem');
+ is(
+ scalar($class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef')),
+ '/dev/disk/by-id/nvme-eui.0123456789abcdef',
+ 'stable volume path',
+ );
+ {
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $nqn = 'nqn.other';
+ $disk->redefine(read_subsysnqn => sub { $nqn });
+ my $sysfs = Test::MockModule->new('PVE::NVMeOF');
+ $sysfs->redefine(namespace_wwid => sub { 'x' });
+ my $check = sub {
+ eval { PVE::Storage::NVMeOFPlugin::assert_namespace($cfg, @_) };
+ $@;
+ };
+ like($check->('nvme-x', '/dev/nvme0n1'), qr/not part of subsystem/, 'other subsystem');
+ like($check->('nvme-x', '/dev/sda'), qr/not an NVMe namespace/, 'other device type');
+ like($check->('nvme-x', '/dev/nvme0n1p1'), qr/not an NVMe namespace/, 'partition');
+ $nqn = 'nqn.test';
+ is($check->('nvme-x', '/dev/nvme0n1'), '', 'namespace of the subsystem');
+ like(
+ $check->('nvme-Vendor_Model_123_1', '/dev/nvme0n1'),
+ qr/not named after the WWID/,
+ 'another by-id name of a namespace of the subsystem',
+ );
+ my $cwd = Test::MockModule->new('Cwd');
+ $cwd->redefine(realpath => sub { $dir });
+ eval { $class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef') };
+ like($@, qr/not an NVMe namespace/, 'the path of an existing device is checked');
+ }
+
+ for my $bad ('nvme-../../sda', 'nvme-eui.abc-part1', 'sda') {
+ eval { $class->parse_volname($bad) };
+ like($@, qr/unable to parse/, "invalid volume $bad");
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ $nvme->mock(namespaces => sub { { nvme0n1 => { wwid => 'eui.abc', size => 4096 } } });
+ is(
+ $class->list_volumes('fabric', $cfg)->[0]->{volid},
+ 'fabric:nvme-eui.abc',
+ 'content none still offers bases',
+ );
+ is_deeply($class->list_images('fabric', $cfg, 100), [], 'namespaces have no VM owner');
+ $nvme->mock(subsystem_controllers => sub { {} });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test') };
+ like($@, qr/not available/,
+ 'missing namespace fails without waiting on absent controllers');
+ my ($now, $queries) = (0, 0);
+ my $clock = Test::MockModule->new('Time::HiRes');
+ $clock->redefine(time => sub { $now += 5 }, usleep => sub { });
+ $nvme->mock(subsystem_controllers => sub { $queries++; { nvme1 => {} } });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test', undef, {}) };
+ is($queries, 1, 'a missing namespace of a connected subsystem is waited for');
+ eval {
+ $class->activate_volume(
+ 'fabric',
+ $cfg,
+ 'nvme-nonexistent-test',
+ undef,
+ { status_only => 1 },
+ );
+ };
+ like($@, qr/not available/, 'in a status pass it fails as well');
+ is($queries, 1, 'but without a wait');
+ is(
+ ($class->parse_volname('nvme-eui.0123456789abcdef'))[0],
+ 'vm-vol',
+ 'namespaces are VM disks',
+ );
+};
+
+subtest 'sysfs topology' => sub {
+ my $sys = $PVE::NVMeOF::SYSFS;
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1",
+ "$sys/class/nvme-subsystem/nvme-subsys0/nvme0n1",
+ "$sys/block/nvme0n1",
+ );
+ my %attrs = (
+ address => 'traddr=192.0.2.1,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.test',
+ state => 'connecting',
+ );
+ file_set_contents("$sys/class/nvme-fabrics/ctl/nvme1/$_", "$attrs{$_}\n") for keys %attrs;
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys0/subsysnqn", "nqn.test\n");
+ file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ file_set_contents("$sys/block/nvme0n1/size", "8\n");
+ is(
+ PVE::NVMeOF::controllers()->{nvme1}->{state},
+ 'connecting',
+ 'reconnecting controller is still present',
+ );
+ is(
+ PVE::NVMeOF::path_controller(
+ PVE::NVMeOF::subsystem_controllers('nqn.test'),
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ ),
+ 'nvme1',
+ 'portal controller found',
+ );
+ is_deeply(
+ PVE::NVMeOF::namespaces('nqn.test'),
+ { nvme0n1 => { wwid => 'eui.abc', size => 4096 } },
+ 'namespace facts',
+ );
+ is_deeply(PVE::NVMeOF::namespaces('nqn.other'), {}, 'other subsystem excluded');
+};
+
+subtest 'serialized commands inherit the lock' => sub {
+ local $PVE::NVMeOF::LOCK_WAIT = 0;
+ my $script = join(
+ ' ',
+ 'my @held = grep { (readlink($_) // "") =~ /fabrics.lock$/ } glob("/proc/self/fd/*");',
+ 'die "not inherited" if !@held;',
+ 'open(my $fh, ">>", $ARGV[0]) or die $!;',
+ 'die "lock missing" if flock($fh, LOCK_EX|LOCK_NB);',
+ 'print "locked\\n";',
+ );
+ my $value = PVE::NVMeOF::with_lock(sub {
+ my $out = '';
+ PVE::Tools::run_command(
+ [
+ '/usr/bin/perl',
+ '-MFcntl=:flock',
+ '-e',
+ $script,
+ "$PVE::NVMeOF::RUN_DIR/fabrics.lock",
+ ],
+ timeout => 5,
+ outfunc => sub { $out .= $_[0] },
+ );
+ return $out;
+ });
+ is($value, 'locked', 'exec cannot acquire the lock held by its parent');
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or die $!;
+ flock($lock, LOCK_EX) or die $!;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'busy operation never enters callback');
+ close($lock);
+
+ my $tools = Test::MockModule->new('PVE::Tools');
+ my $timed_out = 1;
+ $tools->mock(run_fork_with_timeout => sub { return ($_[1]->(), $timed_out) });
+ my $retained;
+ eval {
+ PVE::NVMeOF::with_lock(sub {
+ my ($path) =
+ grep { (readlink($_) // '') =~ /fabrics.lock$/ } glob('/proc/self/fd/*');
+ my ($fd) = $path =~ m{/(\d+)$};
+ open($retained, '>&', $fd) or die $!;
+ return 1;
+ });
+ };
+ like($@, qr/timed out.*may still be running/, 'timeout does not claim deletion completed');
+ $timed_out = 0;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'retained descriptor keeps serialization after the caller returns');
+ close($retained);
+ is(PVE::NVMeOF::with_lock(sub { 1 }), 1, 'last descriptor close releases serialization');
+};
+
+subtest 'a short hold of the lock does not fail a connect' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my $scfg = { %$cfg, subsysnqn => 'nqn.wait', portals => '192.0.2.3' };
+ my $ctl = "$PVE::NVMeOF::SYSFS/class/nvme-fabrics/ctl/nvme9";
+ $net->mock(tcp_ping => sub { 1 });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(
+ run_command => sub(@) {
+ my %attrs = (
+ address => 'traddr=192.0.2.3,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.wait',
+ state => 'live',
+ );
+ make_path($ctl);
+ file_set_contents("$ctl/$_", "$attrs{$_}\n") for keys %attrs;
+ },
+ );
+ pipe(my $held, my $signal) or die "pipe failed - $!\n";
+ my $holder = fork() // die "fork failed - $!\n";
+ if (!$holder) {
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or POSIX::_exit(1);
+ flock($lock, LOCK_EX) or POSIX::_exit(1);
+ syswrite($signal, '1');
+ Time::HiRes::sleep(0.5);
+ POSIX::_exit(0);
+ }
+ close($signal);
+ sysread($held, my $state, 1);
+ is($state, '1', 'another process holds the lock');
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ $class->activate_storage('wait', $scfg);
+ }
+ waitpid($holder, 0);
+ is($warning, '', 'the connect waits for the lock');
+ my $path = PVE::NVMeOF::storage_paths($scfg)->[0];
+ ok(!PVE::NVMeOF::in_cooldown($scfg, $path), 'and arms no cooldown');
+ is(
+ PVE::NVMeOF::path_controller(PVE::NVMeOF::subsystem_controllers('nqn.wait'), $path),
+ 'nvme9',
+ 'the portal is connected',
+ );
+ remove_tree($ctl);
+};
+
+subtest 'connect options, kernel reconnect and cooldown' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my @commands;
+ my $controllers = {};
+ $nvme->mock(with_lock => sub { $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(subsystem_controllers => sub { $controllers });
+ my $appear = 1;
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ is($opts{timeout}, 30, 'bounded connect');
+ push @commands, $cmd;
+ my %arg =
+ map { $cmd->[$_] => $cmd->[$_ + 1] } grep { $cmd->[$_] =~ /^--tr/ } 0 .. $#$cmd;
+ my $controller =
+ { traddr => $arg{'--traddr'}, trsvcid => $arg{'--trsvcid'}, state => 'live' };
+ $controllers->{ 'nvme' . scalar(@commands) } = $controller if $appear;
+ },
+ );
+ $net->mock(tcp_ping => sub { 1 });
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 2, 'one connect per missing portal');
+ ok(grep({ $_ eq '--ctrl-loss-tmo=-1' } $commands[0]->@*), 'kernel reconnects indefinitely');
+ is_deeply([@{ $commands[0] }[-2, -1]], ['--fast_io_fail_tmo', 120], 'fast failure default');
+ {
+ local $PVE::Storage::NVMeOFPlugin::ACTIVATION_BUDGET = 0;
+ @commands = ();
+ $controllers = {};
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 1, 'with a live controller, a spent time budget leaves the rest');
+ ($controllers, $appear) = ({}, 0);
+ @commands = ();
+ {
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('fabric', $cfg) };
+ }
+ is(scalar(@commands), 2, 'without one, every portal is tried');
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ $appear = 1;
+ }
+ @commands = ();
+ $controllers = {
+ nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' },
+ nvme2 => { traddr => '2001:db8::2', trsvcid => 4421, state => 'live' },
+ };
+ $class->activate_storage('fabric', $cfg);
+ is_deeply(\@commands, [],
+ 'existing controllers are never reconnected, regardless of state');
+ $class->deactivate_storage('fabric', $cfg);
+ is_deeply(\@commands, [], 'deactivation does not remove controllers');
+ $controllers = {};
+ my $path = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $path);
+ ok(PVE::NVMeOF::in_cooldown($cfg, $path), 'failure starts cooldown');
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 1, 'only the other portal connects');
+ ($controllers, $appear) = ({}, 0);
+ my $other = PVE::NVMeOF::storage_paths($cfg)->[1];
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ eval { $class->activate_storage('fabric', $cfg) };
+ }
+ like($warning, qr/no controller appeared/, 'a connect without a controller is a failure');
+ ok(PVE::NVMeOF::in_cooldown($cfg, $other), 'which starts the cooldown too');
+ like(
+ $@,
+ qr/^cannot connect to any portal - .*failed less than a minute ago; .*no controller appeared/,
+ 'without any controller the activation fails with the reason of each portal',
+ );
+ unlink(glob("$PVE::NVMeOF::RUN_DIR/retry/*"));
+ $nvme->mock(assert_support => sub { die "nvme-cli is not installed\n" });
+ @commands = ();
+ eval { $class->activate_storage('fabric', $cfg) };
+ is($@, "nvme-cli is not installed\n", 'a missing prerequisite fails the activation');
+ is_deeply(\@commands, [], 'before any connect');
+ ok(!PVE::NVMeOF::in_cooldown($cfg, $path), 'and without a cooldown');
+ $controllers = { nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'live' } };
+ $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ is(
+ eval { $class->activate_storage('fabric', $cfg); 1 },
+ 1,
+ 'but not with a usable path',
+ );
+ }
+ like($warning, qr/cannot connect to the other portals - nvme-cli/, 'which it warns about');
+ $nvme->mock(assert_support => sub { });
+ $controllers =
+ { nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' } };
+ {
+ local $SIG{__WARN__} = sub { };
+ eval { $class->activate_storage('fabric', $cfg) };
+ }
+ like(
+ $@,
+ qr/^cannot connect to any portal/,
+ 'a reconnecting path is not usable when the missing one fails',
+ );
+};
+
+subtest 'local disk setup rejects fabric namespaces by transport' => sub {
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ for my $transport (qw(nvme-tcp nvme-rdma nvme-fc)) {
+ $disk->mock(get_disks => sub { { nvme0n1 => { transport => $transport } } });
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1') };
+ like($@, qr/not a valid local disk/,
+ "$transport refuses without storage configuration");
+ $disk->mock(
+ get_disks => sub {
+ {
+ nvme0n1 => { transport => $transport },
+ nvme0n1p1 => { parent => '/dev/nvme0n1', type => 'partition' },
+ };
+ },
+ );
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1p1') };
+ like($@, qr/not a valid local disk/, "$transport refuses a partition of a namespace");
+ }
+};
+
+done_testing();
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 3245b774..2a9a2121 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -38,6 +38,7 @@ $storage->mock(config => sub { $cfg });
$disk->mock(verify_blockdev_path => sub { $device });
$disk->mock(is_partition => sub { 0 });
$disk->mock(get_nvme_transport => sub { 'fc' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
$disk->mock(is_iscsi_device => sub { 0 });
$disk->mock(is_mounted => sub { 0 });
$disk->mock(has_holder => sub { 0 });
@@ -86,6 +87,21 @@ for my $base (qw(fabric nvme-fabric)) {
eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
like($@, qr/base volume/, "native base reference on storage '$base' refuses");
}
+$cfg->{ids} =
+ { fabric =>
+ { type => 'nvmeof', subsysnqn => 'nqn.test', disable => 1, content => { images => 1 } } };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like(
+ $@,
+ qr/serves images from this subsystem/,
+ 'direct namespace image use refuses even when disabled',
+);
+$cfg->{ids}->{fabric}->{content} = { 'vm-vol' => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like($@, qr/serves images from this subsystem/, 'also when restricted to VM disks');
+$cfg->{ids}->{fabric}->{content} = { none => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+is($@, '', 'connection-only storage permits namespace initialization');
$cfg->{ids} = {};
@order = @opens = ();
$tools->mock(file_get_contents => sub { 1024 });
^ permalink raw reply related [relevance 16%]
* [PATCH v3 storage 07/18] api: add node-level NVMe over Fabrics status and controller removal
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (5 preceding siblings ...)
2026-11-22 1:25 20% ` [PATCH v3 storage 06/18] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
@ 2026-11-22 1:25 16% ` Thomas Lamprecht
2026-11-22 1:25 10% ` [PATCH v3 storage 08/18] multipath: report the NVMe host NQN of each node Thomas Lamprecht
` (9 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
The host NQN for the access rules of an array and the controllers of
a node are only visible with nvme-cli on a shell. Add the API module
for /nodes/{node}/san/nvmeof with the host identity and the fabrics
controllers with their subsystem, portal, state and storage. The
namespaces of all subsystems are counted in one pass for that list, as
a node can have a thousand controllers, for example with a storage
plugin that uses a subsystem per guest disk.
Removing a portal or the storage does not disconnect, so a controller
can be removed here, unless a namespace that is mounted, has holders,
is a swap area, is open in a process or is referenced by a storage
would lose its last usable path. A controller that is no usable path
itself, such as one that keeps reconnecting to a deleted subsystem,
only needs the local checks, as the check of the storage references
reads the namespace. A controller with namespaces outside of native
NVMe multipath is refused, as they lack the head devices that these
checks go by. The caller can pass the subsystem and portal it listed,
to refuse a controller number that the kernel reused meanwhile.
Reading needs Sys.Audit on the node or Datastore.Allocate on /storage,
the removal Sys.Modify on '/'.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 199 +++++++++++++++++++++++++++++
src/PVE/API2/SAN/Node.pm | 8 +-
src/PVE/Diskmanage.pm | 18 +--
src/PVE/NVMeOF.pm | 127 +++++++++++++++++--
src/test/Makefile | 3 +-
src/test/run_nvmeof_api_tests.pl | 207 +++++++++++++++++++++++++++++++
src/test/run_nvmeof_tests.pl | 7 ++
src/test/run_san_api_tests.pl | 2 +-
9 files changed, 553 insertions(+), 19 deletions(-)
create mode 100644 src/PVE/API2/NVMeOF.pm
create mode 100755 src/test/run_nvmeof_api_tests.pl
diff --git a/src/PVE/API2/Makefile b/src/PVE/API2/Makefile
index 70ff1ec4..07773db1 100644
--- a/src/PVE/API2/Makefile
+++ b/src/PVE/API2/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Disks.pm ${DESTDIR}${PERLDIR}/PVE/API2/Disks.pm
install -D -m 0644 ISCSI.pm ${DESTDIR}${PERLDIR}/PVE/API2/ISCSI.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/API2/NVMeOF.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/API2/Multipath.pm
make -C Storage install
make -C Disks install
diff --git a/src/PVE/API2/NVMeOF.pm b/src/PVE/API2/NVMeOF.pm
new file mode 100644
index 00000000..a2c657b7
--- /dev/null
+++ b/src/PVE/API2/NVMeOF.pm
@@ -0,0 +1,199 @@
+package PVE::API2::NVMeOF;
+
+use v5.36;
+
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTHandler;
+use PVE::RPCEnvironment;
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+use base qw(PVE::RESTHandler);
+
+my $read_permissions = {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+};
+my $controller_schema = {
+ description => 'The fabrics controller name, for example nvme3.',
+ type => 'string',
+ pattern => 'nvme[0-9]+',
+};
+
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ method => 'GET',
+ proxyto => 'node',
+ permissions => { user => 'all' },
+ description => 'Node NVMe over Fabrics index.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => { type => 'object', properties => { name => { type => 'string' } } },
+ links => [{ rel => 'child', href => '{name}' }],
+ },
+ code => sub { return [{ name => 'status' }, { name => 'controller' }] },
+});
+
+__PACKAGE__->register_method({
+ name => 'status',
+ path => 'status',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'Report the NVMe host identity and nvme-cli availability.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ supported => { type => 'boolean', description => 'Whether nvme-cli is installed.' },
+ 'host-nqn' => {
+ type => 'string',
+ optional => 1,
+ description => 'The host NQN for target access control.',
+ },
+ 'host-id' =>
+ { type => 'string', optional => 1, description => 'The persistent host UUID.' },
+ error => {
+ type => 'string',
+ optional => 1,
+ description => 'Why the host identity is unavailable.',
+ },
+ },
+ },
+ code => sub {
+ my $res = { supported => PVE::NVMeOF::is_supported() };
+ my $host = eval { PVE::NVMeOF::host_identity() };
+ if (my $error = $@) {
+ chomp $error;
+ $res->{error} = $error;
+ } else {
+ $res->{'host-nqn'} = $host->{nqn};
+ $res->{'host-id'} = $host->{id};
+ }
+ return $res;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'controllers',
+ path => 'controller',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'List connected NVMe over Fabrics controllers and their states.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ controller => $controller_schema,
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ transport => { type => 'string', description => 'The controller transport.' },
+ portal => {
+ type => 'string',
+ description => 'The controller address and port, if applicable.',
+ },
+ state => {
+ type => 'string',
+ description => 'The controller state, such as live or connecting.',
+ },
+ namespaces => {
+ type => 'integer',
+ description => 'The number of namespace devices in the subsystem.',
+ },
+ 'used-by-storage' => {
+ type => 'string',
+ optional => 1,
+ description => 'An NVMe over Fabrics storage using the subsystem.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my $cfg = PVE::Storage::config();
+ my %owners;
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $owners{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
+ }
+ my $controllers = PVE::NVMeOF::controllers();
+ my $counts = PVE::NVMeOF::namespace_counts();
+ my @rows;
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ my $nqn = $ctrl->{subsystem};
+ push @rows,
+ {
+ controller => $name,
+ subsysnqn => $nqn,
+ transport => $ctrl->{transport},
+ portal => PVE::NVMeOF::format_path($ctrl),
+ state => $ctrl->{state},
+ namespaces => $counts->{$nqn} // 0,
+ defined($owners{$nqn}) ? ('used-by-storage' => $owners{$nqn}) : (),
+ };
+ }
+ return \@rows;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'disconnect',
+ path => 'controller/{controller}',
+ method => 'DELETE',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/', ['Sys.Modify']] },
+ description => 'Disconnect one fabrics controller. Refuse when a namespace in use has no'
+ . ' other usable path. A storage still listing the portal reconnects it on activation.',
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ controller => $controller_schema,
+ subsysnqn => {
+ type => 'string',
+ maxLength => 223,
+ optional => 1,
+ description => 'Refuse unless the controller still has this subsystem NQN.',
+ },
+ portal => {
+ type => 'string',
+ maxLength => 128,
+ optional => 1,
+ description => 'Refuse unless the controller still has this portal.',
+ },
+ },
+ },
+ returns => { type => 'string', description => 'The task identifier.' },
+ code => sub($param) {
+ my $rpcenv = PVE::RPCEnvironment::get();
+ return $rpcenv->fork_worker(
+ 'nvmedisconnect',
+ $param->{controller},
+ $rpcenv->get_user(),
+ sub {
+ PVE::NVMeOF::disconnect_guarded(
+ $param->{controller},
+ { subsysnqn => $param->{subsysnqn}, portal => $param->{portal} },
+ );
+ },
+ );
+ },
+});
+
+1;
diff --git a/src/PVE/API2/SAN/Node.pm b/src/PVE/API2/SAN/Node.pm
index 4b96caf5..260c95f7 100644
--- a/src/PVE/API2/SAN/Node.pm
+++ b/src/PVE/API2/SAN/Node.pm
@@ -10,6 +10,7 @@ use PVE::Storage;
use PVE::Storage::SAN;
use PVE::API2::ISCSI;
+use PVE::API2::NVMeOF;
use base qw(PVE::RESTHandler);
@@ -18,6 +19,11 @@ __PACKAGE__->register_method({
path => 'iscsi',
});
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::NVMeOF",
+ path => 'nvmeof',
+});
+
__PACKAGE__->register_method({
name => 'index',
path => '',
@@ -42,7 +48,7 @@ __PACKAGE__->register_method({
links => [{ rel => 'child', href => "{name}" }],
},
code => sub {
- return [map { +{ name => $_ } } qw(iscsi luns)];
+ return [map { +{ name => $_ } } qw(iscsi luns nvmeof)];
},
});
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 21857dc6..523d9c05 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -958,6 +958,15 @@ sub get_multipath_disks {
return $disklist;
}
+# 'change' is transient; paths in 'inaccessible' or 'persistent-loss' cannot serve IO even on a live
+# controller
+sub nvme_path_is_usable {
+ my ($path) = @_;
+ my $ana = $path->{'ana-state'};
+ return $path->{state} eq 'live'
+ && (!defined($ana) || $ana eq 'optimized' || $ana eq 'non-optimized');
+}
+
# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
# single-controller devices lack these children and are omitted.
sub get_nvme_path_status {
@@ -993,15 +1002,8 @@ sub get_nvme_path_status {
my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
$entry->{'ana-state'} = $ana if defined($ana);
- # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
- # cannot serve IO even on a live controller
- my $usable = $state eq 'live'
- && (!defined($ana)
- || $ana eq 'optimized'
- || $ana eq 'non-optimized');
-
my $status = $res->{$head} //= { active => 0, paths => [] };
- $status->{active}++ if $usable;
+ $status->{active}++ if nvme_path_is_usable($entry);
push @{ $status->{paths} }, $entry;
},
);
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index 15612b04..7961a49e 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -9,6 +9,7 @@ use JSON qw(decode_json);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use Time::HiRes ();
+use PVE::Cluster;
use PVE::JSONSchema;
use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
@@ -21,6 +22,7 @@ our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
our $HOSTID_FILE = '/etc/nvme/hostid';
our $RUN_DIR = '/run/pve/nvmeof';
our $LOCK_WAIT = 10;
+our $SWAPS = '/proc/swaps';
our $NQN_PATTERN = 'nqn\.[^\s,=]+';
our $DISCOVERY_NQN = 'nqn.2014-08.org.nvmexpress.discovery';
@@ -162,26 +164,42 @@ sub path_controller($controllers, $path) {
return undef;
}
-sub namespaces($subsystem) {
- my $res = {};
+# Calls $code with the subsystem NQN and the device name of each namespace of this node, or only
+# of those of the subsystem $only.
+my sub foreach_namespace($code, $only = undef) {
my $dir = "$SYSFS/class/nvme-subsystem";
dir_glob_foreach(
$dir,
'nvme-subsys[0-9]+',
sub($subsys, @) {
my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn") // return;
- return if $nqn ne $subsystem;
+ return if defined($only) && $nqn ne $only;
dir_glob_foreach(
"$dir/$subsys",
'nvme[0-9]+n[0-9]+',
- sub($dev, @) {
- my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid") // return;
- my $size = file_read_firstline("$SYSFS/block/$dev/size") // return;
- $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
- },
+ sub($dev, @) { $code->($nqn, $dev) },
);
},
);
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ foreach_namespace(
+ sub($nqn, $dev) {
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid") // return;
+ my $size = file_read_firstline("$SYSFS/block/$dev/size") // return;
+ $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
+ },
+ $subsystem,
+ );
+ return $res;
+}
+
+# The number of namespaces of each subsystem of this node, from one pass over the subsystems.
+sub namespace_counts() {
+ my $res = {};
+ foreach_namespace(sub($nqn, @) { $res->{$nqn}++ });
return $res;
}
@@ -331,4 +349,97 @@ sub discover($portal) {
die "discovery at portal '$portal' failed - $error";
}
+# A swap area on a namespace has no holder, mount or file descriptor of a process.
+my sub is_swap($device) {
+ my %rdevs = map {
+ my $rdev = (stat($_))[6];
+ defined($rdev) ? ($rdev => 1) : ()
+ } ($device, glob("${device}p[0-9]*"));
+ for my $line (split(/\n/, PVE::Tools::file_get_contents($SWAPS))) {
+ my ($swap) = split(/\s+/, $line);
+ next if !defined($swap) || $swap !~ m!^/!;
+ return 1 if $swap =~ m!^\Q$device\E(?:p[0-9]+)?$!;
+ my $rdev = (stat($swap))[6];
+ return 1 if defined($rdev) && $rdevs{$rdev};
+ }
+ return 0;
+}
+
+# The expected subsystem and portal refuse a controller that replaced the one the caller listed.
+sub disconnect_guarded($controller, $expected = {}) {
+ my ($name) = $controller =~ /\A(nvme[0-9]+)\z/;
+ die "invalid controller name '$controller'\n" if !defined($name);
+ return with_lock(sub {
+ require PVE::Storage;
+ require PVE::Storage::SAN;
+ my $ctrl = controllers()->{$name}
+ // die "'$name' is not an NVMe over Fabrics controller\n";
+ if (
+ (defined($expected->{subsysnqn}) && $expected->{subsysnqn} ne $ctrl->{subsystem})
+ || (defined($expected->{portal}) && $expected->{portal} ne format_path($ctrl))
+ ) {
+ die
+ "controller '$name' is no longer connected to the listed subsystem and portal\n";
+ }
+ # Without native multipath a namespace is a device of its controller and has no head
+ # device, which the checks below go by.
+ my $local = 0;
+ dir_glob_foreach(
+ "$SYSFS/class/nvme-fabrics/ctl/$name",
+ "${name}n[0-9]+",
+ sub { $local = 1 },
+ );
+ die "cannot disconnect '$name' - its namespaces do not use native NVMe multipath\n"
+ if $local;
+ my $namespaces = namespaces($ctrl->{subsystem});
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %heads = map { $_ => 1 } keys %$namespaces;
+ for my $head (keys %$status) {
+ $heads{$head} = 1
+ if grep { $_->{device} eq "/dev/$name" } $status->{$head}->{paths}->@*;
+ }
+ PVE::Cluster::cfs_update(1);
+ my $cfg = PVE::Storage::config();
+ for my $head (sort keys %heads) {
+ my $paths = $status->{$head}->{paths} // [];
+ my @others = grep { $_->{device} ne "/dev/$name" } @$paths;
+ next if grep { PVE::Diskmanage::nvme_path_is_usable($_) } @others;
+ my $ns = $namespaces->{$head};
+ if (!defined($ns)) {
+ die "cannot disconnect '$name' - namespace '$head' has no device on this node"
+ . " to check for use\n";
+ }
+ my $device = "/dev/$head";
+ if (
+ PVE::Diskmanage::is_mounted($device)
+ || PVE::Diskmanage::has_holder($device)
+ || is_swap($device)
+ ) {
+ die "cannot disconnect '$name' - namespace '$head' is in use and has no other"
+ . " usable path\n";
+ }
+ my $opener = PVE::Diskmanage::device_opener($device, glob("${device}p[0-9]*"));
+ if (defined($opener)) {
+ die "cannot disconnect '$name' - process $opener has namespace '$head' open and"
+ . " it has no other usable path\n";
+ }
+ # The check of the storage references reads the namespace. Removing a path that is not
+ # usable either costs no usable path, and a reconnecting one cannot be read.
+ next if !grep {
+ $_->{device} eq "/dev/$name" && PVE::Diskmanage::nvme_path_is_usable($_)
+ } @$paths;
+ eval {
+ PVE::Storage::SAN::assert_lun_unreferenced(
+ $cfg,
+ { devpath => $device, wwid => $ns->{wwid} },
+ );
+ };
+ die "cannot disconnect '$name' - $@" if $@;
+ }
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command([$NVME, 'disconnect', '--device', "/dev/$name"], timeout => 30);
+ return;
+ });
+}
+
1;
diff --git a/src/test/Makefile b/src/test/Makefile
index ceabd991..d323e8a1 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -117,6 +117,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
-test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_api_tests.pl run_nvmeof_taint_tests.pl
./run_nvmeof_tests.pl
+ ./run_nvmeof_api_tests.pl
perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_api_tests.pl b/src/test/run_nvmeof_api_tests.pl
new file mode 100755
index 00000000..f86291d0
--- /dev/null
+++ b/src/test/run_nvmeof_api_tests.pl
@@ -0,0 +1,207 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use File::Path qw(make_path remove_tree);
+use File::Temp qw(tempdir);
+use Test::MockModule;
+use Test::More;
+
+use PVE::API2::NVMeOF;
+use PVE::Storage::SAN;
+
+my $sys = tempdir('nvmeof-api-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::SYSFS = $sys;
+local $PVE::NVMeOF::SWAPS = "$sys/swaps";
+PVE::Tools::file_set_contents($PVE::NVMeOF::SWAPS, "Filename Type Size Used Priority\n");
+
+subtest 'last-path disconnect is checked inside serialization' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $san = Test::MockModule->new('PVE::Storage::SAN');
+ my $cluster = Test::MockModule->new('PVE::Cluster');
+ our $locked;
+ my ($commands, $checks, $mounted, $busy, $headless) = (0, 0, 0, 0, 0);
+ my $own = { device => '/dev/nvme1', state => 'live' };
+ my $other = { device => '/dev/nvme2', state => 'live', 'ana-state' => 'optimized' };
+ $nvme->mock(with_lock =>
+ sub { die "NVMe over Fabrics is busy\n" if $busy; local $locked = 1; $_[0]->() });
+ $nvme->mock(
+ controllers => sub {
+ ok($locked, 'controller snapshot is locked');
+ { nvme1 => { subsystem => 'nqn.test' } };
+ },
+ );
+ $nvme->mock(namespaces => sub { $headless ? {} : { nvme0n1 => { wwid => 'eui.abc' } } });
+ $nvme->mock(is_supported => sub { 1 });
+ $disk->mock(
+ get_nvme_path_status => sub { { nvme0n1 => { paths => [$own, $other] } } },
+ );
+ $disk->mock(is_mounted => sub { $mounted });
+ $disk->mock(has_holder => sub { 0 });
+ my $opener;
+ $disk->mock(device_opener => sub { $opener });
+ $cluster->mock(cfs_update => sub { ok($locked, 'configuration refreshed under lock') });
+ $storage->mock(config => sub { { ids => {} } });
+ $san->mock(
+ assert_lun_unreferenced => sub { $checks++; die "storage uses this namespace\n" });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'deletion keeps the lock');
+ is($opts{timeout}, 30, 'deletion is bounded');
+ is_deeply(
+ $cmd,
+ ['/usr/sbin/nvme', 'disconnect', '--device', '/dev/nvme1'],
+ 'only the selected controller is removed',
+ );
+ $commands++;
+ },
+ );
+ for my $ana ('optimized', 'non-optimized') {
+ $other->{'ana-state'} = $ana;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ }
+ is($commands, 2, 'another usable path permits removal');
+ is($checks, 0, 'no usage probe when another path is usable');
+ for my $ana ('inaccessible', 'persistent-loss', 'change') {
+ $other->{'ana-state'} = $ana;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, "$ana does not protect an in-use namespace");
+ }
+ $other = { device => '/dev/nvme2', state => 'connecting', 'ana-state' => 'optimized' };
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, 'reconnecting is not a usable path');
+ is($commands, 2, 'refusals never delete');
+ $own->{state} = 'connecting';
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 3, 'a controller that is no usable path either needs no storage check');
+ $opener = '4711 (kvm)';
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like(
+ $@,
+ qr/process 4711 \(kvm\) has namespace/,
+ 'but a process that has the namespace open refuses',
+ );
+ $opener = undef;
+ $own->{state} = 'live';
+ $san->mock(assert_lun_unreferenced => sub { $checks++ });
+ $mounted = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'local mount refuses');
+ $mounted = 0;
+ PVE::Tools::file_set_contents(
+ $PVE::NVMeOF::SWAPS,
+ "Filename Type Size Used Priority\n/dev/nvme0n1p2 partition 1024 0 -2\n",
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'a swap area on the namespace refuses');
+ PVE::Tools::file_set_contents($PVE::NVMeOF::SWAPS, "Filename Type Size Used Priority\n");
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1', { subsysnqn => 'nqn.other' }) };
+ like($@, qr/no longer connected to the listed subsystem/, 'a replaced controller refuses');
+ $opener = '4711 (kvm)';
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/process 4711 \(kvm\) has namespace 'nvme0n1' open/,
+ 'an open namespace refuses');
+ $opener = undef;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 4, 'unused namespace can lose its final path');
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1",
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme0c1n1",
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/do not use native NVMe multipath/, 'a namespace without head device refuses');
+ is($commands, 4, 'and nothing is disconnected');
+ remove_tree("$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1");
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 5, 'the path device of native multipath does not');
+ $headless = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/has no device/, 'uncheckable namespace refuses');
+ $busy = 1;
+ $nvme->mock(controllers => sub { die "must not count paths\n" });
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is busy/, 'ongoing deletion blocks another snapshot');
+ eval { PVE::NVMeOF::disconnect_guarded('../nvme1') };
+ like($@, qr/invalid controller/, 'invalid controller refused before locking');
+};
+
+subtest 'node API contract' => sub {
+ my $api = 'PVE::API2::NVMeOF';
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ $storage->mock(
+ config =>
+ sub { { ids => { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } } } },
+ );
+ $nvme->mock(is_supported => sub { 0 });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'uuid' } });
+ my $status = $api->status({ node => 'n1' });
+ is($status->{supported}, 0, 'availability means nvme-cli, not identity or version');
+ is($status->{'host-nqn'}, 'nqn.host', 'host identity shown independently');
+ $nvme->mock(is_supported => sub { 1 });
+ $nvme->mock(host_identity => sub { die "missing host identity\n" });
+ $status = $api->status({ node => 'n1' });
+ is_deeply(
+ $status,
+ { supported => 1, error => 'missing host identity' },
+ 'identity error does not hide installed tools',
+ );
+ $nvme->mock(
+ controllers => sub { {
+ nvme1 => {
+ subsystem => 'nqn.test',
+ transport => 'tcp',
+ traddr => '192.0.2.1',
+ trsvcid => 4420,
+ state => 'connecting',
+ },
+ } },
+ );
+ $nvme->mock(
+ namespaces => sub { die "must not walk the subsystems for each controller\n" },
+ namespace_counts => sub { { 'nqn.test' => 2, 'nqn.other' => 5 } },
+ );
+ my $rows = $api->controllers({ node => 'n1' });
+ is($rows->[0]->{namespaces}, 2, 'namespaces counted for the subsystem of the controller');
+ is($rows->[0]->{'used-by-storage'}, 'fabric', 'controller attributed');
+ is($rows->[0]->{state}, 'connecting', 'kernel state remains visible');
+
+ for my $pair (['status', $status], ['controllers', $rows]) {
+ my $method = $api->map_method_by_name($pair->[0]);
+ eval { PVE::JSONSchema::validate($pair->[1], $method->{returns}) };
+ is($@, '', "$pair->[0] schema");
+ ok($method->{protected} && $method->{proxyto} eq 'node', 'protected and node-proxied');
+ }
+ is(
+ $api->map_method_by_name('disconnect')->{path},
+ 'controller/{controller}',
+ 'REST-shaped deletion',
+ );
+ eval {
+ PVE::JSONSchema::validate(
+ { node => 'n1', controller => 'nvme1', subsysnqn => 'testsubsys' },
+ $api->map_method_by_name('disconnect')->{parameters},
+ );
+ };
+ is($@, '', 'the listed subsystem name is taken as is, also when it is no NQN');
+ my $rpc = Test::MockModule->new('PVE::RPCEnvironment');
+ {
+
+ package NVMeTestRPC;
+ sub get_user { 'root@pam' }
+ sub fork_worker { $_[4]->(); return 'UPID:test' }
+ }
+ $rpc->mock(get => sub { bless {}, 'NVMeTestRPC' });
+ my $removed;
+ $nvme->mock(disconnect_guarded => sub { $removed = $_[0] });
+ is(
+ $api->disconnect({ node => 'n1', controller => 'nvme1' }),
+ 'UPID:test',
+ 'API returns task identifier',
+ );
+ is($removed, 'nvme1', 'task calls guarded disconnect');
+};
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index ddd905ee..ac029207 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -212,6 +212,13 @@ subtest 'sysfs topology' => sub {
'namespace facts',
);
is_deeply(PVE::NVMeOF::namespaces('nqn.other'), {}, 'other subsystem excluded');
+ make_path(map { "$sys/class/nvme-subsystem/nvme-subsys1/nvme1n$_" } 1 .. 3);
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys1/subsysnqn", "nqn.other\n");
+ is_deeply(
+ PVE::NVMeOF::namespace_counts(),
+ { 'nqn.test' => 1, 'nqn.other' => 3 },
+ 'namespaces counted per subsystem',
+ );
};
subtest 'serialized commands inherit the lock' => sub {
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
index 73938a7e..2ae7b2b4 100755
--- a/src/test/run_san_api_tests.pl
+++ b/src/test/run_san_api_tests.pl
@@ -109,7 +109,7 @@ is_deeply(
);
is_deeply(
PVE::API2::SAN::Node->index({ node => 'test' }),
- [{ name => 'iscsi' }, { name => 'luns' }],
+ [{ name => 'iscsi' }, { name => 'luns' }, { name => 'nvmeof' }],
'node SAN index',
);
for my $case (
^ permalink raw reply related [relevance 16%]
* [PATCH v3 docs 10/18] storage: document NVMe over Fabrics storages
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (8 preceding siblings ...)
2026-11-22 1:25 18% ` [PATCH v3 storage 09/18] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
@ 2026-11-22 1:25 20% ` Thomas Lamprecht
2026-11-22 1:25 19% ` [PATCH v3 manager 12/18] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
` (6 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
Add a chapter for the nvmeof storage type: prerequisites, setting up
shared LVM on a namespace with the guided setup or by hand, the
properties, checking and disconnecting paths, and the limits of the
storage type. The introduction lists it among the network storages, and
the LVM chapter names it next to iSCSI as base storage.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
pve-gui.adoc | 12 ++-
pve-intro.adoc | 3 +-
pve-storage-lvm.adoc | 10 +-
pve-storage-multipath.adoc | 3 +-
pve-storage-nvmeof.adoc | 189 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 24 +++--
6 files changed, 222 insertions(+), 19 deletions(-)
create mode 100644 pve-storage-nvmeof.adoc
diff --git a/pve-gui.adoc b/pve-gui.adoc
index 9a1f70b..a514eca 100644
--- a/pve-gui.adoc
+++ b/pve-gui.adoc
@@ -233,10 +233,11 @@ On the datacenter level, you can access cluster-wide settings and information.
* *Options:* view and manage cluster-wide default settings.
* *Storage:* provides an interface for managing cluster storage. The *Add* menu
- offers guided setups for shared LVM on iSCSI and Fibre Channel LUNs.
+ offers guided setups for shared LVM on iSCSI and Fibre Channel LUNs and on
+ NVMe over Fabrics namespaces.
-* *SAN:* shows the state of the SAN LUNs on all nodes and manages the multipath
- configuration.
+* *SAN:* shows the state of the SAN LUNs and NVMe namespaces on all nodes and
+ manages the multipath configuration.
* *Backup:* schedule backup jobs. This operates cluster wide, so it doesn't
matter where the VMs/containers are on your cluster when scheduling.
@@ -288,8 +289,9 @@ The top header has useful buttons such as 'Reboot', 'Shutdown', 'Shell',
* *Disks:* get an overview of the attached disks, and manage how they are used.
-* *SAN:* get an overview of the SAN LUNs of the node, with their paths and
- usage. Below it, *iSCSI* shows the iSCSI targets and sessions.
+* *SAN:* get an overview of the SAN LUNs and NVMe namespaces of the node, with
+ their paths and usage. Below it, *iSCSI* shows the iSCSI targets and sessions,
+ and *NVMe over Fabrics* the connected controllers.
* *Ceph:* is only used if you have installed a Ceph server on your
host. In this case, you can manage your Ceph cluster and see the status
diff --git a/pve-intro.adoc b/pve-intro.adoc
index c2a0b6a..baec59f 100644
--- a/pve-intro.adoc
+++ b/pve-intro.adoc
@@ -103,9 +103,10 @@ the cluster have direct access to VM disk images.
The following network storage types are supported:
-* LVM group (network backing with iSCSI targets)
+* LVM group (network backing with iSCSI targets or NVMe over Fabrics)
* iSCSI target
* iSCSI LUNs (direct use)
+* NVMe over Fabrics subsystem
* NFS share
* CIFS share
* Ceph RBD
diff --git a/pve-storage-lvm.adoc b/pve-storage-lvm.adoc
index 92019fc..8b9564c 100644
--- a/pve-storage-lvm.adoc
+++ b/pve-storage-lvm.adoc
@@ -34,7 +34,8 @@ LVM volume group name. This must point to an existing volume group.
Base volume. This volume is automatically activated before accessing
the storage. This is mostly useful when the LVM volume group resides
-on a remote iSCSI server.
+on a remote iSCSI server or on an xref:storage_nvmeof[NVMe over Fabrics]
+namespace.
`saferemove`::
@@ -143,9 +144,10 @@ A benefit of LVM is that it can be used with shared storage.
For example, an iSCSI LUN. The backend implements proper cluster-wide locking if
the storage is marked as shared in the configuration.
-TIP: *Shared LVM on iSCSI* or *Shared LVM on Fibre Channel* in *Datacenter ->
-Storage -> Add* in the web UI creates a shared LVM storage on a SAN LUN, see
-xref:storage_multipath_setup[Multipath].
+TIP: *Shared LVM on iSCSI*, *Shared LVM on Fibre Channel* or *Shared LVM on NVMe
+over Fabrics* in *Datacenter -> Storage -> Add* in the web UI creates a shared
+LVM storage on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace].
NOTE: If you extend a shared volume group onto another device on one node, the
other nodes may only see the added physical volume after LVM has scanned their
diff --git a/pve-storage-multipath.adoc b/pve-storage-multipath.adoc
index 3e07eba..45ab3a8 100644
--- a/pve-storage-multipath.adoc
+++ b/pve-storage-multipath.adoc
@@ -15,7 +15,8 @@ Fibre Channel.
{pve} sets up the maps on all nodes and shows their state under *Datacenter ->
SAN*. An iSCSI storage with *Multipath* enabled requests the maps of its LUNs, a
Fibre Channel LUN needs a multipath entry. NVMe namespaces use the multipath
-support of the kernel instead and are not covered here.
+support of the kernel instead, see xref:storage_nvmeof[NVMe over Fabrics], and
+are not covered here.
Prerequisites
~~~~~~~~~~~~~
diff --git a/pve-storage-nvmeof.adoc b/pve-storage-nvmeof.adoc
new file mode 100644
index 0000000..2a5aaa6
--- /dev/null
+++ b/pve-storage-nvmeof.adoc
@@ -0,0 +1,189 @@
+[[storage_nvmeof]]
+NVMe over Fabrics Backend
+-------------------------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: NVMe over Fabrics
+endif::wiki[]
+
+Storage pool type: `nvmeof`
+
+NVMe over Fabrics (NVMe-oF) gives a node access to the namespaces of an NVMe
+subsystem on a storage array over TCP. Namespaces are the NVMe counterpart of
+LUNs. Use one as the base volume of a shared LVM storage, or use the namespaces
+directly as disk images.
+
+Each node connects one controller per portal of the storage. The kernel
+combines these paths into one device per namespace with its native NVMe
+multipath and reconnects lost paths on its own. `multipath-tools` is not
+involved.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+. Upgrade all nodes before adding the first NVMe over Fabrics storage, also
+ nodes that will not use it. A node without support for this storage type
+ removes such storages from the cluster-wide storage configuration when it
+ writes that configuration, for example when a storage is added or edited on
+ that node.
+. Install `nvme-cli` on every participating node. The `libpve-storage-perl`
+ package recommends it, but installations without recommended packages need it
+ added separately. Its installation creates the node's host NQN in
+ `/etc/nvme/hostnqn` and host ID in `/etc/nvme/hostid`. Nodes cloned from one
+ image share them. Give each a new identity before it connects, with
+ `nvme gen-hostnqn > /etc/nvme/hostnqn` and `uuidgen > /etc/nvme/hostid`.
+. Allow each node's host NQN on the array. The names are shown under
+ *Datacenter -> SAN* and in the guided setup.
+. Present the same empty namespace to all intended nodes. Portals are IP
+ addresses that every node can reach; host names are not accepted.
+. Use a storage network that only trusted hosts can reach. The connections use
+ neither authentication nor TLS.
+. Keep native NVMe multipath enabled, which is the kernel default
+ (`nvme_core.multipath=Y`).
+
+[[storage_nvmeof_setup]]
+Setting Up Shared LVM
+~~~~~~~~~~~~~~~~~~~~~
+
+. On a node that can reach the array, select *Shared LVM on NVMe over Fabrics*
+ under *Datacenter -> Storage -> Add*. The *Add Shared LVM* menu of
+ *Datacenter -> SAN* has the same setup.
+. Enter the *ID* of the new storage, a discovery portal and the subsystem, and
+ check the portals. If no NVMe over Fabrics storage connects the nodes to that
+ subsystem yet, the setup adds one named after the ID with a `-base` suffix, or
+ as set under *Advanced*. This storage connects to the subsystem with `content
+ none`, while the LVM storage manages guest disks. Clear the nodes in the list
+ of host NQNs that should not use the storages. Continuing creates or reuses
+ the NVMe over Fabrics storage before you select a namespace.
+. Select the namespace after checking that no host uses it and that no data on
+ it must be kept. The volume group is named after the ID unless set under
+ *Advanced*.
+. Check the state of the namespace on each node of the storage, which the
+ setup shows once the storage is added, as described for LUNs in
+ xref:storage_multipath_setup[Multipath]. For a node that stays *Missing*,
+ check its access to the namespace on the array before placing guests on the
+ storage.
+
+The discovery fills in *Portals*. Some targets, such as the Linux kernel
+target, report only the portal that was asked: add the others to the list.
+With a single portal, the state of the namespace shows `1/1`, which has no path
+redundancy.
+Portals can also be changed later in the edit dialog of the NVMe over Fabrics
+storage; each node then connects new ones on its own.
+
+*Datacenter -> Storage -> Add -> NVMe over Fabrics* adds only the NVMe over
+Fabrics storage. Without a discovery portal, enter the subsystem NQN and its
+portals as they are. Enable *Use namespaces directly* there to use whole
+namespaces as guest disks, or add an *LVM* storage on a namespace later, with
+the NVMe over Fabrics storage as *Base storage*.
+
+To set it up by hand, run these commands on a node that can reach the array:
+
+----
+# pvesm scan nvmeof <portal>
+# pvesm add nvmeof <nvmeof-storage> --subsysnqn <nqn> --portals <portals> \
+ --content none
+# pvesm list <nvmeof-storage>
+# pvesm add lvm <storage> --vgname <vg> --base <volume-id> --shared 1
+----
+
+Use the complete volume ID from the listing, `<nvmeof-storage>:nvme-<wwid>`.
+Adding the LVM storage creates the volume group if it does not exist yet.
+Creating it is refused if the namespace holds data that {pve} recognizes, such
+as partitions, a file system or a volume group, or if another storage references
+it. To reuse a namespace, wipe it as described for LUNs in
+xref:storage_multipath_setup[Multipath].
+
+Configuration
+~~~~~~~~~~~~~
+
+The backend supports the common storage properties `content`, `nodes`,
+`disable`, and the following NVMe over Fabrics specific properties:
+
+subsysnqn::
+
+The NQN of the NVMe subsystem. It cannot be changed later, and only one storage
+can use a subsystem.
+
+portals::
+
+Comma-separated list of the subsystem's TCP portals, one per path. Each is an
+IPv4 address or an IPv6 address in brackets, with an optional port (default
+4420).
+
+fast-io-fail-tmo::
+
+Seconds a path may be reconnecting before I/O sent to it fails. The default is
+120: guests get I/O errors once all paths of a namespace have been lost for
+that long. With `-1`, I/O waits until a path returns. A change applies to newly
+connected controllers only.
+
+.Configuration Example (`/etc/pve/storage.cfg`)
+----
+nvmeof: fabric
+ subsysnqn nqn.2010-06.com.example:array1
+ portals 192.0.2.10,192.0.2.11
+ content none
+----
+
+.Storage features for backend `nvmeof`
+[width="100%",cols="m,m,3*d",options="header"]
+|==============================================================================
+|Content types |Image formats |Shared |Snapshots |Clones
+|images none |raw |yes |no |no
+|==============================================================================
+
+{pve} does not create or delete namespaces; manage them on the array. A volume
+is named `nvme-<wwid>` after its namespace, like its link in `/dev/disk/by-id/`.
+
+Checking and Disconnecting Paths
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Datacenter -> SAN* lists the namespaces of NVMe over Fabrics
+storages among the LUNs, with their state on each node of the storage and
+*Multipath* shown as *Native*, as does *Node -> SAN* for the namespaces of a
+node. Expand a namespace under *Node -> SAN* to inspect its paths.
+Its *State* counts the usable paths out of the portals of the storage, for
+example `1/2` while one of two paths is unusable, and shows *Failed* without a
+usable path. *Node -> SAN ->
+NVMe over Fabrics* lists the node's controllers, one per connected portal,
+with their *State*: *Connected*, or *Reconnecting* while the kernel retries a
+lost path. A node sends a xref:notification_events[multipath notification] when
+a namespace loses or regains paths, as for a multipath map. A node that cannot
+query `multipathd` sends no such notifications, also not for its namespaces,
+although *Datacenter -> SAN* still shows their state.
+
+Each node of an enabled storage connects to the portals that it is not yet
+connected to. A portal that failed is retried after a minute. Removing a portal,
+or disabling or removing the storage, does not disconnect anything. To remove
+such a path, select its controller under *Node -> SAN -> NVMe over Fabrics* on
+each node and press *Disconnect*, or run
+`pvesh delete /nodes/<node>/san/nvmeof/controller/<controller>`.
+This is refused if a namespace that is mounted, in use by another device or as
+swap, open in a process such as a running guest, or referenced by a storage
+would lose its last usable path. For a controller that is no usable path itself,
+such as one that keeps reconnecting to a deleted subsystem, only the local uses
+count, not a storage reference. The process check does not find a process that
+opened the namespace through another device node, for example one in a
+container. A controller with namespaces that do not use native NVMe multipath is
+refused as well. A storage that still lists the portal connects to it again.
+Namespaces of a subsystem that no storage uses then show fewer paths, but none
+as missing, as nothing tells how many paths they should have.
+
+Limits
+~~~~~~
+
+* Only the TCP transport is supported, without authentication or TLS.
+* NVMe/FC namespaces need no storage of this type, and the guided setups and
+ the cluster-wide status do not cover them. *Node -> SAN* lists them. Create
+ their volume group under *Node -> Disks -> LVM*; with *Add Storage* enabled,
+ this adds a shared LVM storage.
+
+ifdef::wiki[]
+
+See Also
+~~~~~~~~
+
+* link:/wiki/Storage[Storage]
+
+endif::wiki[]
diff --git a/pvesm.adoc b/pvesm.adoc
index 8f1b24e..0bea1d2 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -79,6 +79,7 @@ nodes that can be accessed as RBD (RADOS Block Device).
|LVM-thin |lvmthin |block |no |yes |yes
|iSCSI/kernel |iscsi |block |yes^3^|yes^4^ |yes
|iSCSI/libiscsi |iscsidirect |block |yes^3^|yes^4^ |yes
+|NVMe-oF |nvmeof |block |yes^3^|yes^4^ |yes
|FC/SAS |native^6^ |block |yes^3^|yes^4^ |yes
|Ceph/RBD |rbd |block |yes |yes |yes
|ZFS over iSCSI |zfs |block |yes |yes |yes
@@ -96,11 +97,13 @@ TiB sized), these operations may take several minutes, or in extreme cases, even
hours. If your setup is affected, create and remove snapshots while the VM is
shut down, expecting a long task duration.
-^3^: With iSCSI, Fibre Channel (FC), or SAS block storage as shared storage in
-a cluster, LVM is used to split the LUN into virtual disks. A LUN is usually
-reachable over several paths; xref:storage_multipath[Multipath] describes how
-{pve} manages them in a cluster. FC and SAS LUNs need a
-xref:storage_multipath_entries[multipath entry].
+^3^: With iSCSI, NVMe over Fabrics (NVMe-oF), Fibre Channel (FC), or SAS block
+storage as shared storage in a cluster, LVM is used to split the LUN or
+namespace into virtual disks. A LUN is usually reachable over several paths;
+xref:storage_multipath[Multipath] describes how {pve} manages them in a cluster.
+FC and SAS LUNs need a xref:storage_multipath_entries[multipath entry].
+NVMe-oF namespaces use the kernel's native multipath instead, see
+xref:storage_nvmeof[NVMe over Fabrics].
^4^: Since {pve} 9, snapshots as a volume chain have been available for VMs.
These snapshots use separate volumes for the snapshot data and layer them. For
@@ -154,9 +157,10 @@ is available on all nodes, but it is physically different and can have
totally different content.
Add storage under *Datacenter -> Storage -> Add* in the web UI. For shared LVM
-on a xref:storage_multipath_setup[SAN LUN], use *Shared LVM on iSCSI* or
-*Shared LVM on Fibre Channel* there instead. It creates the storages that are
-needed and enables multipath for the LUN.
+on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace], use *Shared LVM on iSCSI*, *Shared
+LVM on Fibre Channel* or *Shared LVM on NVMe over Fabrics* there instead. It
+creates the storages that are needed and enables multipath for a LUN.
Storage Pools
@@ -507,6 +511,8 @@ See Also
* link:/wiki/Storage:_Multipath[Storage: Multipath]
+* link:/wiki/Storage:_NVMe_over_Fabrics[Storage: NVMe over Fabrics]
+
* link:/wiki/Storage:_LVM[Storage: LVM]
* link:/wiki/Storage:_LVM_Thin[Storage: LVM Thin]
@@ -551,6 +557,8 @@ include::pve-storage-iscsidirect.adoc[]
include::pve-storage-multipath.adoc[]
+include::pve-storage-nvmeof.adoc[]
+
include::pve-storage-rbd.adoc[]
include::pve-storage-cephfs.adoc[]
^ permalink raw reply related [relevance 20%]
* [PATCH v3 storage 09/18] multipath: report NVMe over Fabrics namespaces in the cluster status
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (7 preceding siblings ...)
2026-11-22 1:25 10% ` [PATCH v3 storage 08/18] multipath: report the NVMe host NQN of each node Thomas Lamprecht
@ 2026-11-22 1:25 18% ` Thomas Lamprecht
2026-11-22 1:25 20% ` [PATCH v3 docs 10/18] storage: document NVMe over Fabrics storages Thomas Lamprecht
` (7 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the LUNs that multipathd handles on
each node. The namespaces of an NVMe over Fabrics storage use the
native multipath of the kernel and were missing from it, so a lost
path or a node without access to a namespace only showed in the LUN
list of that node.
Let each node report the namespaces of the subsystems such a storage
names, with the path counts its LUN list already shows, and expect
them on the nodes of the storage like the LUNs of an iSCSI storage.
They do not depend on multipathd, so a node without it reports them
as well and only the state of its maps stays unknown. A node that
cannot list its namespaces marks its report, so that they show as
unknown there instead of missing.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/SAN/Cluster.pm | 17 +++-
src/PVE/Multipath/Status.pm | 67 ++++++++++++++--
src/test/run_multipath_api_tests.pl | 120 +++++++++++++++++++++++++++-
3 files changed, 191 insertions(+), 13 deletions(-)
diff --git a/src/PVE/API2/SAN/Cluster.pm b/src/PVE/API2/SAN/Cluster.pm
index ac372d65..4d7f0011 100644
--- a/src/PVE/API2/SAN/Cluster.pm
+++ b/src/PVE/API2/SAN/Cluster.pm
@@ -63,7 +63,8 @@ my $lun_node_schema = {
minimum => 0,
optional => 1,
description => 'The number of active paths of the map whose checker state is ready,'
- . ' ghost, or not reported.',
+ . ' ghost, or not reported. For an NVMe namespace, the number of its paths over a'
+ . ' live controller whose ANA state is optimized, non-optimized, or not reported.',
},
'paths-total' => {
type => 'integer',
@@ -77,7 +78,8 @@ my $lun_node_schema = {
optional => 1,
description => 'The number of paths the LUN should have on the node: the highest of'
. ' the count of its multipath entry and, for each managed iSCSI storage of the'
- . ' LUN, the number of its portals.',
+ . ' LUN, the number of its portals. For an NVMe namespace, the number of portals'
+ . ' of its NVMe over Fabrics storage.',
},
},
};
@@ -165,6 +167,12 @@ __PACKAGE__->register_method({
wwid => { type => 'string', description => 'The LUN WWID.' },
explicit =>
{ type => 'boolean', description => 'An explicit entry exists.' },
+ native => {
+ type => 'boolean',
+ optional => 1,
+ description => 'An NVMe namespace, which uses the native'
+ . ' multipath of the kernel.',
+ },
name => {
type => 'string',
optional => 1,
@@ -177,8 +185,9 @@ __PACKAGE__->register_method({
optional => 1,
description =>
'The storage that uses the LUN: as its base volume or through'
- . ' the volume group on it, or as an iSCSI storage that serves'
- . ' the LUNs of its target as images.',
+ . ' the volume group on it, or as an iSCSI or NVMe over Fabrics'
+ . ' storage that serves the LUNs of its target or subsystem as'
+ . ' images.',
},
'multipath-storage' => {
type => 'string',
diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm
index 1b85e108..baae32a6 100644
--- a/src/PVE/Multipath/Status.pm
+++ b/src/PVE/Multipath/Status.pm
@@ -9,6 +9,7 @@ use MIME::Base64 qw(decode_base64 encode_base64);
use PVE::Cluster;
use PVE::INotify;
+use PVE::Diskmanage;
use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
@@ -37,6 +38,47 @@ sub worst_state(@states) {
return $worst;
}
+# Namespaces use the native multipath of the kernel, so their state does not depend on multipathd.
+my sub namespace_luns($pv_vgs) {
+ require PVE::Storage;
+ my $cfg = PVE::Storage::config();
+ my $node = PVE::INotify::nodename();
+ my @storages = grep {
+ my $scfg = $cfg->{ids}->{$_};
+ $scfg->{type} eq 'nvmeof'
+ && !$scfg->{disable}
+ && (!$scfg->{nodes} || $scfg->{nodes}->{$node})
+ } sort keys $cfg->{ids}->%*;
+ # reading the paths walks all NVMe namespaces of the node, also those of other plugins
+ return [] if !@storages;
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %luns;
+ for my $sid (@storages) {
+ my $scfg = $cfg->{ids}->{$sid};
+ my $expected = eval { scalar(PVE::NVMeOF::storage_paths($scfg)->@*) };
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ for my $name (sort keys %$namespaces) {
+ my $wwid = $namespaces->{$name}->{wwid};
+ next if $luns{$wwid};
+ my $paths = $status->{$name} // { active => 0, paths => [] };
+ my $total = scalar($paths->{paths}->@*);
+ my $lun = $luns{$wwid} = {
+ wwid => $wwid,
+ native => 1,
+ size => $namespaces->{$name}->{size},
+ storages => [$sid],
+ 'paths-total' => $total,
+ 'paths-active' => $paths->{active},
+ state => PVE::Multipath::derive_health($paths->{active}, $total, $expected),
+ };
+ $lun->{'paths-expected'} = $expected if defined($expected);
+ my $vg = ($pv_vgs // {})->{"/dev/$name"};
+ $lun->{vgname} = $vg if defined($vg);
+ }
+ }
+ return [map { $luns{$_} } sort keys %luns];
+}
+
sub publish($report) {
my $node = PVE::INotify::nodename();
my $now = time();
@@ -68,11 +110,11 @@ sub update_node_status() {
require PVE::NVMeOF;
my $host = eval { PVE::NVMeOF::host_identity() };
$report->{'nvme-host-nqn'} = $host->{nqn} if $host;
+ require PVE::Storage::LVMPlugin;
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
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();
- require PVE::Storage::LVMPlugin;
- my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
# A node can have many maps that something else set up, for example a storage plugin with
# one LUN per guest disk. Only the maps that the node manages, that are the base volume of a
# storage or hold its volume group get a row, the others are counted.
@@ -134,8 +176,15 @@ sub update_node_status() {
if (my $error = $@) {
chomp $error;
$report->{error} = $error;
- delete $report->{luns};
+ $report->{luns} = [];
}
+ my $namespaces = eval { namespace_luns($pv_vgs) };
+ if (my $error = $@) {
+ warn "multipath: cannot query NVMe namespaces - $error";
+ # a consumer must not take the namespaces as gone
+ $report->{'namespaces-unknown'} = 1;
+ }
+ push $report->{luns}->@*, @$namespaces if $namespaces;
eval { publish($report) };
warn "multipath: cannot publish node status - $@" if $@;
return $report;
@@ -152,7 +201,7 @@ sub cluster_status() {
my %reports = map { $_ => decode_report($raw->{$_}) // {} } @$all_nodes;
my %reported = map { $_->{wwid} => 1 }
grep { defined($_->{wwid}) } map { ($_->{luns} // [])->@* } values %reports;
- my (%nodes, %luns, %expected, %observed, %vg_owner, %disabled_owner);
+ my (%nodes, %luns, %expected, %observed, %vg_owner, %lists, %disabled_owner);
# the nodes that list a map because the configuration names it for them
my (%managed, %unhinted);
my $storage_nodes = sub($scfg) {
@@ -178,7 +227,6 @@ sub cluster_status() {
$vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
next if $scfg->{type} ne 'lvm';
my $base = PVE::Multipath::parse_base_volume($scfg->{base}) // next;
- next if $base->{kind} eq 'nvme'; # a namespace, which has no map
# A base volume by its SCSI name is a map only if its iSCSI storage requests maps. The name
# can also be another by-id link of the LUN, so only a WWID that a node reports counts.
my $map = $requests_maps->($base->{storage}) && $reported{ $base->{wwid} };
@@ -190,6 +238,7 @@ sub cluster_status() {
next;
}
$luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $luns{$wwid}->{native} = 1 if $base->{kind} eq 'nvme';
$luns{$wwid}->{'used-by-storage'} //= $sid;
$managed{$wwid}->{$_} = 1 for @$all_nodes;
$luns{$wwid}->{'multipath-storage'} //= $base->{storage}
@@ -206,11 +255,13 @@ sub cluster_status() {
$entry->{$_} = $report->{$_} for grep { defined($report->{$_}) } @keys;
$entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok';
$unhinted{$node} = 1 if $report->{'vgs-unknown'};
- next if $entry->{state} ne 'ok';
+ # the node lists its namespaces, also if it is unavailable for its maps
+ $lists{$node} = 1 if $report->{luns} && !$report->{'namespaces-unknown'};
for my $lun (($report->{luns} // [])->@*) {
my $wwid = $lun->{wwid} // next;
my $row = $luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $row->{native} = 1 if $lun->{native};
$row->{$_} //= $lun->{$_} for grep { defined($lun->{$_}) } qw(name size);
my $owner = defined($lun->{vgname}) ? $vg_owner{ $lun->{vgname} } : undef;
$row->{'used-by-storage'} //= $owner if defined($owner);
@@ -244,10 +295,10 @@ sub cluster_status() {
if ($observed{$wwid}->{$node}) {
$row->{nodes}->{$node} = $observed{$wwid}->{$node};
} elsif ($expected{$wwid}->{$node}) {
- my $listed = $nodes{$node}->{state} eq 'ok';
+ my $listed = $row->{native} ? $lists{$node} : $nodes{$node}->{state} eq 'ok';
# without the hint file of LVM a node leaves a map out that it only knows through
# the volume group of a storage
- $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node};
+ $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node} && !$row->{native};
$row->{nodes}->{$node} = { state => $listed ? 'missing' : 'unknown' };
}
}
diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl
index a91332df..85ddce7b 100755
--- a/src/test/run_multipath_api_tests.pl
+++ b/src/test/run_multipath_api_tests.pl
@@ -686,7 +686,12 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
my $status = Test::MockModule->new('PVE::Multipath::Status');
my $mp = Test::MockModule->new('PVE::Multipath');
my $iscsi = Test::MockModule->new('PVE::Storage::ISCSIPlugin');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $disks = Test::MockModule->new('PVE::Diskmanage');
my ($report, @order);
+ my $ids = {};
+ $storage->mock(config => sub { { ids => $ids } });
+ $disks->mock(get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
$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' } });
@@ -728,6 +733,58 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
is($report->{luns}->[0]->{'paths-expected'}, 3, 'expected count reported');
is($report->{luns}->[0]->{state}, 'degraded', 'fewer paths than expected');
ok(!exists($report->{supported}), 'the report has no separate "supported" field');
+
+ $ids->{nvme} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test:sub',
+ portals => '192.0.2.1,192.0.2.2',
+ };
+ $nvme->mock(
+ namespaces => sub($nqn) {
+ return $nqn eq 'nqn.test:sub'
+ ? { nvme1n1 => { wwid => 'uuid.1', size => 4096 } }
+ : {};
+ },
+ );
+ my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+ $lvm->mock(cached_pv_volume_groups => sub { { '/dev/nvme1n1' => 'vgns' } });
+ my $namespace = {
+ wwid => 'uuid.1',
+ native => 1,
+ size => 4096,
+ storages => ['nvme'],
+ vgname => 'vgns',
+ 'paths-total' => 1,
+ 'paths-active' => 1,
+ 'paths-expected' => 2,
+ state => 'degraded',
+ };
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}->[1], $namespace, 'namespace with fewer paths than portals');
+ $mp->mock(is_running => sub { 0 });
+ PVE::Multipath::Status::update_node_status();
+ is(
+ $report->{error},
+ 'multipathd is not running or does not respond',
+ 'stopped daemon still reported',
+ );
+ is_deeply($report->{luns}, [$namespace], 'namespaces do not need multipathd');
+ ok(!$report->{'namespaces-unknown'}, 'which the node could list');
+ {
+ local $ids->{nvme}->{disable} = 1;
+ $disks->mock(get_nvme_path_status => sub { die "walked the NVMe paths\n" });
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}, [], 'a disabled storage reports no namespaces');
+ ok(!$report->{'namespaces-unknown'}, 'and reads no NVMe paths for them');
+ $disks->mock(
+ get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
+ }
+ $nvme->mock(namespaces => sub { die "sysfs gone\n" });
+ {
+ local $SIG{__WARN__} = sub { };
+ PVE::Multipath::Status::update_node_status();
+ }
+ ok($report->{'namespaces-unknown'}, 'a failed namespace query marks the report');
};
subtest 'API returns final node and LUN states' => sub {
@@ -764,12 +821,31 @@ subtest 'API returns final node and LUN states' => sub {
'paths-active' => 2,
storages => ['scoped'],
},
+ {
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'optimal',
+ 'paths-total' => 2,
+ 'paths-active' => 2,
+ storages => ['nvme'],
+ },
],
}),
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' }),
+ n5 => encode_report({
+ time => $NOW,
+ error => 'multipath-tools is not installed',
+ luns => [{
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'degraded',
+ 'paths-total' => 2,
+ 'paths-active' => 1,
+ storages => ['nvme'],
+ }],
+ }),
);
$cluster->mock(get_node_kv => sub { \%raw });
my $entries = { '3600a' => { type => 'wwid' } };
@@ -787,6 +863,8 @@ subtest 'API returns final node and LUN states' => sub {
{ type => 'iscsi', 'managed-multipath' => 1, nodes => { departed => 1 } },
lvmgone => { type => 'lvm', base => 'gone:0.0.0.dm-uuid-mpath-3600e' },
scoped => { type => 'iscsi', 'managed-multipath' => 1, nodes => { n2 => 1 } },
+ nvme => { type => 'nvmeof', subsysnqn => 'nqn.test:sub' },
+ lvmns => { type => 'lvm', base => 'nvme:nvme-uuid.2', nodes => { n5 => 1 } },
},
} },
);
@@ -848,6 +926,46 @@ subtest 'API returns final node and LUN states' => sub {
'an entry for other nodes does not change that',
);
}
+ my $namespace = $lun{'uuid.1'};
+ ok($namespace->{native}, 'namespace marked as native');
+ ok(!exists($namespace->{'multipath-storage'}), 'a namespace has no requested map');
+ is_deeply(
+ { map { $_ => $namespace->{nodes}->{$_}->{state} } keys $namespace->{nodes}->%* },
+ {
+ n1 => 'optimal',
+ n2 => 'missing',
+ n3 => 'unknown',
+ n4 => 'unknown',
+ n5 => 'degraded',
+ },
+ 'namespace state of a node without multipathd counts',
+ );
+ is($lun->{nodes}->{n5}->{state}, 'unknown', 'no map state from a node without multipathd');
+ is_deeply(
+ $lun{'uuid.2'},
+ {
+ wwid => 'uuid.2',
+ explicit => 0,
+ native => 1,
+ 'used-by-storage' => 'lvmns',
+ state => 'missing',
+ nodes => { n5 => { state => 'missing' } },
+ },
+ 'base namespace that a node without multipathd does not report',
+ );
+ $raw{n5} = encode_report({ time => $NOW, error => 'too many LUNs to report' });
+ $res = PVE::API2::SAN::Cluster->status({});
+ %lun = map { $_->{wwid} => $_ } $res->{luns}->@*;
+ is($lun{'uuid.2'}->{nodes}->{n5}->{state}, 'unknown', 'node without a list');
+ {
+ local $raw{n2} = encode_report({ time => $NOW, luns => [], 'namespaces-unknown' => 1 });
+ my %unlisted = map { $_->{wwid} => $_ } PVE::API2::SAN::Cluster->status({})->{luns}->@*;
+ is(
+ $unlisted{'uuid.1'}->{nodes}->{n2}->{state},
+ 'unknown',
+ 'a node that could not query its namespaces does not miss them',
+ );
+ }
eval {
PVE::JSONSchema::validate(
$res,
^ permalink raw reply related [relevance 18%]
* [PATCH v3 manager 15/18] ui: node san: list NVMe over Fabrics controllers
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (12 preceding siblings ...)
2026-11-22 1:25 19% ` [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 13% ` Thomas Lamprecht
2026-11-22 1:25 13% ` [PATCH v3 manager 17/18] ui: san: show that a namespace uses native multipath Thomas Lamprecht
` (2 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
Add a view below Node > SAN with the controllers of a node, one per
connected portal, with their transport, state and storage, and the host
NQN of the node. A controller can be disconnected there, for example
after its portal was removed from the storage, which the node refuses
for the last usable path of a namespace in use. The controllers come
from sysfs, so the view lists them also without nvme-cli, which only
Disconnect needs.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/SANUtils.js | 5 +
www/manager6/Utils.js | 1 +
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 152 +++++++++++++++++++++++++
5 files changed, 167 insertions(+), 1 deletion(-)
create mode 100644 www/manager6/node/NVMeOFControllers.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index f2fc80279..f3591e1c8 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -253,6 +253,7 @@ JSSRC= \
node/ISCSITargets.js \
node/LVM.js \
node/LVMThin.js \
+ node/NVMeOFControllers.js \
node/SANLuns.js \
node/StatusView.js \
node/Subscription.js \
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index d28285d22..abff7f458 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -132,6 +132,11 @@ Ext.define('PVE.SANUtils', {
'logged-in': ['check-circle good', gettext('Connected')],
recovering: ['exclamation-circle warning', gettext('Reconnecting')],
'not-connected': ['times-circle faded', gettext('Not connected')],
+ live: ['check-circle good', gettext('Connected')],
+ connecting: ['exclamation-circle warning', gettext('Reconnecting')],
+ resetting: ['exclamation-circle warning', gettext('Reconnecting')],
+ deleting: ['times-circle faded', gettext('Disconnecting')],
+ 'deleting (no IO)': ['times-circle faded', gettext('Disconnecting')],
}[state];
let [icon, label] = display ?? ['question-circle faded', state];
return `<i class="fa fa-fw fa-${icon}"></i> ${Ext.htmlEncode(text ?? label)}`;
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index d508d0469..fc3667f51 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -2276,6 +2276,7 @@ Ext.define('PVE.Utils', {
lvmthinremove: ['Thinpool', gettext('Remove')],
migrateall: ['', gettext('Bulk migrate VMs and Containers')],
move_volume: ['CT', gettext('Move Volume')],
+ nvmedisconnect: ['NVMe-oF', gettext('Disconnect')],
'pbs-download': ['VM/CT', gettext('File Restore Download')],
pull_file: ['CT', gettext('Pull file')],
push_file: ['CT', gettext('Push file')],
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index c85183766..830e8542a 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -398,7 +398,7 @@ Ext.define('PVE.node.Config', {
);
}
- // the LUN and iSCSI reads of the node accept either privilege
+ // the LUN, iSCSI and NVMe over Fabrics reads of the node accept either privilege
if (caps.nodes['Sys.Audit'] || caps.storage['Datastore.Allocate']) {
me.items.push(
{
@@ -414,6 +414,13 @@ Ext.define('PVE.node.Config', {
iconCls: 'fa fa-bullseye',
groups: ['san'],
},
+ {
+ xtype: 'pveNVMeOFControllerList',
+ title: 'NVMe over Fabrics',
+ itemId: 'san-nvmeof',
+ iconCls: 'fa fa-plug',
+ groups: ['san'],
+ },
);
}
diff --git a/www/manager6/node/NVMeOFControllers.js b/www/manager6/node/NVMeOFControllers.js
new file mode 100644
index 000000000..cad9b4cbc
--- /dev/null
+++ b/www/manager6/node/NVMeOFControllers.js
@@ -0,0 +1,152 @@
+Ext.define('PVE.node.NVMeOFControllerList', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'pveNVMeOFControllerList',
+ onlineHelp: 'storage_nvmeof',
+ emptyText: gettext('No NVMe over Fabrics controllers found'),
+ viewConfig: { enableTextSelection: true },
+ store: {
+ fields: [
+ 'controller',
+ 'transport',
+ 'subsysnqn',
+ 'portal',
+ 'state',
+ 'namespaces',
+ 'used-by-storage',
+ ],
+ sorters: ['subsysnqn', 'portal'],
+ },
+ columns: [
+ { text: gettext('Controller'), dataIndex: 'controller', width: 100 },
+ {
+ text: gettext('Subsystem'),
+ dataIndex: 'subsysnqn',
+ flex: 5,
+ renderer: Ext.htmlEncode,
+ },
+ {
+ text: gettext('Transport'),
+ dataIndex: 'transport',
+ width: 90,
+ // the transport of the controller, named as for the paths of a namespace
+ renderer: (value) => PVE.SANUtils.renderSanTransport(value && `nvme-${value}`),
+ },
+ { text: gettext('Portal'), dataIndex: 'portal', width: 180, renderer: Ext.htmlEncode },
+ {
+ text: gettext('State'),
+ dataIndex: 'state',
+ width: 150,
+ renderer: PVE.SANUtils.renderState,
+ },
+ { text: gettext('Namespaces'), dataIndex: 'namespaces', width: 110 },
+ {
+ text: gettext('Storage'),
+ dataIndex: 'used-by-storage',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+
+ reload: function () {
+ let me = this;
+ let load = (path, success) =>
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${me.nodename}/san/nvmeof/${path}`,
+ method: 'GET',
+ waitMsgTarget: me.getView(),
+ failure: (response) =>
+ Proxmox.Utils.setErrorMask(me.getView(), response.htmlStatus),
+ success: (response) => !me.destroyed && success(response.result.data),
+ });
+ load('status', function (status) {
+ me.down('#hostnqn').setValue(status['host-nqn'] || '');
+ me.supported = !!status.supported;
+ let error = status.supported
+ ? status.error
+ : gettext('nvme-cli is not installed on this node.');
+ // the controllers come from sysfs, which needs neither nvme-cli nor a host identity
+ let warning = me.down('#warning');
+ warning.setHtml(
+ error
+ ? `<i class="fa fa-fw fa-exclamation-triangle warning"></i> ${Ext.htmlEncode(error)}`
+ : '',
+ );
+ warning.setHidden(!error);
+ load('controller', function (controllers) {
+ Proxmox.Utils.setErrorMask(me.getView(), false);
+ me.getStore().setData(controllers);
+ });
+ });
+ },
+
+ listeners: {
+ activate: function () {
+ this.reload();
+ },
+ },
+
+ initComponent: function () {
+ let me = this;
+ me.nodename = me.pveSelNode.data.node;
+ me.tbar = [
+ { text: gettext('Reload'), iconCls: 'fa fa-refresh', handler: () => me.reload() },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Disconnect'),
+ iconCls: 'fa fa-unlink',
+ disabled: true,
+ dangerous: true,
+ // the disconnect uses nvme-cli
+ enableFn: () => !!Ext.state.Manager.get('GuiCap').dc['Sys.Modify'] && me.supported,
+ confirmMsg: (rec) =>
+ Ext.String.format(
+ gettext(
+ 'Disconnect controller {0} from portal {1}? A storage that still lists that portal connects to it again.',
+ ),
+ Ext.htmlEncode(rec.get('controller')),
+ Ext.htmlEncode(rec.get('portal')),
+ ),
+ handler: (button, event, rec) =>
+ Proxmox.Utils.API2Request({
+ // refused if the kernel reused the controller number meanwhile
+ url:
+ `/nodes/${me.nodename}/san/nvmeof/controller/${rec.get('controller')}?` +
+ Ext.Object.toQueryString({
+ subsysnqn: rec.get('subsysnqn'),
+ portal: rec.get('portal'),
+ }),
+ method: 'DELETE',
+ waitMsgTarget: me,
+ failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+ success: (response) =>
+ Ext.create('Proxmox.window.TaskProgress', {
+ upid: response.result.data,
+ autoShow: true,
+ taskDone: () => !me.destroyed && me.reload(),
+ }),
+ }),
+ },
+ '->',
+ {
+ xtype: 'displayfield',
+ itemId: 'hostnqn',
+ fieldLabel: gettext('Host NQN'),
+ },
+ {
+ iconCls: 'fa fa-clipboard',
+ tooltip: gettext('Copy to Clipboard'),
+ handler: () => PVE.Utils.copyToClipboard(me.down('#hostnqn').getValue()),
+ },
+ ];
+ me.dockedItems = [
+ {
+ xtype: 'component',
+ itemId: 'warning',
+ dock: 'top',
+ padding: 5,
+ hidden: true,
+ },
+ ];
+ me.callParent();
+ },
+});
^ permalink raw reply related [relevance 13%]
* [PATCH v3 manager 12/18] ui: storage: add NVMe over Fabrics storage
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (9 preceding siblings ...)
2026-11-22 1:25 20% ` [PATCH v3 docs 10/18] storage: document NVMe over Fabrics storages Thomas Lamprecht
@ 2026-11-22 1:25 19% ` Thomas Lamprecht
2026-11-22 1:25 20% ` [PATCH v3 manager 13/18] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
` (5 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
Show NVMe over Fabrics storages with their subsystem in the storage
list, and add a dialog for them. The dialog lists the subsystems that a
discovery portal reports and fills in the portals of the selected one,
which can be changed. Without a discovery portal, the subsystem and its
portals can be entered as they are. As in the iSCSI dialog, the
discovery can run on another node, since the node serving the web UI
may not be allowed on the array. The node of the discovery is then
preselected as the node of the storage.
The subsystem selector builds on the iSCSI target selector, which now
lets a subclass set its store fields and sort key.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/Utils.js | 6 ++
www/manager6/dc/StorageView.js | 14 ++-
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/NVMeOFEdit.js | 150 +++++++++++++++++++++++++++++
5 files changed, 172 insertions(+), 4 deletions(-)
create mode 100644 www/manager6/storage/NVMeOFEdit.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 1ee82e9a9..dddf17590 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -380,6 +380,7 @@ JSSRC= \
storage/LvmThinEdit.js \
storage/BTRFSEdit.js \
storage/NFSEdit.js \
+ storage/NVMeOFEdit.js \
storage/PBSEdit.js \
storage/RBDEdit.js \
storage/StatusView.js \
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index faf621bc5..d508d0469 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -886,6 +886,12 @@ Ext.define('PVE.Utils', {
faIcon: 'building',
backups: false,
},
+ nvmeof: {
+ name: 'NVMe over Fabrics',
+ ipanel: 'NVMeOFInputPanel',
+ faIcon: 'building',
+ backups: false,
+ },
cephfs: {
name: 'CephFS',
ipanel: 'CephFSInputPanel',
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index baad3990f..6afea33ce 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -68,8 +68,9 @@ Ext.define(
});
},
- // What a storage is on: the volume group or pool for the types without path or target.
- storageLocation: function ({ type, vgname, thinpool, pool, target, path }) {
+ // What a storage is on: the volume group, pool or subsystem for the types without path or
+ // target.
+ storageLocation: function ({ type, vgname, thinpool, pool, subsysnqn, target, path }) {
switch (type) {
case 'lvm':
return vgname;
@@ -77,6 +78,8 @@ Ext.define(
return vgname && thinpool ? `${vgname}/${thinpool}` : vgname;
case 'zfspool':
return pool;
+ case 'nvmeof':
+ return subsysnqn;
default:
return target || path;
}
@@ -208,6 +211,13 @@ Ext.define(
),
'lun target',
],
+ nvmeof: [
+ 'san',
+ gettext(
+ 'Connect to an NVMe/TCP subsystem, to use its namespaces directly or as base of an LVM storage.',
+ ),
+ 'nvme tcp subsystem namespace',
+ ],
zfs: [
'san',
gettext(
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index c26c83467..192b974ea 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -5,6 +5,7 @@ Ext.define('PVE.storage.IScsiScan', {
queryParam: 'portal',
valueField: 'target',
displayField: 'target',
+ scanFields: ['target', 'portal'],
matchFieldWidth: false,
allowBlank: false,
@@ -56,13 +57,13 @@ Ext.define('PVE.storage.IScsiScan', {
}
let store = Ext.create('Ext.data.Store', {
- fields: ['target', 'portal'],
+ fields: me.scanFields,
proxy: {
type: 'proxmox',
url: `${me.apiBaseUrl}${me.nodename}${me.apiSuffix}`,
},
});
- store.sort('target', 'ASC');
+ store.sort(me.valueField, 'ASC');
Ext.apply(me, {
store: store,
diff --git a/www/manager6/storage/NVMeOFEdit.js b/www/manager6/storage/NVMeOFEdit.js
new file mode 100644
index 000000000..2ff1eb662
--- /dev/null
+++ b/www/manager6/storage/NVMeOFEdit.js
@@ -0,0 +1,150 @@
+Ext.define('PVE.storage.NVMeOFScan', {
+ extend: 'PVE.storage.IScsiScan',
+ alias: 'widget.pveNVMeOFScan',
+
+ valueField: 'subsysnqn',
+ displayField: 'subsysnqn',
+ scanFields: ['subsysnqn', 'portals'],
+
+ listConfig: {
+ width: 650,
+ columns: [
+ {
+ dataIndex: 'subsysnqn',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+ emptyText: PVE.Utils.renderNotFound(gettext('Subsystem')),
+ },
+
+ config: {
+ apiSuffix: '/scan/nvmeof',
+ },
+});
+
+Ext.define('PVE.storage.NVMeOFInputPanel', {
+ extend: 'PVE.panel.StorageBase',
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ onlineHelp: 'storage_nvmeof',
+
+ namespaceContent: 'images',
+
+ onGetValues: function (values) {
+ let me = this;
+
+ values.content = values.namespaces ? me.namespaceContent : 'none';
+ delete values.namespaces;
+
+ return me.callParent([values]);
+ },
+
+ // a storage can be restricted to some volume types, keep its content types then
+ setValues: function (values) {
+ let me = this;
+
+ values.namespaces = PVE.Utils.contentAllows(values.content, 'vm-vol');
+ if (values.namespaces) {
+ me.namespaceContent = Ext.Array.from(values.content).join(',');
+ }
+ me.callParent([values]);
+ },
+
+ column1: [
+ {
+ xtype: 'textfield',
+ name: 'discovery-portal',
+ fieldLabel: gettext('Discovery Portal'),
+ // without discovery, the subsystem and portals can be entered as they are
+ allowBlank: true,
+ submitValue: false,
+ cbind: {
+ hidden: '{!isCreate}',
+ disabled: '{!isCreate}',
+ },
+ listeners: {
+ change: {
+ fn: function (field, value) {
+ let scan = this.up('inputpanel').lookup('subsystemScan');
+ scan.setHideTrigger(!value);
+ scan.setPortal(value);
+ scan.setValue('');
+ if (!value) {
+ scan.getStore().removeAll();
+ }
+ },
+ buffer: 500,
+ },
+ },
+ },
+ {
+ xtype: 'checkbox',
+ name: 'namespaces',
+ boxLabel: gettext('Use namespaces directly'),
+ },
+ ],
+
+ // NQNs and portal lists are longer than a column is wide
+ columnB: [
+ {
+ cbind: {
+ xtype: (get) => (get('isCreate') ? 'pveNVMeOFScan' : 'displayfield'),
+ hideTrigger: '{isCreate}',
+ },
+ // an NQN can also be typed, if the array offers no discovery
+ editable: true,
+ notFoundIsValid: true,
+ // the list needs a discovery portal
+ expand: function () {
+ if (this.portal) {
+ this.self.prototype.expand.call(this);
+ }
+ },
+ name: 'subsysnqn',
+ value: '',
+ fieldLabel: gettext('Subsystem'),
+ allowBlank: false,
+ reference: 'subsystemScan',
+ listeners: {
+ change: function (field, value) {
+ let rec = field
+ .getStore?.()
+ .findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ field
+ .up('inputpanel')
+ .down('field[name=portals]')
+ .setValue(rec.get('portals'));
+ }
+ },
+ nodechanged: function (value) {
+ this.up('inputpanel').lookup('storageNodeRestriction').setValue(value);
+ },
+ },
+ },
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ allowBlank: false,
+ },
+ ],
+
+ advancedColumn1: [
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'fast-io-fail-tmo',
+ fieldLabel: gettext('Fail I/O After (s)'),
+ minValue: -1,
+ emptyText: '120',
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Applies to newly connected paths. -1 disables the timeout.'),
+ },
+ },
+ ],
+});
^ permalink raw reply related [relevance 19%]
* [PATCH v3 manager 18/18] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (14 preceding siblings ...)
2026-11-22 1:25 13% ` [PATCH v3 manager 17/18] ui: san: show that a namespace uses native multipath Thomas Lamprecht
@ 2026-11-22 1:25 14% ` Thomas Lamprecht
2026-11-23 2:02 6% ` superseded: [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
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.
A report whose namespaces could not be listed counts as incomplete, so
that they are not taken as gone. A node that cannot query multipathd
sends no notifications, also not for its namespaces, which its report
still lists.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
PVE/MultipathNotification.pm | 5 +++--
PVE/Service/pvestatd.pm | 2 +-
test/MultipathNotification_test.pl | 3 +++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/PVE/MultipathNotification.pm b/PVE/MultipathNotification.pm
index 99c79405b..d25851d0c 100644
--- a/PVE/MultipathNotification.pm
+++ b/PVE/MultipathNotification.pm
@@ -97,8 +97,9 @@ sub flush($self, $notify) {
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'};
+ # without the hints of LVM, maps known only by their volume group can be left out, and a failed
+ # query leaves out the NVMe namespaces
+ my $complete = $usable && !$report->{'vgs-unknown'} && !$report->{'namespaces-unknown'};
my $previous = $self->{previous};
my $current = $self->{previous} = {};
if (!defined($luns)) {
diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index 68d7f2e08..5cdce325a 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();
diff --git a/test/MultipathNotification_test.pl b/test/MultipathNotification_test.pl
index f78a31e6e..d61ce6ea1 100755
--- a/test/MultipathNotification_test.pl
+++ b/test/MultipathNotification_test.pl
@@ -93,6 +93,9 @@ 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);
+report_with(
+ { luns => [], 'namespaces-unknown' => 1 }, [], 'nor one without the NVMe namespaces',
+);
pass_with(
{},
[['info', 'c:gone', 'd:gone']],
^ permalink raw reply related [relevance 14%]
* [PATCH v3 manager 17/18] ui: san: show that a namespace uses native multipath
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (13 preceding siblings ...)
2026-11-22 1:25 13% ` [PATCH v3 manager 15/18] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
@ 2026-11-22 1:25 13% ` Thomas Lamprecht
2026-11-22 1:25 14% ` [PATCH v3 manager 18/18] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
2026-11-23 2:02 6% ` superseded: [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the namespaces of NVMe over Fabrics
storages too. They use the native multipath of the kernel, with
neither an entry nor a storage that requests a map, so the Multipath
column would call them unmanaged. Show "Native" for them, as the LUN
list of a node does, and name them as namespaces in Paths by Node.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/SAN.js | 16 ++++++++++++++--
www/manager6/window/SANLunState.js | 8 ++++----
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index e30b5ef48..fdf2935bf 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -15,6 +15,7 @@ Ext.define('pve-san-status', {
'name',
'explicit',
'multipath-storage',
+ 'native',
'nodes',
'size',
'used-by-storage',
@@ -118,6 +119,7 @@ Ext.define('PVE.dc.SANView', {
Ext.create('PVE.window.SANLunState', {
wwid: rec.get('wwid'),
name: rec.get('name'),
+ nvme: !!rec.get('native'),
autoShow: true,
});
let setupItem = (type) => ({
@@ -258,7 +260,11 @@ Ext.define('PVE.dc.SANView', {
disabled: !canModify,
handler: function (button) {
let lun = button.up('grid').getSelection()[0];
- let wwid = lun?.get('explicit') ? undefined : lun?.get('wwid');
+ // a namespace uses native multipath, which takes no entry
+ let wwid =
+ lun?.get('explicit') || lun?.get('native')
+ ? undefined
+ : lun?.get('wwid');
edit({ wwid, isCreate: true });
},
},
@@ -381,7 +387,13 @@ Ext.define('PVE.dc.SANView', {
width: 170,
renderer: (value, md, rec) => {
let storage = rec.get('multipath-storage');
- let kind = value ? 'manual' : storage ? 'storage' : 'unmanaged';
+ let kind = rec.get('native')
+ ? 'native'
+ : value
+ ? 'manual'
+ : storage
+ ? 'storage'
+ : 'unmanaged';
return Ext.htmlEncode(PVE.SANUtils.multipathText(kind, storage));
},
},
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index 5dfce247a..f84940fd8 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -23,12 +23,12 @@ Ext.define('PVE.window.SANLunState', {
let title = me.nvme
? gettext('Storage {0}: Namespace State')
: gettext('Storage {0}: LUN State');
+ let pathsTitle = me.nvme
+ ? gettext('Namespace {0}: Paths by Node')
+ : gettext('LUN {0}: Paths by Node');
me.title = me.storage
? Ext.String.format(title, me.storage)
- : Ext.String.format(
- gettext('LUN {0}: Paths by Node'),
- Ext.htmlEncode(me.name || me.wwid),
- );
+ : Ext.String.format(pathsTitle, Ext.htmlEncode(me.name || me.wwid));
// The other nodes set up the LUN of a new storage with their next status updates.
let pendingUntil = me.storage ? Date.now() + 60000 : 0;
let rstore = Ext.create('Proxmox.data.UpdateStore', {
^ permalink raw reply related [relevance 13%]
* [PATCH v3 manager 13/18] ui: lvm: offer NVMe over Fabrics storages as base storage
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (10 preceding siblings ...)
2026-11-22 1:25 19% ` [PATCH v3 manager 12/18] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-22 1:25 20% ` Thomas Lamprecht
2026-11-22 1:25 19% ` [PATCH v3 manager 14/18] ui: storage: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
` (4 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
A namespace of an NVMe over Fabrics storage can hold the volume group
of an LVM storage like an iSCSI LUN, so list such storages in the base
storage selector as well and name the type of each.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/StorageView.js | 4 ++--
www/manager6/storage/LVMEdit.js | 12 ++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 6afea33ce..5f4f519be 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -250,9 +250,9 @@ Ext.define(
lvm: [
'local',
gettext(
- 'Use an existing volume group, or create one on a LUN of an iSCSI storage.',
+ 'Use an existing volume group, or create one on an iSCSI LUN or NVMe/TCP namespace.',
),
- 'san lun shared',
+ 'san lun shared nvme namespace',
],
lvmthin: ['local', gettext('Use an existing LVM thin pool.'), ''],
zfspool: ['local', gettext('Use an existing ZFS pool or dataset.'), 'zpool'],
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 688130b19..146dac12c 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -70,10 +70,13 @@ Ext.define('PVE.storage.BaseStorageSelector', {
let store = Ext.create('Ext.data.Store', {
autoLoad: {
addRecords: true,
- params: {
- type: 'iscsi',
- },
},
+ filters: [
+ {
+ filterFn: (rec) =>
+ !rec.get('storage') || ['iscsi', 'nvmeof'].includes(rec.get('type')),
+ },
+ ],
fields: [
'storage',
'type',
@@ -82,7 +85,8 @@ Ext.define('PVE.storage.BaseStorageSelector', {
name: 'text',
convert: function (value, record) {
if (record.data.storage) {
- return record.data.storage + ' (iSCSI)';
+ let type = PVE.Utils.format_storage_type(record.data.type);
+ return `${record.data.storage} (${type})`;
} else {
return me.existingGroupsText;
}
^ permalink raw reply related [relevance 20%]
* [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage
@ 2026-11-22 1:25 11% Thomas Lamprecht
2026-11-22 1:25 8% ` [PATCH v3 storage 01/18] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
` (16 more replies)
0 siblings, 17 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
A storage type for NVMe subsystems over TCP on top of the SAN series
[0] (libpve-storage-perl 9.1.22, pve-manager 9.2.36, pve-docs 9.2.20):
namespaces as base volumes for shared LVM or directly as disk images,
using the kernel's native multipath.
This is v3. Besides review fixes for v2 [2], it follows the SAN rework
on master: the guided setup lives under Datacenter > Storage > Add and
asks for one ID, the node API moved under /nodes/{node}/san, and
pvestatd's path notifications cover namespaces too.
This is a deliberately small first version: TCP only, without
authentication or TLS, relying on the array's host NQN allow-list and
a separate storage network. The kernel handles path failover and
reconnects, while the plugin only connects missing portals and never
disconnects on portal or storage removal; disconnecting a controller
is an explicit per-node action. Two prerequisites from the docs: cloned
nodes need distinct host NQNs before connecting, and all nodes must be
upgraded before adding the first nvmeof storage (older nodes drop
unknown storage types when writing storage.cfg).
What it adds:
- Storage type 'nvmeof' (isolated properties, one storage per
subsystem) connecting configured TCP portals with ctrl_loss_tmo=-1
and a configurable fast-io-fail-tmo (default 120s), exposing
namespaces as nvme-<wwid> volumes.
- LVM support for nvmeof namespaces as base volumes, reusing the SAN
reference checks and per-LUN locking.
- Discovery via /nodes/{node}/scan/nvmeof and 'pvesm scan nvmeof', and
node management via /nodes/{node}/san/nvmeof (host identity,
controller list, and guarded per-controller disconnect refusing the
last usable path of any mounted, held, swap, open, or storage-used
namespace; as in the SAN series, the open-process check misses opens
through another device node).
- Cluster status and path-loss notifications covering nvmeof
namespaces. Status reporting works without multipathd; notifications
still require multipathd to be queryable.
- Web UI: guided 'Shared LVM on NVMe over Fabrics' setup under
Datacenter > Storage > Add (shared with iSCSI), nvmeof storage
dialog with discovery, Node > SAN controller list, and host NQNs in
Datacenter > SAN.
- pvereport host NQN and subsystem output, plus nvme-cli as a
Recommends of libpve-storage-perl.
Changes since v2 [2]:
- Follow the SAN rework: single-ID wizard deriving '<ID>-base', node
selection in the host NQN list, portal suggestions without default
port 4420, early-close cleanup, and /nodes/{node}/san/nvmeof.
- Notify on lost and restored namespace paths in pvestatd.
- Tighten activation and locking: fail only if no controller is live
(reporting per-portal errors) and warn otherwise; cap extra portal
connects at 15s while holding storage.cfg's lock; wait up to 10s for
the node fabrics lock; clear portal cooldowns on storage creation.
- Enforce WWID-based volume names (model/serial by-id links can alias
within a subsystem) and refuse local disk setup on fabric namespace
partitions.
- Harden Disconnect: also refuse the last usable path of swap
namespaces, and pass expected subsystem and portal from the UI to
catch reused controller numbers.
- Skip the NVMe path walk on nodes without nvmeof storages, and add
NVMe-oF info to pvereport.
- Validation and UI fixes: require at least one portal, trim and clear
wizard portals on discovery portal change, ignore empty or stale
scans, skip SMART on NVMe/FC too, leave Add Multipath Entry blank
for namespaces, and parse LVM base volume IDs first (fixing IDs like
'nvme-a').
- Docs: explain upgrading all nodes first, document local-only checks
for unusable controllers, and list nvmeof in the intro and LVM
chapters.
The ZFS over NVMe/TCP plugin on the list [3] brings its own initiator.
Because 'nvmeof' isolates its properties, names do not clash; sharing
connect helpers can follow once both are in.
Packaging: pve-manager needs versioned Depends on libpve-storage-perl
and pve-docs (plus Build-Depends on pve-doc-generator);
libpve-storage-perl should break pve-manager without patch 18.
Testing builds on the v1 [1] and v2 [2] runs on a six-node nested
cluster (dual-portal Linux nvmet and NetApp AFF A20). For v3 on master,
I re-ran both guided setups from Add (new nvmet at 1/1, reused NetApp
at 2/2), cut one NetApp path for a minute and both for 40s under guest
I/O (1/2 and Failed 0/2, storages inactive, I/O requeued cleanly, full
recovery), live-migrated a guest with disks on both storages, and
disconnected controllers via the API on every node. After the final
review fixes, I also verified model/serial by-id refusals, Disconnect
refusals for a mismatched subsystem or in-use LVM namespace, and UI
controller disconnect.
The 15s activation cap, swap and partition refusals, non-NQN subsystem
names, and skipped path walk are covered by unit tests only. Earlier on
v3, storage status reconnected a controller once another process
released the fabrics lock after five seconds.
[0]: https://lore.proxmox.com/pve-devel/20261119194655.3163258-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20261113030541.1591528-1-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20261118204302.3100813-1-t.lamprecht@proxmox.com/
[3]: https://lore.proxmox.com/pve-devel/20261005002609.571-1-joaquinvarela@neatech.ar/
pve-storage:
Thomas Lamprecht (9):
diskmanage: skip SMART queries for NVMe fabric namespaces
nvmeof: add a storage for NVMe over Fabrics subsystems
lvm: allow a volume group on an NVMe over Fabrics namespace
api: scan: add NVMe over Fabrics discovery
pvesm: add a scan command for NVMe over Fabrics
api: san luns: attribute NVMe namespaces to storage
api: add node-level NVMe over Fabrics status and controller removal
multipath: report the NVMe host NQN of each node
multipath: report NVMe over Fabrics namespaces in the cluster status
ApiChangeLog | 9 +-
debian/control | 1 +
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 199 +++++++++++
src/PVE/API2/SAN/Cluster.pm | 22 +-
src/PVE/API2/SAN/Node.pm | 17 +-
src/PVE/API2/Storage/Scan.pm | 49 +++
src/PVE/CLI/pvesm.pm | 13 +
src/PVE/Diskmanage.pm | 29 +-
src/PVE/Makefile | 1 +
src/PVE/Multipath/Status.pm | 72 +++-
src/PVE/NVMeOF.pm | 445 +++++++++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/LVMPlugin.pm | 3 +-
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 266 ++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 32 +-
src/test/Makefile | 6 +
src/test/disklist_test.pm | 14 +
src/test/run_multipath_api_tests.pl | 132 ++++++-
src/test/run_nvmeof_api_tests.pl | 207 +++++++++++
src/test/run_nvmeof_taint_tests.pl | 67 ++++
src/test/run_nvmeof_tests.pl | 533 ++++++++++++++++++++++++++++
src/test/run_san_api_tests.pl | 4 +-
src/test/run_san_lun_scan_tests.pl | 41 +++
src/test/run_san_nvme_tests.pl | 33 ++
27 files changed, 2160 insertions(+), 41 deletions(-)
pve-docs:
Thomas Lamprecht (1):
storage: document NVMe over Fabrics storages
pve-gui.adoc | 12 ++-
pve-intro.adoc | 3 +-
pve-storage-lvm.adoc | 10 +-
pve-storage-multipath.adoc | 3 +-
pve-storage-nvmeof.adoc | 189 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 24 +++--
6 files changed, 222 insertions(+), 19 deletions(-)
pve-manager:
Thomas Lamprecht (8):
report: add the NVMe over Fabrics host NQN and subsystems
ui: storage: add NVMe over Fabrics storage
ui: lvm: offer NVMe over Fabrics storages as base storage
ui: storage: add a guided setup for shared LVM on NVMe over Fabrics
ui: node san: list NVMe over Fabrics controllers
ui: san: show the NVMe host NQN of each node
ui: san: show that a namespace uses native multipath
pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps
PVE/MultipathNotification.pm | 5 +-
PVE/Report.pm | 6 +
PVE/Service/pvestatd.pm | 2 +-
test/MultipathNotification_test.pl | 3 +
www/manager6/Makefile | 4 +-
www/manager6/SANUtils.js | 7 +-
www/manager6/Utils.js | 7 +
www/manager6/dc/SAN.js | 49 +++-
www/manager6/dc/StorageView.js | 23 +-
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 152 ++++++++++++
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/LVMEdit.js | 12 +-
www/manager6/storage/NVMeOFEdit.js | 150 +++++++++++
www/manager6/storage/wizard/LunSelect.js | 35 ++-
www/manager6/storage/wizard/NodeIdentities.js | 57 +++--
.../storage/wizard/{IScsi.js => Target.js} | 232 +++++++++++++-----
www/manager6/storage/wizard/Wizard.js | 60 +++--
www/manager6/window/SANLunState.js | 38 ++-
19 files changed, 699 insertions(+), 157 deletions(-)
^ permalink raw reply [relevance 11%]
* [PATCH v3 storage 06/18] api: san luns: attribute NVMe namespaces to storage
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (4 preceding siblings ...)
2026-11-22 1:25 11% ` [PATCH v3 storage 05/18] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
@ 2026-11-22 1:25 20% ` Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 07/18] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
` (10 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
The SAN LUN inventory lists NVMe namespaces with their subsystem, but
without relation to an NVMe over Fabrics storage. Expect one path per
portal of the storage that connects the subsystem of a namespace, so
that a namespace with fewer paths shows as degraded.
A namespace counts as used by the LVM storage that has it as base
volume, else by the storage of its subsystem if that one serves the
namespaces as images.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/SAN/Node.pm | 9 ++++---
src/PVE/Storage/SAN.pm | 19 ++++++++++++--
src/test/run_san_lun_scan_tests.pl | 41 ++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/src/PVE/API2/SAN/Node.pm b/src/PVE/API2/SAN/Node.pm
index 08a7473b..4b96caf5 100644
--- a/src/PVE/API2/SAN/Node.pm
+++ b/src/PVE/API2/SAN/Node.pm
@@ -118,8 +118,9 @@ __PACKAGE__->register_method({
'paths-expected' => {
description => "The number of paths the LUN should have on this node: the"
. " highest of the count of its multipath entry and, for each managed"
- . " iSCSI storage of the LUN, the number of its portals. Absent if no"
- . " count is known.",
+ . " iSCSI storage of the LUN, the number of its portals. For a namespace"
+ . " of an NVMe over Fabrics storage, the number of its portals. Absent if"
+ . " no count is known.",
type => 'integer',
optional => 1,
},
@@ -198,8 +199,8 @@ __PACKAGE__->register_method({
},
'used-by-storage' => {
description => "The storage that uses the LUN: as its base volume or"
- . " through the volume group on it, or as an iSCSI storage that serves the"
- . " LUNs of its target as images.",
+ . " through the volume group on it, or as an iSCSI or NVMe over Fabrics"
+ . " storage that serves the LUNs of its target or subsystem as images.",
type => 'string',
optional => 1,
},
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index 53c24c9e..f0ca5aef 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -16,6 +16,7 @@ use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
use PVE::Multipath::Identity;
+use PVE::NVMeOF;
use PVE::Storage;
use PVE::Storage::LVMPlugin;
@@ -42,7 +43,9 @@ sub scan_luns($cfg) {
PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
- my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %targets, %paths, %unmapped);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %nvme_owner, %nvme_paths);
+ my (%targets, %paths);
+ my %unmapped;
my $wanted =
PVE::Multipath::Generator::wanted_wwids($mpcfg, PVE::INotify::nodename(), $derived);
@@ -58,6 +61,11 @@ sub scan_luns($cfg) {
if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
my $base = PVE::Multipath::parse_base_volume($scfg->{base});
$base_owner{ $base->{wwid} } //= $sid if $base;
+ next if $scfg->{type} ne 'nvmeof';
+ $nvme_owner{ $scfg->{subsysnqn} } //= $sid;
+ # only a storage in use on this node expects its paths here
+ my $here = !$scfg->{nodes} || $scfg->{nodes}->{ PVE::INotify::nodename() };
+ $nvme_paths{ $scfg->{subsysnqn} } //= $sid if $here && !$scfg->{disable};
}
my %rows;
@@ -102,6 +110,10 @@ sub scan_luns($cfg) {
$row->{'nvme-subsystem'} = $nqn;
my $nsid = file_read_firstline("/sys/block/$name/nsid");
$row->{'nvme-nsid'} = int($nsid) if defined($nsid) && $nsid =~ /^\d+$/;
+ if (my $sid = $nvme_paths{$nqn}) {
+ $row->{'paths-expected'} =
+ scalar(PVE::NVMeOF::storage_paths($cfg->{ids}->{$sid})->@*);
+ }
}
}
for my $key (qw(transport vendor model serial)) {
@@ -208,9 +220,12 @@ sub scan_luns($cfg) {
$row->{'paths-expected'},
);
}
+ my $nvme = $nvme_owner{ $row->{'nvme-subsystem'} // '' };
+ undef $nvme if $nvme && !PVE::Storage::san_storage_serves_images($cfg->{ids}->{$nvme});
my ($target) =
map { $target_owner{$_} // () } sort keys(($targets{ $row->{wwid} } // {})->%*);
- my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target;
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target
+ // $nvme;
$row->{'used-by-storage'} = $owner if defined($owner);
}
return [map { $rows{$_} } sort keys %rows];
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
index 7119c88a..7fd9563b 100755
--- a/src/test/run_san_lun_scan_tests.pl
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -329,6 +329,12 @@ is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id lin
$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
$scan->mock(file_read_firstline => sub { $_[0] =~ m{/nsid$} ? 1 : 'eui.0123456789abcdef' });
$disk->mock(read_subsysnqn => sub { 'nqn.test' });
+$cfg->{ids}->{fabric} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,192.0.2.2',
+ content => { images => 1 },
+};
$scan->unmock('stable_path');
$scan->mock(abs_path => sub { '/dev/nvme0n1' });
$rows = PVE::Storage::SAN::scan_luns($cfg);
@@ -346,6 +352,41 @@ eval { PVE::JSONSchema::validate($rows, $schema) };
is($@, '', 'native row matches the API schema');
is($rows->[0]->{'nvme-subsystem'}, 'nqn.test', 'subsystem NQN exposed');
is($rows->[0]->{'nvme-nsid'}, 1, 'namespace ID exposed');
+is($rows->[0]->{'used-by-storage'}, 'fabric', 'a storage serving the namespaces uses them');
+is($rows->[0]->{'paths-expected'}, 2, 'one expected path per configured portal');
+
+for my $count (1, 3) {
+ $config->mock(
+ read_config => sub { {
+ ids => { 'eui.0123456789abcdef' => { type => 'wwid', 'paths-expected' => $count } },
+ } },
+ );
+ my $entry = PVE::Storage::SAN::scan_luns($cfg);
+ is($entry->[0]->{'paths-expected'}, 2, "a multipath entry does not change it ($count)");
+}
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+{
+ local $cfg->{ids}->{fabric}->{content} = { none => 1 };
+ my $plain = PVE::Storage::SAN::scan_luns($cfg);
+ is($plain->[0]->{'used-by-storage'}, undef, 'a connection storage does not');
+ is($plain->[0]->{'paths-expected'}, 2, 'but still tells the expected paths');
+}
+{
+ local $cfg->{ids}->{fabric}->{disable} = 1;
+ my $disabled = PVE::Storage::SAN::scan_luns($cfg);
+ is($disabled->[0]->{'paths-expected'}, undef, 'a disabled storage expects no paths');
+ is($disabled->[0]->{'used-by-storage'}, 'fabric', 'but still uses the namespaces');
+}
+{
+ local $cfg->{ids}->{fabric}->{nodes} = { other => 1 };
+ my $elsewhere = PVE::Storage::SAN::scan_luns($cfg);
+ is($elsewhere->[0]->{'paths-expected'}, undef, 'nor a storage of other nodes');
+}
+for my $base (qw(fabric nvme-fabric)) {
+ $cfg->{ids}->{data}->{base} = "$base:nvme-eui.0123456789abcdef";
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is($rows->[0]->{'used-by-storage'}, 'data', "LVM base consumer takes precedence ($base)");
+}
$disk->mock(is_partition => sub { 1 });
ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
^ permalink raw reply related [relevance 20%]
* [PATCH v3 storage 04/18] api: scan: add NVMe over Fabrics discovery
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-22 1:25 16% ` [PATCH v3 storage 03/18] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
@ 2026-11-22 1:25 16% ` Thomas Lamprecht
2026-11-22 1:25 11% ` [PATCH v3 storage 05/18] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
` (12 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
Setting up an NVMe over Fabrics storage needs the NQN of the
subsystem and its portals. Add /nodes/{node}/scan/nvmeof, which asks
the discovery service at a portal for the NVMe/TCP subsystems it
offers to the node and lists them with their portals.
Without a port, it tries the discovery port 8009 and then the I/O
port 4420, where Linux targets answer discovery too. The scan needs
Datastore.Allocate on /storage, like the iSCSI scan.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 49 +++++++++++++++++++++
src/PVE/NVMeOF.pm | 63 +++++++++++++++++++++++++++
src/test/run_nvmeof_taint_tests.pl | 5 +++
src/test/run_nvmeof_tests.pl | 68 ++++++++++++++++++++++++++++++
src/test/run_san_api_tests.pl | 2 +-
5 files changed, 186 insertions(+), 1 deletion(-)
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index f37e7d4e..c6263994 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -6,6 +6,7 @@ use warnings;
# NOTE: This API endpoints are mounted by pve-manager's API2::Node module and pvesm CLI
use PVE::JSONSchema qw(get_standard_option);
+use PVE::NVMeOF;
use PVE::RESTHandler;
use PVE::SafeSyslog;
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'lvmthin' },
{ method => 'nfs' },
+ { method => 'nvmeof' },
{ method => 'pbs' },
{ method => 'zfs' },
];
@@ -300,6 +302,53 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'nvmeofscan',
+ path => 'nvmeof',
+ method => 'GET',
+ description =>
+ 'List the NVMe over TCP subsystems offered to this node by a discovery controller.',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/storage', ['Datastore.Allocate']] },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ portal => {
+ description => 'IPv4 or bracketed IPv6 discovery address with an optional port.'
+ . ' Without a port, try 8009 then 4420.',
+ type => 'string',
+ format => 'pve-storage-nvme-portal',
+ },
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ portals => {
+ type => 'string',
+ description => 'The discovered TCP portals, comma separated.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+ my $res = PVE::NVMeOF::discover($param->{portal});
+ return [
+ map { {
+ subsysnqn => $_,
+ portals => join(',', map { PVE::NVMeOF::format_path($_) } $res->{$_}->@*),
+ } } sort keys %$res
+ ];
+ },
+});
+
__PACKAGE__->register_method({
name => 'lvmscan',
path => 'lvm',
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index 45b3acfc..15612b04 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -5,10 +5,12 @@ use v5.36;
use Digest::SHA qw(sha1_hex);
use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
use File::Path qw(make_path);
+use JSON qw(decode_json);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use Time::HiRes ();
use PVE::JSONSchema;
+use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
use PVE::Diskmanage;
@@ -268,4 +270,65 @@ sub connect_path($scfg, $path) {
});
}
+sub parse_discovery_log($raw) {
+ my $log = decode_json($raw);
+ die "invalid NVMe discovery log\n"
+ if ref($log) ne 'HASH' || ref($log->{records}) ne 'ARRAY';
+ my (%seen, %res);
+ for my $record ($log->{records}->@*) {
+ next
+ if ($record->{subtype} // '') ne 'nvme subsystem' || ($record->{trtype} // '') ne 'tcp';
+ my $nqn = subsystem_nqn($record->{subnqn}) // next;
+ my $addr = $record->{traddr} // '';
+ my $port = $record->{trsvcid} // '';
+ my $path = parse_portal(($addr =~ /:/ ? "[$addr]" : $addr) . ":$port") // next;
+ next if $seen{$nqn}->{ format_path($path) }++;
+ push $res{$nqn}->@*, $path;
+ }
+ return \%res;
+}
+
+sub discover($portal) {
+ my $path = parse_portal($portal) // die "invalid portal '$portal'\n";
+ my @ports = $portal =~ /:[0-9]+$/ ? ($path->{trsvcid}) : (8009, 4420);
+ # a missing prerequisite fails on every port, so report it as it is
+ assert_support();
+ my $host = host_identity();
+ my $error;
+ for my $port (@ports) {
+ # the reason of a port that answered tells more than a silent one
+ if (!PVE::Network::tcp_ping($path->{traddr}, $port, 2)) {
+ $error //= "no answer from portal\n";
+ next;
+ }
+ my $result = eval {
+ with_lock(sub {
+ my $out = '';
+ run_command(
+ [
+ $NVME,
+ 'discover',
+ '--transport=tcp',
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $port,
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--output-format=json',
+ ],
+ timeout => 30,
+ outfunc => sub($line) { $out .= "$line\n" },
+ );
+ return parse_discovery_log($out);
+ });
+ };
+ return $result if !$@;
+ $error = $@;
+ }
+ die "discovery at portal '$portal' failed - $error";
+}
+
1;
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
index 6fd37410..ef332633 100755
--- a/src/test/run_nvmeof_taint_tests.pl
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -40,6 +40,7 @@ $nvme->mock(
'all connect operands are validated and untainted',
);
PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ $opts{outfunc}->('{"records":[]}') if $opts{outfunc};
},
);
my $path = PVE::NVMeOF::parse_portal($portal);
@@ -55,6 +56,10 @@ for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.disc
eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
}
+my $net = Test::MockModule->new('PVE::Network');
+$net->mock(tcp_ping => sub { 1 });
+eval { PVE::NVMeOF::discover($portal) };
+is($@, '', 'discovery can execute with file-backed host identity in taint mode');
file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
eval { PVE::NVMeOF::host_identity() };
like($@, qr/nonzero UUID/, 'zero host ID refused');
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index cdf228c0..e33aed75 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -5,6 +5,7 @@ use lib qw(..);
use Fcntl qw(:flock);
use File::Path qw(make_path remove_tree);
use File::Temp qw(tempdir);
+use JSON qw(encode_json);
use POSIX ();
use Test::MockModule;
use Test::More;
@@ -12,6 +13,7 @@ use Time::HiRes ();
use PVE::Tools qw(file_set_contents);
+use PVE::API2::Storage::Scan;
use PVE::NVMeOF;
use PVE::Storage;
@@ -443,4 +445,70 @@ subtest 'local disk setup rejects fabric namespaces by transport' => sub {
}
};
+subtest 'TCP discovery, fallback and API result' => sub {
+ my $record = {
+ subtype => 'nvme subsystem',
+ trtype => 'tcp',
+ subnqn => 'nqn.test',
+ traddr => '192.0.2.1',
+ trsvcid => '4420',
+ };
+ my $raw = encode_json({
+ records =>
+ [$record, $record, { %$record, trtype => 'rdma' }, { %$record, trsvcid => 70000 }],
+ });
+ is_deeply(
+ PVE::NVMeOF::parse_discovery_log($raw),
+ { 'nqn.test' => [{ traddr => '192.0.2.1', trsvcid => 4420 }] },
+ 'TCP only, unique valid portals',
+ );
+ for my $bad ('garbage', '{}', '[]') {
+ eval { PVE::NVMeOF::parse_discovery_log($bad) };
+ ok($@, 'malformed discovery is not an empty success');
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my (@ports, @commands);
+ our $locked;
+ $nvme->mock(with_lock => sub { local $locked = 1; $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'id' } });
+ $net->mock(tcp_ping => sub { push @ports, $_[1]; $_[1] != 8009 });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'discovery holds the NVMe lock');
+ is($opts{timeout}, 30, 'discovery command timeout');
+ push @commands, $cmd;
+ $opts{outfunc}->($raw);
+ },
+ );
+ my $rows = PVE::API2::Storage::Scan->nvmeofscan({ node => 'n1', portal => '192.0.2.1' });
+ is_deeply(\@ports, [8009, 4420], 'unspecified port tries discovery then I/O port');
+ is_deeply($rows, [{ subsysnqn => 'nqn.test', portals => '192.0.2.1:4420' }], 'API shape');
+ eval {
+ PVE::JSONSchema::validate(
+ $rows,
+ PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns},
+ );
+ };
+ is($@, '', 'API schema accepts result');
+ @ports = ();
+ PVE::NVMeOF::discover('[2001:db8::1]:4421');
+ is_deeply(\@ports, [4421], 'explicit port does not fall back');
+ # the discovery port answers but refuses, the I/O port does not answer
+ $net->mock(tcp_ping => sub { $_[1] == 8009 });
+ $nvme->mock(run_command => sub { die "host not allowed\n" });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - host not allowed$/, 'the error of the answering port is kept');
+ $net->mock(tcp_ping => sub { $_[1] == 4420 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - host not allowed$/, 'also if the other port answers');
+ $net->mock(tcp_ping => sub { 0 });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ like($@, qr/failed - no answer from portal$/, 'without any answer');
+ $nvme->mock(assert_support => sub { die "nvme-cli is not installed\n" });
+ eval { PVE::NVMeOF::discover('192.0.2.1') };
+ is($@, "nvme-cli is not installed\n", 'a missing prerequisite is reported as it is');
+};
+
done_testing();
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
index faa29fc3..73938a7e 100755
--- a/src/test/run_san_api_tests.pl
+++ b/src/test/run_san_api_tests.pl
@@ -104,7 +104,7 @@ is_deeply(
);
is_deeply(
[map { $_->{method} } PVE::API2::Storage::Scan->index({ node => 'test' })->@*],
- [qw(cifs iscsi lvm lvmthin nfs pbs zfs)],
+ [qw(cifs iscsi lvm lvmthin nfs nvmeof pbs zfs)],
'scan index lists the discovery scans',
);
is_deeply(
^ permalink raw reply related [relevance 16%]
* [PATCH v3 storage 08/18] multipath: report the NVMe host NQN of each node
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (6 preceding siblings ...)
2026-11-22 1:25 16% ` [PATCH v3 storage 07/18] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
@ 2026-11-22 1:25 10% ` Thomas Lamprecht
2026-11-22 1:25 18% ` [PATCH v3 storage 09/18] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
` (8 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
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');
^ permalink raw reply related [relevance 10%]
* [PATCH v3 storage 05/18] pvesm: add a scan command for NVMe over Fabrics
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
` (3 preceding siblings ...)
2026-11-22 1:25 16% ` [PATCH v3 storage 04/18] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
@ 2026-11-22 1:25 11% ` Thomas Lamprecht
2026-11-22 1:25 20% ` [PATCH v3 storage 06/18] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
` (11 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
Add 'pvesm scan nvmeof <portal>', which prints the subsystems a
portal offers to the node with their portals, like the iSCSI scan
prints targets. That gives the values for a new storage on the
command line, with the usual output formats for scripts.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/CLI/pvesm.pm | 13 +++++++++++++
src/test/run_nvmeof_tests.pl | 12 ++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 070c1596..05da60d8 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -737,6 +737,19 @@ our $cmddef = {
$print_api_result,
$PVE::RESTHandler::standard_output_options,
],
+ nvmeof => [
+ "PVE::API2::Storage::Scan",
+ 'nvmeofscan',
+ ['portal'],
+ { node => $nodename },
+ sub {
+ my ($data, $schema, $options) = @_;
+ PVE::CLIFormatter::print_api_result(
+ $data, $schema, [qw(subsysnqn portals)], $options,
+ );
+ },
+ $PVE::RESTHandler::standard_output_options,
+ ],
'san-luns' => [
"PVE::API2::SAN::Node",
'luns',
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index e33aed75..ddd905ee 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -14,6 +14,7 @@ use Time::HiRes ();
use PVE::Tools qw(file_set_contents);
use PVE::API2::Storage::Scan;
+use PVE::CLI::pvesm;
use PVE::NVMeOF;
use PVE::Storage;
@@ -509,6 +510,17 @@ subtest 'TCP discovery, fallback and API result' => sub {
$nvme->mock(assert_support => sub { die "nvme-cli is not installed\n" });
eval { PVE::NVMeOF::discover('192.0.2.1') };
is($@, "nvme-cli is not installed\n", 'a missing prerequisite is reported as it is');
+ my $formatter = Test::MockModule->new('PVE::CLIFormatter');
+ my $schema = PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns};
+ $formatter->mock(
+ print_api_result => sub {
+ is($_[0], $rows, 'CLI forwards complete discovery rows');
+ is($_[1], $schema, 'CLI forwards discovery schema');
+ is($_[3]->{'output-format'}, 'json', 'CLI supports structured output');
+ },
+ );
+ $PVE::CLI::pvesm::cmddef->{scan}->{nvmeof}->[4]
+ ->($rows, $schema, { 'output-format' => 'json' });
};
done_testing();
^ permalink raw reply related [relevance 11%]
* [PATCH v3 storage 03/18] lvm: allow a volume group on an NVMe over Fabrics namespace
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
2026-11-22 1:25 8% ` [PATCH v3 storage 01/18] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 02/18] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
@ 2026-11-22 1:25 16% ` Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 04/18] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
` (13 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
An LVM storage only accepts an iSCSI LUN as base volume. Accept a
namespace of an NVMe over Fabrics storage too. Adding such an LVM
storage connects the subsystem, waits for the namespace and creates
the volume group on it, and activating it on another node connects
that node first.
The creation treats the namespace like any SAN LUN: it takes the
cluster-wide lock of the LUN and refuses a namespace that another
storage references.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 3 +--
src/test/run_san_nvme_tests.pl | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index b759554c..224f1c68 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -1355,9 +1355,8 @@ sub on_add_hook {
my $basecfg = PVE::Storage::storage_config($cfg, $baseid, 1);
die "base storage ID '$baseid' does not exist\n" if !$basecfg;
- # we only support iscsi for now
die "unsupported base type '$basecfg->{type}'"
- if $basecfg->{type} ne 'iscsi';
+ if $basecfg->{type} ne 'iscsi' && $basecfg->{type} ne 'nvmeof';
# Managed multipath requires the coalesced map or a partition of it, never a transient
# single-path PV.
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 2a9a2121..15ede8be 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -142,4 +142,21 @@ is_deeply(
);
is_deeply(\@opens, [$link], 'VG creation holds the native by-id device');
+$cfg->{ids} = { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } };
+my @activation;
+$storage->mock(path => sub { $link });
+$storage->mock(activate_storage => sub { push @activation, 'storage' });
+$storage->mock(activate_volumes => sub { push @activation, 'volume' });
+$lvm->mock(
+ lvm_create_volume_group => sub {
+ is($_[0], $link, 'add hook passes native base');
+ is($_[3]->{exempt}, 'data', 'add hook exempts new storage');
+ },
+);
+PVE::Storage::LVMPlugin->on_add_hook(
+ 'data',
+ { base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'data', shared => 1 },
+);
+is_deeply(\@activation, ['storage', 'volume'], 'LVM activates the NVMe base before creation');
+
done_testing();
^ permalink raw reply related [relevance 16%]
* [PATCH v3 storage 01/18] diskmanage: skip SMART queries for NVMe fabric namespaces
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-22 1:25 8% ` Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 02/18] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
` (15 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-22 1:25 UTC (permalink / raw)
To: pve-devel
The disk list queries the SMART health of every disk. For an NVMe
namespace attached over TCP, RDMA or Fibre Channel, the query goes to
the target and can stall the listing while a path recovers. Skip it for
these transports, also for namespaces connected by hand. Local NVMe
drives are queried as before.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 4 +++-
src/test/disklist_test.pm | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 77f1a0ec..be3fb8fc 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -709,7 +709,9 @@ sub get_disks {
}
my ($health, $wearout) = ('UNKNOWN', 'N/A');
- if (!$nosmart) {
+ # SMART queries over fabrics can stall while a path recovers.
+ my $remote_nvme = ($nvme_transport // '') =~ /^(?:tcp|rdma|fc)$/;
+ if (!$nosmart && !$remote_nvme) {
eval {
my $smartdata = get_smart_data($devpath, !is_ssdlike($type));
$health = $smartdata->{health} if $smartdata->{health};
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index f79c59d3..38823f8b 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -284,6 +284,20 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if ($testcasedir eq 'nvme_smart') {
+ my $smart_calls;
+ $diskmanage_module->mock(get_smart_data => sub { $smart_calls++; return {} });
+ for my $transport (qw(tcp rdma fc pcie)) {
+ $smart_calls = 0;
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ PVE::Diskmanage::get_disks();
+ $testcount++;
+ is($smart_calls, $transport eq 'pcie' ? 1 : 0, "SMART queries for $transport");
+ }
+ $diskmanage_module->unmock('get_smart_data');
+ $diskmanage_module->unmock('get_nvme_transport');
+ }
+
if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
my $status = PVE::Multipath::path_status_by_wwid();
my $expected_status =
^ permalink raw reply related [relevance 8%]
* Re: [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM
2026-11-19 19:46 6% [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
` (3 preceding siblings ...)
2026-11-19 19:46 10% ` [PATCH v8 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
@ 2026-11-20 8:45 5% ` Thomas Lamprecht
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-20 8:45 UTC (permalink / raw)
To: pve-devel
On Thu, 19 Nov 2026 20:46:05 +0100, Thomas Lamprecht wrote:
> This is v8 of the combined and reduced series of the cluster-wide
> multipath work [0][1] and Dietmar's RFC for guided remote storage setup
> and SAN visibility [2].
>
> If nothing grave comes up I plan to apply this as is.
>
> v8 is v7 [9] plus what an independent review of v7 turned up and held
> up when checked against the code and the lab, i.e.:
>
> [...]
Applied, big thanks here to Blockbridge [0], which where very reactive
and tested basically every version here, ensuring a much better end
result!
[0]: https://www.blockbridge.com
Compared to v8 as posted, I folded in fixes for quite a few more findings,
but mostly rather targeted edge cases:
- If the multipath map of a LUN was not set up on a node, for example
because multipathd failed there, LVM on that node hid the PV on the
LUN, so a wipe from there could destroy the volume group of a shared
storage. The checks before a wipe or a volume group creation now see
such PVs, and also read the LVM label directly.
- The wipe and the volume group creation checked the LUN through its
name, which can lead to another device by the time they write. Both
now check the device they hold open.
- Creating a volume group through the disk API on a LUN that already
had one of the same name, for example from another node, just
succeeded, so two guided setups on one LUN could end with two storages
on the same volume group. This is refused now; only adding a storage
with the LUN as base volume takes over an existing volume group.
- A wipe of a multipath map without any working path could hang in its
checks until the cluster lock timed out. It is now refused right away,
as the volume group creation already did.
- An entry with the name of a map instead of a WWID was accepted by
'multipath -a' without an error, but never showed up as added, so the
node reloaded multipathd on every pass. Such an entry is now reported
as refused.
- The status report that each node publishes only had room for about
180 LUNs. It is stored compressed now, which raises that to about 700.
- The LUN list, the checks and the status each worked out on their own
which LUN an LVM storage uses as base, and did not always agree: a
base with a partition suffix, for example, did not protect its LUN
from a wipe. They now use one helper.
- The cluster status still expected the LUN of a disabled LVM storage
on its nodes, so the LUN showed as missing everywhere once its iSCSI
sessions were gone. A disabled storage now expects nothing.
- A hand-edited overrides file skipped the syntax check that the API
does, so it could hold a multipaths section that the API refuses.
Such a file now stops the apply with an error, instead of being
installed.
- A node without iscsiadm, but in the scope of an iSCSI storage with
multipath management, could neither apply its Fibre Channel entries
nor show Node > SAN. It now only asks iscsiadm about targets that
have paths on that node.
- Adding a second entry for the same WWID now shows the error at the
WWID field, instead of as a generic error.
- If the base volume of an LVM storage could not be activated, a status
pass repeated slow LVM scans for it. It now stops at the first
failure.
- In the web UI, a LUN that is unknown on all nodes no longer lists
every node in its state, the Target/Subsystem header is one string
for translators, and the iSCSI setup says where to allow the
initiator names.
- The multipath chapter is shorter and simpler, and also covers the
options of a multipath entry and that nothing notifies about a lost
path. The web UI and pvestatd chapters mention the SAN panels and
what pvestatd does for multipath.
- Plus some rewording of comments, test descriptions and commit
messages.
Still open (just for sake of completness):
- Nothing notifies about a lost path yet, so an admin has to look at
the SAN view. A notification could build on the status that every
node already reports.
- Storage plugins cannot tell how many paths a volume should have, so
a namespace that a plugin connected looks single-path once one of its
paths is gone. A plugin method for the expected paths could add that.
- NVMe over Fabrics support follows as v3 of its own series, on top of
this.
[pve-cluster]
[01/43] cfs: observe the multipath configuration files
commit: f196907143173a904a24a42f7c2a9f7f78c183c4
[pve-storage]
[02/43] diskmanage: collect disk transport type from lsblk
commit: d5167f815b6344718506e4a5449096ed9518bf4c
[03/43] diskmanage: qualify NVMe over Fabrics transport
commit: 968f1549f8acc3874d253de8a476664438a18d16
[04/43] diskmanage: optionally include iSCSI session devices in disk enumeration
commit: 08c04c8d7a077ff03f4a6fbdab466037ed6e85dd
[05/43] diskmanage: collect native NVMe multipath path state
commit: 6e52aaf06509dc8314030793e1b76f785ee7367a
[06/43] iscsi: factor out session device map from device list
commit: e9e65e672d19cc5d1f33c13a5175cb1eee90fd34
[07/43] multipath: add a library around multipathd
commit: dfe34094562cfc5de060ff835b6e75debc2be12a
[08/43] diskmanage: add helper to list multipath devices
commit: d3e5f28dae60dac121a46a42d63527e5db6f03b5
[09/43] multipath: add a cluster-wide configuration
commit: 59948403ba368b3b771f4860f359c62d1347bd3e
[10/43] iscsi: add an option to manage storage LUNs with multipath
commit: 55dd1de9a1d8017b23ffe53c2815ce5fcfc5a217
[11/43] lvm: activate a missing base volume before using the volume group
commit: 44bc0e3e4e4b261fc4cc76e47dc233f0b4768694
[12/43] multipath: apply the configuration on every node
commit: 51b8a5c820b9ba68d511022350eab4e9cc614937
[13/43] multipath: publish per-node status
commit: e72b1be2793c36e6991d87fe7707ba5288d05509
[14/43] api: add endpoints for the cluster-wide multipath configuration
commit: f0d87e448c207bf166fd000bb880c35c551bfba5
[15/43] api: multipath: add the cluster-wide health status
commit: c98ecf288ff4423d5064e51d19e28734b99a6040
[16/43] diskmanage: look up the requested disks by name
commit: 8222e318de382ea22f554998dd876b67e8c08ee0
[17/43] diskmanage: read the udev data of all disks with one call
commit: 298dcfaec978ae611e6c54d155bd1cdd80e6d7fb
[18/43] api: scan: add a SAN LUN inventory
commit: 2e5f0afad07ffd1845c7d0940e9662df48c72836
[19/43] pvesm: expose the SAN LUN inventory
commit: 73091d3621e51ad5fccb316d2efd902c0570212d
[20/43] api: add node-level iSCSI status
commit: cdf8763f784d2eddadfacaa576d39b64b0c8dea4
[21/43] api: scan: name the portal of an iSCSI path
commit: ad2ccb2ead41c6f4675d9a8d9e382dd59863d7f6
[22/43] disks: lvm: drop unused imports
commit: 946c8422ed805512515864fe80b6aaae340315ec
[23/43] disks: lvm: allow volume groups on SAN LUNs and multipath maps
commit: 6a98c4ba61fb133a6dc82bf20931417f5c0c5ed8
[24/43] disks: lvm: refuse to destroy the volume group of a shared storage
commit: 679d241b7bb4c016704b2fd6ed7983a4983efd98
[25/43] disks: allow wiping a SAN LUN that no storage uses
commit: c5529caa6377f03654d121573659e1cfc0235074
[26/43] api: scan: report the process that has a SAN LUN open
commit: 8e9935f595a664290e6edd4ae8c23b28fe631018
[pve-docs]
[27/43] storage: document the cluster-wide multipath management
commit: 5704d152297524600925469f2065e66d21d49300
[28/43] storage: multipath: describe the use shown for an open LUN
commit: 64861a0de0a5e086f3f5557a6e9165cf75ff8996
[pve-manager]
[29/43] pvestatd: apply the multipath configuration and report the node status
commit: ec55d57a3288630c0690dea4e8d63280e70d58c3
[30/43] report: add the managed multipath configuration
commit: a87eab65140ac4ae098ee4304830d3b9815565a1
[31/43] api: cluster: add the multipath endpoints
commit: 0a6f615a5594135103c3f6aaedeaeefb08664114
[32/43] api: nodes: expose the iSCSI status
commit: faaaadcf6f29c7cd7b1d938d88f0957ceba4d5f8
[33/43] ui: dc: add a SAN view
commit: a335adb38a9b2b9d0a05a1e3afc720bf9a0897c1
[34/43] ui: storage: iscsi: add the multipath option
commit: ca0bfb7e4b079e328f60037ba784ec2354c836b4
[35/43] ui: lvm: enable shared when a base storage is selected
commit: 6cfb3b8ac945ae4b7b0b07ac122da7c5d5f20584
[36/43] ui: node: add SAN LUNs panel
commit: d079fb4b3bd3126df29684822083922e2469afde
[37/43] ui: node: san: wipe a LUN that no storage uses
commit: 966f798adacd34d5b726ae9e6265a8a02a7ec5c5
[38/43] ui: node: san: show iSCSI targets and sessions
commit: 56482f5dd485d37a06f33329216c375e135d5b33
[39/43] ui: dc: san: add a guided setup for shared LVM on iSCSI
commit: e2094f57fff7b8058060b0fb7d0410c2ab3ec744
[40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel
commit: 39162712816a5fc715d00a07d86f683b9a005bf9
[41/43] ui: storage: point the iSCSI and LVM add dialogs to the SAN view
commit: ab30edfcf78d6b6017ebb82354a20402dab22d3b
[42/43] ui: san: show the guest or process that has a LUN open
commit: 188f844baad0ce05b701f0f1a9018ff05f207a25
[43/43] ui: node: san: add a column for the target or subsystem of a LUN
commit: 215871e61ea8ab696d5a4400707d2ea18fb46fa2
^ permalink raw reply [relevance 5%]
* [PATCH v8 storage 18/43] api: scan: add a SAN LUN inventory
2026-11-19 19:46 6% [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-19 19:46 13% ` [PATCH v8 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
2026-11-19 19:46 13% ` [PATCH v8 storage 05/43] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
@ 2026-11-19 19:46 9% ` Thomas Lamprecht
2026-11-19 19:46 10% ` [PATCH v8 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
2026-11-20 8:45 5% ` [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-19 19:46 UTC (permalink / raw)
To: pve-devel
Add /nodes/{node}/scan/san-luns, which lists the LUNs a node sees
over iSCSI, Fibre Channel or NVMe over Fabrics, one row per WWID with
the paths folded into their multipath map. The node disk list has
neither the maps nor a relation to volume groups and storages.
A row has the device to use, its size and transport, how multipath
handles the LUN, the health and state of its paths, and the known usage
with the volume group and storage. The usage comes from cached data
only, as probing a LUN whose paths are down can block. The rows name
storages without checking permissions per storage: the list needs
Sys.Audit on the node, which also shows the storage configuration in the
node report, or Datastore.Allocate on /storage.
A LUN without a map has its devices as paths, in the state that the
kernel reports for each, so that a LUN with a single path also shows
whether it is up. A LUN names its iSCSI target and a namespace its NVMe
subsystem.
The paths of a map are left out of the disk list, which reads sysfs
for each disk it returns. A node with a thousand LUNs has several
thousand of them, and the views poll this list every few seconds.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 218 +++++++++++++++
src/PVE/Diskmanage.pm | 15 +
src/PVE/Multipath.pm | 24 ++
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 227 +++++++++++++++
src/test/Makefile | 8 +-
src/test/disk_tests/multipath/multipathd | 124 ++++++++
.../multipath/multipathd_status_expected.json | 40 +++
src/test/disklist_test.pm | 15 +
src/test/run_san_api_tests.pl | 24 ++
src/test/run_san_lun_scan_tests.pl | 264 ++++++++++++++++++
11 files changed, 960 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/Storage/SAN.pm
create mode 100644 src/test/disk_tests/multipath/multipathd
create mode 100644 src/test/disk_tests/multipath/multipathd_status_expected.json
create mode 100755 src/test/run_san_api_tests.pl
create mode 100755 src/test/run_san_lun_scan_tests.pl
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index d8bd0a96..f3e2dc1e 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -12,6 +12,7 @@ use PVE::SafeSyslog;
use PVE::Storage::LVMPlugin;
use PVE::Storage::LvmThinPlugin;
use PVE::Storage::PBSPlugin;
+use PVE::Storage::SAN;
use PVE::Storage;
use base qw(PVE::RESTHandler);
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'nfs' },
{ method => 'pbs' },
+ { method => 'san-luns' },
{ method => 'zfs' },
];
@@ -375,6 +377,222 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'sanlunscan',
+ path => 'san-luns',
+ method => 'GET',
+ description => "List SAN LUNs with their paths and cached usage.",
+ protected => 1,
+ proxyto => "node",
+ permissions => {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ devpath => {
+ description => "The device path.",
+ type => 'string',
+ },
+ size => {
+ description => "The device size in bytes.",
+ type => 'integer',
+ renderer => 'bytes',
+ optional => 1,
+ },
+ transport => {
+ description =>
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'iscsi', 'nvme', 'nvme-fc', or 'nvme-tcp'.",
+ type => 'string',
+ optional => 1,
+ },
+ vendor => { type => 'string', optional => 1 },
+ model => { type => 'string', optional => 1 },
+ serial => { type => 'string', optional => 1 },
+ state => {
+ description => 'The health of the LUN from the state of its paths, when'
+ . ' that is known. Absent while a requested multipath map is missing.',
+ type => 'string',
+ enum => ['optimal', 'degraded', 'failed'],
+ optional => 1,
+ },
+ 'paths-total' => {
+ description => "The number of paths of a multipath mapped device or of"
+ . " an NVMe namespace attached through multiple controllers, or the"
+ . " number of SCSI devices of a LUN without a map.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-active' => {
+ description =>
+ "The number of active paths whose checker state is ready, ghost,"
+ . " or not reported. Native NVMe paths count when their controller is live"
+ . " and their ANA state is optimized, non-optimized, or not reported. A"
+ . " device of a LUN without a map counts while the kernel reports it as"
+ . " running.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-expected' => {
+ description => "The number of paths the LUN should have on this node: the"
+ . " highest of the count of its multipath entry and, for each managed"
+ . " iSCSI storage of the LUN, the number of its portals. Absent if no"
+ . " count is known.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'path-list' => {
+ description => "The member paths of the device with their state.",
+ type => 'array',
+ optional => 1,
+ items => {
+ type => 'object',
+ properties => {
+ device => {
+ description => "The path block device, or the NVMe"
+ . " controller device the path uses.",
+ type => 'string',
+ },
+ state => {
+ description => "The device mapper state of the path (for"
+ . " example active or failed), the state of the NVMe"
+ . " controller (for example live or connecting), or for a"
+ . " LUN without a map the kernel state of the device (for"
+ . " example running or transport-offline).",
+ type => 'string',
+ },
+ 'checker-state' => {
+ description => "The state reported by the multipathd path"
+ . " checker, for example ready, ghost or faulty.",
+ type => 'string',
+ optional => 1,
+ },
+ 'ana-state' => {
+ description => "The Asymmetric Namespace Access state of"
+ . " the namespace on this path, for example optimized"
+ . " or inaccessible.",
+ type => 'string',
+ optional => 1,
+ },
+ 'host-wwpn' => {
+ description => "The WWPN of the host (initiator) port of"
+ . " Fibre Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ 'target-wwpn' => {
+ description => "The WWPN of the target port of Fibre"
+ . " Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ address => {
+ description => "The address of the NVMe controller the"
+ . " path uses.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ usage => {
+ description => "The usage indicated by cached device metadata.",
+ type => 'string',
+ enum => ['unused', 'lvm', 'other'],
+ },
+ vgname => {
+ description => "The name of the LVM volume group the device belongs to.",
+ type => 'string',
+ optional => 1,
+ },
+ 'by-id' => {
+ description =>
+ "A path under /dev/disk/by-id that encodes the device's identity"
+ . " and has been verified to resolve to this device. Absent when no such"
+ . " link could be verified.",
+ type => 'string',
+ optional => 1,
+ },
+ 'used-by-storage' => {
+ description => "The storage that uses the LUN: as its base volume or"
+ . " through the volume group on it, or as an iSCSI storage that serves the"
+ . " LUNs of its target as images.",
+ type => 'string',
+ optional => 1,
+ },
+ wwid => {
+ description => "The LUN WWID.",
+ type => 'string',
+ },
+ name => {
+ description => 'The map alias, when different from its WWID.',
+ type => 'string',
+ optional => 1,
+ },
+ multipath => {
+ description => "How the node manages multipath for the LUN: 'manual' for a"
+ . " map with an explicit entry, 'storage' for the map of an iSCSI storage"
+ . " with the 'managed-multipath' option, 'unmanaged' for any other map,"
+ . " 'pending' while a map that an entry, a storage or the allow-list of"
+ . " the node requests does not exist yet, 'none' without a map or"
+ . " request, 'native' for the kernel-native multipath of an NVMe"
+ . " namespace.",
+ type => 'string',
+ enum => ['none', 'pending', 'storage', 'manual', 'unmanaged', 'native'],
+ },
+ 'multipath-storage' => {
+ description =>
+ "The multipath-enabled storage the LUN belongs to, whether or"
+ . " not it also has an explicit multipath entry.",
+ type => 'string',
+ optional => 1,
+ },
+ 'nvme-subsystem' => {
+ description => 'The NVMe subsystem NQN.',
+ type => 'string',
+ optional => 1,
+ },
+ 'nvme-nsid' => {
+ description => 'The namespace ID within the NVMe subsystem.',
+ type => 'integer',
+ optional => 1,
+ },
+ 'iscsi-target' => {
+ description => "The IQN of the iSCSI target the LUN is attached through.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-lun' => {
+ description => "The number of the LUN on its iSCSI target.",
+ type => 'integer',
+ optional => 1,
+ },
+ detail => {
+ description => "The cached signature or usage when usage is 'other'.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ code => sub {
+ return PVE::Storage::SAN::scan_luns(PVE::Storage::config());
+ },
+});
+
__PACKAGE__->register_method({
name => 'zfsscan',
path => 'zfs',
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 9c16e6a6..c2c50bcc 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -534,6 +534,14 @@ sub dir_is_empty {
return 1;
}
+# Some controllers pad the NQN or derive it from padded serial/model fields.
+sub read_subsysnqn {
+ my ($path) = @_;
+ my $nqn = file_read_firstline($path) // return undef;
+ $nqn =~ s/\s+$//;
+ return $nqn;
+}
+
# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
# its controller, or from any controller of its subsystem for native NVMe multipath setups.
sub get_nvme_transport {
@@ -554,6 +562,13 @@ sub get_nvme_transport {
return $transport;
}
+# SAS does not distinguish local from remote attachments, so it is not classified as remote.
+sub is_remote_transport {
+ my ($transport) = @_;
+
+ return ($transport // '') =~ m/^(?:fc|fcoe|iscsi|nvme-(?:fc|tcp|rdma))$/;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
diff --git a/src/PVE/Multipath.pm b/src/PVE/Multipath.pm
index ec417381..027e6a53 100644
--- a/src/PVE/Multipath.pm
+++ b/src/PVE/Multipath.pm
@@ -2,7 +2,9 @@ package PVE::Multipath;
use v5.36;
+use Cwd qw(abs_path);
use Encode qw(decode encode);
+use File::Basename qw(basename);
use JSON qw(decode_json);
use PVE::Tools qw(run_command file_get_contents file_read_firstline dir_glob_foreach);
@@ -19,6 +21,12 @@ sub parse_dm_uuid($uuid) {
return { wwid => $wwid, defined($part) ? (partition => int($part)) : () };
}
+sub device_map($device) {
+ my $name = basename(abs_path($device) // $device);
+ return undef if $name !~ /^dm-\d+$/;
+ return parse_dm_uuid(file_read_firstline("/sys/block/$name/dm/uuid"));
+}
+
sub map_info() {
my $maps = {};
dir_glob_foreach(
@@ -159,6 +167,22 @@ sub get_maps() {
return $maps;
}
+sub path_status_by_wwid() {
+ my $res = {};
+ for my $map (get_maps()->@*) {
+ my $wwid = $map->{wwid} // next;
+ my @paths;
+ for my $path ($map->{paths}->@*) {
+ my $row = { device => "/dev/$path->{dev}", state => $path->{'dm-state'} // 'undef' };
+ $row->{'checker-state'} = $path->{'check-state'} if defined($path->{'check-state'});
+ $row->{$_} = $path->{$_} for grep { defined($path->{$_}) } qw(host-wwpn target-wwpn);
+ push @paths, $row;
+ }
+ $res->{$wwid} = { active => $map->{'paths-active'}, paths => \@paths };
+ }
+ return $res;
+}
+
sub wait_for_map($wwid, $timeout = 10) {
my $link = "/dev/disk/by-id/dm-uuid-mpath-$wwid";
my $deadline = time() + ($timeout // 10);
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a67dc25f..a2df83c0 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -14,7 +14,8 @@ SOURCES= \
PBSPlugin.pm \
BTRFSPlugin.pm \
LvmThinPlugin.pm \
- ESXiPlugin.pm
+ ESXiPlugin.pm \
+ SAN.pm
.PHONY: install
install:
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
new file mode 100644
index 00000000..00c45717
--- /dev/null
+++ b/src/PVE/Storage/SAN.pm
@@ -0,0 +1,227 @@
+package PVE::Storage::SAN;
+
+use v5.36;
+
+use Cwd qw(abs_path);
+use File::Basename qw(basename);
+
+use PVE::INotify;
+use PVE::Tools qw(file_read_firstline dir_glob_foreach);
+
+use PVE::Diskmanage;
+use PVE::ISCSI::Topology;
+use PVE::Multipath;
+use PVE::Multipath::Config;
+use PVE::Multipath::Generator;
+use PVE::Multipath::Identity;
+use PVE::Storage;
+use PVE::Storage::LVMPlugin;
+
+my sub base_wwid($scfg) {
+ my (undef, $volname) = PVE::Storage::parse_volume_id($scfg->{base} // '', 1);
+ my ($wwid) = ($volname // '') =~ m/(?:^|\.)(?:dm-uuid-(?:part\d+-)?mpath|scsi|nvme)-(.+)$/;
+ return $wwid;
+}
+
+sub scan_luns($cfg) {
+ my $ids = PVE::Multipath::Identity::collect(all => 1);
+ my $map_info = PVE::Multipath::map_info();
+ my $members = PVE::Multipath::member_map($map_info);
+ # A map stands for its paths, of which a node with many LUNs has thousands. Leave them out of
+ # the disk list, which reads the sysfs attributes and partitions of each disk it returns.
+ my @names;
+ dir_glob_foreach(
+ '/sys/block',
+ '(?:sd[a-z]+|nvme\d+n\d+)',
+ sub($name, @) { push @names, $name if !$members->{$name} },
+ );
+ my $disks = PVE::Diskmanage::get_disks(\@names, 1, 0, 1);
+ my $maps = PVE::Diskmanage::get_multipath_disks($map_info);
+ my $sessions = PVE::ISCSI::Topology::device_map();
+ my $status = eval { PVE::Multipath::path_status_by_wwid() } // {};
+ my $nvme = PVE::Diskmanage::get_nvme_path_status();
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups() // {};
+ my $mpcfg = PVE::Multipath::Config::read_config();
+ my %explicit = map { $_ => 1 }
+ PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
+ my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
+ my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %targets, %unmapped);
+
+ for my $sid (sort keys %$derived) {
+ for my $wwid (keys $derived->{$sid}->{wwids}->%*) {
+ $storage{$wwid} //= $sid;
+ my $count = $derived->{$sid}->{wwids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ }
+ for my $wwid (keys %explicit) {
+ my $count = $mpcfg->{ids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
+ $target_owner{ $scfg->{target} } //= $sid
+ if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
+ my $base = base_wwid($scfg);
+ $base_owner{$base} //= $sid if defined($base);
+ }
+
+ my %rows;
+ my $add = sub($disk, $map = 0) {
+ my $name = basename(abs_path($disk->{devpath}) // $disk->{devpath});
+ my $info =
+ { map => $map, transport => $disk->{transport}, session => $sessions->{$name} };
+ return if !is_san_device($disk->{devpath}, $info);
+ my $wwid = $map ? $disk->{wwn} : PVE::Multipath::Identity::path_wwid($ids, $name);
+ $wwid //= file_read_firstline("/sys/class/block/$name/wwid") if $name =~ /^nvme/;
+ return if !defined($wwid) || !length($wwid);
+
+ my $row = $rows{$wwid} //= {
+ wwid => $wwid,
+ devpath => $disk->{devpath},
+ size => $disk->{size},
+ usage => 'unused',
+ multipath => $listed{$wwid}
+ || $explicit{$wwid}
+ || $storage{$wwid} ? 'pending' : 'none',
+ };
+ my $link = stable_path($disk->{devpath}, $wwid, $map);
+ # The device and its by-id name come from one disk. A map replaces a single path.
+ if ($map || (defined($link) && !$row->{'by-id'})) {
+ delete $row->{'by-id'};
+ $row->{devpath} = $disk->{devpath};
+ $row->{size} = $disk->{size};
+ $row->{'by-id'} = $link if defined($link);
+ }
+ if ($map) {
+ my $alias = basename($disk->{devpath});
+ $row->{name} = $alias if $alias ne $wwid;
+ $row->{multipath} =
+ $explicit{$wwid} ? 'manual'
+ : $storage{$wwid} ? 'storage'
+ : 'unmanaged';
+ }
+ if ($name =~ /^nvme\d+n\d+$/) {
+ $row->{multipath} = 'native' if $nvme->{$name};
+ my $nqn = PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn");
+ if (defined($nqn)) {
+ $row->{'nvme-subsystem'} = $nqn;
+ my $nsid = file_read_firstline("/sys/block/$name/nsid");
+ $row->{'nvme-nsid'} = int($nsid) if defined($nsid) && $nsid =~ /^\d+$/;
+ }
+ }
+ for my $key (qw(transport vendor model serial)) {
+ my $value = $disk->{$key};
+ $row->{$key} //= $value if defined($value) && $value ne 'unknown';
+ }
+ for my $member (map { basename($_) } ($disk->{slaves} // [$disk->{devpath}])->@*) {
+ my $session = $sessions->{$member} // next;
+ $targets{$wwid}->{ $session->{target} } = 1;
+ $row->{'iscsi-target'} //= $session->{target};
+ $row->{'iscsi-lun'} //= $session->{lun};
+ $row->{transport} = 'iscsi';
+ }
+ my $used = $disk->{used};
+ if (defined($used)) {
+ if ($used eq 'LVM' || $used eq 'LVM2_member') {
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ } elsif ($row->{usage} ne 'lvm') {
+ $row->{usage} = 'other';
+ $row->{detail} = $used;
+ }
+ }
+ my $vg = $pv_vgs->{ abs_path($disk->{devpath}) // $disk->{devpath} };
+ if (defined($vg)) {
+ $row->{vgname} //= $vg;
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ }
+ my $paths = $map ? $status->{$wwid} : $nvme->{$name};
+ if ($paths) {
+ $row->{'path-list'} = $paths->{paths};
+ $row->{'paths-total'} = scalar($paths->{paths}->@*);
+ $row->{'paths-active'} = $paths->{active};
+ } elsif ($map) {
+ $row->{'paths-total'} = $disk->{paths};
+ }
+ $unmapped{$wwid}->{$name} = 1 if !$map && $name =~ /^sd[a-z]+$/;
+ $row->{'multipath-storage'} = $storage{$wwid} if defined($storage{$wwid});
+ # multipath entries and iSCSI portals are for maps, not for native NVMe multipath
+ $row->{'paths-expected'} = $expected{$wwid}
+ if defined($expected{$wwid}) && $row->{multipath} ne 'native';
+ };
+ for my $name (sort keys %$disks) {
+ my $disk = $disks->{$name};
+ next if $members->{$name};
+ $add->($disk);
+ }
+ $add->($maps->{$_}, 1) for sort keys %$maps;
+ # Without a map, the paths of a LUN are disks of their own, each in the state that the kernel
+ # keeps for it, which is 'running' while it takes I/O.
+ for my $wwid (sort keys %unmapped) {
+ my $row = $rows{$wwid};
+ next if defined($row->{'paths-total'});
+ my @paths = map { { device => "/dev/$_", state => device_state($_) // 'unknown' } }
+ sort keys $unmapped{$wwid}->%*;
+ $row->{'path-list'} = \@paths;
+ $row->{'paths-total'} = scalar(@paths);
+ $row->{'paths-active'} = scalar(grep { $_->{state} eq 'running' } @paths);
+ }
+ for my $row (values %rows) {
+ # the devices of a LUN whose requested map is missing do not tell the state of the LUN
+ if (defined($row->{'paths-active'}) && $row->{multipath} ne 'pending') {
+ $row->{state} = PVE::Multipath::derive_health(
+ $row->{'paths-active'},
+ $row->{'paths-total'},
+ $row->{'paths-expected'},
+ );
+ }
+ my ($target) =
+ map { $target_owner{$_} // () } sort keys(($targets{ $row->{wwid} } // {})->%*);
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target;
+ $row->{'used-by-storage'} = $owner if defined($owner);
+ }
+ return [map { $rows{$_} } sort keys %rows];
+}
+
+sub device_state($name) {
+ return file_read_firstline("/sys/block/$name/device/state");
+}
+
+sub stable_path($device, $wwid, $map = 0) {
+ my $prefix = $map ? 'dm-uuid-mpath' : basename($device) =~ /^nvme/ ? 'nvme' : 'scsi';
+ my ($link) = "/dev/disk/by-id/$prefix-$wwid" =~ m{\A(/dev/disk/by-id/[A-Za-z0-9_.:+-]+)\z};
+ return undef if !defined($link);
+ return $link if (abs_path($link) // '') eq (abs_path($device) // $device);
+ return undef;
+}
+
+sub is_san_device($device, $info = undef) {
+ if (!$info) {
+ my $path = abs_path($device) // $device;
+ my $map = PVE::Multipath::device_map($path);
+ # the partitions of a LUN are handled like local devices, also the ones that kpartx maps
+ return 0 if PVE::Diskmanage::is_partition($path) || ($map && $map->{partition});
+ my $name = basename($path);
+ my $transport;
+ if ($name =~ /^nvme/) {
+ $transport = 'nvme-' . (PVE::Diskmanage::get_nvme_transport("/sys/block/$name") // '');
+ } elsif ((readlink("/sys/block/$name") // '') =~ m{/rport-\d+}) {
+ $transport = 'fc';
+ }
+ $info = {
+ map => $map,
+ transport => $transport,
+ session => PVE::Diskmanage::is_iscsi_device($name),
+ };
+ }
+ return
+ $info->{map}
+ || $info->{session}
+ || PVE::Diskmanage::is_remote_transport($info->{transport}) ? 1 : 0;
+}
+
+1;
diff --git a/src/test/Makefile b/src/test/Makefile
index bfef56d6..2f6f4cd7 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -71,3 +71,9 @@ test_multipath_api: run_multipath_api_tests.pl
test_san_taint: run_san_taint_tests.pl
perl -T ./run_san_taint_tests.pl
+
+test_san_lun_scan: run_san_lun_scan_tests.pl
+ ./run_san_lun_scan_tests.pl
+
+test_san_api: run_san_api_tests.pl
+ ./run_san_api_tests.pl
diff --git a/src/test/disk_tests/multipath/multipathd b/src/test/disk_tests/multipath/multipathd
new file mode 100644
index 00000000..40243f91
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd
@@ -0,0 +1,124 @@
+{
+ "major_version": 0,
+ "minor_version": 1,
+ "maps": [{
+ "name" : "mpatha",
+ "uuid" : "3600140500000000000000000000000001",
+ "sysfs" : "dm-0",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 0,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sda",
+ "dev_t" : "8:0",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdb",
+ "dev_t" : "8:16",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ },
+ {
+ "name" : "mpathb",
+ "uuid" : "3600140500000000000000000000000002",
+ "sysfs" : "dm-1",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 3,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sdc",
+ "dev_t" : "8:32",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdd",
+ "dev_t" : "8:48",
+ "dm_st" : "failed",
+ "dev_st" : "running",
+ "chk_st" : "faulty",
+ "checker" : "tur",
+ "pri" : 0,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ }]
+}
diff --git a/src/test/disk_tests/multipath/multipathd_status_expected.json b/src/test/disk_tests/multipath/multipathd_status_expected.json
new file mode 100644
index 00000000..df5a24da
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd_status_expected.json
@@ -0,0 +1,40 @@
+{
+ "3600140500000000000000000000000001": {
+ "active": 2,
+ "paths": [
+ {
+ "device": "/dev/sda",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdb",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ },
+ "3600140500000000000000000000000002": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/sdc",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdd",
+ "state": "failed",
+ "checker-state": "faulty",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 305bab8e..f79c59d3 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -82,6 +82,8 @@ sub mocked_run_command {
$content = '{}';
}
@$outputlines = split(/\n/, $content);
+ } elsif ($cmd->[0] =~ m/multipathd/i) {
+ @$outputlines = split(/\n/, read_test_file('multipathd'));
} else {
die "unexpected run_command call: '@$cmd', aborting\n";
}
@@ -282,6 +284,16 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
+ my $status = PVE::Multipath::path_status_by_wwid();
+ my $expected_status =
+ decode_json(read_test_file('multipathd_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'multipath status should be the same');
+ }
+
if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
my $status = PVE::Diskmanage::get_nvme_path_status();
my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
@@ -366,8 +378,11 @@ print("\tMocked get_sysdir_size\n");
$diskmanage_module->mock('assert_blockdev' => sub { return 1; });
print("\tMocked assert_blockdev\n");
$multipath_module = Test::MockModule->new('PVE::Multipath', no_auto => 1);
+$multipath_module->mock('run_command' => \&mocked_run_command);
+$multipath_module->mock('is_supported' => sub { return 1; });
$multipath_module->mock('dir_glob_foreach' => \&mocked_dir_glob_foreach);
$multipath_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked PVE::Multipath run_command and is_supported\n");
$diskmanage_module->mock(
'dir_is_empty' => sub {
my $val = shift;
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
new file mode 100755
index 00000000..4bd7d2d7
--- /dev/null
+++ b/src/test/run_san_api_tests.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw(. ..);
+use PVE::API2::Storage::Scan;
+
+for my $case (['PVE::API2::Storage::Scan', 'sanlunscan']) {
+ my ($class, @names) = @$case;
+ for my $name (@names) {
+ is_deeply(
+ $class->map_method_by_name($name)->{permissions}->{check},
+ [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ "$class $name read permission",
+ );
+ }
+}
+
+done_testing();
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
new file mode 100755
index 00000000..d394bc0b
--- /dev/null
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -0,0 +1,264 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(..);
+use Test::More;
+use Test::MockModule;
+
+use PVE::Storage::SAN;
+use PVE::API2::Storage::Scan;
+
+my $disk = Test::MockModule->new('PVE::Diskmanage');
+my $mp = Test::MockModule->new('PVE::Multipath');
+my $id = Test::MockModule->new('PVE::Multipath::Identity');
+my $config = Test::MockModule->new('PVE::Multipath::Config');
+my $storage = Test::MockModule->new('PVE::Storage');
+my $iscsi = Test::MockModule->new('PVE::ISCSI::Topology');
+my $scan = Test::MockModule->new('PVE::Storage::SAN');
+my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+my $hints;
+$lvm->mock(file_get_contents => sub { $hints // die "No such file\n" });
+$lvm->mock(abs_path => sub { $_[0] });
+$lvm->mock(run_command => sub { die "unexpected LVM device probe\n" });
+
+my $disks = {
+ sda => { devpath => '/dev/sda', size => 100, transport => 'sata' },
+ sdb => { devpath => '/dev/sdb', size => 200, transport => 'iscsi' },
+ sdc => { devpath => '/dev/sdc', size => 200, transport => 'iscsi', used => 'LVM2_member' },
+ sdd =>
+ { devpath => '/dev/sdd', size => 300, transport => 'fc', multipath => '/dev/mapper/lun' },
+ sde => { devpath => '/dev/sde', size => 400, transport => 'fc' },
+};
+my $maps = {
+ 'dm-0' => {
+ devpath => '/dev/mapper/lun',
+ size => 300,
+ wwn => '3600map',
+ paths => 2,
+ slaves => ['/dev/sdd', '/dev/sdf'],
+ transport => 'fc',
+ },
+};
+$id->mock(collect => sub { {} });
+$id->mock(path_wwid => sub { $_[1] =~ /^(sdb|sdc)$/ ? '3600plain' : undef });
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+my $generator = Test::MockModule->new('PVE::Multipath::Generator');
+$generator->mock(derived_wwids => sub { {} });
+$iscsi->mock(
+ device_map => sub {
+ return { map { $_ => { target => 'iqn.test', lun => 1 } } qw(sdb sdc) };
+ },
+);
+my @listed;
+$scan->redefine(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $code) = @_;
+ return PVE::Tools::dir_glob_foreach($dir, $regex, $code) if $dir ne '/sys/block';
+ $code->($_) for grep { /^$regex$/ } qw(sda sdb sdc sdd sde sdf dm-0 loop0 nvme0n1);
+ },
+);
+$disk->mock(
+ get_disks => sub {
+ ok($_[3], 'SAN inventory opts into iSCSI');
+ @listed = sort $_[0]->@*;
+ return $disks;
+ },
+ get_multipath_disks => sub { $maps },
+ get_nvme_path_status => sub { {} },
+ run_command => sub { die 'unexpected device probe' },
+);
+$mp->mock(list_etc_multipath_wwids => sub { [] });
+$mp->mock(
+ map_info => sub {
+ return {
+ map {
+ $_ => {
+ wwid => $maps->{$_}->{wwn},
+ slaves => [map { s{^/dev/}{}r } $maps->{$_}->{slaves}->@*],
+ }
+ } keys %$maps
+ };
+ },
+);
+$mp->mock(
+ path_status_by_wwid => sub {
+ return {
+ '3600map' => {
+ active => 1,
+ paths => [
+ { device => '/dev/sdd', state => 'active', 'checker-state' => 'ghost' },
+ { device => '/dev/sdf', state => 'failed', 'checker-state' => 'faulty' },
+ ],
+ },
+ };
+ },
+);
+$scan->mock(abs_path => sub { $_[0] });
+$scan->mock(stable_path => sub { '/dev/disk/by-id/scsi-' . $_[1] });
+my %device_state;
+$scan->mock(
+ device_state => sub { exists($device_state{ $_[0] }) ? $device_state{ $_[0] } : 'running' },
+);
+my $cfg =
+ { ids => { direct => { type => 'iscsi', target => 'iqn.test', content => { images => 1 } } } };
+my $rows = PVE::Storage::SAN::scan_luns($cfg);
+is(scalar(@$rows), 2, 'only identified SAN LUNs, one row per identity');
+is_deeply(
+ \@listed,
+ [qw(nvme0n1 sda sdb sdc sde)],
+ 'the paths of a map are left out of the disk list',
+);
+my %row = map { $_->{wwid} => $_ } @$rows;
+is($row{'3600plain'}->{usage}, 'lvm', 'positive usage from any path survives folding');
+is($row{'3600plain'}->{'used-by-storage'}, 'direct', 'a storage serving the LUNs uses them');
+{
+ local $cfg->{ids}->{direct}->{content} = { none => 1 };
+ my %plain = map { $_->{wwid} => $_ } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($plain{'3600plain'}->{'used-by-storage'}, undef, 'a connection storage does not');
+}
+is_deeply(
+ $row{'3600plain'}->{'path-list'},
+ [map { { device => $_, state => 'running' } } qw(/dev/sdb /dev/sdc)],
+ 'without a map, the devices of a LUN are its paths',
+);
+is($row{'3600plain'}->{state}, 'optimal', 'their kernel state gives the health of the LUN');
+{
+ local $device_state{sdc} = 'transport-offline';
+ my ($down) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($down->{'paths-active'}, 1, 'only a running device takes I/O');
+ is($down->{state}, 'degraded', 'a LUN with a device down is degraded');
+ $device_state{sdc} = undef;
+ ($down) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($down->{'path-list'}->[1]->{state}, 'unknown', 'a device without a state');
+ is($down->{'paths-active'}, 1, 'does not count as running');
+}
+{
+ # a LUN whose requested map is missing
+ $mp->mock(list_etc_multipath_wwids => sub { ['3600plain'] });
+ my ($pending) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($pending->{multipath}, 'pending', 'waits for its map');
+ is(scalar($pending->{'path-list'}->@*), 2, 'lists its devices');
+ ok(!exists($pending->{state}), 'but has no state from them');
+ $mp->mock(list_etc_multipath_wwids => sub { [] });
+}
+{
+ # a LUN with a single path and no map
+ $id->mock(path_wwid => sub { $_[1] eq 'sdb' ? '3600plain' : undef });
+ my ($single) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($single->{'paths-total'}, 1, 'one device, one path');
+ is($single->{state}, 'optimal', 'which the web UI shows as OK with one path');
+ local $device_state{sdb} = 'blocked';
+ ($single) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($single->{state}, 'failed', 'a blocked device takes no I/O');
+ $id->mock(path_wwid => sub { $_[1] =~ /^(sdb|sdc)$/ ? '3600plain' : undef });
+}
+is($row{'3600map'}->{state}, 'degraded', 'final state counts usable paths');
+is($row{'3600map'}->{multipath}, 'manual', 'explicit map');
+is($row{'3600map'}->{devpath}, '/dev/mapper/lun', 'map is the selected device');
+my $schema = PVE::API2::Storage::Scan->map_method_by_name('sanlunscan')->{returns};
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'rows match the public schema');
+is($row{'3600map'}->{name}, 'lun', 'map alias is exposed');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/3600map';
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unnamed) = grep { $_->{wwid} eq '3600map' } @$rows;
+ok(!exists($unnamed->{name}), 'WWID is not repeated as an alias');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/lun';
+
+{
+ my $healthy = {
+ '3600map' => {
+ active => 2,
+ paths => [map { { device => $_, state => 'active' } } qw(/dev/sdd /dev/sdf)],
+ },
+ };
+ $mp->mock(path_status_by_wwid => sub { $healthy });
+ my ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{state}, 'optimal', 'all paths usable without an expected count');
+ $config->mock(
+ read_config =>
+ sub { { ids => { '3600map' => { type => 'wwid', 'paths-expected' => 3 } } } },
+ );
+ ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{'paths-expected'}, 3, 'expected count of the entry');
+ is($map->{state}, 'degraded', 'fewer paths than the entry expects');
+ $config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+}
+
+$mp->mock(path_status_by_wwid => sub { {} });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unobserved) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($unobserved->{'paths-total'}, 2, 'map membership supplies total without daemon status');
+ok(!exists($unobserved->{'paths-active'}), 'no invented active count');
+ok(!exists($unobserved->{state}), 'no false failed state');
+
+$cfg->{ids}->{data} = { type => 'lvm', vgname => 'data' };
+$hints = "hints_version: 2.1\nscan:/dev/mapper/lun pvid:abc devn:253:0 vg:data\n";
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($cached) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($cached->{vgname}, 'data', 'hints supply the display VG');
+is($cached->{usage}, 'lvm', 'hints also supply cached usage evidence');
+is($cached->{'used-by-storage'}, 'data', 'VG allows storage attribution');
+for my $contents (undef, '', "scan=/dev/mapper/lun vg=data\n") {
+ $hints = $contents;
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is(scalar(@$rows), 2, 'missing or unrecognized hints do not lose LUNs');
+ my ($uncached) = grep { $_->{wwid} eq '3600map' } @$rows;
+ ok(!exists($uncached->{vgname}), 'VG name is absent without a hint');
+ ok(!exists($uncached->{'used-by-storage'}), 'VG-derived attribution is also absent');
+ is($uncached->{usage}, 'unused', 'usage falls back to other cached evidence');
+}
+for my $base (qw(direct scsi-direct)) {
+ # a base volume by the name that an iSCSI storage gives it without multipath
+ local $cfg->{ids}->{legacy} =
+ { type => 'lvm', vgname => 'legacy', base => "$base:0.0.1.scsi-3600map" };
+ my ($based) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is(
+ $based->{'used-by-storage'},
+ 'legacy',
+ "the storage of a SCSI base volume on storage '$base', without hints",
+ );
+}
+
+$disks->{sdc}->{used} = 'ext4';
+$maps = {};
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{usage}, 'other', 'foreign data from a sibling path is retained');
+is($rows->[0]->{detail}, 'ext4', 'signature detail');
+$scan->mock(stable_path => sub { $_[0] eq '/dev/sdc' ? '/dev/disk/by-id/scsi-3600plain' : undef });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/scsi-3600plain', 'by-id link of the second path');
+is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id link resolves to');
+
+$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
+$scan->mock(file_read_firstline => sub { $_[0] =~ m{/nsid$} ? 1 : 'eui.0123456789abcdef' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
+$scan->unmock('stable_path');
+$scan->mock(abs_path => sub { '/dev/nvme0n1' });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'none', 'NVMe without native multipath paths');
+$disk->mock(
+ get_nvme_path_status => sub {
+ { nvme0n1 =>
+ { active => 1, paths => [{ device => '/dev/nvme0c0n1', state => 'live' }] } };
+ },
+);
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'native', 'NVMe uses kernel-native multipath');
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/nvme-eui.0123456789abcdef', 'NVMe stable name');
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'native row matches the API schema');
+is($rows->[0]->{'nvme-subsystem'}, 'nqn.test', 'subsystem NQN exposed');
+is($rows->[0]->{'nvme-nsid'}, 1, 'namespace ID exposed');
+
+$disk->mock(is_partition => sub { 1 });
+ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
+$disk->mock(is_partition => sub { 0 });
+my $mp_module = Test::MockModule->new('PVE::Multipath');
+$mp_module->redefine(device_map => sub { { wwid => '3600a', partition => 1 } });
+ok(!PVE::Storage::SAN::is_san_device('/dev/dm-5'), 'neither is one that kpartx maps');
+$mp_module->redefine(device_map => sub { { wwid => '3600a' } });
+ok(PVE::Storage::SAN::is_san_device('/dev/dm-4'), 'while the map itself is');
+
+done_testing();
^ permalink raw reply related [relevance 9%]
* [PATCH v8 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel
2026-11-19 19:46 6% [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-19 19:46 9% ` [PATCH v8 storage 18/43] api: scan: add a SAN LUN inventory Thomas Lamprecht
@ 2026-11-19 19:46 10% ` Thomas Lamprecht
2026-11-20 8:45 5% ` [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-19 19:46 UTC (permalink / raw)
To: pve-devel
Fibre Channel LUNs show up as block devices on the nodes, without a
storage that connects to them, so Datacenter > Storage > Add has no
dialog to start from. Add a Fibre Channel entry to the guided setup of
the SAN view. The entry offers SCSI LUNs only. An NVMe/FC namespace uses
the native multipath of the kernel and has no storage that connects it,
so the cluster-wide status could not show its state on the nodes.
The setup enables multipath for the LUN if needed, so its menu entry
needs Sys.Modify as well. Then the setup creates the volume group on the
name of the map under /dev/disk/by-id, through the node serving the web
UI, and adds the shared LVM storage itself. The node disk API would add
the storage for all nodes and without the snapshot setting. Before it
changes anything, the setup checks that the storage ID is free, as it
cannot create the volume group a second time.
As the setup adds the storage, it waits for the volume group task on its
own, not in a task window. Closing a task window would end the setup
with a volume group and no storage. For the same reason, the setup
cannot be closed until the wait is over. If the task state cannot be
read for a while, the setup ends and says how to add the storage by
hand, as the task may still succeed and must not be started again.
No storage knows how many paths a node should have to a Fibre Channel
LUN. So a multipath entry that the setup adds expects as many paths as
the map has on the node serving the web UI. A node zoned to fewer
fabrics, or one that lost a path, then shows the LUN as degraded.
Nodes do not scan for a LUN that gets mapped to them after their login
to the array, so the setup points to the rescan of the Fibre Channel
hosts.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/dc/SAN.js | 8 +-
www/manager6/storage/wizard/FibreChannel.js | 196 ++++++++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 20 ++
www/manager6/storage/wizard/Wizard.js | 125 ++++++++++++-
www/manager6/window/SANLunState.js | 10 +-
6 files changed, 348 insertions(+), 12 deletions(-)
create mode 100644 www/manager6/storage/wizard/FibreChannel.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 09a02a9c4..1644e1d41 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -390,6 +390,7 @@ JSSRC= \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
storage/wizard/IScsi.js \
+ storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index 6efb48bf6..888fda6fc 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -111,16 +111,20 @@ Ext.define('PVE.dc.SANView', {
autoShow: true,
apiCallDone: (success) => success && reload(),
});
- let setupItem = (wizardType, className) => ({
+ let setupItem = (wizardType, className, disabled) => ({
text: PVE.storage.wizard.SAN.subject(wizardType),
iconCls: 'fa fa-fw fa-building',
+ disabled,
handler: () => Ext.create(className, { autoShow: true, reloadCallback: reload }),
});
me.tbar = [
{
text: gettext('Guided Setup'),
disabled: !canSetup,
- menu: [setupItem('iscsi', 'PVE.storage.wizard.IScsi')],
+ menu: [
+ setupItem('iscsi', 'PVE.storage.wizard.IScsi'),
+ setupItem('fc', 'PVE.storage.wizard.FibreChannel', !canModify),
+ ],
},
];
me.items = [
diff --git a/www/manager6/storage/wizard/FibreChannel.js b/www/manager6/storage/wizard/FibreChannel.js
new file mode 100644
index 000000000..f93a0f999
--- /dev/null
+++ b/www/manager6/storage/wizard/FibreChannel.js
@@ -0,0 +1,196 @@
+Ext.define('PVE.storage.wizard.FibreChannel', {
+ extend: 'PVE.storage.wizard.SAN',
+ wizardType: 'fc',
+
+ createStorage: function (values, lun) {
+ let me = this;
+ let fail = (response) => me.showError(response.htmlStatus);
+ let create = function (row) {
+ if (me.destroyed) {
+ return;
+ }
+ // the request starts the task that waitForTask() then waits for, so keep the setup open
+ let keepOpen = () => false;
+ me.on('beforeclose', keepOpen);
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${Proxmox.NodeName}/disks/lvm`,
+ method: 'POST',
+ params: { name: values.vgname, device: row['by-id'] },
+ waitMsgTarget: me,
+ callback: () => me.un('beforeclose', keepOpen),
+ failure: fail,
+ success: function (response) {
+ if (me.destroyed) {
+ return;
+ }
+ let recovery = (text) =>
+ Ext.htmlEncode(Ext.String.format(text, values.vgname, values.storage));
+ let addStorage = () =>
+ me.addLVMStorage(values, (res) =>
+ me.stopWithError(
+ res.htmlStatus +
+ '<br>' +
+ recovery(
+ gettext(
+ 'Volume group "{0}" was created, but adding storage "{1}" failed. Add it under Datacenter > Storage > Add > LVM with Shared enabled and the same nodes and snapshot setting as in the setup.',
+ ),
+ ),
+ ),
+ );
+ let lost = (status) =>
+ me.stopWithError(
+ status +
+ '<br>' +
+ recovery(
+ gettext(
+ 'Could not read the task status. The volume group creation task may still be running. Check its log under Node > Task History. If it succeeds, add volume group "{0}" as storage "{1}" under Datacenter > Storage > Add > LVM with Shared enabled and the same nodes and snapshot setting as in the setup.',
+ ),
+ ),
+ );
+ let message = gettext('Creating the volume group...');
+ me.waitForTask(response.result.data, message, addStorage, lost);
+ },
+ });
+ };
+ let hasMultipath = (row) => ['manual', 'storage', 'unmanaged'].includes(row.multipath);
+ // the volume group is created on the by-id path of the map, which names the WWID
+ let ready = (row) => hasMultipath(row) && !!row['by-id'];
+ // Fibre Channel has no storage that knows how many paths a node should have, so an entry
+ // the setup adds expects the paths of this node. A node with fewer paths then shows as
+ // degraded. The wizard remembers the entry it added, so that a retry still sets the
+ // expected paths before it creates the volume group.
+ let expectPaths = function (row) {
+ if (!(row['paths-total'] >= 2)) {
+ delete me.addedEntry;
+ create(row);
+ return;
+ }
+ Proxmox.Utils.API2Request({
+ url: `/cluster/multipath/wwid/${encodeURIComponent(lun.wwid)}`,
+ method: 'PUT',
+ params: { 'paths-expected': row['paths-total'] },
+ waitMsgTarget: me,
+ failure: fail,
+ success: () => {
+ delete me.addedEntry;
+ create(row);
+ },
+ });
+ };
+ let waitForMap = function () {
+ if (me.destroyed) {
+ return;
+ }
+ let store = Ext.create('Proxmox.data.UpdateStore', {
+ storeid: 'san-wizard-map',
+ model: 'pve-san-lun',
+ interval: 3000,
+ proxy: {
+ type: 'proxmox',
+ url: `/api2/json/nodes/${Proxmox.NodeName}/scan/san-luns`,
+ },
+ });
+ let timer = Ext.defer(function () {
+ store.destroy();
+ if (!me.destroyed) {
+ me.setLoading(false);
+ me.showError(
+ gettext(
+ 'The multipath map or its name under /dev/disk/by-id did not appear within 90 seconds. Check Node > SAN, then reload the LUN list.',
+ ),
+ );
+ }
+ }, 90000);
+ me.on(
+ 'destroy',
+ () => {
+ clearTimeout(timer);
+ if (!store.destroyed) {
+ store.destroy();
+ }
+ },
+ null,
+ { single: true },
+ );
+ me.setLoading(gettext('Waiting for the multipath map...'));
+ store.on('load', function (s, records, success, operation) {
+ if (me.destroyed) {
+ return;
+ }
+ let row = records?.find((rec) => rec.get('wwid') === lun.wwid)?.data;
+ if (!success || (row && ready(row))) {
+ clearTimeout(timer);
+ store.destroy();
+ me.setLoading(false);
+ if (success) {
+ me.down('#luns').down('grid').getSelection()[0].set(row);
+ if (me.addedEntry === lun.wwid) {
+ expectPaths(row);
+ } else {
+ create(row);
+ }
+ } else {
+ me.showError(Proxmox.Utils.getResponseErrorMessage(operation.getError()));
+ }
+ }
+ });
+ store.startUpdate();
+ };
+ let setup = function () {
+ if (ready(lun)) {
+ if (me.addedEntry === lun.wwid) {
+ expectPaths(lun);
+ } else {
+ create(lun);
+ }
+ } else if (
+ hasMultipath(lun) ||
+ lun.multipath === 'pending' ||
+ me.addedEntry === lun.wwid
+ ) {
+ waitForMap();
+ } else {
+ let params = { wwid: lun.wwid };
+ if (values.nodes) {
+ params.nodes = values.nodes;
+ }
+ Proxmox.Utils.API2Request({
+ url: '/cluster/multipath/wwid',
+ method: 'POST',
+ params,
+ waitMsgTarget: me,
+ failure: fail,
+ success: () => {
+ me.addedEntry = lun.wwid;
+ waitForMap();
+ },
+ });
+ }
+ };
+ // The storage is added last. Its ID has to be free before anything is created: once the
+ // volume group exists, the setup cannot create it again.
+ Proxmox.Utils.API2Request({
+ url: '/storage',
+ method: 'GET',
+ waitMsgTarget: me,
+ failure: fail,
+ success: function (response) {
+ if (me.destroyed) {
+ return;
+ }
+ if (response.result.data.some((entry) => entry.storage === values.storage)) {
+ me.showError(
+ Ext.htmlEncode(
+ Ext.String.format(
+ gettext('Storage ID "{0}" is already in use. Choose another ID.'),
+ values.storage,
+ ),
+ ),
+ );
+ return;
+ }
+ setup();
+ },
+ });
+ },
+});
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index e42779927..985131c00 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -23,6 +23,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let grid = me.down('grid');
me.rstore.stopUpdate();
let connection = wizard.connection;
+ if (!connection) {
+ me.rstore.startUpdate();
+ return;
+ }
// The scan names one target per LUN, also for a LUN reached through several. The content
// listing has the LUNs of the connection, and a LUN that shows up later is listed once the
// scan names the target of the connection for it.
@@ -88,6 +92,15 @@ Ext.define('PVE.storage.wizard.LunSelect', {
'A LUN that is in use cannot be selected. A LUN with data that is no longer needed has to be wiped under Node > SAN first.',
),
},
+ ...(me.rescanNote
+ ? [
+ {
+ xtype: 'component',
+ margin: '0 0 10 0',
+ html: `<span class="pmx-hint">${Ext.htmlEncode(gettext('Note:'))}</span> ${me.rescanNote}`,
+ },
+ ]
+ : []),
{
xtype: 'grid',
flex: 1,
@@ -189,6 +202,13 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let search = me.down('pveRecordSearchField');
me.on('activate', function () {
search.setTargetStore(me.store);
+ if (me.up('window').wizardType === 'fc') {
+ me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ me.store.addFilter({
+ id: 'transport',
+ filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')),
+ });
+ }
me.reload();
});
// The setup can update the selected row after this step, which the search must not hide.
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index e0541375b..8c88aae16 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -5,7 +5,10 @@ Ext.define('PVE.storage.wizard.SAN', {
statics: {
subject: (type) =>
- Ext.String.format(gettext('LVM on {0}'), PVE.Utils.format_storage_type(type)),
+ Ext.String.format(
+ gettext('LVM on {0}'),
+ type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
+ ),
// a validator of a Nodes field, which ExtJS calls with the field as this
validateNodes: function () {
@@ -21,6 +24,11 @@ Ext.define('PVE.storage.wizard.SAN', {
},
},
+ stopWithError: function (message) {
+ this.close();
+ Ext.Msg.alert(gettext('Error'), message);
+ },
+
showError: function (message) {
if (this.destroyed) {
return;
@@ -29,6 +37,65 @@ Ext.define('PVE.storage.wizard.SAN', {
Ext.Msg.alert(gettext('Error'), message);
},
+ // Waits for a task with the setup masked and continues with next() once it succeeded. A task
+ // window of its own could be closed while the task runs, which would end the setup there. The
+ // setup cannot be closed during the wait either, for example with the Escape key.
+ // If the state of the task cannot be read for some time, lost() gets the error: the task may
+ // still be running then, so the setup must not start it again.
+ waitForTask: function (upid, message, next, lost) {
+ let me = this;
+ let task = Proxmox.Utils.parse_task_upid(upid);
+ let failures = 0;
+ let keepOpen = () => false;
+ let done = function (error) {
+ if (me.destroyed) {
+ return;
+ }
+ me.un('beforeclose', keepOpen);
+ me.setLoading(false);
+ if (error === undefined) {
+ next();
+ } else {
+ me.showError(error);
+ }
+ };
+ let poll = function () {
+ if (me.destroyed) {
+ return;
+ }
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${task.node}/tasks/${encodeURIComponent(upid)}/status`,
+ method: 'GET',
+ failure: function (response) {
+ if (me.destroyed) {
+ return;
+ }
+ if (++failures < 5) {
+ Ext.defer(poll, 2000);
+ return;
+ }
+ me.un('beforeclose', keepOpen);
+ me.setLoading(false);
+ lost(response.htmlStatus);
+ },
+ success: function (response) {
+ failures = 0;
+ let { status, exitstatus } = response.result.data;
+ if (status !== 'stopped') {
+ Ext.defer(poll, 1000);
+ return;
+ }
+ let result = Proxmox.Utils.parse_task_status(exitstatus);
+ let failed = result === 'error' || result === 'unknown';
+ done(failed ? Ext.htmlEncode(exitstatus) : undefined);
+ },
+ });
+ };
+ me.on('beforeclose', keepOpen);
+ me.setLoading(message);
+ poll();
+ },
+
volumeSettings: function () {
let me = this;
let value = (name) => me.down(`field[name=${name}]`).getValue();
@@ -36,7 +103,13 @@ Ext.define('PVE.storage.wizard.SAN', {
storage: value('storage'),
vgname: value('vgname'),
'snapshot-as-volume-chain': value('snapshot-as-volume-chain') ? 1 : 0,
- nodes: me.connection.nodes,
+ nodes:
+ me.wizardType === 'fc'
+ ? []
+ .concat(value('nodes') || [])
+ .filter(Boolean)
+ .join(',')
+ : me.connection.nodes,
};
},
@@ -65,6 +138,7 @@ Ext.define('PVE.storage.wizard.SAN', {
wwid,
storage: values.storage,
nodes: params.nodes,
+ fc: me.wizardType === 'fc',
autoShow: true,
});
},
@@ -72,11 +146,18 @@ Ext.define('PVE.storage.wizard.SAN', {
},
multipathSummary: function (lun) {
+ let me = this;
// an explicit entry takes precedence, also for a LUN of the connection storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
}
- return PVE.SANUtils.multipathText('storage', this.connection.storage);
+ if (me.connection) {
+ return PVE.SANUtils.multipathText('storage', me.connection.storage);
+ }
+ // the Fibre Channel setup adds an entry for a LUN without multipath
+ return lun.multipath === 'none'
+ ? gettext('Explicit entry, added by this setup')
+ : PVE.SANUtils.multipathText(lun.multipath, lun['multipath-storage']);
},
updateSummary: function () {
@@ -84,7 +165,6 @@ Ext.define('PVE.storage.wizard.SAN', {
let values = me.volumeSettings();
let lun = me.down('#luns').getSelection();
let rows = [
- [gettext('Connection Storage'), me.connection.storage],
[gettext('Storage ID'), values.storage],
[gettext('Volume Group'), values.vgname],
['WWID', lun.wwid],
@@ -96,6 +176,9 @@ Ext.define('PVE.storage.wizard.SAN', {
Proxmox.Utils.format_boolean(values['snapshot-as-volume-chain']),
],
];
+ if (me.connection) {
+ rows.unshift([gettext('Connection Storage'), me.connection.storage]);
+ }
me.down('#summary')
.getStore()
.setData(rows.map(([key, value]) => ({ key, value })));
@@ -111,6 +194,10 @@ Ext.define('PVE.storage.wizard.SAN', {
initComponent: function () {
let me = this;
+ if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ throw 'no SAN storage type specified';
+ }
+ let iscsi = me.wizardType === 'iscsi';
me.subject = PVE.storage.wizard.SAN.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
let common = PVE.panel.StorageBase.commonFields(true);
@@ -130,13 +217,35 @@ Ext.define('PVE.storage.wizard.SAN', {
PVE.panel.StorageBase.volumeChainField(true, 'lvm'),
],
};
+ if (!iscsi) {
+ settings.advancedItems = [
+ { ...common.nodes, validator: PVE.storage.wizard.SAN.validateNodes },
+ ];
+ }
me.items = [
- { xtype: 'pveStorageWizardIScsiTarget', title: gettext('Target'), itemId: 'target' },
+ ...(iscsi
+ ? [
+ {
+ xtype: 'pveStorageWizardIScsiTarget',
+ title: gettext('Target'),
+ itemId: 'target',
+ },
+ ]
+ : []),
{
xtype: 'pveStorageWizardLunSelect',
title: 'LUN',
itemId: 'luns',
onlineHelp: 'storage_multipath',
+ // the nodes only see a newly mapped Fibre Channel LUN after a rescan
+ rescanNote: iscsi
+ ? undefined
+ : Ext.String.format(
+ gettext(
+ 'After mapping a new LUN on the array, rescan the Fibre Channel hosts of each node (<a href="{0}" target="_blank" rel="noopener noreferrer">documentation</a>).',
+ ),
+ Ext.htmlEncode(Proxmox.Utils.get_help_link('storage_multipath')),
+ ),
},
settings,
{
@@ -171,14 +280,16 @@ Ext.define('PVE.storage.wizard.SAN', {
me.callParent();
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (tab === me.down('#luns')) {
+ if (iscsi && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- me.down('#submit').setText(gettext('Next'));
+ if (iscsi) {
+ me.down('#submit').setText(gettext('Next'));
+ }
me.on('destroy', () => me.reloadCallback?.());
},
});
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index 6d5221329..6215f8e57 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -55,9 +55,13 @@ Ext.define('PVE.window.SANLunState', {
margin: '0 0 10 0',
html: Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
- ),
+ me.fc
+ ? gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.',
+ )
+ : gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
+ ),
me.storage,
),
),
^ permalink raw reply related [relevance 10%]
* [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM
@ 2026-11-19 19:46 6% Thomas Lamprecht
2026-11-19 19:46 13% ` [PATCH v8 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
` (4 more replies)
0 siblings, 5 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-19 19:46 UTC (permalink / raw)
To: pve-devel
This is v8 of the combined and reduced series of the cluster-wide
multipath work [0][1] and Dietmar's RFC for guided remote storage setup
and SAN visibility [2].
If nothing grave comes up I plan to apply this as is.
v8 is v7 [9] plus what an independent review of v7 turned up and held
up when checked against the code and the lab, i.e.:
- A WWID that multipath refuses, for example because the overrides
blacklist it, no longer stops the other WWIDs of a node or the reload
of the configuration. The node reports it as an error and tries it
again after five minutes, or after the overrides change; a multipath
that hangs ends the additions of that pass.
- The overrides also refuse a '{' that is not on the line of its
section name: multipath only warns about that and applies the
section, so a multipaths block could get past the check.
- A drop-in is only replaced if its first line is exactly the generated
one, no longer also with the header of the unreleased v1 to v3.
- A wipe that finished no longer ends as a failed task if udev does not
settle in time afterwards.
- The guided setups are one class per transport, instead of functions
on a namespace, and the note of the target step names the Next button
through a placeholder for translators.
- The setup procedure of the chapter keeps its steps short, with the
Fibre Channel details and keeping a volume group after the list. It
names multipath_component_detection and says that a portal a node
cannot reach keeps the LUNs of the storage Degraded there.
- A base volume is read as volume ID first, so a storage ID like
'scsi-a' no longer confuses which LUN an LVM storage has as base in
the LUN list and the status.
- Smaller ones: descriptions for the fields of the cluster-wide status,
if blocks instead of long post-ifs, clearer comments, test
descriptions and commit messages, and the chapter says why all nodes
need the upgrade first.
Blockbridge tested v7 with their plugin again, thanks! On their
suggestion, Node > SAN shows the namespace ID of an NVMe namespace in
the LUN column, now named LUN/NSID. Their note that a namespace their
plugin connected looks like a single-path one once a path is
disconnected led to two small changes: an explicit multipath entry for
an NVMe namespace is refused, as it showed the namespace as Missing on
every node and could not give it an expected path count, and the chapter
says that NVMe namespaces have none. A plugin method for the expected
paths of plugin volumes could follow as an addition.
What I left as is: points decided for v5 [3] to v7, such as the time
budget of the cluster lock for slow commands, storage IDs for node
auditors and a version check for mixed clusters, and master's behavior
of the other node disk endpoints, which keep allowing a Fibre Channel
LUN as local disk of one node.
Overview of what an admin gets with this:
- Datacenter > Storage > SAN, a new entry below Storage, shows the
multipath state of every node and of the LUNs that Proxmox VE
manages or has a storage on, and edits the multipath entries and
array-specific overrides. I explicitly chose this over the
client/plugin side of Storage, as we do not have e.g. Ceph or
ZFS/LVM/... creation in there either. We might want to rethink and
consolidate our storage interface vs. management story in the
future, but IMO a partial switch now is not worth it, that would add
even more potential for confusion than the new SAN view.
- Its Guided Setup menu leads through shared LVM on a LUN: for iSCSI it
connects or reuses a target, with the initiator names of its nodes at
hand, for Fibre Channel it takes a LUN the nodes already see. Both
set up multipath and end with the state of the LUN on every node.
- Datacenter > Storage > Add keeps its dialogs. The iSCSI one gets a
Multipath option and the LVM one enables Shared for a base storage,
and both point to the SAN view.
- Node > SAN lists the LUNs of a node with their paths and usage, can
wipe a LUN that no storage uses, and shows the iSCSI sessions.
The rules the series follows since v4: nodes add WWIDs and maps but
never remove them, a write is checked where it happens, lists do not
probe devices, there are no new iSCSI operations, the guided setup makes
the API calls an admin would make by hand, and multipath management is
turned on by the admin. The v4 cover [7] has the reasons.
Two things an admin will likely miss: there is no notification when a
LUN loses path redundancy, the state only shows on the SAN pages and in
the API. And Fibre Channel starts at a LUN the nodes already see; the
chapter gives the commands to list WWPNs and rescan the HBAs.
How it works:
- /etc/pve/multipath.cfg holds explicit entries per WWID,
/etc/pve/multipath-overrides.conf array settings; patch 01
registers both. An iSCSI storage with the 'managed-multipath' option
supplies its LUNs without entries. The option is not named
'multipath', as third-party plugins use that name, and the storage
layer leaves out a third-party plugin that declares a property of
another plugin.
- pvestatd calls one function of pve-storage per pass. It adds the
WWIDs the node needs to /etc/multipath/wwids, writes the drop-ins
/etc/multipath/conf.d/pve-*.conf, reloads multipathd after a change,
and publishes the state of the maps that Proxmox VE manages or that a
storage builds on through the node key-value store.
- /cluster/multipath/status aggregates these reports;
/cluster/multipath/{wwid,overrides} edit the two files;
/nodes/{node}/scan/san-luns lists the LUNs of a node and
/nodes/{node}/iscsi its sessions.
- The volumes of an iSCSI storage with the option are named after the
multipath map, so an LVM storage uses them through 'base' as before.
- Volume group creation and wipe run under a cluster lock per LUN. They
refuse a LUN that a storage uses or a process of the node has open,
also through another path. Opens through another device node, such as
one of a container, and users on other hosts are not seen.
Patches:
- cluster 01: register the two configuration files
- storage 02-26: helpers for the disk and iSCSI session inventory
(mostly Dietmar's), the multipath library and configuration, the
iSCSI option, the per-node apply and status with their API, the disk
list of many disks, the LUN inventory, the read-only iSCSI status and
the portal of an iSCSI path, volume groups on LUNs, the wipe and the
process that has a LUN open
- docs 27-28: the multipath chapter, rewritten around tasks, and the
paragraph for a LUN that a process has open
- manager 29-43: the pvestatd call, report and API mounts, then the
views, the two dialog changes, the two guided setups, the note in the
add dialogs, and the guest or process and the target of a LUN
Other changes since v7 [9]:
- rebased onto current master
When applying, versioned dependencies have to be set: pve-manager on
libpve-storage-perl, and libpve-storage-perl (also as build dependency)
on the libpve-cluster-perl with patch 01, as PVE::Storage
registers the two files when it is loaded. pve-cluster with the same
patch keeps the version counters of the two files; with an older pmxcfs
they are read and parsed again on every request. pve-manager also needs
the pve-doc-generator (build) and pve-docs with the multipath chapter,
for its help links. With these versions set, the chapter's request to
upgrade all nodes before enabling the management could name them. If the
bound for LVM status commands [4] gets applied too, whichever is applied
second has to pass the status cache to the two lvm_vgs() calls of the
base volume activation, as they can block a status pass otherwise. Both
mark the cache of the status update with 'status_only', in the same
line.
The per-node target and portal series [5][6] are independent of this
one. It takes the LUNs of an iSCSI storage from the sessions of its one
target, so if a storage can have several targets per node, whichever is
applied second has to cover that.
I tested v8 on the lab of v4 [7] to v7, upgraded from the v7 build, with
the NVMe over Fabrics series and [4] on top. A WWID that the overrides
blacklist next to another let the other be added and its map assembled,
with the refusal shown for each node in the SAN view; the two forms of a
'{' apart from its section name were refused; a drop-in with the old
header stayed and the node said why. The iSCSI setup on the NetApp, the
Fibre Channel setup and the NVMe over Fabrics setup ran to the end with
the new classes, and two wipes ended as OK tasks. With five refused
WWIDs, every node named three and counted the other two, and lifting the
blacklist of one let it be added in the next pass. An unquoted value
with braces in the overrides got the hint to quote it. An LVM storage on
a LUN of a second iSCSI storage named 'scsi-n02' showed as its user in
the LUN list and the cluster status, and the wipe of the LUN was
refused. For the rest, the tests of v7 [9] and v6 [8] still apply.
[0]: https://lore.proxmox.com/pve-devel/20260626121000.2095591-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20260703124707.1172980-2-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20260731102156.3947857-1-dietmar@proxmox.com/
[3]: https://lore.proxmox.com/pve-devel/20261116012355.3187417-1-t.lamprecht@proxmox.com/
[4]: https://lore.proxmox.com/pve-devel/20261111015217.941220-1-t.lamprecht@proxmox.com/
[5]: https://lore.proxmox.com/pve-devel/20260430173220.441001-1-m.limbeck@proxmox.com/
[6]: https://lore.proxmox.com/pve-devel/20260804090819.2136483-1-dietmar@proxmox.com/
[7]: https://lore.proxmox.com/pve-devel/20261113030146.1559030-1-t.lamprecht@proxmox.com/
[8]: https://lore.proxmox.com/pve-devel/20261118065302.3033937-1-t.lamprecht@proxmox.com/
[9]: https://lore.proxmox.com/pve-devel/20261118202646.3017286-1-t.lamprecht@proxmox.com/
pve-cluster:
Thomas Lamprecht (1):
cfs: observe the multipath configuration files
src/PVE/Cluster.pm | 2 ++
src/pmxcfs/status.c | 2 ++
2 files changed, 4 insertions(+)
pve-storage:
Dietmar Maurer (8):
diskmanage: collect disk transport type from lsblk
diskmanage: qualify NVMe over Fabrics transport
diskmanage: optionally include iSCSI session devices in disk enumeration
diskmanage: collect native NVMe multipath path state
iscsi: factor out session device map from device list
diskmanage: add helper to list multipath devices
pvesm: expose the SAN LUN inventory
api: add node-level iSCSI status
Thomas Lamprecht (17):
multipath: add a library around multipathd
multipath: add a cluster-wide configuration
iscsi: add an option to manage storage LUNs with multipath
lvm: activate a missing base volume before using the volume group
multipath: apply the configuration on every node
multipath: publish per-node status
api: add endpoints for the cluster-wide multipath configuration
api: multipath: add the cluster-wide health status
diskmanage: look up the requested disks by name
diskmanage: read the udev data of all disks with one call
api: scan: add a SAN LUN inventory
api: scan: name the portal of an iSCSI path
disks: lvm: drop unused imports
disks: lvm: allow volume groups on SAN LUNs and multipath maps
disks: lvm: refuse to destroy the volume group of a shared storage
disks: allow wiping a SAN LUN that no storage uses
api: scan: report the process that has a SAN LUN open
debian/control | 3 +-
src/PVE/API2/Disks.pm | 47 +-
src/PVE/API2/Disks/LVM.pm | 81 +-
src/PVE/API2/ISCSI.pm | 166 +++++
src/PVE/API2/Makefile | 2 +
src/PVE/API2/Multipath.pm | 537 +++++++++++++
src/PVE/API2/Storage/Scan.pm | 244 ++++++
src/PVE/CLI/pvesm.pm | 15 +
src/PVE/Diskmanage.pm | 386 ++++++++--
src/PVE/ISCSI/Topology.pm | 89 +++
src/PVE/Makefile | 6 +
src/PVE/Multipath.pm | 213 ++++++
src/PVE/Multipath/Config.pm | 215 ++++++
src/PVE/Multipath/Generator.pm | 156 ++++
src/PVE/Multipath/Identity.pm | 44 ++
src/PVE/Multipath/Status.pm | 229 ++++++
src/PVE/Storage.pm | 2 +-
src/PVE/Storage/ISCSIPlugin.pm | 219 ++++--
src/PVE/Storage/LVMPlugin.pm | 158 +++-
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 463 ++++++++++++
src/test/Makefile | 37 +-
src/test/disk_api_test.pm | 314 ++++++++
src/test/disk_tests/iscsi/disklist | 1 +
.../disk_tests/iscsi/disklist_expected.json | 19 +
src/test/disk_tests/iscsi/lsblk | 5 +
src/test/disk_tests/iscsi/sda/device/model | 1 +
src/test/disk_tests/iscsi/sda/device/vendor | 1 +
.../disk_tests/iscsi/sda/queue/rotational | 1 +
src/test/disk_tests/iscsi/sda/size | 1 +
src/test/disk_tests/iscsi/sda_udevadm | 21 +
src/test/disk_tests/multipath/disklist | 11 +
.../multipath/disklist_expected.json | 107 +++
src/test/disk_tests/multipath/dm-0/dm/name | 1 +
src/test/disk_tests/multipath/dm-0/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-0/size | 1 +
src/test/disk_tests/multipath/dm-0_slaves | 4 +
src/test/disk_tests/multipath/dm-1/dm/name | 1 +
src/test/disk_tests/multipath/dm-1/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-1/size | 1 +
src/test/disk_tests/multipath/dm-1_slaves | 4 +
src/test/disk_tests/multipath/dm-2/dm/name | 1 +
src/test/disk_tests/multipath/dm-2/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-2/size | 1 +
src/test/disk_tests/multipath/dm-2_slaves | 0
src/test/disk_tests/multipath/dm-3/dm/name | 1 +
src/test/disk_tests/multipath/dm-3/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-3/size | 1 +
src/test/disk_tests/multipath/dm-3_slaves | 0
src/test/disk_tests/multipath/dm-4/dm/name | 1 +
src/test/disk_tests/multipath/dm-4/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-4/size | 1 +
src/test/disk_tests/multipath/dm-4_slaves | 0
src/test/disk_tests/multipath/lsblk | 77 ++
src/test/disk_tests/multipath/lvs | 0
src/test/disk_tests/multipath/mounts | 1 +
.../multipath/multipath_expected.json | 59 ++
src/test/disk_tests/multipath/multipathd | 124 +++
.../multipath/multipathd_status_expected.json | 40 +
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 +
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/nvme5/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +
.../multipath/nvme_path_status_expected.json | 19 +
src/test/disk_tests/multipath/partlist | 0
src/test/disk_tests/multipath/pvs | 1 +
.../disk_tests/multipath/sda/device/model | 1 +
.../disk_tests/multipath/sda/device/vendor | 1 +
.../disk_tests/multipath/sda/holders/holder | 1 +
.../disk_tests/multipath/sda/queue/rotational | 1 +
src/test/disk_tests/multipath/sda/size | 1 +
src/test/disk_tests/multipath/sda_udevadm | 18 +
.../disk_tests/multipath/sdb/device/model | 1 +
.../disk_tests/multipath/sdb/device/vendor | 1 +
.../disk_tests/multipath/sdb/holders/holder | 1 +
.../disk_tests/multipath/sdb/queue/rotational | 1 +
src/test/disk_tests/multipath/sdb/size | 1 +
src/test/disk_tests/multipath/sdb_udevadm | 18 +
.../disk_tests/multipath/sdc/device/model | 1 +
.../disk_tests/multipath/sdc/device/vendor | 1 +
.../disk_tests/multipath/sdc/holders/holder | 1 +
.../disk_tests/multipath/sdc/queue/rotational | 1 +
src/test/disk_tests/multipath/sdc/size | 1 +
src/test/disk_tests/multipath/sdc_udevadm | 18 +
.../disk_tests/multipath/sdd/device/model | 1 +
.../disk_tests/multipath/sdd/device/vendor | 1 +
.../disk_tests/multipath/sdd/holders/holder | 1 +
.../disk_tests/multipath/sdd/queue/rotational | 1 +
src/test/disk_tests/multipath/sdd/size | 1 +
src/test/disk_tests/multipath/sdd_udevadm | 18 +
src/test/disk_tests/multipath/zpool | 1 +
.../disk_tests/sas/disklist_expected.json | 1 +
src/test/disk_tests/sas/lsblk | 5 +
src/test/disklist_test.pm | 179 ++++-
src/test/multipath-three-states.json | 52 ++
src/test/plugin_properties_test.pm | 1 +
src/test/run_disk_api_tests.pl | 11 +
src/test/run_iscsi_activation_tests.pl | 109 +++
src/test/run_lun_identity_tests.pl | 57 ++
src/test/run_multipath_api_tests.pl | 705 ++++++++++++++++++
src/test/run_multipath_tests.pl | 194 +++++
src/test/run_san_api_tests.pl | 124 +++
src/test/run_san_library_tests.pl | 135 ++++
src/test/run_san_lun_scan_tests.pl | 338 +++++++++
src/test/run_san_nvme_tests.pl | 122 +++
src/test/run_san_taint_tests.pl | 60 ++
src/test/run_san_wipe_tests.pl | 271 +++++++
src/test/run_san_write_check_tests.pl | 219 ++++++
src/test/run_test_lvm_base_activation.pl | 121 +++
src/test/run_test_lvm_base_volume.pl | 16 +-
src/test/run_test_lvm_create.pl | 46 ++
126 files changed, 6846 insertions(+), 197 deletions(-)
pve-docs:
Thomas Lamprecht (2):
storage: document the cluster-wide multipath management
storage: multipath: describe the use shown for an open LUN
pmxcfs.adoc | 2 +
pve-storage-iscsi.adoc | 11 ++
pve-storage-iscsidirect.adoc | 2 +-
pve-storage-lvm.adoc | 3 +
pve-storage-multipath.adoc | 329 +++++++++++++++++++++++++++++++++++
pvesm.adoc | 18 +-
6 files changed, 359 insertions(+), 6 deletions(-)
pve-manager:
Dietmar Maurer (2):
api: nodes: expose the iSCSI status
ui: node: san: show iSCSI targets and sessions
Thomas Lamprecht (13):
pvestatd: apply the multipath configuration and report the node status
report: add the managed multipath configuration
api: cluster: add the multipath endpoints
ui: dc: add a SAN view
ui: storage: iscsi: add the multipath option
ui: lvm: enable shared when a base storage is selected
ui: node: add SAN LUNs panel
ui: node: san: wipe a LUN that no storage uses
ui: dc: san: add a guided setup for shared LVM on iSCSI
ui: dc: san: add a guided setup for shared LVM on Fibre Channel
ui: storage: point the iSCSI and LVM add dialogs to the SAN view
ui: san: show the guest or process that has a LUN open
ui: node: san: add a column for the target or subsystem of a LUN
PVE/API2/Cluster.pm | 7 +
PVE/API2/Nodes.pm | 7 +
PVE/Report.pm | 3 +
PVE/Service/pvestatd.pm | 7 +
www/manager6/Makefile | 12 +
www/manager6/SANUtils.js | 239 +++++++++++
www/manager6/Utils.js | 19 +
www/manager6/dc/Config.js | 23 +-
www/manager6/dc/MultipathWwidEdit.js | 81 ++++
www/manager6/dc/SAN.js | 398 ++++++++++++++++++
www/manager6/node/Config.js | 24 ++
www/manager6/node/ISCSITargets.js | 150 +++++++
www/manager6/node/LVM.js | 5 +
www/manager6/node/SANLuns.js | 233 ++++++++++
www/manager6/storage/Base.js | 5 +
www/manager6/storage/IScsiEdit.js | 46 ++
www/manager6/storage/LVMEdit.js | 6 +
www/manager6/storage/wizard/FibreChannel.js | 196 +++++++++
www/manager6/storage/wizard/IScsi.js | 306 ++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 224 ++++++++++
www/manager6/storage/wizard/NodeIdentities.js | 94 +++++
www/manager6/storage/wizard/Wizard.js | 295 +++++++++++++
www/manager6/window/SANLunState.js | 119 ++++++
www/manager6/window/SANLunWipe.js | 64 +++
24 files changed, 2557 insertions(+), 6 deletions(-)
^ permalink raw reply [relevance 6%]
* [PATCH v8 storage 03/43] diskmanage: qualify NVMe over Fabrics transport
2026-11-19 19:46 6% [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
@ 2026-11-19 19:46 13% ` Thomas Lamprecht
2026-11-19 19:46 13% ` [PATCH v8 storage 05/43] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
` (3 subsequent siblings)
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-19 19:46 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
lsblk reports 'nvme' for namespaces attached over a fabric too, so
they cannot be told from local PCIe drives. Read the transport from
the controller, or from a controller of the subsystem with native
multipath, and report nvme-fc, nvme-tcp, nvme-rdma or nvme-loop for
such namespaces.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: add the test case with the two namespaces only, as the multipath
devices it was part of follow later; mention the new values in the
transport description; call the wrapped test function with arrow
syntax]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Disks.pm | 3 +-
src/PVE/Diskmanage.pm | 27 ++++++++++++++
src/test/disk_tests/multipath/disklist | 2 ++
.../multipath/disklist_expected.json | 35 +++++++++++++++++++
src/test/disk_tests/multipath/lsblk | 18 ++++++++++
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 ++++++++
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +++++++
src/test/disklist_test.pm | 12 +++++++
17 files changed, 131 insertions(+), 1 deletion(-)
create mode 100644 src/test/disk_tests/multipath/disklist
create mode 100644 src/test/disk_tests/multipath/disklist_expected.json
create mode 100644 src/test/disk_tests/multipath/lsblk
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme8n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme8n1/size
create mode 100644 src/test/disk_tests/multipath/nvme8n1_udevadm
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/vendor
create mode 100644 src/test/disk_tests/multipath/nvme9n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme9n1/size
create mode 100644 src/test/disk_tests/multipath/nvme9n1_udevadm
diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index 1abab820..980ba7ff 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -138,7 +138,8 @@ __PACKAGE__->register_method({
transport => {
type => 'string',
description =>
- "The device transport, for example 'sata', 'sas', 'usb', 'fc', or 'nvme'.",
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'nvme', 'nvme-fc', or 'nvme-tcp'.",
optional => 1,
},
parent => {
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 4d66902b..7862bcd4 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -505,6 +505,26 @@ sub is_iscsi {
return 0;
}
+# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
+# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+sub get_nvme_transport {
+ my ($sysdir) = @_;
+
+ my $transport = file_read_firstline("$sysdir/device/transport");
+ return $transport if defined($transport);
+
+ dir_glob_foreach(
+ "$sysdir/device",
+ 'nvme\d+',
+ sub {
+ my ($controller) = @_;
+ $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ },
+ );
+
+ return $transport;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
@@ -597,6 +617,9 @@ sub get_disks {
# we do not want iscsi devices
return if is_iscsi($sysdir);
+ my $nvme_transport;
+ $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
+
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
@@ -648,7 +671,11 @@ sub get_disks {
wearout => $wearout,
};
+ # lsblk reports plain 'nvme' for fabrics attached namespaces
my $transport = $lsblk_info->{$devpath}->{tran};
+ if (defined($nvme_transport) && $nvme_transport ne 'pcie') {
+ $transport = "nvme-$nvme_transport";
+ }
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
diff --git a/src/test/disk_tests/multipath/disklist b/src/test/disk_tests/multipath/disklist
new file mode 100644
index 00000000..b5e636a5
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist
@@ -0,0 +1,2 @@
+nvme8n1
+nvme9n1
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
new file mode 100644
index 00000000..908c2b56
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -0,0 +1,35 @@
+{
+ "nvme8n1": {
+ "devpath": "/dev/nvme8n1",
+ "size": 10737418240,
+ "vendor": "unknown",
+ "model": "FCMODEL",
+ "serial": "FCNVME1",
+ "wwn": "uuid.20000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
+ "transport": "nvme-fc"
+ },
+ "nvme9n1": {
+ "devpath": "/dev/nvme9n1",
+ "size": 10737418240,
+ "vendor": "FABVEND",
+ "model": "FABRICS CTRL",
+ "serial": "FAB1",
+ "wwn": "uuid.10000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "transport": "nvme-tcp"
+ }
+}
diff --git a/src/test/disk_tests/multipath/lsblk b/src/test/disk_tests/multipath/lsblk
new file mode 100644
index 00000000..597adf94
--- /dev/null
+++ b/src/test/disk_tests/multipath/lsblk
@@ -0,0 +1,18 @@
+{
+ "blockdevices": [
+ {
+ "path": "/dev/nvme8n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ },
+ {
+ "path": "/dev/nvme9n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ }
+ ]
+}
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/model b/src/test/disk_tests/multipath/nvme8n1/device/model
new file mode 100644
index 00000000..1aac689e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/model
@@ -0,0 +1 @@
+FCMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/transport b/src/test/disk_tests/multipath/nvme8n1/device/transport
new file mode 100644
index 00000000..8b517d01
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/transport
@@ -0,0 +1 @@
+fc
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/queue/rotational b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/size b/src/test/disk_tests/multipath/nvme8n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1_udevadm b/src/test/disk_tests/multipath/nvme8n1_udevadm
new file mode 100644
index 00000000..d0cd5ea9
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1_udevadm
@@ -0,0 +1,14 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+N: nvme8n1
+S: disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVLINKS=/dev/disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVNAME=/dev/nvme8n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+E: DEVTYPE=disk
+E: ID_MODEL=FCMODEL
+E: ID_SERIAL=FCNVME_1
+E: ID_SERIAL_SHORT=FCNVME1
+E: ID_WWN=uuid.20000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=1
+E: SUBSYSTEM=block
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/model b/src/test/disk_tests/multipath/nvme9n1/device/model
new file mode 100644
index 00000000..aa0287c7
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/model
@@ -0,0 +1 @@
+FABMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/transport
new file mode 100644
index 00000000..f5483dbf
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/transport
@@ -0,0 +1 @@
+tcp
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/vendor b/src/test/disk_tests/multipath/nvme9n1/device/vendor
new file mode 100644
index 00000000..cdc6ddfa
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/vendor
@@ -0,0 +1 @@
+FABVEND
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/queue/rotational b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/size b/src/test/disk_tests/multipath/nvme9n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1_udevadm b/src/test/disk_tests/multipath/nvme9n1_udevadm
new file mode 100644
index 00000000..b6d13ccb
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1_udevadm
@@ -0,0 +1,12 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+N: nvme9n1
+E: DEVNAME=/dev/nvme9n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+E: DEVTYPE=disk
+E: ID_MODEL=FABRICS CTRL
+E: ID_SERIAL=FABRICS_1
+E: ID_SERIAL_SHORT=FAB1
+E: ID_WWN=uuid.10000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=0
+E: SUBSYSTEM=block
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index a0dc01f6..c7374fd5 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -101,6 +101,16 @@ sub mocked_is_iscsi {
return 0;
}
+sub mocked_file_read_firstline {
+ my ($path) = @_;
+
+ my $originalsub = $diskmanage_module->original('file_read_firstline');
+
+ $path =~ s|^/sys/block|disk_tests/$testcasedir|;
+
+ return $originalsub->($path);
+}
+
sub mocked_dir_glob_foreach {
my ($dir, $regex, $sub) = @_;
@@ -248,6 +258,8 @@ $diskmanage_module->mock(
},
);
print("\tMocked dir_is_empty\n");
+$diskmanage_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked file_read_firstline\n");
$diskmanage_module->mock('check_bin' => sub { return 1; });
print("\tMocked check_bin\n");
my $tools_module = Test::MockModule->new('PVE::ProcFSTools', no_auto => 1);
^ permalink raw reply related [relevance 13%]
* [PATCH v8 storage 05/43] diskmanage: collect native NVMe multipath path state
2026-11-19 19:46 6% [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-19 19:46 13% ` [PATCH v8 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
@ 2026-11-19 19:46 13% ` Thomas Lamprecht
2026-11-19 19:46 9% ` [PATCH v8 storage 18/43] api: scan: add a SAN LUN inventory Thomas Lamprecht
` (2 subsequent siblings)
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-19 19:46 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
NVMe over Fabrics usually uses native multipath, whose paths
multipathd does not know. Collect the controller state and address
and the ANA state of each path from sysfs, grouped by namespace, so
the SAN LUN inventory can report path health for both multipath
stacks. Devices with a single local controller have no per-path
entries and are left out.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: drop redundant comments; call the wrapped test function with
arrow syntax]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 60 +++++++++++++++++++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../nvme9n1/device/{ => nvme5}/transport | 0
.../multipath/nvme_path_status_expected.json | 19 ++++++
src/test/disklist_test.pm | 20 +++++++
12 files changed, 107 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
rename src/test/disk_tests/multipath/nvme9n1/device/{ => nvme5}/transport (100%)
create mode 100644 src/test/disk_tests/multipath/nvme_path_status_expected.json
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index c342abcd..516c108d 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -818,6 +818,66 @@ sub get_disks {
return $disklist;
}
+# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
+# single-controller devices lack these children and are omitted.
+sub get_nvme_path_status {
+ my $res = {};
+
+ dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ 'nvme-subsys\d+',
+ sub {
+ my ($subsys) = @_;
+ my $subsysdir = "/sys/class/nvme-subsystem/$subsys";
+
+ dir_glob_foreach(
+ $subsysdir,
+ 'nvme\d+',
+ sub {
+ my ($ctrl) = @_;
+ my $ctrldir = "$subsysdir/$ctrl";
+ my $state = file_read_firstline("$ctrldir/state") // return;
+ my $address = file_read_firstline("$ctrldir/address");
+
+ dir_glob_foreach(
+ $ctrldir,
+ 'nvme\d+c\d+n\d+',
+ sub {
+ my ($pathdev) = @_;
+ return if $pathdev !~ m/^nvme(\d+)c\d+n(\d+)$/;
+ my $head = "nvme$1n$2";
+
+ my $entry = { device => "/dev/$ctrl", state => $state };
+ $entry->{address} = $address
+ if defined($address) && $address ne '';
+ my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
+ $entry->{'ana-state'} = $ana if defined($ana);
+
+ # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
+ # cannot serve IO even on a live controller
+ my $usable = $state eq 'live'
+ && (!defined($ana)
+ || $ana eq 'optimized'
+ || $ana eq 'non-optimized');
+
+ my $status = $res->{$head} //= { active => 0, paths => [] };
+ $status->{active}++ if $usable;
+ push @{ $status->{paths} }, $entry;
+ },
+ );
+ },
+ );
+ },
+ );
+
+ for my $status (values %$res) {
+ @{ $status->{paths} } =
+ sort { $a->{device} cmp $b->{device} } @{ $status->{paths} };
+ }
+
+ return $res;
+}
+
sub get_partnum {
my ($part_path) = @_;
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
new file mode 100644
index 00000000..803fab3e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
@@ -0,0 +1 @@
+traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
new file mode 100644
index 00000000..e48c58f5
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
@@ -0,0 +1 @@
+optimized
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
new file mode 100644
index 00000000..36618744
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
@@ -0,0 +1 @@
+traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
new file mode 100644
index 00000000..436c48ee
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
@@ -0,0 +1 @@
+inaccessible
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
new file mode 100644
index 00000000..f99fcb14
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
@@ -0,0 +1 @@
+0000:02:00.0
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/nvme5/transport
similarity index 100%
rename from src/test/disk_tests/multipath/nvme9n1/device/transport
rename to src/test/disk_tests/multipath/nvme9n1/device/nvme5/transport
diff --git a/src/test/disk_tests/multipath/nvme_path_status_expected.json b/src/test/disk_tests/multipath/nvme_path_status_expected.json
new file mode 100644
index 00000000..62611b3f
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme_path_status_expected.json
@@ -0,0 +1,19 @@
+{
+ "nvme2n1": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/nvme3",
+ "state": "live",
+ "address": "traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "optimized"
+ },
+ {
+ "device": "/dev/nvme4",
+ "state": "live",
+ "address": "traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "inaccessible"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 4c85d9e9..889475f6 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -103,6 +103,7 @@ sub mocked_file_read_firstline {
my $originalsub = $diskmanage_module->original('file_read_firstline');
$path =~ s|^/sys/block|disk_tests/$testcasedir|;
+ $path =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|;
return $originalsub->($path);
}
@@ -112,6 +113,16 @@ sub mocked_dir_glob_foreach {
my $lines = [];
+ # nvme subsystem trees and the controllers of a namespace are provided as directories, glob
+ # them like production code
+ if (
+ $dir =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|
+ || $dir =~ s|^/sys/block/(nvme\d+n\d+/device)$|disk_tests/$testcasedir/$1|
+ ) {
+ my $originalsub = $diskmanage_module->original('dir_glob_foreach');
+ return $originalsub->($dir, $regex, $sub);
+ }
+
# read lines in from file
if ($dir =~ m{^/sys/block$}) {
@$lines = split(/\n/, read_test_file('disklist'));
@@ -230,6 +241,15 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'nvme path status should be the same');
+ }
+
done_testing($testcount);
};
}
^ permalink raw reply related [relevance 13%]
* superseded: [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (15 preceding siblings ...)
2026-11-13 3:04 9% ` [PATCH manager 17/17] ui: dc: san: show that a namespace uses native multipath Thomas Lamprecht
@ 2026-11-18 20:44 6% ` Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:44 UTC (permalink / raw)
To: pve-devel
superseded-by: https://lore.proxmox.com/pve-devel/20261118204302.3100813-1-t.lamprecht@proxmox.com/
^ permalink raw reply [relevance 6%]
* [PATCH v2 storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-18 20:42 8% ` [PATCH v2 storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
@ 2026-11-18 20:42 17% ` Thomas Lamprecht
2026-11-18 20:42 16% ` [PATCH v2 storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
` (14 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
NVMe/TCP namespaces need a manual nvme-cli setup on every node so
far. Add a storage type that connects one subsystem through each
configured portal and offers its namespaces as raw volumes. Native
NVMe multipath joins the paths and the kernel reconnects lost ones.
A second storage for a subsystem is refused: the LUN list, the
controller list and the node status attribute a subsystem to one
storage. Resolving the path of a volume checks an existing device
against the subsystem: a volume name can be the by-id name of any NVMe
device, and not every user of a path activates the volume first.
The plugin isolates its properties, so names like 'portals' belong to
this storage type alone, and a third-party plugin that declares one,
like 'subsysnqn', is not left out. As the first in-tree plugin that
isolates, it makes the storage API check the parameters for adding and
updating a storage of any type against the options of that type alone.
A third-party plugin then has to list the sensitive properties it uses
in options(), as the API change log says.
Local disk setup refuses namespaces attached over a fabric, as for
iSCSI LUNs. Wiping a namespace or creating a volume group on it is
refused while a storage serves images from its subsystem. nvme-cli
is only recommended, as no other storage type needs it.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
ApiChangeLog | 7 +-
debian/control | 1 +
src/PVE/Diskmanage.pm | 2 +
src/PVE/Makefile | 1 +
src/PVE/NVMeOF.pm | 244 +++++++++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 223 +++++++++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 13 ++
src/test/Makefile | 6 +-
src/test/run_nvmeof_taint_tests.pl | 60 ++++++
src/test/run_nvmeof_tests.pl | 302 +++++++++++++++++++++++++++++
src/test/run_san_nvme_tests.pl | 16 ++
14 files changed, 875 insertions(+), 5 deletions(-)
create mode 100644 src/PVE/NVMeOF.pm
create mode 100644 src/PVE/Storage/NVMeOFPlugin.pm
create mode 100755 src/test/run_nvmeof_taint_tests.pl
create mode 100755 src/test/run_nvmeof_tests.pl
diff --git a/ApiChangeLog b/ApiChangeLog
index 10f39508..d7310fe4 100644
--- a/ApiChangeLog
+++ b/ApiChangeLog
@@ -101,9 +101,10 @@ Future changes should be documented in here.
declares a property of that name is then not loaded until it renames it, so prefer names that
are specific to the plugin, for example prefixed with its type.
- As soon as one such plugin is installed, the API checks the parameters for adding and updating a
- storage against the options of its type alone, for all storage types. So every plugin has to
- list the sensitive properties that it uses in `options()`.
+ Since the in-tree 'nvmeof' plugin isolates its properties, the API checks the parameters for
+ adding and updating a storage against the options of its type alone, for all storage types,
+ also for plugins of older API versions. So every plugin has to list the sensitive properties
+ that it uses in `options()`.
Set 'sensitive-properties' in such a plugin, even if empty. Without it, the fallback list of
version 11 also applies to the plugin's own properties of these names.
diff --git a/debian/control b/debian/control
index d10dfb23..8b9b6455 100644
--- a/debian/control
+++ b/debian/control
@@ -55,6 +55,7 @@ Depends: bzip2,
${misc:Depends},
${perl:Depends},
Recommends: multipath-tools,
+ nvme-cli,
pve-esxi-import-tools (>= 0.6.0),
skopeo,
zfsutils-linux (>= 2.4.1-pve2),
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 8fda7afc..1ad91e06 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -108,6 +108,8 @@ sub disk_is_used {
my $disklist = get_disks($dev, 1, 1);
die "'$disk' is not a valid local disk\n" if !defined($disklist->{$dev});
+ die "'$disk' is not a valid local disk\n"
+ if ($disklist->{$dev}->{transport} // '') =~ /^nvme-(?:tcp|rdma|fc)$/;
return 1 if $disklist->{$dev}->{used};
return 0;
diff --git a/src/PVE/Makefile b/src/PVE/Makefile
index 13fecbf8..238eefd4 100644
--- a/src/PVE/Makefile
+++ b/src/PVE/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Storage.pm ${DESTDIR}${PERLDIR}/PVE/Storage.pm
install -D -m 0644 Diskmanage.pm ${DESTDIR}${PERLDIR}/PVE/Diskmanage.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/NVMeOF.pm
install -D -m 0644 ISCSI/Topology.pm ${DESTDIR}${PERLDIR}/PVE/ISCSI/Topology.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/Multipath.pm
install -D -m 0644 Multipath/Config.pm ${DESTDIR}${PERLDIR}/PVE/Multipath/Config.pm
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
new file mode 100644
index 00000000..ebaedf9b
--- /dev/null
+++ b/src/PVE/NVMeOF.pm
@@ -0,0 +1,244 @@
+package PVE::NVMeOF;
+
+use v5.36;
+
+use Digest::SHA qw(sha1_hex);
+use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
+use File::Path qw(make_path);
+use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
+
+use PVE::JSONSchema;
+use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
+
+use PVE::Diskmanage;
+
+our $NVME = '/usr/sbin/nvme';
+our $SYSFS = '/sys';
+our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
+our $HOSTID_FILE = '/etc/nvme/hostid';
+our $RUN_DIR = '/run/pve/nvmeof';
+our $NQN_PATTERN = 'nqn\.[^\s,=]+';
+
+sub canonical_address($addr) {
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ return inet_ntop(AF_INET, $packed);
+ }
+ if (defined(my $packed = inet_pton(AF_INET6, $addr))) {
+ return inet_ntop(AF_INET, substr($packed, 12))
+ if substr($packed, 0, 12) eq ("\0" x 10) . "\xff\xff";
+ return inet_ntop(AF_INET6, $packed);
+ }
+ return lc($addr);
+}
+
+# Link-local IPv6 needs a node-specific interface and cannot identify a shared configured portal.
+sub parse_portal($portal) {
+ my ($addr, $port);
+ if ($portal =~ m/^\[([0-9a-fA-F:.]+)\](?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } elsif ($portal =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(?::([0-9]+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } else {
+ return undef;
+ }
+ return undef if defined($port) && ($port < 1 || $port > 65535);
+ $addr = canonical_address($addr);
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ my $multicast = (unpack('C', $packed) & 0xf0) == 0xe0;
+ return undef if $addr eq '0.0.0.0' || $addr eq '255.255.255.255' || $multicast;
+ } elsif (defined($packed = inet_pton(AF_INET6, $addr))) {
+ my $prefix = unpack('n', $packed);
+ return undef
+ if $addr eq '::' || ($prefix & 0xffc0) == 0xfe80 || ($prefix & 0xff00) == 0xff00;
+ } else {
+ return undef;
+ }
+ return { traddr => $addr, trsvcid => int($port // 4420) };
+}
+
+PVE::JSONSchema::register_format(
+ 'pve-storage-nvme-portal',
+ sub($portal, $noerr = undef) {
+ return $portal if parse_portal($portal);
+ return undef if $noerr;
+ die "value is not an IPv4 address or a bracketed IPv6 address with optional port\n";
+ },
+);
+
+sub format_path($path) {
+ my $addr = $path->{traddr} =~ /:/ ? "[$path->{traddr}]" : $path->{traddr};
+ return defined($path->{trsvcid}) ? "$addr:$path->{trsvcid}" : $addr;
+}
+
+sub storage_paths($scfg) {
+ return [map { parse_portal($_) // die "invalid portal '$_'\n" }
+ PVE::Tools::split_list($scfg->{portals})];
+}
+
+sub host_identity() {
+ my ($nqn) = (file_read_firstline($HOSTNQN_FILE) // '') =~ /\A($NQN_PATTERN)\z/;
+ my ($id) = (file_read_firstline($HOSTID_FILE) // '') =~
+ /\A([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\z/i;
+ if (!defined($nqn) || length($nqn) > 223) {
+ die "invalid or missing NVMe host NQN in '$HOSTNQN_FILE' - install nvme-cli and check the"
+ . " host identity\n";
+ }
+ die "invalid or missing NVMe host ID in '$HOSTID_FILE' - expected a nonzero UUID\n"
+ if !defined($id) || $id =~ /^[0-]+$/;
+ return { nqn => $nqn, id => lc($id) };
+}
+
+sub is_supported() { return -x $NVME ? 1 : 0 }
+
+sub assert_support() {
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command(['modprobe', 'nvme-tcp'], timeout => 10)
+ if !-e "$SYSFS/module/nvme_tcp";
+ my $multipath = file_read_firstline("$SYSFS/module/nvme_core/parameters/multipath") // '';
+ die "native NVMe multipath is disabled - enable nvme_core.multipath\n" if $multipath ne 'Y';
+}
+
+sub controllers() {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-fabrics/ctl";
+ dir_glob_foreach(
+ $dir,
+ 'nvme[0-9]+',
+ sub($name, @) {
+ my $address = file_read_firstline("$dir/$name/address") // return;
+ my %address = map { split(/=/, $_, 2) } grep { /=/ } split(/,/, $address);
+ return if !defined($address{traddr});
+ $res->{$name} = {
+ transport => file_read_firstline("$dir/$name/transport") // '',
+ subsystem => PVE::Diskmanage::read_subsysnqn("$dir/$name/subsysnqn") // '',
+ state => file_read_firstline("$dir/$name/state") // 'unknown',
+ traddr => canonical_address($address{traddr}),
+ trsvcid => $address{trsvcid},
+ };
+ },
+ );
+ return $res;
+}
+
+sub subsystem_controllers($subsystem) {
+ my $controllers = controllers();
+ return {
+ map { $_ => $controllers->{$_} } grep {
+ $controllers->{$_}->{subsystem} eq $subsystem
+ && $controllers->{$_}->{transport} eq 'tcp'
+ } keys %$controllers
+ };
+}
+
+sub path_controller($controllers, $path) {
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ if ($ctrl->{traddr} eq $path->{traddr} && ($ctrl->{trsvcid} // '') eq $path->{trsvcid}) {
+ return $name;
+ }
+ }
+ return undef;
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-subsystem";
+ dir_glob_foreach(
+ $dir,
+ 'nvme-subsys[0-9]+',
+ sub($subsys, @) {
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn") // return;
+ return if $nqn ne $subsystem;
+ dir_glob_foreach(
+ "$dir/$subsys",
+ 'nvme[0-9]+n[0-9]+',
+ sub($dev, @) {
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid") // return;
+ my $size = file_read_firstline("$SYSFS/block/$dev/size") // return;
+ $res->{$dev} = { wwid => $wwid, size => int($size) * 512 };
+ },
+ );
+ },
+ );
+ return $res;
+}
+
+sub with_lock($code) {
+ my ($res, $timeout) = PVE::Tools::run_fork_with_timeout(
+ 35,
+ sub {
+ make_path($RUN_DIR);
+ open(my $lock, '>>', "$RUN_DIR/fabrics.lock") or die "cannot open NVMe lock - $!\n";
+ flock($lock, LOCK_EX | LOCK_NB)
+ or die "NVMe over Fabrics is busy - another operation is still running\n";
+ # A command still in the kernel must retain serialization after its caller times out.
+ my $flags = fcntl($lock, F_GETFD, 0) // die "cannot read NVMe lock flags - $!\n";
+ fcntl($lock, F_SETFD, $flags & ~FD_CLOEXEC)
+ or die "cannot inherit NVMe lock - $!\n";
+ return $code->();
+ },
+ );
+ die "NVMe over Fabrics operation timed out - it may still be running\n" if $timeout;
+ return $res;
+}
+
+my sub retry_file($scfg, $path) {
+ my ($key) =
+ sha1_hex(join(
+ "\0", $scfg->{subsysnqn}, format_path($path), $scfg->{'fast-io-fail-tmo'} // 120)) =~
+ /\A([0-9a-f]{40})\z/;
+ return "$RUN_DIR/retry/$key";
+}
+
+sub in_cooldown($scfg, $path) {
+ my $mtime = (stat(retry_file($scfg, $path)))[9] // return 0;
+ my $age = time() - $mtime;
+ return $age > -60 && $age < 60;
+}
+
+sub note_connect_failure($scfg, $path) {
+ make_path("$RUN_DIR/retry");
+ file_set_contents(retry_file($scfg, $path), '');
+}
+
+sub connect_path($scfg, $path) {
+ my ($nqn) = $scfg->{subsysnqn} =~ /\A($NQN_PATTERN)\z/;
+ if (!defined($nqn) || length($nqn) > 223 || $nqn eq 'nqn.2014-08.org.nvmexpress.discovery') {
+ die "invalid subsystem NQN\n";
+ }
+ my ($fail) = ($scfg->{'fast-io-fail-tmo'} // 120) =~ /\A(-?[0-9]+)\z/;
+ die "invalid fast I/O fail timeout\n" if !defined($fail) || $fail < -1;
+ return with_lock(sub {
+ return if path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ assert_support();
+ my $host = host_identity();
+ run_command(
+ [
+ $NVME,
+ 'connect',
+ '--transport=tcp',
+ '--nqn',
+ $nqn,
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $path->{trsvcid},
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--ctrl-loss-tmo=-1',
+ '--fast_io_fail_tmo',
+ $fail,
+ ],
+ timeout => 30,
+ );
+ # nvme-cli can exit successfully without having connected
+ die "no controller appeared\n"
+ if !path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ unlink(retry_file($scfg, $path));
+ return;
+ });
+}
+
+1;
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index 1e9c670a..91283ff2 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -33,6 +33,7 @@ use PVE::Storage::LvmThinPlugin;
use PVE::Storage::NFSPlugin;
use PVE::Storage::CIFSPlugin;
use PVE::Storage::ISCSIPlugin;
+use PVE::Storage::NVMeOFPlugin;
use PVE::Storage::RBDPlugin;
use PVE::Storage::CephFSPlugin;
use PVE::Storage::ISCSIDirectPlugin;
@@ -58,6 +59,7 @@ PVE::Storage::LvmThinPlugin->register();
PVE::Storage::NFSPlugin->register();
PVE::Storage::CIFSPlugin->register();
PVE::Storage::ISCSIPlugin->register();
+PVE::Storage::NVMeOFPlugin->register();
PVE::Storage::RBDPlugin->register();
PVE::Storage::CephFSPlugin->register();
PVE::Storage::ISCSIDirectPlugin->register();
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a2df83c0..7f2ff6c8 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -6,6 +6,7 @@ SOURCES= \
NFSPlugin.pm \
CIFSPlugin.pm \
ISCSIPlugin.pm \
+ NVMeOFPlugin.pm \
CephFSPlugin.pm \
RBDPlugin.pm \
ISCSIDirectPlugin.pm \
diff --git a/src/PVE/Storage/NVMeOFPlugin.pm b/src/PVE/Storage/NVMeOFPlugin.pm
new file mode 100644
index 00000000..cb514c1d
--- /dev/null
+++ b/src/PVE/Storage/NVMeOFPlugin.pm
@@ -0,0 +1,223 @@
+package PVE::Storage::NVMeOFPlugin;
+
+use v5.36;
+
+use Cwd ();
+use Time::HiRes ();
+
+use PVE::Network;
+
+use PVE::Diskmanage;
+use PVE::NVMeOF;
+use PVE::Storage::Plugin;
+
+use base qw(PVE::Storage::Plugin);
+
+sub type { return 'nvmeof' }
+
+sub plugindata {
+ return {
+ content => [{ images => 1, 'vm-vol' => 1, none => 1 }, { images => 1 }],
+ select_existing => 1,
+ 'isolate-properties' => 1,
+ 'advanced-properties' => {
+ 'fast-io-fail-tmo' => 1,
+ },
+ 'hidden-properties' => {
+ bwlimit => 1,
+ },
+ 'sensitive-properties' => {},
+ };
+}
+
+sub properties {
+ return {
+ subsysnqn => {
+ title => "Subsystem",
+ description => 'The NQN of the NVMe subsystem.',
+ type => 'string',
+ pattern => $PVE::NVMeOF::NQN_PATTERN,
+ maxLength => 223,
+ },
+ portals => {
+ title => "Portals",
+ description =>
+ 'TCP portals of the NVMe subsystem, as IPv4 or bracketed IPv6 addresses'
+ . ' with an optional port (default 4420).',
+ type => 'string',
+ format => 'pve-storage-nvme-portal-list',
+ },
+ 'fast-io-fail-tmo' => {
+ title => "Fail I/O After (s)",
+ description => 'Seconds before I/O through a reconnecting path fails. -1 disables'
+ . ' this timeout; I/O can remain queued while paths reconnect.',
+ type => 'integer',
+ minimum => -1,
+ default => 120,
+ },
+ };
+}
+
+sub options {
+ return {
+ subsysnqn => { fixed => 1 },
+ portals => {},
+ 'fast-io-fail-tmo' => { optional => 1 },
+ nodes => { optional => 1 },
+ disable => { optional => 1 },
+ content => { optional => 1 },
+ bwlimit => { optional => 1 },
+ };
+}
+
+my sub assert_valid_config($scfg) {
+ die "the discovery subsystem cannot be used as storage\n"
+ if $scfg->{subsysnqn} eq 'nqn.2014-08.org.nvmexpress.discovery';
+ my %seen;
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ die "portal '$portal' is listed more than once\n" if $seen{$portal}++;
+ }
+}
+
+sub on_add_hook($class, $storeid, $scfg, %param) {
+ assert_valid_config($scfg);
+ # the LUN and controller lists and the node status attribute a subsystem to its one storage
+ my $ids = PVE::Storage::config()->{ids};
+ for my $sid (sort keys %$ids) {
+ next if $sid eq $storeid || $ids->{$sid}->{type} ne 'nvmeof';
+ die "storage '$sid' already uses this subsystem\n"
+ if $ids->{$sid}->{subsysnqn} eq $scfg->{subsysnqn};
+ }
+ return;
+}
+
+sub on_update_hook_full($class, $storeid, $scfg, $update, $delete, $sensitive, @) {
+ my $merged = { %$scfg, %$update };
+ delete $merged->{$_} for ($delete // [])->@*;
+ assert_valid_config($merged);
+ return $class->SUPER::on_update_hook_full($storeid, $scfg, $update, $delete, $sensitive);
+}
+
+sub parse_volname($class, $volname) {
+ if ($volname =~ m!^(nvme-[a-zA-Z0-9_.:+-]+)$! && $volname !~ /-part[0-9]+$/) {
+ return ($class->guest_volume_vtype('raw'), $1, undef, undef, undef, undef, 'raw');
+ }
+ die "unable to parse NVMe over Fabrics volume name '$volname'\n";
+}
+
+# The name of a volume can be the by-id name of any NVMe device, also of a local disk or of a
+# namespace of another subsystem.
+sub assert_namespace($scfg, $volname, $real) {
+ my ($dev) = $real =~ m!^/dev/(nvme[0-9]+n[0-9]+)$!;
+ die "volume '$volname' is not an NVMe namespace\n" if !defined($dev);
+ my $nqn = PVE::Diskmanage::read_subsysnqn("/sys/block/$dev/device/subsysnqn") // '';
+ die "volume '$volname' is not part of subsystem '$scfg->{subsysnqn}'\n"
+ if $nqn ne $scfg->{subsysnqn};
+}
+
+sub filesystem_path($class, $scfg, $volname, $snapname = undef, @) {
+ die "snapshot is not possible on NVMe over Fabrics storage\n" if defined($snapname);
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my $path = "/dev/disk/by-id/$name";
+ # not every user of a path activates the volume first, and the base volume of an LVM storage
+ # has no device before its storage connects
+ my $real = Cwd::realpath($path);
+ assert_namespace($scfg, $volname, $real) if defined($real) && -e $real;
+ return wantarray ? ($path, $vmid, $vtype) : $path;
+}
+
+sub create_base { die "can't create base images in NVMe over Fabrics storage\n" }
+sub clone_image { die "can't clone images in NVMe over Fabrics storage\n" }
+sub alloc_image { die "can't allocate space in NVMe over Fabrics storage\n" }
+sub free_image { die "can't free space in NVMe over Fabrics storage\n" }
+sub volume_resize { die "volume resize is not possible on NVMe over Fabrics storage\n" }
+
+sub list_volumes($class, $storeid, $scfg, $vmid = undef, $content_types = undef, @) {
+ my $res = $class->list_images($storeid, $scfg, $vmid);
+ $_->{content} = 'images' for @$res;
+ return $res;
+}
+
+sub list_images($class, $storeid, $scfg, $vmid = undef, $vollist = undef, $cache = undef, @) {
+ return [] if defined($vmid) && !$vollist;
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ my $res = [];
+ for my $dev (sort keys %$namespaces) {
+ my $ns = $namespaces->{$dev};
+ my $volid = "$storeid:nvme-$ns->{wwid}";
+ next if $vollist && !grep { $_ eq $volid } @$vollist;
+ push @$res,
+ {
+ volid => $volid,
+ format => 'raw',
+ size => $ns->{size},
+ vmid => 0,
+ };
+ }
+ return $res;
+}
+
+sub status($class, $storeid, $scfg, $cache = undef, @) {
+ my $active = grep { $_->{state} eq 'live' }
+ values PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn})->%*;
+ return (0, 0, 0, $active ? 1 : 0);
+}
+
+sub activate_storage($class, $storeid, $scfg, $cache = undef, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ next if defined(PVE::NVMeOF::path_controller($controllers, $path));
+ next if PVE::NVMeOF::in_cooldown($scfg, $path);
+ eval {
+ die "no answer from portal\n"
+ if !PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::connect_path($scfg, $path);
+ };
+ if (my $err = $@) {
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ warn "storage '$storeid': connecting to '"
+ . PVE::NVMeOF::format_path($path)
+ . "' failed - $err";
+ }
+ }
+ return;
+}
+
+sub deactivate_storage { return }
+
+sub check_connection($class, $storeid, $scfg, @) {
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return 1 if grep { $_->{state} eq 'live' } values %$controllers;
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ next if defined(PVE::NVMeOF::path_controller($controllers, $path));
+ next if PVE::NVMeOF::in_cooldown($scfg, $path);
+ return 1 if PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ }
+ return 0;
+}
+
+sub activate_volume($class, $storeid, $scfg, $volname, $snapname = undef, $cache = undef, @) {
+ my $path = $class->filesystem_path($scfg, $volname, $snapname);
+ # as for the multipath map of an iSCSI LUN, a status pass does not wait for the device
+ my $deadline = Time::HiRes::time() + ($cache && $cache->{status_only} ? 0 : 10);
+ while (!-b $path && Time::HiRes::time() < $deadline) {
+ last if !keys PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn})->%*;
+ Time::HiRes::usleep(250_000);
+ }
+ my $real = Cwd::realpath($path);
+ die "volume '$volname' is not available on this node\n" if !$real || !-b $real;
+ assert_namespace($scfg, $volname, $real);
+}
+
+sub volume_has_feature(
+ $class, $scfg, $feature, $storeid, $volname,
+ $snapname = undef,
+ $running = undef, @,
+) {
+ return 1 if $feature eq 'copy' && !defined($snapname);
+ return undef;
+}
+
+1;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 724c2d35..6e305580 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -42,7 +42,7 @@ our @COMMON_TAR_FLAGS = qw(
);
our @SHARED_STORAGE = (
- 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs',
+ 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs', 'nvmeof',
);
our $QCOW2_PREALLOCATION = {
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index b025c03f..86469f5c 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -298,6 +298,11 @@ sub lun_partitions($lun) {
}
sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
+ my $name = basename($lun->{devpath});
+ my $nqn =
+ $name =~ /^nvme\d+n\d+$/
+ ? PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn")
+ : undef;
my %vgs = map { $_ => 1 } PVE::Storage::LVMPlugin::lun_volume_groups(
[$lun->{devpath}, lun_partitions($lun)->@*],
)->@*;
@@ -320,6 +325,14 @@ sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
) {
die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this target\n";
}
+ if (
+ $type eq 'nvmeof'
+ && defined($nqn)
+ && $scfg->{subsysnqn} eq $nqn
+ && PVE::Storage::san_storage_serves_images($scfg)
+ ) {
+ die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this subsystem\n";
+ }
next if $type ne 'lvm' || !$scfg->{base};
my (undef, $volname) = PVE::Storage::Plugin::parse_volume_id($scfg->{base});
my ($wwid) = $volname =~ m/(?:^|\.)(?:dm-uuid-(?:part\d+-)?mpath|scsi|nvme)-(.+)$/;
diff --git a/src/test/Makefile b/src/test/Makefile
index 279ba1ee..c88666f5 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api test_disk_api
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api test_disk_api test_nvmeof
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -83,3 +83,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
+
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+ ./run_nvmeof_tests.pl
+ perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
new file mode 100755
index 00000000..62405291
--- /dev/null
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl -T
+
+use v5.36;
+use lib qw(..);
+use File::Temp qw(tempdir);
+use Scalar::Util qw(tainted);
+use Test::More;
+use Test::MockModule;
+use PVE::NVMeOF;
+use PVE::Tools qw(file_set_contents file_get_contents);
+
+$ENV{PATH} = '/usr/sbin:/usr/bin:/sbin:/bin';
+delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+my $dir = tempdir('nvmeof-taint-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::HOSTNQN_FILE = "$dir/hostnqn";
+local $PVE::NVMeOF::HOSTID_FILE = "$dir/hostid";
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+file_set_contents($PVE::NVMeOF::HOSTNQN_FILE, "nqn.host\n");
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "12345678-1234-1234-1234-123456789abc\n");
+file_set_contents("$dir/config", "nqn.test\n192.0.2.1\n120\n");
+my ($nqn, $portal, $fail) = split(/\n/, file_get_contents("$dir/config"));
+ok(tainted($nqn), 'configuration input is tainted');
+my $nvme = Test::MockModule->new('PVE::NVMeOF');
+$nvme->mock(with_lock => sub { $_[0]->() });
+my $commands = 0;
+$nvme->mock(
+ subsystem_controllers => sub {
+ return $commands ? { nvme0 => { traddr => '192.0.2.1', trsvcid => 4420 } } : {};
+ },
+);
+$nvme->mock(assert_support => sub { });
+$nvme->mock(
+ run_command => sub($cmd, %opts) {
+ $commands++;
+ is(
+ scalar(grep { tainted($_) } @$cmd),
+ 0,
+ 'all connect operands are validated and untainted',
+ );
+ PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ },
+);
+my $path = PVE::NVMeOF::parse_portal($portal);
+eval { PVE::NVMeOF::connect_path({ subsysnqn => $nqn, 'fast-io-fail-tmo' => $fail }, $path) };
+is($@, '', 'connect command can execute in taint mode');
+is($commands, 1, 'one connect');
+PVE::NVMeOF::note_connect_failure({ subsysnqn => $nqn }, $path);
+ok(
+ PVE::NVMeOF::in_cooldown({ subsysnqn => $nqn }, $path),
+ 'cooldown accepts validated file-backed configuration',
+);
+for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.discovery') {
+ eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
+ like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
+}
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
+eval { PVE::NVMeOF::host_identity() };
+like($@, qr/nonzero UUID/, 'zero host ID refused');
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
new file mode 100755
index 00000000..b75f7a5a
--- /dev/null
+++ b/src/test/run_nvmeof_tests.pl
@@ -0,0 +1,302 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use Fcntl qw(:flock);
+use File::Path qw(make_path);
+use File::Temp qw(tempdir);
+use Test::MockModule;
+use Test::More;
+
+use PVE::Tools qw(file_set_contents);
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+local $PVE::NVMeOF::SYSFS = "$dir/sys";
+my $class = 'PVE::Storage::NVMeOFPlugin';
+my $cfg = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,[2001:db8::2]:4421',
+ content => { none => 1 },
+};
+
+subtest 'configuration, portals and volumes' => sub {
+ is(PVE::Storage::Plugin->lookup('nvmeof'), $class, 'plugin registered');
+ is_deeply(
+ [sort keys $class->properties()->%*],
+ [qw(fast-io-fail-tmo portals subsysnqn)],
+ 'only three plugin-specific properties',
+ );
+ my sub nvmeof_schema($schema) {
+ my @types = map { ($_->{oneOf} // [])->@* } ($schema->{allOf} // [])->@*;
+ my ($nvmeof) = grep { $_->{'instance-type'} eq 'nvmeof' } @types;
+ return $nvmeof->{properties} // {};
+ }
+ my $create = nvmeof_schema(PVE::Storage::Plugin->createSchema());
+ is_deeply(
+ [sort grep { !$create->{$_}->{optional} } keys $create->%*],
+ [qw(portals subsysnqn)],
+ 'adding a storage requires the subsystem and the portals',
+ );
+ my $update = nvmeof_schema(PVE::Storage::Plugin->updateSchema());
+ ok($update->{portals} && !$update->{subsysnqn}, 'the subsystem cannot be changed');
+ my $parsed = PVE::Storage::Plugin->parse_config(
+ 'storage.cfg',
+ "nvmeof: fabric\n\tsubsysnqn nqn.test\n\tportals 192.0.2.1\n\tcontent none\n",
+ );
+ is($parsed->{ids}->{fabric}->{subsysnqn}, 'nqn.test', 'storage.cfg accepts the plugin');
+ is_deeply(
+ $parsed->{ids}->{fabric}->{content},
+ { none => 1 },
+ 'connection-only content parses',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ { traddr => '192.0.2.1', trsvcid => 4420 },
+ 'default I/O port',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('[2001:0db8::1]:4421'),
+ { traddr => '2001:db8::1', trsvcid => 4421 },
+ 'canonical IPv6',
+ );
+
+ for my $bad (
+ 'host.example', '1.2.3.4:0', '1.2.3.4:65536', '[fe80::1]', '[::]', '224.0.0.1',
+ ) {
+ ok(!PVE::NVMeOF::parse_portal($bad), "invalid portal $bad");
+ }
+ eval { $class->on_add_hook('fabric', { %$cfg, portals => '192.0.2.1,192.0.2.1:4420' }); };
+ like($@, qr/listed more than once/, 'duplicate portals refused');
+ eval {
+ $class->on_add_hook(
+ 'fabric',
+ { %$cfg, subsysnqn => 'nqn.2014-08.org.nvmexpress.discovery' },
+ );
+ };
+ like($@, qr/discovery subsystem/, 'discovery subsystem refused');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $ids = { fabric => $cfg, local => { type => 'dir' } };
+ $storage->mock(config => sub { { ids => $ids } });
+ is(eval { $class->on_add_hook('fabric', $cfg); 1 }, 1, 'a storage is not in its own way');
+ eval { $class->on_add_hook('second', {%$cfg}) };
+ like($@, qr/storage 'fabric' already uses this subsystem/, 'one storage per subsystem');
+ is(
+ scalar($class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef')),
+ '/dev/disk/by-id/nvme-eui.0123456789abcdef',
+ 'stable volume path',
+ );
+ {
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $nqn = 'nqn.other';
+ $disk->redefine(read_subsysnqn => sub { $nqn });
+ my $check = sub {
+ eval { PVE::Storage::NVMeOFPlugin::assert_namespace($cfg, @_) };
+ $@;
+ };
+ like($check->('nvme-x', '/dev/nvme0n1'), qr/not part of subsystem/, 'other subsystem');
+ like($check->('nvme-x', '/dev/sda'), qr/not an NVMe namespace/, 'other device type');
+ like($check->('nvme-x', '/dev/nvme0n1p1'), qr/not an NVMe namespace/, 'partition');
+ $nqn = 'nqn.test';
+ is($check->('nvme-x', '/dev/nvme0n1'), '', 'namespace of the subsystem');
+ my $cwd = Test::MockModule->new('Cwd');
+ $cwd->redefine(realpath => sub { $dir });
+ eval { $class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef') };
+ like($@, qr/not an NVMe namespace/, 'the path of an existing device is checked');
+ }
+
+ for my $bad ('nvme-../../sda', 'nvme-eui.abc-part1', 'sda') {
+ eval { $class->parse_volname($bad) };
+ like($@, qr/unable to parse/, "invalid volume $bad");
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ $nvme->mock(namespaces => sub { { nvme0n1 => { wwid => 'eui.abc', size => 4096 } } });
+ is(
+ $class->list_volumes('fabric', $cfg)->[0]->{volid},
+ 'fabric:nvme-eui.abc',
+ 'content none still offers bases',
+ );
+ is_deeply($class->list_images('fabric', $cfg, 100), [], 'namespaces have no VM owner');
+ $nvme->mock(subsystem_controllers => sub { {} });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test') };
+ like($@, qr/not available/,
+ 'missing namespace fails without waiting on absent controllers');
+ my ($now, $queries) = (0, 0);
+ my $clock = Test::MockModule->new('Time::HiRes');
+ $clock->redefine(time => sub { $now += 5 }, usleep => sub { });
+ $nvme->mock(subsystem_controllers => sub { $queries++; { nvme1 => {} } });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test', undef, {}) };
+ is($queries, 1, 'a missing namespace of a connected subsystem is waited for');
+ eval {
+ $class->activate_volume(
+ 'fabric',
+ $cfg,
+ 'nvme-nonexistent-test',
+ undef,
+ { status_only => 1 },
+ );
+ };
+ like($@, qr/not available/, 'in a status pass it fails as well');
+ is($queries, 1, 'but without a wait');
+ is(
+ ($class->parse_volname('nvme-eui.0123456789abcdef'))[0],
+ 'vm-vol',
+ 'namespaces are VM disks',
+ );
+};
+
+subtest 'sysfs topology' => sub {
+ my $sys = $PVE::NVMeOF::SYSFS;
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1",
+ "$sys/class/nvme-subsystem/nvme-subsys0/nvme0n1",
+ "$sys/block/nvme0n1",
+ );
+ my %attrs = (
+ address => 'traddr=192.0.2.1,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.test',
+ state => 'connecting',
+ );
+ file_set_contents("$sys/class/nvme-fabrics/ctl/nvme1/$_", "$attrs{$_}\n") for keys %attrs;
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys0/subsysnqn", "nqn.test\n");
+ file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ file_set_contents("$sys/block/nvme0n1/size", "8\n");
+ is(
+ PVE::NVMeOF::controllers()->{nvme1}->{state},
+ 'connecting',
+ 'reconnecting controller is still present',
+ );
+ is(
+ PVE::NVMeOF::path_controller(
+ PVE::NVMeOF::subsystem_controllers('nqn.test'),
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ ),
+ 'nvme1',
+ 'portal controller found',
+ );
+ is_deeply(
+ PVE::NVMeOF::namespaces('nqn.test'),
+ { nvme0n1 => { wwid => 'eui.abc', size => 4096 } },
+ 'namespace facts',
+ );
+ is_deeply(PVE::NVMeOF::namespaces('nqn.other'), {}, 'other subsystem excluded');
+};
+
+subtest 'serialized commands inherit the lock' => sub {
+ my $value = PVE::NVMeOF::with_lock(sub {
+ my $out = '';
+ PVE::Tools::run_command(
+ [
+ '/usr/bin/perl',
+ '-MFcntl=:flock',
+ '-e',
+ 'my @held = grep { (readlink($_) // "") =~ /fabrics.lock$/ } glob("/proc/self/fd/*"); die "not inherited" if !@held; open(my $fh, ">>", $ARGV[0]) or die $!; die "lock missing" if flock($fh, LOCK_EX|LOCK_NB); print "locked\\n";',
+ "$PVE::NVMeOF::RUN_DIR/fabrics.lock",
+ ],
+ timeout => 5,
+ outfunc => sub { $out .= $_[0] },
+ );
+ return $out;
+ });
+ is($value, 'locked', 'exec cannot acquire the lock held by its parent');
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or die $!;
+ flock($lock, LOCK_EX) or die $!;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'busy operation never enters callback');
+ close($lock);
+
+ my $tools = Test::MockModule->new('PVE::Tools');
+ my $timed_out = 1;
+ $tools->mock(run_fork_with_timeout => sub { return ($_[1]->(), $timed_out) });
+ my $retained;
+ eval {
+ PVE::NVMeOF::with_lock(sub {
+ my ($path) =
+ grep { (readlink($_) // '') =~ /fabrics.lock$/ } glob('/proc/self/fd/*');
+ my ($fd) = $path =~ m{/(\d+)$};
+ open($retained, '>&', $fd) or die $!;
+ return 1;
+ });
+ };
+ like($@, qr/timed out.*may still be running/, 'timeout does not claim deletion completed');
+ $timed_out = 0;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'retained descriptor keeps serialization after the caller returns');
+ close($retained);
+ is(PVE::NVMeOF::with_lock(sub { 1 }), 1, 'last descriptor close releases serialization');
+};
+
+subtest 'connect options, kernel reconnect and cooldown' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my @commands;
+ my $controllers = {};
+ $nvme->mock(with_lock => sub { $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(subsystem_controllers => sub { $controllers });
+ my $appear = 1;
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ is($opts{timeout}, 30, 'bounded connect');
+ push @commands, $cmd;
+ my %arg =
+ map { $cmd->[$_] => $cmd->[$_ + 1] } grep { $cmd->[$_] =~ /^--tr/ } 0 .. $#$cmd;
+ my $controller =
+ { traddr => $arg{'--traddr'}, trsvcid => $arg{'--trsvcid'}, state => 'live' };
+ $controllers->{ 'nvme' . scalar(@commands) } = $controller if $appear;
+ },
+ );
+ $net->mock(tcp_ping => sub { 1 });
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 2, 'one connect per missing portal');
+ ok(grep({ $_ eq '--ctrl-loss-tmo=-1' } $commands[0]->@*), 'kernel reconnects indefinitely');
+ is_deeply([@{ $commands[0] }[-2, -1]], ['--fast_io_fail_tmo', 120], 'fast failure default');
+ @commands = ();
+ $controllers = {
+ nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' },
+ nvme2 => { traddr => '2001:db8::2', trsvcid => 4421, state => 'live' },
+ };
+ $class->activate_storage('fabric', $cfg);
+ is_deeply(\@commands, [],
+ 'existing controllers are never reconnected, regardless of state');
+ $class->deactivate_storage('fabric', $cfg);
+ is_deeply(\@commands, [], 'deactivation does not remove controllers');
+ $controllers = {};
+ my $path = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $path);
+ ok(PVE::NVMeOF::in_cooldown($cfg, $path), 'failure starts cooldown');
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 1, 'only the other portal connects');
+ ($controllers, $appear) = ({}, 0);
+ my $other = PVE::NVMeOF::storage_paths($cfg)->[1];
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ $class->activate_storage('fabric', $cfg);
+ }
+ like($warning, qr/no controller appeared/, 'a connect without a controller is a failure');
+ ok(PVE::NVMeOF::in_cooldown($cfg, $other), 'which starts the cooldown too');
+};
+
+subtest 'local disk setup rejects fabric namespaces by transport' => sub {
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ for my $transport (qw(nvme-tcp nvme-rdma nvme-fc)) {
+ $disk->mock(get_disks => sub { { nvme0n1 => { transport => $transport } } });
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1') };
+ like($@, qr/not a valid local disk/,
+ "$transport refuses without storage configuration");
+ }
+};
+
+done_testing();
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index 51236f87..c74b638a 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -38,6 +38,7 @@ $storage->mock(config => sub { $cfg });
$disk->mock(verify_blockdev_path => sub { $device });
$disk->mock(is_partition => sub { 0 });
$disk->mock(get_nvme_transport => sub { 'fc' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
$disk->mock(is_iscsi_device => sub { 0 });
$disk->mock(is_mounted => sub { 0 });
$disk->mock(has_holder => sub { 0 });
@@ -78,6 +79,21 @@ $disk->mock(is_partition => sub { 0 });
$cfg->{ids}->{data} = { type => 'lvm', base => 'fabric:nvme-eui.0123456789abcdef' };
eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
like($@, qr/base volume/, 'native base reference refuses');
+$cfg->{ids} =
+ { fabric =>
+ { type => 'nvmeof', subsysnqn => 'nqn.test', disable => 1, content => { images => 1 } } };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like(
+ $@,
+ qr/serves images from this subsystem/,
+ 'direct namespace image use refuses even when disabled',
+);
+$cfg->{ids}->{fabric}->{content} = { 'vm-vol' => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like($@, qr/serves images from this subsystem/, 'also when restricted to VM disks');
+$cfg->{ids}->{fabric}->{content} = { none => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+is($@, '', 'connection-only storage permits namespace initialization');
$cfg->{ids} = {};
@order = @opens = ();
$tools->mock(file_get_contents => sub { 1024 });
^ permalink raw reply related [relevance 17%]
* [PATCH v2 manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (12 preceding siblings ...)
2026-11-18 20:42 18% ` [PATCH v2 manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
@ 2026-11-18 20:42 19% ` Thomas Lamprecht
2026-11-18 20:42 12% ` [PATCH v2 manager 15/17] ui: node: san: list NVMe over Fabrics controllers Thomas Lamprecht
` (2 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
Add an NVMe over Fabrics entry to the guided setup of the SAN view, with
the same steps as for iSCSI. It connects to a subsystem found at a
discovery portal and shows the host NQNs of all nodes for the access
rules of the array.
The target step is shared with iSCSI, as only the storage type, its scan
and the node identities differ. The add dialog of NVMe over Fabrics
storages names the SAN view, as those of iSCSI and LVM do.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 2 +-
www/manager6/SANUtils.js | 1 +
www/manager6/dc/SAN.js | 2 +-
www/manager6/storage/NVMeOFEdit.js | 3 +
www/manager6/storage/wizard/LunSelect.js | 34 ++--
www/manager6/storage/wizard/NodeIdentities.js | 45 +++---
.../storage/wizard/{IScsi.js => Target.js} | 153 ++++++++++++------
www/manager6/storage/wizard/Wizard.js | 43 ++---
www/manager6/window/SANLunState.js | 23 ++-
9 files changed, 203 insertions(+), 103 deletions(-)
rename www/manager6/storage/wizard/{IScsi.js => Target.js} (61%)
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index f8a1a2698..1fbce8c4d 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -390,7 +390,7 @@ JSSRC= \
storage/wizard/Wizard.js \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
- storage/wizard/IScsi.js \
+ storage/wizard/Target.js \
storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index c2df2d1ad..1b2b25c12 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -27,6 +27,7 @@ Ext.define('pve-san-lun', {
'iscsi-target',
'iscsi-lun',
'nvme-subsystem',
+ 'nvme-nsid',
// one column shows the target of a LUN and the subsystem of a namespace
{
name: 'target',
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index e9a5e5ccc..fcddc3e2e 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -126,7 +126,7 @@ Ext.define('PVE.dc.SANView', {
{
text: gettext('Guided Setup'),
disabled: !canSetup,
- menu: [setupItem('iscsi'), setupItem('fc', !canModify)],
+ menu: [setupItem('iscsi'), setupItem('fc', !canModify), setupItem('nvmeof')],
},
];
me.items = [
diff --git a/www/manager6/storage/NVMeOFEdit.js b/www/manager6/storage/NVMeOFEdit.js
index 5d816cbbe..306cbea3d 100644
--- a/www/manager6/storage/NVMeOFEdit.js
+++ b/www/manager6/storage/NVMeOFEdit.js
@@ -29,6 +29,9 @@ Ext.define('PVE.storage.NVMeOFInputPanel', {
onlineHelp: 'storage_nvmeof',
+ // TRANSLATORS: "Guided Setup" is a button of the SAN view, {0} the menu path of that view.
+ sanNote: gettext('To set up shared LVM on a namespace, use Guided Setup in {0}.'),
+
namespaceContent: 'images',
onGetValues: function (values) {
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index 834a3412c..9da0c195b 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -30,10 +30,11 @@ Ext.define('PVE.storage.wizard.LunSelect', {
// The scan names one target per LUN, also for a LUN reached through several. The content
// listing has the LUNs of the connection, and a LUN that shows up later is listed once the
// scan names the target of the connection for it.
+ let targetKey = wizard.wizardType === 'nvmeof' ? 'nvme-subsystem' : 'iscsi-target';
let filter = {
id: 'connection',
filterFn: (rec) =>
- rec.get('iscsi-target') === connection.target ||
+ rec.get(targetKey) === connection.target ||
(me.connectionWwids ?? []).includes(rec.get('wwid')),
};
me.store.addFilter(filter);
@@ -45,7 +46,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
success: function (response) {
if (!me.destroyed) {
me.connectionWwids = response.result.data
- .map((entry) => entry.volid.match(/\.dm-uuid-mpath-(.+)$/)?.[1])
+ .map((entry) => entry.volid.match(/(?:\.dm-uuid-mpath-|:nvme-)(.+)$/)?.[1])
.filter(Boolean);
me.store.addFilter(filter);
}
@@ -71,7 +72,9 @@ Ext.define('PVE.storage.wizard.LunSelect', {
sortAfterUpdate: true,
});
let inUse = (row) => row['used-by-storage'] || row['used-by-process'];
- let noLunsText = gettext('No LUNs found. Check connections and array access.');
+ let noLunsText = me.nvme
+ ? gettext('No namespaces found. Check connections and array access.')
+ : gettext('No LUNs found. Check connections and array access.');
let updateSelection = function () {
let row = me.getSelection();
me.down('#selection').setValue(row && !inUse(row) ? row.wwid : '');
@@ -88,9 +91,13 @@ Ext.define('PVE.storage.wizard.LunSelect', {
xtype: 'component',
cls: 'pmx-hint',
margin: '0 0 10 0',
- html: gettext(
- 'A LUN that is in use cannot be selected. A LUN with data that is no longer needed has to be wiped under Node > SAN first.',
- ),
+ html: me.nvme
+ ? gettext(
+ 'A namespace that is in use cannot be selected. A namespace with data that is no longer needed has to be wiped under Node > SAN first.',
+ )
+ : gettext(
+ 'A LUN that is in use cannot be selected. A LUN with data that is no longer needed has to be wiped under Node > SAN first.',
+ ),
},
...(me.rescanNote
? [
@@ -123,6 +130,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
renderer: Ext.htmlEncode,
},
{ text: 'LUN', dataIndex: 'iscsi-lun', width: 60 },
+ { text: 'NSID', dataIndex: 'nvme-nsid', width: 60 },
{
text: gettext('Model'),
dataIndex: 'model',
@@ -140,6 +148,8 @@ Ext.define('PVE.storage.wizard.LunSelect', {
text: gettext('Multipath'),
dataIndex: 'multipath',
width: 170,
+ // native NVMe multipath needs no setup per namespace
+ hidden: me.nvme,
renderer: PVE.SANUtils.renderSanLunMultipath,
},
{
@@ -186,7 +196,11 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let grid = me.down('grid');
if (grid?.rendered) {
grid.setEmptyText(
- query ? gettext('No LUNs match the search.') : noLunsText,
+ query
+ ? me.nvme
+ ? gettext('No namespaces match the search.')
+ : gettext('No LUNs match the search.')
+ : noLunsText,
);
}
},
@@ -202,8 +216,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let search = me.down('pveRecordSearchField');
me.on('activate', function () {
search.setTargetStore(me.store);
- if (me.up('window').wizardType === 'fc') {
- me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ let type = me.up('window').wizardType;
+ me.down('gridcolumn[dataIndex=iscsi-lun]').setHidden(type !== 'iscsi');
+ me.down('gridcolumn[dataIndex=nvme-nsid]').setHidden(type !== 'nvmeof');
+ if (type === 'fc') {
me.store.addFilter({
id: 'transport',
filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')),
diff --git a/www/manager6/storage/wizard/NodeIdentities.js b/www/manager6/storage/wizard/NodeIdentities.js
index a0ef62fee..ed0ad8357 100644
--- a/www/manager6/storage/wizard/NodeIdentities.js
+++ b/www/manager6/storage/wizard/NodeIdentities.js
@@ -1,7 +1,7 @@
Ext.define('pve-san-node-identity', {
extend: 'Ext.data.Model',
idProperty: 'node',
- fields: ['node', 'state', 'iscsi-initiator-name'],
+ fields: ['node', 'state', 'iscsi-initiator-name', 'nvme-host-nqn'],
});
Ext.define('PVE.storage.wizard.NodeIdentities', {
@@ -10,21 +10,8 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
height: 220,
disableSelection: true,
viewConfig: { enableTextSelection: true },
- columns: [
- { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
- {
- text: gettext('State'),
- dataIndex: 'state',
- width: 175,
- renderer: PVE.SANUtils.renderState,
- },
- {
- text: gettext('Initiator Name'),
- dataIndex: 'iscsi-initiator-name',
- flex: 1,
- renderer: Ext.htmlEncode,
- },
- ],
+
+ identity: 'iscsi-initiator-name',
// Lists only the given nodes, or all nodes for none, which Copy then follows.
setNodes: function (nodes) {
@@ -39,6 +26,24 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
initComponent: function () {
let me = this;
+ let nvme = me.identity === 'nvme-host-nqn';
+ me.columns = [
+ { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
+ {
+ text: gettext('State'),
+ dataIndex: 'state',
+ width: 175,
+ renderer: PVE.SANUtils.renderState,
+ // the state of multipathd, which NVMe does not use
+ hidden: nvme,
+ },
+ {
+ text: nvme ? gettext('Host NQN') : gettext('Initiator Name'),
+ dataIndex: me.identity,
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ];
me.rstore = Ext.create('Proxmox.data.UpdateStore', {
storeid: 'san-wizard-identities',
model: 'pve-san-node-identity',
@@ -67,17 +72,19 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
me.tbar = [
{
xtype: 'tbtext',
- text: gettext('Allow the initiator names of the nodes that will use the target.'),
+ text: nvme
+ ? gettext('Allow the host NQNs of the nodes that will use the target.')
+ : gettext('Allow the initiator names of the nodes that will use the target.'),
},
'->',
{
- text: gettext('Copy Initiator Names'),
+ text: nvme ? gettext('Copy Host NQNs') : gettext('Copy Initiator Names'),
iconCls: 'fa fa-clipboard',
handler: () =>
PVE.Utils.copyToClipboard(
me.store
.getRange()
- .map((rec) => rec.get('iscsi-initiator-name'))
+ .map((rec) => rec.get(me.identity))
.filter(Boolean)
.join('\n'),
),
diff --git a/www/manager6/storage/wizard/IScsi.js b/www/manager6/storage/wizard/Target.js
similarity index 61%
rename from www/manager6/storage/wizard/IScsi.js
rename to www/manager6/storage/wizard/Target.js
index d23cf3bb2..3fd0912fd 100644
--- a/www/manager6/storage/wizard/IScsi.js
+++ b/www/manager6/storage/wizard/Target.js
@@ -1,13 +1,14 @@
-Ext.define('PVE.storage.wizard.IScsiTarget', {
+Ext.define('PVE.storage.wizard.Target', {
extend: 'Proxmox.panel.InputPanel',
- xtype: 'pveStorageWizardIScsiTarget',
- onlineHelp: 'storage_open_iscsi',
+ xtype: 'pveStorageWizardTarget',
+
+ storageType: 'iscsi',
updateConnectionField: function () {
let me = this;
let target = me.down('field[name=target]').getValue();
let storage = me.storages?.find(
- (entry) => entry.type === 'iscsi' && entry.target === target,
+ (entry) => entry.type === me.storageType && entry[me.targetKey] === target,
);
let field = me.down('field[name=connection]');
if (storage) {
@@ -20,16 +21,20 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
onSubmit: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let wizard = me.up('window');
let values = me.getValues();
- let params = {
- type: 'iscsi',
- storage: values.connection,
- portal: values.portal,
- target: values.target,
- content: 'none',
- 'managed-multipath': 1,
- };
+ let params = { type: me.storageType, storage: values.connection, content: 'none' };
+ if (nvme) {
+ params.subsysnqn = values.target;
+ params.portals = values.portals;
+ } else {
+ Object.assign(params, {
+ portal: values.portal,
+ target: values.target,
+ 'managed-multipath': 1,
+ });
+ }
let nodes = []
.concat(values.nodes || [])
.filter(Boolean)
@@ -61,29 +66,41 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
}
me.storages = response.result.data;
me.updateConnectionField();
- let users = me.storages.filter((entry) => entry.target === values.target);
+ let users = me.storages.filter((entry) => entry[me.targetKey] === values.target);
if (users.length) {
let base = users[0];
let conflict;
if (users.length !== 1) {
conflict = Ext.String.format(
- gettext(
- 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
- ),
+ nvme
+ ? gettext(
+ 'Storages {0} use this subsystem. The setup can only reuse a subsystem that one storage uses.',
+ )
+ : gettext(
+ 'Storages {0} use this target. The setup can only reuse a target that one storage uses.',
+ ),
users.map((entry) => entry.storage).join(', '),
);
- } else if (base.type !== 'iscsi') {
+ } else if (base.type !== me.storageType) {
conflict = Ext.String.format(
- gettext(
- 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses this subsystem. The setup can only reuse an NVMe over Fabrics storage.',
+ )
+ : gettext(
+ 'Storage "{0}" uses this target. The setup can only reuse an iSCSI storage.',
+ ),
base.storage,
);
} else if (`${base.content ?? ''}` !== 'none') {
conflict = Ext.String.format(
- gettext(
- 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" uses the namespaces of this subsystem directly. If no guest uses them, clear Use namespaces directly in its edit dialog, otherwise use another subsystem.',
+ )
+ : gettext(
+ 'Storage "{0}" uses the LUNs of this target directly. If no guest uses them, clear Use LUNs directly in its edit dialog, otherwise use another target.',
+ ),
base.storage,
);
}
@@ -95,9 +112,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
wizard.showError(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" connects to this subsystem, but it is disabled. Enable that storage first.',
+ )
+ : gettext(
+ 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
+ ),
base.storage,
),
),
@@ -133,10 +154,10 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
}
let connection = {
storage: base.storage,
- target: base.target,
+ target: values.target,
nodes: selectedNodes.join(','),
};
- if (!base['managed-multipath']) {
+ if (!nvme && !base['managed-multipath']) {
wizard.showError(
Ext.htmlEncode(
Ext.String.format(
@@ -159,7 +180,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
waitMsgTarget: wizard,
failure: fail,
success: () =>
- connected({ storage: params.storage, target: params.target, nodes }),
+ connected({ storage: params.storage, target: values.target, nodes }),
});
},
});
@@ -167,6 +188,10 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
initComponent: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
+ me.targetKey = nvme ? 'subsysnqn' : 'target';
+ me.onlineHelp = nvme ? 'storage_nvmeof' : 'storage_open_iscsi';
+ let targetLabel = nvme ? gettext('Subsystem') : gettext('Target');
let common = PVE.panel.StorageBase.commonFields(true);
// wide enough for the longest label of the step
let labelWidth = 150;
@@ -174,7 +199,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
{
xtype: 'textfield',
name: 'portal',
- fieldLabel: gettext('Portal'),
+ fieldLabel: nvme ? gettext('Discovery Portal') : gettext('Portal'),
labelWidth,
allowBlank: false,
listeners: {
@@ -190,33 +215,54 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
},
{
- xtype: 'pveIScsiScan',
+ xtype: nvme ? 'pveNVMeOFScan' : 'pveIScsiScan',
name: 'target',
- fieldLabel: gettext('Target'),
+ fieldLabel: targetLabel,
labelWidth,
disabled: true,
showNodeSelector: false,
nodename: Proxmox.NodeName,
- listeners: { change: () => me.updateConnectionField() },
+ listeners: {
+ change: function (field, value) {
+ me.updateConnectionField();
+ let rec = nvme
+ ? field.getStore().findRecord('subsysnqn', value, 0, false, true, true)
+ : undefined;
+ if (rec) {
+ me.down('field[name=portals]').setValue(rec.get('portals'));
+ }
+ },
+ },
listConfig: {
width: 650,
- emptyText: PVE.Utils.renderNotFound(gettext('iSCSI Target')),
+ emptyText: PVE.Utils.renderNotFound(targetLabel),
columns: [
{
- text: gettext('Target'),
- dataIndex: 'target',
+ text: targetLabel,
+ dataIndex: me.targetKey,
flex: 1,
renderer: Ext.htmlEncode,
},
{
text: gettext('Portals'),
- dataIndex: 'portal',
+ dataIndex: nvme ? 'portals' : 'portal',
width: 220,
renderer: Ext.htmlEncode,
},
],
},
},
+ ...(nvme
+ ? [
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ labelWidth,
+ allowBlank: false,
+ },
+ ]
+ : []),
{
...common.id,
name: 'connection',
@@ -227,12 +273,19 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
xtype: 'component',
margin: '0 0 10 0',
html: `<span class="pmx-hint">${Ext.htmlEncode(gettext('Note:'))}</span> ${Ext.htmlEncode(
- gettext(
- 'Next creates or reuses the connection storage before you select a LUN.',
- ),
+ nvme
+ ? gettext(
+ 'Next creates or reuses the connection storage before you select a namespace.',
+ )
+ : gettext(
+ 'Next creates or reuses the connection storage before you select a LUN.',
+ ),
)}`,
},
- { xtype: 'pveStorageWizardNodeIdentities' },
+ {
+ xtype: 'pveStorageWizardNodeIdentities',
+ identity: nvme ? 'nvme-host-nqn' : 'iscsi-initiator-name',
+ },
];
me.advancedItems = [
{
@@ -267,8 +320,10 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
});
-PVE.storage.wizard.createIScsiLVM = function (wizard, values, lun) {
+PVE.storage.wizard.createLVMOnBase = function (wizard, values, lun) {
let connection = wizard.connection;
+ let suffix =
+ wizard.wizardType === 'nvmeof' ? `:nvme-${lun.wwid}` : `.dm-uuid-mpath-${lun.wwid}`;
let fail = (response) => wizard.showError(response.htmlStatus);
Proxmox.Utils.API2Request({
url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(connection.storage)}/content`,
@@ -280,14 +335,16 @@ PVE.storage.wizard.createIScsiLVM = function (wizard, values, lun) {
if (wizard.destroyed) {
return;
}
- let volume = response.result.data.find((entry) =>
- entry.volid.endsWith(`.dm-uuid-mpath-${lun.wwid}`),
- );
+ let volume = response.result.data.find((entry) => entry.volid.endsWith(suffix));
if (!volume) {
wizard.showError(
- gettext(
- 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
- ),
+ wizard.wizardType === 'nvmeof'
+ ? gettext(
+ 'The selected namespace is not available yet. Check Node > SAN, then retry.',
+ )
+ : gettext(
+ 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
+ ),
);
return;
}
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index bfcc5a6cb..485641bac 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -138,6 +138,7 @@ Ext.define('PVE.storage.wizard.SAN', {
storage: values.storage,
nodes: params.nodes,
fc: me.wizardType === 'fc',
+ nvme: me.wizardType === 'nvmeof',
autoShow: true,
});
},
@@ -146,6 +147,9 @@ Ext.define('PVE.storage.wizard.SAN', {
multipathSummary: function (lun) {
let me = this;
+ if (me.wizardType === 'nvmeof') {
+ return PVE.SANUtils.multipathText('native');
+ }
// an explicit entry takes precedence, also for a LUN of the connection storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
@@ -191,23 +195,24 @@ Ext.define('PVE.storage.wizard.SAN', {
if (me.wizardType === 'fc') {
PVE.storage.wizard.createFC(me, values, lun);
} else {
- PVE.storage.wizard.createIScsiLVM(me, values, lun);
+ PVE.storage.wizard.createLVMOnBase(me, values, lun);
}
},
initComponent: function () {
let me = this;
- if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ if (!['iscsi', 'fc', 'nvmeof'].includes(me.wizardType)) {
throw 'no SAN storage type specified';
}
- let iscsi = me.wizardType === 'iscsi';
+ let fc = me.wizardType === 'fc';
me.subject = PVE.storage.wizard.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
+ let onlineHelp = me.wizardType === 'nvmeof' ? 'storage_nvmeof' : 'storage_multipath';
let common = PVE.panel.StorageBase.commonFields(true);
let settings = {
xtype: 'inputpanel',
title: gettext('Volume Group'),
- onlineHelp: 'storage_multipath',
+ onlineHelp,
items: [
{ ...common.id, fieldLabel: gettext('Storage ID') },
{
@@ -220,35 +225,37 @@ Ext.define('PVE.storage.wizard.SAN', {
PVE.panel.StorageBase.volumeChainField(true, 'lvm'),
],
};
- if (!iscsi) {
+ if (fc) {
settings.advancedItems = [
{ ...common.nodes, validator: PVE.storage.wizard.validateNodes },
];
}
me.items = [
- ...(iscsi
- ? [
+ ...(fc
+ ? []
+ : [
{
- xtype: 'pveStorageWizardIScsiTarget',
+ xtype: 'pveStorageWizardTarget',
title: gettext('Target'),
itemId: 'target',
+ storageType: me.wizardType,
},
- ]
- : []),
+ ]),
{
xtype: 'pveStorageWizardLunSelect',
- title: 'LUN',
+ title: me.wizardType === 'nvmeof' ? gettext('Namespace') : 'LUN',
itemId: 'luns',
- onlineHelp: 'storage_multipath',
+ nvme: me.wizardType === 'nvmeof',
+ onlineHelp,
// the nodes only see a newly mapped Fibre Channel LUN after a rescan
- rescanNote: iscsi
- ? undefined
- : Ext.String.format(
+ rescanNote: fc
+ ? Ext.String.format(
gettext(
'After mapping a new LUN on the array, rescan the Fibre Channel hosts of each node (<a href="{0}" target="_blank" rel="noopener noreferrer">documentation</a>).',
),
Ext.htmlEncode(Proxmox.Utils.get_help_link('storage_multipath')),
- ),
+ )
+ : undefined,
},
settings,
{
@@ -283,14 +290,14 @@ Ext.define('PVE.storage.wizard.SAN', {
me.callParent();
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (iscsi && tab === me.down('#luns')) {
+ if (!fc && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- if (iscsi) {
+ if (!fc) {
me.down('#submit').setText(gettext('Next'));
}
me.on('destroy', () => me.reloadCallback?.());
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index 6215f8e57..6cdcdce2d 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -19,7 +19,10 @@ Ext.define('PVE.window.SANLunState', {
if (!me.wwid || !me.storage) {
throw 'no LUN or storage specified';
}
- me.title = Ext.String.format(gettext('Storage {0}: LUN State'), me.storage);
+ me.title = Ext.String.format(
+ me.nvme ? gettext('Storage {0}: Namespace State') : gettext('Storage {0}: LUN State'),
+ me.storage,
+ );
// The other nodes set up a new LUN with their next status updates.
let pendingUntil = Date.now() + 60000;
let rstore = Ext.create('Proxmox.data.UpdateStore', {
@@ -55,13 +58,17 @@ Ext.define('PVE.window.SANLunState', {
margin: '0 0 10 0',
html: Ext.htmlEncode(
Ext.String.format(
- me.fc
+ me.nvme
? gettext(
- 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.',
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the namespace on the array.',
)
- : gettext(
- 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
- ),
+ : me.fc
+ ? gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.',
+ )
+ : gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
+ ),
me.storage,
),
),
@@ -71,7 +78,9 @@ Ext.define('PVE.window.SANLunState', {
flex: 1,
store,
disableSelection: true,
- emptyText: gettext('No node reported this LUN yet.'),
+ emptyText: me.nvme
+ ? gettext('No node reported this namespace yet.')
+ : gettext('No node reported this LUN yet.'),
columns: [
{
text: gettext('Node'),
^ permalink raw reply related [relevance 19%]
* [PATCH v2 storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (7 preceding siblings ...)
2026-11-18 20:42 10% ` [PATCH v2 storage 08/17] multipath: report the NVMe host NQN of each node Thomas Lamprecht
@ 2026-11-18 20:42 16% ` Thomas Lamprecht
2026-11-18 20:42 20% ` [PATCH v2 docs 10/17] storage: document NVMe over Fabrics storages Thomas Lamprecht
` (7 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the LUNs that multipathd handles on
each node. The namespaces of an NVMe over Fabrics storage use the
native multipath of the kernel and were missing from it, so a lost
path or a node without access to a namespace only showed in the LUN
list of that node.
Let each node report the namespaces of the subsystems such a storage
names, with the path counts its LUN list already shows, and expect
them on the nodes of the storage like the LUNs of an iSCSI storage.
They do not depend on multipathd, so a node without it reports them
as well and only the state of its maps stays unknown.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Multipath.pm | 11 +++-
src/PVE/Multipath/Status.pm | 58 +++++++++++++++---
src/test/run_multipath_api_tests.pl | 95 ++++++++++++++++++++++++++++-
3 files changed, 152 insertions(+), 12 deletions(-)
diff --git a/src/PVE/API2/Multipath.pm b/src/PVE/API2/Multipath.pm
index e69919c2..51ef7281 100644
--- a/src/PVE/API2/Multipath.pm
+++ b/src/PVE/API2/Multipath.pm
@@ -130,14 +130,21 @@ __PACKAGE__->register_method({
wwid => { type => 'string', description => 'The LUN WWID.' },
explicit =>
{ type => 'boolean', description => 'An explicit entry exists.' },
+ native => {
+ type => 'boolean',
+ optional => 1,
+ description => 'An NVMe namespace, which uses the native'
+ . ' multipath of the kernel.',
+ },
name => { type => 'string', optional => 1 },
'used-by-storage' => {
type => 'string',
optional => 1,
description =>
'The storage that uses the LUN: as its base volume or through'
- . ' the volume group on it, or as an iSCSI storage that serves'
- . ' the LUNs of its target as images.',
+ . ' the volume group on it, or as an iSCSI or NVMe over Fabrics'
+ . ' storage that serves the LUNs of its target or subsystem as'
+ . ' images.',
},
'multipath-storage' => {
type => 'string',
diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm
index ae386164..d26eb7f8 100644
--- a/src/PVE/Multipath/Status.pm
+++ b/src/PVE/Multipath/Status.pm
@@ -7,6 +7,7 @@ use JSON qw(decode_json);
use PVE::Cluster;
use PVE::INotify;
+use PVE::Diskmanage;
use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
@@ -24,6 +25,39 @@ sub worst_state(@states) {
return $worst;
}
+# Namespaces use the native multipath of the kernel, so their state does not depend on multipathd.
+my sub namespace_luns($pv_vgs) {
+ require PVE::Storage;
+ my $cfg = PVE::Storage::config();
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %luns;
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ next if $scfg->{type} ne 'nvmeof';
+ my $expected = eval { scalar(PVE::NVMeOF::storage_paths($scfg)->@*) };
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ for my $name (sort keys %$namespaces) {
+ my $wwid = $namespaces->{$name}->{wwid};
+ next if $luns{$wwid};
+ my $paths = $status->{$name} // { active => 0, paths => [] };
+ my $total = scalar($paths->{paths}->@*);
+ my $lun = $luns{$wwid} = {
+ wwid => $wwid,
+ native => 1,
+ size => $namespaces->{$name}->{size},
+ storages => [$sid],
+ 'paths-total' => $total,
+ 'paths-active' => $paths->{active},
+ state => PVE::Multipath::derive_health($paths->{active}, $total, $expected),
+ };
+ $lun->{'paths-expected'} = $expected if defined($expected);
+ my $vg = ($pv_vgs // {})->{"/dev/$name"};
+ $lun->{vgname} = $vg if defined($vg);
+ }
+ }
+ return [map { $luns{$_} } sort keys %luns];
+}
+
sub publish($report) {
my $node = PVE::INotify::nodename();
my $now = time();
@@ -55,11 +89,11 @@ sub update_node_status() {
require PVE::NVMeOF;
my $host = eval { PVE::NVMeOF::host_identity() };
$report->{'nvme-host-nqn'} = $host->{nqn} if $host;
+ require PVE::Storage::LVMPlugin;
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
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();
- require PVE::Storage::LVMPlugin;
- my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
# A node can have many maps that something else set up, for example a storage plugin with
# one LUN per guest disk. Only the maps that the node manages, that are the base volume of a
# storage or hold its volume group get a row, the others are counted.
@@ -119,8 +153,11 @@ sub update_node_status() {
if (my $error = $@) {
chomp $error;
$report->{error} = $error;
- delete $report->{luns};
+ $report->{luns} = [];
}
+ my $namespaces = eval { namespace_luns($pv_vgs) };
+ warn "multipath: cannot query NVMe namespaces - $@" if $@;
+ push $report->{luns}->@*, @$namespaces if $namespaces;
eval { publish($report) };
warn "multipath: cannot publish node status - $@" if $@;
}
@@ -133,7 +170,7 @@ sub cluster_status() {
my $all_nodes = PVE::Cluster::get_nodelist();
my $members = PVE::Cluster::get_members();
my $raw = PVE::Cluster::get_node_kv($KEY);
- my (%nodes, %luns, %expected, %observed, %vg_owner);
+ my (%nodes, %luns, %expected, %observed, %vg_owner, %lists);
# the nodes that list a map because the configuration names it for them
my (%managed, %unhinted);
my $storage_nodes = sub($scfg) {
@@ -158,12 +195,13 @@ sub cluster_status() {
my $scfg = $storage->{ids}->{$sid};
$vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
next if $scfg->{type} ne 'lvm';
- my ($wwid) = ($scfg->{base} // '') =~ /(?:^|\.)dm-uuid-(?:part\d+-)?mpath-(\S+)$/;
+ my ($base, $volname) = PVE::Storage::parse_volume_id($scfg->{base} // '', 1);
+ my ($kind, $wwid) = ($volname // '') =~ /(?:^|\.)(dm-uuid-(?:part\d+-)?mpath|nvme)-(\S+)$/;
next if !defined($wwid);
$luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $luns{$wwid}->{native} = 1 if $kind eq 'nvme';
$luns{$wwid}->{'used-by-storage'} //= $sid;
$managed{$wwid}->{$_} = 1 for @$all_nodes;
- my ($base) = $scfg->{base} =~ /^([^:]+):/;
$luns{$wwid}->{'multipath-storage'} //= $base if $requests_maps->($base);
$expected{$wwid}->{$_} = 1 for $storage_nodes->($scfg)->@*;
}
@@ -178,11 +216,13 @@ sub cluster_status() {
$entry->{$_} = $report->{$_} for grep { defined($report->{$_}) } @keys;
$entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok';
$unhinted{$node} = 1 if $report->{'vgs-unknown'};
- next if $entry->{state} ne 'ok';
+ # an unavailable node lists its namespaces only, or nothing
+ $lists{$node} = 1 if $report->{luns};
for my $lun (($report->{luns} // [])->@*) {
my $wwid = $lun->{wwid} // next;
my $row = $luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $row->{native} = 1 if $lun->{native};
$row->{$_} //= $lun->{$_} for grep { defined($lun->{$_}) } qw(name size);
my $owner = defined($lun->{vgname}) ? $vg_owner{ $lun->{vgname} } : undef;
$row->{'used-by-storage'} //= $owner if defined($owner);
@@ -216,10 +256,10 @@ sub cluster_status() {
if ($observed{$wwid}->{$node}) {
$row->{nodes}->{$node} = $observed{$wwid}->{$node};
} elsif ($expected{$wwid}->{$node}) {
- my $listed = $nodes{$node}->{state} eq 'ok';
+ my $listed = $nodes{$node}->{state} eq 'ok' || ($row->{native} && $lists{$node});
# without the hint file of LVM a node leaves a map out that it only knows through
# the volume group of a storage
- $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node};
+ $listed = 0 if $unhinted{$node} && !$managed{$wwid}->{$node} && !$row->{native};
$row->{nodes}->{$node} = { state => $listed ? 'missing' : 'unknown' };
}
}
diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl
index 078ba66d..fd63503a 100755
--- a/src/test/run_multipath_api_tests.pl
+++ b/src/test/run_multipath_api_tests.pl
@@ -383,7 +383,12 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
my $status = Test::MockModule->new('PVE::Multipath::Status');
my $mp = Test::MockModule->new('PVE::Multipath');
my $iscsi = Test::MockModule->new('PVE::Storage::ISCSIPlugin');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $disks = Test::MockModule->new('PVE::Diskmanage');
my ($report, @order);
+ my $ids = {};
+ $storage->mock(config => sub { { ids => $ids } });
+ $disks->mock(get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
$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' } });
@@ -421,6 +426,42 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
is($report->{luns}->[0]->{'paths-expected'}, 3, 'expected count reported');
is($report->{luns}->[0]->{state}, 'degraded', 'fewer paths than expected');
ok(!exists($report->{supported}), 'no separate capability state');
+
+ $ids->{nvme} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test:sub',
+ portals => '192.0.2.1,192.0.2.2',
+ };
+ $nvme->mock(
+ namespaces => sub($nqn) {
+ return $nqn eq 'nqn.test:sub'
+ ? { nvme1n1 => { wwid => 'uuid.1', size => 4096 } }
+ : {};
+ },
+ );
+ my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+ $lvm->mock(cached_pv_volume_groups => sub { { '/dev/nvme1n1' => 'vgns' } });
+ my $namespace = {
+ wwid => 'uuid.1',
+ native => 1,
+ size => 4096,
+ storages => ['nvme'],
+ vgname => 'vgns',
+ 'paths-total' => 1,
+ 'paths-active' => 1,
+ 'paths-expected' => 2,
+ state => 'degraded',
+ };
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}->[1], $namespace, 'namespace with fewer paths than portals');
+ $mp->mock(is_running => sub { 0 });
+ PVE::Multipath::Status::update_node_status();
+ is(
+ $report->{error},
+ 'multipathd is not running or does not respond',
+ 'stopped daemon still reported',
+ );
+ is_deeply($report->{luns}, [$namespace], 'namespaces do not need multipathd');
};
subtest 'API returns final node and LUN states' => sub {
@@ -457,12 +498,31 @@ subtest 'API returns final node and LUN states' => sub {
'paths-active' => 2,
storages => ['scoped'],
},
+ {
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'optimal',
+ 'paths-total' => 2,
+ 'paths-active' => 2,
+ storages => ['nvme'],
+ },
],
}),
n2 => encode_json({ time => $NOW, luns => [], 'nvme-host-nqn' => 'nqn.test:n2' }),
n3 => encode_json({ time => $NOW - 181, luns => [] }),
n4 => encode_json({ time => $NOW, luns => [] }),
- n5 => encode_json({ time => $NOW, error => 'multipath-tools is not installed' }),
+ n5 => encode_json({
+ time => $NOW,
+ error => 'multipath-tools is not installed',
+ luns => [{
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'degraded',
+ 'paths-total' => 2,
+ 'paths-active' => 1,
+ storages => ['nvme'],
+ }],
+ }),
);
$cluster->mock(get_node_kv => sub { \%raw });
my $entries = { '3600a' => { type => 'wwid' } };
@@ -480,6 +540,8 @@ subtest 'API returns final node and LUN states' => sub {
{ type => 'iscsi', 'managed-multipath' => 1, nodes => { departed => 1 } },
lvmgone => { type => 'lvm', base => 'gone:0.0.0.dm-uuid-mpath-3600e' },
scoped => { type => 'iscsi', 'managed-multipath' => 1, nodes => { n2 => 1 } },
+ nvme => { type => 'nvmeof', subsysnqn => 'nqn.test:sub' },
+ lvmns => { type => 'lvm', base => 'nvme:nvme-uuid.2', nodes => { n5 => 1 } },
},
} },
);
@@ -541,6 +603,37 @@ subtest 'API returns final node and LUN states' => sub {
'an entry for other nodes does not change that',
);
}
+ my $namespace = $lun{'uuid.1'};
+ ok($namespace->{native}, 'namespace marked as native');
+ ok(!exists($namespace->{'multipath-storage'}), 'a namespace has no requested map');
+ is_deeply(
+ { map { $_ => $namespace->{nodes}->{$_}->{state} } keys $namespace->{nodes}->%* },
+ {
+ n1 => 'optimal',
+ n2 => 'missing',
+ n3 => 'unknown',
+ n4 => 'unknown',
+ n5 => 'degraded',
+ },
+ 'namespace state of a node without multipathd counts',
+ );
+ is($lun->{nodes}->{n5}->{state}, 'unknown', 'no map state from a node without multipathd');
+ is_deeply(
+ $lun{'uuid.2'},
+ {
+ wwid => 'uuid.2',
+ explicit => 0,
+ native => 1,
+ 'used-by-storage' => 'lvmns',
+ state => 'missing',
+ nodes => { n5 => { state => 'missing' } },
+ },
+ 'base namespace that a node without multipathd does not report',
+ );
+ $raw{n5} = encode_json({ time => $NOW, error => 'too many LUNs to report' });
+ $res = PVE::API2::Multipath->status({});
+ %lun = map { $_->{wwid} => $_ } $res->{luns}->@*;
+ is($lun{'uuid.2'}->{nodes}->{n5}->{state}, 'unknown', 'node without a list');
eval {
PVE::JSONSchema::validate(
$res,
^ permalink raw reply related [relevance 16%]
* [PATCH v2 storage 07/17] api: add node-level NVMe over Fabrics status and controller removal
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (5 preceding siblings ...)
2026-11-18 20:42 21% ` [PATCH v2 storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage Thomas Lamprecht
@ 2026-11-18 20:42 14% ` Thomas Lamprecht
2026-11-18 20:42 10% ` [PATCH v2 storage 08/17] multipath: report the NVMe host NQN of each node Thomas Lamprecht
` (9 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
The host NQN for the access rules of an array and the controllers of
a node are only visible with nvme-cli on a shell. Add the API module
for /nodes/{node}/nvmeof with the host identity and the fabrics
controllers with their subsystem, portal, state and storage. The
namespaces of all subsystems are counted in one pass for that list, as
a node can have a thousand controllers, for example with a storage
plugin that uses a subsystem per guest disk.
Removing a portal or the storage does not disconnect, so a controller
can be removed here, unless a namespace that is mounted, has holders,
is open in a process or is referenced by a storage would lose its
last usable path. A controller with namespaces outside of native
NVMe multipath is refused, as they lack the head devices that these
checks go by. Reading needs Sys.Audit on the node or
Datastore.Allocate on /storage, the removal Sys.Modify on '/'.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 182 +++++++++++++++++++++++++++++++
src/PVE/Diskmanage.pm | 16 +--
src/PVE/NVMeOF.pm | 71 ++++++++++++
src/test/Makefile | 3 +-
src/test/run_nvmeof_api_tests.pl | 178 ++++++++++++++++++++++++++++++
src/test/run_nvmeof_tests.pl | 7 ++
7 files changed, 449 insertions(+), 9 deletions(-)
create mode 100644 src/PVE/API2/NVMeOF.pm
create mode 100755 src/test/run_nvmeof_api_tests.pl
diff --git a/src/PVE/API2/Makefile b/src/PVE/API2/Makefile
index c3066fa0..e5411bdb 100644
--- a/src/PVE/API2/Makefile
+++ b/src/PVE/API2/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Disks.pm ${DESTDIR}${PERLDIR}/PVE/API2/Disks.pm
install -D -m 0644 ISCSI.pm ${DESTDIR}${PERLDIR}/PVE/API2/ISCSI.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/API2/NVMeOF.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/API2/Multipath.pm
make -C Storage install
make -C Disks install
diff --git a/src/PVE/API2/NVMeOF.pm b/src/PVE/API2/NVMeOF.pm
new file mode 100644
index 00000000..71b4423d
--- /dev/null
+++ b/src/PVE/API2/NVMeOF.pm
@@ -0,0 +1,182 @@
+package PVE::API2::NVMeOF;
+
+use v5.36;
+
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTHandler;
+use PVE::RPCEnvironment;
+
+use PVE::NVMeOF;
+use PVE::Storage;
+
+use base qw(PVE::RESTHandler);
+
+my $read_permissions = {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+};
+my $controller_schema = {
+ description => 'The fabrics controller name, for example nvme3.',
+ type => 'string',
+ pattern => 'nvme[0-9]+',
+};
+
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ method => 'GET',
+ proxyto => 'node',
+ permissions => { user => 'all' },
+ description => 'Node NVMe over Fabrics index.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => { type => 'object', properties => { name => { type => 'string' } } },
+ links => [{ rel => 'child', href => '{name}' }],
+ },
+ code => sub { return [{ name => 'status' }, { name => 'controller' }] },
+});
+
+__PACKAGE__->register_method({
+ name => 'status',
+ path => 'status',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'Report the NVMe host identity and nvme-cli availability.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ supported => { type => 'boolean', description => 'Whether nvme-cli is installed.' },
+ 'host-nqn' => {
+ type => 'string',
+ optional => 1,
+ description => 'The host NQN for target access control.',
+ },
+ 'host-id' =>
+ { type => 'string', optional => 1, description => 'The persistent host UUID.' },
+ error => {
+ type => 'string',
+ optional => 1,
+ description => 'Why the host identity is unavailable.',
+ },
+ },
+ },
+ code => sub {
+ my $res = { supported => PVE::NVMeOF::is_supported() };
+ my $host = eval { PVE::NVMeOF::host_identity() };
+ if (my $error = $@) {
+ chomp $error;
+ $res->{error} = $error;
+ } else {
+ $res->{'host-nqn'} = $host->{nqn};
+ $res->{'host-id'} = $host->{id};
+ }
+ return $res;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'controllers',
+ path => 'controller',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'List connected NVMe over Fabrics controllers and their states.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ controller => $controller_schema,
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ transport => { type => 'string', description => 'The controller transport.' },
+ portal => {
+ type => 'string',
+ description => 'The controller address and port, if applicable.',
+ },
+ state => {
+ type => 'string',
+ description => 'The controller state, such as live or connecting.',
+ },
+ namespaces => {
+ type => 'integer',
+ description => 'The number of namespace devices in the subsystem.',
+ },
+ 'used-by-storage' => {
+ type => 'string',
+ optional => 1,
+ description => 'An NVMe over Fabrics storage using the subsystem.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my $cfg = PVE::Storage::config();
+ my %owners;
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $owners{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
+ }
+ my $controllers = PVE::NVMeOF::controllers();
+ my $counts = PVE::NVMeOF::namespace_counts();
+ my @rows;
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ my $nqn = $ctrl->{subsystem};
+ push @rows,
+ {
+ controller => $name,
+ subsysnqn => $nqn,
+ transport => $ctrl->{transport},
+ portal => PVE::NVMeOF::format_path($ctrl),
+ state => $ctrl->{state},
+ namespaces => $counts->{$nqn} // 0,
+ defined($owners{$nqn}) ? ('used-by-storage' => $owners{$nqn}) : (),
+ };
+ }
+ return \@rows;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'disconnect',
+ path => 'controller/{controller}',
+ method => 'DELETE',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/', ['Sys.Modify']] },
+ description => 'Disconnect one fabrics controller. Refuse when a namespace in use has no'
+ . ' other usable path. A storage still listing the portal reconnects it on activation.',
+ parameters => {
+ additionalProperties => 0,
+ properties =>
+ { node => get_standard_option('pve-node'), controller => $controller_schema },
+ },
+ returns => { type => 'string', description => 'The task identifier.' },
+ code => sub($param) {
+ my $rpcenv = PVE::RPCEnvironment::get();
+ return $rpcenv->fork_worker(
+ 'nvmedisconnect',
+ $param->{controller},
+ $rpcenv->get_user(),
+ sub {
+ PVE::NVMeOF::disconnect_guarded($param->{controller});
+ },
+ );
+ },
+});
+
+1;
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 1ad91e06..05bed420 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -940,6 +940,13 @@ sub get_multipath_disks {
return $disklist;
}
+sub nvme_path_is_usable {
+ my ($path) = @_;
+ my $ana = $path->{'ana-state'};
+ return $path->{state} eq 'live'
+ && (!defined($ana) || $ana eq 'optimized' || $ana eq 'non-optimized');
+}
+
# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
# single-controller devices lack these children and are omitted.
sub get_nvme_path_status {
@@ -975,15 +982,8 @@ sub get_nvme_path_status {
my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
$entry->{'ana-state'} = $ana if defined($ana);
- # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
- # cannot serve IO even on a live controller
- my $usable = $state eq 'live'
- && (!defined($ana)
- || $ana eq 'optimized'
- || $ana eq 'non-optimized');
-
my $status = $res->{$head} //= { active => 0, paths => [] };
- $status->{active}++ if $usable;
+ $status->{active}++ if nvme_path_is_usable($entry);
push @{ $status->{paths} }, $entry;
},
);
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index f9a293d9..bce63768 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -165,6 +165,21 @@ sub namespaces($subsystem) {
return $res;
}
+# The number of namespaces of each subsystem of this node, from one pass over the subsystems.
+sub namespace_counts() {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-subsystem";
+ dir_glob_foreach(
+ $dir,
+ 'nvme-subsys[0-9]+',
+ sub($subsys, @) {
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn") // return;
+ dir_glob_foreach("$dir/$subsys", 'nvme[0-9]+n[0-9]+', sub { $res->{$nqn}++ });
+ },
+ );
+ return $res;
+}
+
sub with_lock($code) {
my ($res, $timeout) = PVE::Tools::run_fork_with_timeout(
35,
@@ -306,4 +321,60 @@ sub discover($portal) {
die "discovery at portal '$portal' failed - $error";
}
+sub disconnect_guarded($controller) {
+ my ($name) = $controller =~ /\A(nvme[0-9]+)\z/;
+ die "invalid controller name '$controller'\n" if !defined($name);
+ return with_lock(sub {
+ require PVE::Storage::SAN;
+ my $ctrl = controllers()->{$name}
+ // die "'$name' is not an NVMe over Fabrics controller\n";
+ # Without native multipath a namespace is a device of its controller and has no head
+ # device, which the checks below go by.
+ my $local = 0;
+ dir_glob_foreach(
+ "$SYSFS/class/nvme-fabrics/ctl/$name",
+ "${name}n[0-9]+",
+ sub { $local = 1 },
+ );
+ die "cannot disconnect '$name' - its namespaces do not use native NVMe multipath\n"
+ if $local;
+ my $namespaces = namespaces($ctrl->{subsystem});
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %heads = map { $_ => 1 } keys %$namespaces;
+ for my $head (keys %$status) {
+ $heads{$head} = 1
+ if grep { $_->{device} eq "/dev/$name" } $status->{$head}->{paths}->@*;
+ }
+ PVE::Cluster::cfs_update(1);
+ my $cfg = PVE::Storage::config();
+ for my $head (sort keys %heads) {
+ my $paths = $status->{$head}->{paths} // [];
+ my @others = grep { $_->{device} ne "/dev/$name" } @$paths;
+ next if grep { PVE::Diskmanage::nvme_path_is_usable($_) } @others;
+ my $ns = $namespaces->{$head} // die
+ "cannot disconnect '$name' - namespace '$head' has no device on this node to check for use\n";
+ my $device = "/dev/$head";
+ if (PVE::Diskmanage::is_mounted($device) || PVE::Diskmanage::has_holder($device)) {
+ die "cannot disconnect '$name' - namespace '$head' is in use and has no other"
+ . " usable path\n";
+ }
+ my $opener = PVE::Diskmanage::device_opener($device, glob("${device}p[0-9]*"));
+ if (defined($opener)) {
+ die "cannot disconnect '$name' - process $opener has namespace '$head' open and"
+ . " it has no other usable path\n";
+ }
+ eval {
+ PVE::Storage::SAN::assert_lun_unreferenced(
+ $cfg,
+ { devpath => $device, wwid => $ns->{wwid} },
+ );
+ };
+ die "cannot disconnect '$name' - $@" if $@;
+ }
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command([$NVME, 'disconnect', '--device', "/dev/$name"], timeout => 30);
+ return;
+ });
+}
+
1;
diff --git a/src/test/Makefile b/src/test/Makefile
index c88666f5..ac4265b4 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -84,6 +84,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
-test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_api_tests.pl run_nvmeof_taint_tests.pl
./run_nvmeof_tests.pl
+ ./run_nvmeof_api_tests.pl
perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_api_tests.pl b/src/test/run_nvmeof_api_tests.pl
new file mode 100755
index 00000000..8c881ee6
--- /dev/null
+++ b/src/test/run_nvmeof_api_tests.pl
@@ -0,0 +1,178 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use File::Path qw(make_path remove_tree);
+use File::Temp qw(tempdir);
+use Test::MockModule;
+use Test::More;
+
+use PVE::Storage::SAN;
+use PVE::API2::NVMeOF;
+
+my $sys = tempdir('nvmeof-api-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::SYSFS = $sys;
+
+subtest 'last-path disconnect is checked inside serialization' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $san = Test::MockModule->new('PVE::Storage::SAN');
+ my $cluster = Test::MockModule->new('PVE::Cluster');
+ our $locked;
+ my ($commands, $checks, $mounted, $busy, $headless) = (0, 0, 0, 0, 0);
+ my $other = { device => '/dev/nvme2', state => 'live', 'ana-state' => 'optimized' };
+ $nvme->mock(with_lock =>
+ sub { die "NVMe over Fabrics is busy\n" if $busy; local $locked = 1; $_[0]->() });
+ $nvme->mock(
+ controllers => sub {
+ ok($locked, 'controller snapshot is locked');
+ { nvme1 => { subsystem => 'nqn.test' } };
+ },
+ );
+ $nvme->mock(namespaces => sub { $headless ? {} : { nvme0n1 => { wwid => 'eui.abc' } } });
+ $nvme->mock(is_supported => sub { 1 });
+ $disk->mock(
+ get_nvme_path_status =>
+ sub { {
+ nvme0n1 => { paths => [{ device => '/dev/nvme1', state => 'live' }, $other] } } },
+ );
+ $disk->mock(is_mounted => sub { $mounted });
+ $disk->mock(has_holder => sub { 0 });
+ my $opener;
+ $disk->mock(device_opener => sub { $opener });
+ $cluster->mock(cfs_update => sub { ok($locked, 'configuration refreshed under lock') });
+ $storage->mock(config => sub { { ids => {} } });
+ $san->mock(
+ assert_lun_unreferenced => sub { $checks++; die "storage uses this namespace\n" });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'deletion keeps the lock');
+ is($opts{timeout}, 30, 'deletion is bounded');
+ is_deeply(
+ $cmd,
+ ['/usr/sbin/nvme', 'disconnect', '--device', '/dev/nvme1'],
+ 'only the selected controller is removed',
+ );
+ $commands++;
+ },
+ );
+ for my $ana ('optimized', 'non-optimized') {
+ $other->{'ana-state'} = $ana;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ }
+ is($commands, 2, 'another usable path permits removal');
+ is($checks, 0, 'no usage probe when another path is usable');
+ for my $ana ('inaccessible', 'persistent-loss', 'change') {
+ $other->{'ana-state'} = $ana;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, "$ana does not protect an in-use namespace");
+ }
+ $other = { device => '/dev/nvme2', state => 'connecting', 'ana-state' => 'optimized' };
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, 'reconnecting is not a usable path');
+ is($commands, 2, 'refusals never delete');
+ $san->mock(assert_lun_unreferenced => sub { $checks++ });
+ $mounted = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'local mount refuses');
+ $mounted = 0;
+ $opener = '4711 (kvm)';
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/process 4711 \(kvm\) has namespace 'nvme0n1' open/,
+ 'an open namespace refuses');
+ $opener = undef;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 3, 'unused namespace can lose its final path');
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1",
+ "$sys/class/nvme-fabrics/ctl/nvme1/nvme0c1n1",
+ );
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/do not use native NVMe multipath/, 'a namespace without head device refuses');
+ is($commands, 3, 'and nothing is disconnected');
+ remove_tree("$sys/class/nvme-fabrics/ctl/nvme1/nvme1n1");
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 4, 'the path device of native multipath does not');
+ $headless = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/has no device/, 'uncheckable namespace refuses');
+ $busy = 1;
+ $nvme->mock(controllers => sub { die "must not count paths\n" });
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is busy/, 'ongoing deletion blocks another snapshot');
+ eval { PVE::NVMeOF::disconnect_guarded('../nvme1') };
+ like($@, qr/invalid controller/, 'invalid controller refused before locking');
+};
+
+subtest 'node API contract' => sub {
+ my $api = 'PVE::API2::NVMeOF';
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ $storage->mock(
+ config =>
+ sub { { ids => { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } } } },
+ );
+ $nvme->mock(is_supported => sub { 0 });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'uuid' } });
+ my $status = $api->status({ node => 'n1' });
+ is($status->{supported}, 0, 'availability means nvme-cli, not identity or version');
+ is($status->{'host-nqn'}, 'nqn.host', 'host identity shown independently');
+ $nvme->mock(is_supported => sub { 1 });
+ $nvme->mock(host_identity => sub { die "missing host identity\n" });
+ $status = $api->status({ node => 'n1' });
+ is_deeply(
+ $status,
+ { supported => 1, error => 'missing host identity' },
+ 'identity error does not hide installed tools',
+ );
+ $nvme->mock(
+ controllers => sub { {
+ nvme1 => {
+ subsystem => 'nqn.test',
+ transport => 'tcp',
+ traddr => '192.0.2.1',
+ trsvcid => 4420,
+ state => 'connecting',
+ },
+ } },
+ );
+ $nvme->mock(
+ namespaces => sub { die "must not walk the subsystems for each controller\n" },
+ namespace_counts => sub { { 'nqn.test' => 2, 'nqn.other' => 5 } },
+ );
+ my $rows = $api->controllers({ node => 'n1' });
+ is($rows->[0]->{namespaces}, 2, 'namespaces counted for the subsystem of the controller');
+ is($rows->[0]->{'used-by-storage'}, 'fabric', 'controller attributed');
+ is($rows->[0]->{state}, 'connecting', 'kernel state remains visible');
+
+ for my $pair (['status', $status], ['controllers', $rows]) {
+ my $method = $api->map_method_by_name($pair->[0]);
+ eval { PVE::JSONSchema::validate($pair->[1], $method->{returns}) };
+ is($@, '', "$pair->[0] schema");
+ ok($method->{protected} && $method->{proxyto} eq 'node', 'protected and node-proxied');
+ }
+ is(
+ $api->map_method_by_name('disconnect')->{path},
+ 'controller/{controller}',
+ 'REST-shaped deletion',
+ );
+ my $rpc = Test::MockModule->new('PVE::RPCEnvironment');
+ {
+
+ package NVMeTestRPC;
+ sub get_user { 'root@pam' }
+ sub fork_worker { $_[4]->(); return 'UPID:test' }
+ }
+ $rpc->mock(get => sub { bless {}, 'NVMeTestRPC' });
+ my $removed;
+ $nvme->mock(disconnect_guarded => sub { $removed = $_[0] });
+ is(
+ $api->disconnect({ node => 'n1', controller => 'nvme1' }),
+ 'UPID:test',
+ 'API returns task identifier',
+ );
+ is($removed, 'nvme1', 'task calls guarded disconnect');
+};
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index 90b34857..aca76d7a 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -188,6 +188,13 @@ subtest 'sysfs topology' => sub {
'namespace facts',
);
is_deeply(PVE::NVMeOF::namespaces('nqn.other'), {}, 'other subsystem excluded');
+ make_path(map { "$sys/class/nvme-subsystem/nvme-subsys1/nvme1n$_" } 1 .. 3);
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys1/subsysnqn", "nqn.other\n");
+ is_deeply(
+ PVE::NVMeOF::namespace_counts(),
+ { 'nqn.test' => 1, 'nqn.other' => 3 },
+ 'namespaces counted per subsystem',
+ );
};
subtest 'serialized commands inherit the lock' => sub {
^ permalink raw reply related [relevance 14%]
* [PATCH v2 manager 15/17] ui: node: san: list NVMe over Fabrics controllers
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (13 preceding siblings ...)
2026-11-18 20:42 19% ` [PATCH v2 manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
@ 2026-11-18 20:42 12% ` Thomas Lamprecht
2026-11-18 20:42 9% ` [PATCH v2 manager 17/17] ui: dc: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-22 14:52 6% ` superseded: [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
Add a view below Node > SAN with the controllers of a node, one per
connected portal, their state and the storage they belong to, and the
host NQN of the node. A controller can be disconnected from there, for
example after its portal was removed from the storage. The node
refuses that for the last usable path of a namespace in use.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/SANUtils.js | 5 ++
www/manager6/Utils.js | 1 +
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 115 +++++++++++++++++++++++++
5 files changed, 130 insertions(+), 1 deletion(-)
create mode 100644 www/manager6/node/NVMeOFControllers.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 1fbce8c4d..5877c660d 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -252,6 +252,7 @@ JSSRC= \
node/ISCSITargets.js \
node/LVM.js \
node/LVMThin.js \
+ node/NVMeOFControllers.js \
node/SANLuns.js \
node/StatusView.js \
node/Subscription.js \
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index 1b2b25c12..2a4877df5 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -135,6 +135,11 @@ Ext.define('PVE.SANUtils', {
'logged-in': ['check-circle good', gettext('Connected')],
recovering: ['exclamation-circle warning', gettext('Reconnecting')],
'not-connected': ['times-circle faded', gettext('Not connected')],
+ live: ['check-circle good', gettext('Connected')],
+ connecting: ['exclamation-circle warning', gettext('Reconnecting')],
+ resetting: ['exclamation-circle warning', gettext('Reconnecting')],
+ deleting: ['times-circle faded', gettext('Disconnecting')],
+ 'deleting (no IO)': ['times-circle faded', gettext('Disconnecting')],
}[value];
let [icon, label] = display ?? ['question-circle faded', value];
return `<i class="fa fa-fw fa-${icon}"></i> ${Ext.htmlEncode(label)}`;
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index ef8218918..5610f0020 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -2268,6 +2268,7 @@ Ext.define('PVE.Utils', {
lvmthinremove: ['Thinpool', gettext('Remove')],
migrateall: ['', gettext('Bulk migrate VMs and Containers')],
move_volume: ['CT', gettext('Move Volume')],
+ nvmedisconnect: ['NVMe-oF', gettext('Disconnect')],
'pbs-download': ['VM/CT', gettext('File Restore Download')],
pull_file: ['CT', gettext('Pull file')],
push_file: ['CT', gettext('Push file')],
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 476463a65..f6c2506b2 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -385,7 +385,7 @@ Ext.define('PVE.node.Config', {
);
}
- // the san-luns and iscsi reads accept either privilege
+ // the san-luns, iscsi and nvmeof reads accept either privilege
if (caps.nodes['Sys.Audit'] || caps.storage['Datastore.Allocate']) {
me.items.push(
{
@@ -401,6 +401,13 @@ Ext.define('PVE.node.Config', {
iconCls: 'fa fa-bullseye',
groups: ['san'],
},
+ {
+ xtype: 'pveNVMeOFControllerList',
+ title: 'NVMe over Fabrics',
+ itemId: 'san-nvmeof',
+ iconCls: 'fa fa-plug',
+ groups: ['san'],
+ },
);
}
diff --git a/www/manager6/node/NVMeOFControllers.js b/www/manager6/node/NVMeOFControllers.js
new file mode 100644
index 000000000..93955442d
--- /dev/null
+++ b/www/manager6/node/NVMeOFControllers.js
@@ -0,0 +1,115 @@
+Ext.define('PVE.node.NVMeOFControllerList', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'pveNVMeOFControllerList',
+ onlineHelp: 'storage_nvmeof',
+ emptyText: gettext('No NVMe over Fabrics controllers found'),
+ viewConfig: { enableTextSelection: true },
+ store: {
+ fields: ['controller', 'subsysnqn', 'portal', 'state', 'namespaces', 'used-by-storage'],
+ sorters: ['subsysnqn', 'portal'],
+ },
+ columns: [
+ { text: gettext('Controller'), dataIndex: 'controller', width: 100 },
+ {
+ text: gettext('Subsystem'),
+ dataIndex: 'subsysnqn',
+ flex: 5,
+ renderer: Ext.htmlEncode,
+ },
+ { text: gettext('Portal'), dataIndex: 'portal', width: 180, renderer: Ext.htmlEncode },
+ {
+ text: gettext('State'),
+ dataIndex: 'state',
+ width: 150,
+ renderer: PVE.SANUtils.renderState,
+ },
+ { text: gettext('Namespaces'), dataIndex: 'namespaces', width: 110 },
+ {
+ text: gettext('Storage'),
+ dataIndex: 'used-by-storage',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+
+ reload: function () {
+ let me = this;
+ let load = (path, success) =>
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${me.nodename}/nvmeof/${path}`,
+ method: 'GET',
+ waitMsgTarget: me.getView(),
+ failure: (response) =>
+ Proxmox.Utils.setErrorMask(me.getView(), response.htmlStatus),
+ success: (response) => !me.destroyed && success(response.result.data),
+ });
+ load('status', function (status) {
+ me.down('#hostnqn').setValue(status['host-nqn'] || '');
+ let error = status.supported
+ ? status.error
+ : gettext('nvme-cli is not installed on this node.');
+ if (error) {
+ Proxmox.Utils.setErrorMask(me.getView(), Ext.htmlEncode(error));
+ return;
+ }
+ load('controller', function (controllers) {
+ Proxmox.Utils.setErrorMask(me.getView(), false);
+ me.getStore().setData(controllers);
+ });
+ });
+ },
+
+ listeners: {
+ activate: function () {
+ this.reload();
+ },
+ },
+
+ initComponent: function () {
+ let me = this;
+ me.nodename = me.pveSelNode.data.node;
+ me.tbar = [
+ { text: gettext('Reload'), iconCls: 'fa fa-refresh', handler: () => me.reload() },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Disconnect'),
+ iconCls: 'fa fa-unlink',
+ disabled: true,
+ dangerous: true,
+ enableFn: () => !!Ext.state.Manager.get('GuiCap').dc['Sys.Modify'],
+ confirmMsg: (rec) =>
+ Ext.String.format(
+ gettext(
+ 'Disconnect controller {0}? A storage that still lists its portal connects to it again.',
+ ),
+ Ext.htmlEncode(rec.get('controller')),
+ ),
+ handler: (button, event, rec) =>
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${me.nodename}/nvmeof/controller/${rec.get('controller')}`,
+ method: 'DELETE',
+ waitMsgTarget: me,
+ failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+ success: (response) =>
+ Ext.create('Proxmox.window.TaskProgress', {
+ upid: response.result.data,
+ autoShow: true,
+ taskDone: () => !me.destroyed && me.reload(),
+ }),
+ }),
+ },
+ '->',
+ {
+ xtype: 'displayfield',
+ itemId: 'hostnqn',
+ fieldLabel: gettext('Host NQN'),
+ },
+ {
+ iconCls: 'fa fa-clipboard',
+ tooltip: gettext('Copy to Clipboard'),
+ handler: () => PVE.Utils.copyToClipboard(me.down('#hostnqn').getValue()),
+ },
+ ];
+ me.callParent();
+ },
+});
^ permalink raw reply related [relevance 12%]
* [PATCH v2 docs 10/17] storage: document NVMe over Fabrics storages
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (8 preceding siblings ...)
2026-11-18 20:42 16% ` [PATCH v2 storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
@ 2026-11-18 20:42 20% ` Thomas Lamprecht
2026-11-18 20:42 6% ` [PATCH v2 manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints Thomas Lamprecht
` (6 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
Add a chapter for the nvmeof storage type: prerequisites, setting up
shared LVM on a namespace with the guided setup or by hand, the
properties, checking and disconnecting paths, and the limits of the
storage type.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
pve-storage-multipath.adoc | 4 +-
pve-storage-nvmeof.adoc | 167 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 20 +++--
3 files changed, 183 insertions(+), 8 deletions(-)
create mode 100644 pve-storage-nvmeof.adoc
diff --git a/pve-storage-multipath.adoc b/pve-storage-multipath.adoc
index d74fa23..caeae9b 100644
--- a/pve-storage-multipath.adoc
+++ b/pve-storage-multipath.adoc
@@ -14,8 +14,8 @@ Identifier (WWID) identifies the same LUN on every node.
{pve} configures maps cluster-wide and shows their state under *Datacenter ->
Storage -> SAN*. An iSCSI storage with *Multipath* enabled requests maps for its
LUNs; Fibre Channel LUNs need entries in `/etc/pve/multipath.cfg`. NVMe
-namespaces use kernel-native multipath instead; the procedures below cover SCSI
-LUNs.
+namespaces use kernel-native multipath instead, see
+xref:storage_nvmeof[NVMe over Fabrics]; the procedures below cover SCSI LUNs.
Prerequisites
~~~~~~~~~~~~~
diff --git a/pve-storage-nvmeof.adoc b/pve-storage-nvmeof.adoc
new file mode 100644
index 0000000..aa464b6
--- /dev/null
+++ b/pve-storage-nvmeof.adoc
@@ -0,0 +1,167 @@
+[[storage_nvmeof]]
+NVMe over Fabrics Backend
+-------------------------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: NVMe over Fabrics
+endif::wiki[]
+
+Storage pool type: `nvmeof`
+
+NVMe over Fabrics (NVMe-oF) gives a node access to the namespaces of an NVMe
+subsystem on a storage array over TCP. Namespaces are the NVMe counterpart of
+LUNs. Use one as the base volume of a shared LVM storage, or use the namespaces
+directly as disk images.
+
+Each node connects one controller per portal of the storage. The kernel
+combines these paths into one device per namespace with its native NVMe
+multipath and reconnects lost paths on its own. `multipath-tools` is not
+involved.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+. Upgrade all nodes before adding the first NVMe over Fabrics storage.
+. Install `nvme-cli` on every participating node. The `libpve-storage-perl`
+ package recommends it, but installations without recommended packages need it
+ added separately. Its installation creates the node's host NQN in
+ `/etc/nvme/hostnqn` and host ID in `/etc/nvme/hostid`. Nodes cloned from one
+ image share them. Give each a new identity before it connects, with
+ `nvme gen-hostnqn > /etc/nvme/hostnqn` and `uuidgen > /etc/nvme/hostid`.
+. Allow each node's host NQN on the array. The names are shown under
+ *Datacenter -> Storage -> SAN* and in the guided setup.
+. Present the same empty namespace to all intended nodes. Portals are IP
+ addresses that every node can reach; host names are not accepted.
+. Use a storage network that only trusted hosts can reach. The connections use
+ neither authentication nor TLS.
+. Keep native NVMe multipath enabled, which is the kernel default
+ (`nvme_core.multipath=Y`).
+
+[[storage_nvmeof_setup]]
+Setting Up Shared LVM
+~~~~~~~~~~~~~~~~~~~~~
+
+. Open *Datacenter -> Storage -> SAN* in the web UI on a node that can reach
+ the array and select *Guided Setup -> LVM on NVMe over Fabrics*.
+. Enter a discovery portal, select the subsystem, check the portals and name
+ the connection storage. This storage connects to the subsystem with
+ `content none`, while the LVM storage manages guest disks. Continuing creates
+ or reuses the connection storage before you select a namespace.
+. Select the namespace, choose the storage ID and volume group, then confirm.
+ Leave *Nodes* empty for all nodes.
+. Check the state of the namespace on each node of the storage, which the
+ setup shows once the storage is added, as described for LUNs in
+ xref:storage_multipath_setup[Multipath]. For a node that stays *Missing*,
+ check its access to the namespace on the array before placing guests on the
+ storage.
+
+The discovery fills in *Portals*. Some targets, such as the Linux kernel
+target, report only the portal that was asked: add the others to the list.
+With a single portal, the state of the namespace reads *OK (1 path)*.
+Portals can also be changed later in the edit dialog of the connection storage;
+each node then connects new ones on its own.
+
+*Datacenter -> Storage -> Add -> NVMe over Fabrics* adds only the connection
+storage. Enable *Use namespaces directly* there to use whole namespaces as guest
+disks, or add an *LVM* storage on a namespace later, with the connection storage
+as *Base storage*.
+
+To set it up by hand, run these commands on a node that can reach the array:
+
+----
+# pvesm scan nvmeof <portal>
+# pvesm add nvmeof <connection> --subsysnqn <nqn> --portals <portals> --content none
+# pvesm list <connection>
+# pvesm add lvm <storage> --vgname <vg> --base <volume-id> --shared 1
+----
+
+Use the complete volume ID from the listing, `<connection>:nvme-<wwid>`. Adding
+the LVM storage creates the volume group if it does not exist yet. Creating it
+is refused if the namespace holds data that {pve} recognizes, such as
+partitions, a file system or a volume group, or if another storage references
+it. To reuse a namespace, wipe it as described for LUNs in
+xref:storage_multipath_setup[Multipath].
+
+Configuration
+~~~~~~~~~~~~~
+
+The backend supports the common storage properties `content`, `nodes`,
+`disable`, and the following NVMe over Fabrics specific properties:
+
+subsysnqn::
+
+The NQN of the NVMe subsystem. It cannot be changed later, and only one storage
+can use a subsystem.
+
+portals::
+
+Comma-separated list of the subsystem's TCP portals, one per path. Each is an
+IPv4 address or an IPv6 address in brackets, with an optional port (default
+4420).
+
+fast-io-fail-tmo::
+
+Seconds a path may be reconnecting before I/O sent to it fails. The default is
+120: guests get I/O errors once all paths of a namespace have been lost for
+that long. With `-1`, I/O waits until a path returns. A change applies to newly
+connected controllers only.
+
+.Configuration Example (`/etc/pve/storage.cfg`)
+----
+nvmeof: fabric
+ subsysnqn nqn.2010-06.com.example:array1
+ portals 192.0.2.10,192.0.2.11
+ content none
+----
+
+.Storage features for backend `nvmeof`
+[width="100%",cols="m,m,3*d",options="header"]
+|==============================================================================
+|Content types |Image formats |Shared |Snapshots |Clones
+|images none |raw |yes |no |no
+|==============================================================================
+
+{pve} does not create or delete namespaces; manage them on the array. A volume
+is named `nvme-<wwid>` after its namespace, like its link in `/dev/disk/by-id/`.
+
+Checking and Disconnecting Paths
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Datacenter -> Storage -> SAN* lists the namespaces of NVMe over Fabrics
+storages among the LUNs, with their state on each node of the storage and
+*Multipath* shown as *Native*, as does *Node -> SAN* for the namespaces of a
+node. Expand a namespace there to inspect its paths.
+Its *State* is *Degraded* while a path is unusable or fewer paths exist than
+the storage has portals, and *Failed* without a usable path. *Node -> SAN ->
+NVMe over Fabrics* lists the node's controllers, one per connected portal:
+*Connected*, or *Reconnecting* while the kernel retries a lost path.
+
+An enabled storage connects the portals a node has no controller for. A portal
+that failed is retried after a minute. Removing a portal, or disabling or
+removing the storage, does not disconnect anything. To remove such a path,
+select its controller under *Node -> SAN -> NVMe over Fabrics* on each node and
+press *Disconnect*, or run
+`pvesh delete /nodes/<node>/nvmeof/controller/<controller>`. This is refused if
+a namespace that is mounted, in use by another device, open in a process such
+as a running guest, or referenced by a storage would lose its last usable path.
+The process check does not find one that opened the namespace through another
+device node. A controller with namespaces that do not use native NVMe multipath
+is refused as well. A storage that still lists the portal connects to it again.
+
+Limits
+~~~~~~
+
+* Only the TCP transport is supported, without authentication or TLS.
+* NVMe/FC namespaces need no storage of this type, and the guided setups and
+ the cluster-wide status do not cover them. *Node -> SAN* lists them. Create
+ their volume group under *Node -> Disks -> LVM*; with *Add Storage* enabled,
+ this adds a shared LVM storage.
+
+ifdef::wiki[]
+
+See Also
+~~~~~~~~
+
+* link:/wiki/Storage[Storage]
+
+endif::wiki[]
diff --git a/pvesm.adoc b/pvesm.adoc
index f7de231..5cf0df2 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -79,6 +79,7 @@ nodes that can be accessed as RBD (RADOS Block Device).
|LVM-thin |lvmthin |block |no |yes |yes
|iSCSI/kernel |iscsi |block |yes^3^|yes^4^ |yes
|iSCSI/libiscsi |iscsidirect |block |yes^3^|yes^4^ |yes
+|NVMe-oF |nvmeof |block |yes^3^|yes^4^ |yes
|FC/SAS |native^6^ |block |yes^3^|yes^4^ |yes
|Ceph/RBD |rbd |block |yes |yes |yes
|ZFS over iSCSI |zfs |block |yes |yes |yes
@@ -96,10 +97,12 @@ TiB sized), these operations may take several minutes, or in extreme cases, even
hours. If your setup is affected, create and remove snapshots while the VM is
shut down, expecting a long task duration.
-^3^: With iSCSI, Fibre Channel (FC), or SAS block storage as shared storage in
-a cluster, LVM is used to split the LUN into virtual disks. A LUN is usually
-reachable over several paths; xref:storage_multipath[Multipath] describes how
-{pve} manages them in a cluster.
+^3^: With iSCSI, NVMe over Fabrics (NVMe-oF), Fibre Channel (FC), or SAS block
+storage as shared storage in a cluster, LVM is used to split the LUN or
+namespace into virtual disks. A LUN is usually reachable over several paths;
+xref:storage_multipath[Multipath] describes how {pve} manages them in a cluster.
+NVMe-oF namespaces use the kernel's native multipath instead, see
+xref:storage_nvmeof[NVMe over Fabrics].
^4^: Since {pve} 9, snapshots as a volume chain have been available for VMs.
These snapshots use separate volumes for the snapshot data and layer them. For
@@ -153,9 +156,10 @@ is available on all nodes, but it is physically different and can have
totally different content.
Add storage under *Datacenter -> Storage -> Add* in the web UI. For shared LVM
-on a xref:storage_multipath_setup[SAN LUN], use *Guided Setup* under
+on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace], use *Guided Setup* under
*Datacenter -> Storage -> SAN* instead. It creates the storages that are needed
-and enables multipath for the LUN.
+and enables multipath for a LUN.
Storage Pools
@@ -506,6 +510,8 @@ See Also
* link:/wiki/Storage:_Multipath[Storage: Multipath]
+* link:/wiki/Storage:_NVMe_over_Fabrics[Storage: NVMe over Fabrics]
+
* link:/wiki/Storage:_LVM[Storage: LVM]
* link:/wiki/Storage:_LVM_Thin[Storage: LVM Thin]
@@ -550,6 +556,8 @@ include::pve-storage-iscsidirect.adoc[]
include::pve-storage-multipath.adoc[]
+include::pve-storage-nvmeof.adoc[]
+
include::pve-storage-rbd.adoc[]
include::pve-storage-cephfs.adoc[]
^ permalink raw reply related [relevance 20%]
* [PATCH v2 manager 12/17] ui: storage: add NVMe over Fabrics storage
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (10 preceding siblings ...)
2026-11-18 20:42 6% ` [PATCH v2 manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints Thomas Lamprecht
@ 2026-11-18 20:42 18% ` Thomas Lamprecht
2026-11-18 20:42 18% ` [PATCH v2 manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
` (4 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
Show NVMe over Fabrics storages with their subsystem in the storage
list, and add a dialog for them. The dialog lists the subsystems that a
discovery portal reports and fills in the portals of the selected one,
which can be changed. As in the iSCSI dialog, the discovery can run on
another node, since the node serving the web UI may not be allowed on
the array. The node of the discovery is then preselected as the node of
the storage.
The subsystem selector builds on the iSCSI target selector, which lets a
subclass set its store fields and sort key.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/Utils.js | 6 ++
www/manager6/dc/StorageView.js | 5 +-
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/NVMeOFEdit.js | 137 +++++++++++++++++++++++++++++
5 files changed, 151 insertions(+), 3 deletions(-)
create mode 100644 www/manager6/storage/NVMeOFEdit.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 1644e1d41..f8a1a2698 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -378,6 +378,7 @@ JSSRC= \
storage/LvmThinEdit.js \
storage/BTRFSEdit.js \
storage/NFSEdit.js \
+ storage/NVMeOFEdit.js \
storage/PBSEdit.js \
storage/RBDEdit.js \
storage/StatusView.js \
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 64269755d..ef8218918 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -886,6 +886,12 @@ Ext.define('PVE.Utils', {
faIcon: 'building',
backups: false,
},
+ nvmeof: {
+ name: 'NVMe over Fabrics',
+ ipanel: 'NVMeOFInputPanel',
+ faIcon: 'building',
+ backups: false,
+ },
cephfs: {
name: 'CephFS',
ipanel: 'CephFSInputPanel',
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index f0f298102..4d7e93dfd 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -247,7 +247,9 @@ Ext.define(
sortable: true,
dataIndex: 'path',
renderer: function (value, metaData, record) {
- return Ext.htmlEncode(record.data.target || value);
+ return Ext.htmlEncode(
+ record.data.target || record.data.subsysnqn || value,
+ );
},
},
{
@@ -298,6 +300,7 @@ Ext.define(
'server',
'portal',
'target',
+ 'subsysnqn',
'export',
'storage',
{ name: 'shared', type: 'boolean' },
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index c20aa2896..14f5d83f3 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -5,6 +5,7 @@ Ext.define('PVE.storage.IScsiScan', {
queryParam: 'portal',
valueField: 'target',
displayField: 'target',
+ scanFields: ['target', 'portal'],
matchFieldWidth: false,
allowBlank: false,
@@ -53,13 +54,13 @@ Ext.define('PVE.storage.IScsiScan', {
}
let store = Ext.create('Ext.data.Store', {
- fields: ['target', 'portal'],
+ fields: me.scanFields,
proxy: {
type: 'proxmox',
url: `${me.apiBaseUrl}${me.nodename}${me.apiSuffix}`,
},
});
- store.sort('target', 'ASC');
+ store.sort(me.valueField, 'ASC');
Ext.apply(me, {
store: store,
diff --git a/www/manager6/storage/NVMeOFEdit.js b/www/manager6/storage/NVMeOFEdit.js
new file mode 100644
index 000000000..5d816cbbe
--- /dev/null
+++ b/www/manager6/storage/NVMeOFEdit.js
@@ -0,0 +1,137 @@
+Ext.define('PVE.storage.NVMeOFScan', {
+ extend: 'PVE.storage.IScsiScan',
+ alias: 'widget.pveNVMeOFScan',
+
+ valueField: 'subsysnqn',
+ displayField: 'subsysnqn',
+ scanFields: ['subsysnqn', 'portals'],
+
+ listConfig: {
+ width: 650,
+ columns: [
+ {
+ dataIndex: 'subsysnqn',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+ emptyText: PVE.Utils.renderNotFound(gettext('Subsystem')),
+ },
+
+ config: {
+ apiSuffix: '/scan/nvmeof',
+ },
+});
+
+Ext.define('PVE.storage.NVMeOFInputPanel', {
+ extend: 'PVE.panel.StorageBase',
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ onlineHelp: 'storage_nvmeof',
+
+ namespaceContent: 'images',
+
+ onGetValues: function (values) {
+ let me = this;
+
+ values.content = values.namespaces ? me.namespaceContent : 'none';
+ delete values.namespaces;
+
+ return me.callParent([values]);
+ },
+
+ // a storage can be restricted to some volume types, keep its content types then
+ setValues: function (values) {
+ let me = this;
+
+ values.namespaces = PVE.Utils.contentAllows(values.content, 'vm-vol');
+ if (values.namespaces) {
+ me.namespaceContent = Ext.Array.from(values.content).join(',');
+ }
+ me.callParent([values]);
+ },
+
+ column1: [
+ {
+ xtype: 'textfield',
+ name: 'discovery-portal',
+ fieldLabel: gettext('Discovery Portal'),
+ allowBlank: false,
+ submitValue: false,
+ cbind: {
+ hidden: '{!isCreate}',
+ disabled: '{!isCreate}',
+ },
+ listeners: {
+ change: {
+ fn: function (field, value) {
+ let scan = this.up('inputpanel').lookup('subsystemScan');
+ scan.setDisabled(!value);
+ scan.setPortal(value);
+ scan.setValue('');
+ },
+ buffer: 500,
+ },
+ },
+ },
+ {
+ xtype: 'checkbox',
+ name: 'namespaces',
+ boxLabel: gettext('Use namespaces directly'),
+ },
+ ],
+
+ // NQNs and portal lists are longer than a column is wide
+ columnB: [
+ {
+ cbind: {
+ xtype: (get) => (get('isCreate') ? 'pveNVMeOFScan' : 'displayfield'),
+ disabled: '{isCreate}',
+ },
+ name: 'subsysnqn',
+ value: '',
+ fieldLabel: gettext('Subsystem'),
+ allowBlank: false,
+ reference: 'subsystemScan',
+ listeners: {
+ change: function (field, value) {
+ let rec = field
+ .getStore?.()
+ .findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ field
+ .up('inputpanel')
+ .down('field[name=portals]')
+ .setValue(rec.get('portals'));
+ }
+ },
+ nodechanged: function (value) {
+ this.up('inputpanel').lookup('storageNodeRestriction').setValue(value);
+ },
+ },
+ },
+ {
+ xtype: 'textfield',
+ name: 'portals',
+ fieldLabel: gettext('Portals'),
+ allowBlank: false,
+ },
+ ],
+
+ advancedColumn1: [
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'fast-io-fail-tmo',
+ fieldLabel: gettext('Fail I/O After (s)'),
+ minValue: -1,
+ emptyText: '120',
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Applies to newly connected paths. -1 disables the timeout.'),
+ },
+ },
+ ],
+});
^ permalink raw reply related [relevance 18%]
* [PATCH v2 manager 17/17] ui: dc: san: show that a namespace uses native multipath
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (14 preceding siblings ...)
2026-11-18 20:42 12% ` [PATCH v2 manager 15/17] ui: node: san: list NVMe over Fabrics controllers Thomas Lamprecht
@ 2026-11-18 20:42 9% ` Thomas Lamprecht
2026-11-22 14:52 6% ` superseded: [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the namespaces of NVMe over Fabrics
storages as well. They use the native multipath of the kernel, with
neither an entry nor a storage that requests a map, so the Multipath
column would call them unmanaged. Show "Native" for them, as the LUN
list of a node does.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/SAN.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index 475ea4e33..30bb65e8e 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -15,6 +15,7 @@ Ext.define('pve-san-status', {
'name',
'explicit',
'multipath-storage',
+ 'native',
'nodes',
'size',
'used-by-storage',
@@ -371,7 +372,14 @@ Ext.define('PVE.dc.SANView', {
width: 170,
renderer: (value, md, rec) => {
let storage = rec.get('multipath-storage');
- let kind = value ? 'manual' : storage ? 'storage' : 'unmanaged';
+ // a namespace uses the native multipath of the kernel
+ let kind = rec.get('native')
+ ? 'native'
+ : value
+ ? 'manual'
+ : storage
+ ? 'storage'
+ : 'unmanaged';
return Ext.htmlEncode(PVE.SANUtils.multipathText(kind, storage));
},
},
^ permalink raw reply related [relevance 9%]
* [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage
@ 2026-11-18 20:42 10% Thomas Lamprecht
2026-11-18 20:42 8% ` [PATCH v2 storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
` (16 more replies)
0 siblings, 17 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
A storage type for NVMe subsystems reached over TCP, on top of v7 of the
SAN series [0]: namespaces as base volumes of shared LVM, or directly as
disk images, with the kernel's native multipath.
This is v2 [1]. Besides following the SAN series, it adds three
checks, listed first below.
This is a deliberately small first version: TCP only, without
authentication or TLS, so access rests on the host NQN list of the
target and a separate storage network. It relies on the kernel to
reconnect lost paths and on the SAN series for the LUN inventory, the
guided setup and the checks before a namespace is written. The plugin
connects what is missing and removes nothing, also not when a portal or
the storage is removed: disconnecting a controller is an explicit action
per node.
Two prerequisites from the chapter: nodes cloned from one image need
distinct host NQNs before they connect. And as with every new storage
type, all nodes need the upgrade before the first such storage is added,
as a node that does not know the type drops its definitions when it
writes storage.cfg. I ran into that in the lab.
What it adds:
- storage type 'nvmeof' with a subsystem NQN and a list of TCP portals,
one storage per subsystem. Each node connects the portals it has no
controller for and leaves existing controllers as they are. New
controllers get ctrl_loss_tmo=-1, so the kernel keeps reconnecting,
and fail I/O on a lost path after 120 seconds unless configured
otherwise. Volumes are named nvme-<wwid>.
- LVM accepts such a volume as base, with the reference check and the
per-LUN lock of the SAN series.
- discovery: /nodes/{node}/scan/nvmeof and 'pvesm scan nvmeof'.
- /nodes/{node}/nvmeof: host identity, controller list, and removal of
one controller. That is refused if a namespace that is mounted, has a
holder, is open in a process or is referenced by a storage would lose
its last usable path. As in the SAN series, the process check misses
an open through another device node. A storage that still lists the
portal connects again.
- the node report and with it the cluster-wide status of the SAN series
include the namespaces of nvmeof storages, with their state on each
node of the storage. They do not need multipathd.
- web UI: the Guided Setup menu of the SAN view gets a third entry for
shared LVM on a namespace, which ends with the state of the namespace
on every node like the other two; Datacenter > Storage > Add gets the
dialog of the storage type, with subsystem discovery and the note
pointing to the SAN view; Node > SAN lists the controllers, next to
the namespaces that the SAN series lists with their paths; the SAN
view shows the host NQN of each node.
- nvme-cli becomes a Recommends of libpve-storage-perl.
Patches:
- storage 01-09: SMART skip for TCP and RDMA namespaces, the
plugin, LVM base, discovery, namespace attribution in the LUN
inventory, the node API, the host NQN and the namespaces in the node
report
- docs 10: the storage chapter
- manager 11-17: API mount, storage type and its dialog, LVM base
selector, guided setup, controller list, host NQN column, native
multipath in the LUN list of the SAN view
Changes since v1 [1]:
- the controller removal also refuses when a process has a namespace
open, and refuses a controller whose namespaces do not use native
NVMe multipath, as its checks go by their head devices
- resolving a volume ID to its path checks an existing device against
the subsystem of the storage, not only activation: a volume name can
be the by-id name of any NVMe device, and a live import, for example,
reads its source without activating it
- a second storage for the same subsystem is refused. The LUN list, the
controller list and the node report take the first storage they find,
so namespaces showed as unused next to a connection storage. One
storage lists all portals instead
- the discovery in the add dialog can run on another node, as for iSCSI
- the chapter lists the trusted storage network as a prerequisite
- NVMe/FC is no longer offered in the Fibre Channel setup, which covers
SCSI LUNs only; the chapter says how to set up such a namespace
- the controller list counts the namespaces in one pass: 8.4 seconds
for 1000 controllers before, 0.07 now, found by a plugin vendor
- the status update does not wait for a missing namespace, as in the
SAN series, and the hint of the namespace step speaks of a namespace
in use
- the subsystem and ID of a namespace in the LUN inventory, and the
subsystem in the target column of the LUN list of a node, come from
v7 of the SAN series now, which shows them for any namespace
- rebased onto v7 of the SAN series and plugin API 17, with 'vm-vol'
content and the plugin metadata, and with the namespace variants of
the setup texts that v7 changed
- the plugin isolates its properties, so they need no prefix:
'nvme-portals' and 'nvme-fast-io-fail-tmo' are now 'portals' and
'fast-io-fail-tmo', and a third-party plugin can declare these names
and 'subsysnqn' for itself. Being a new type, it has no
configurations to carry over. As the first in-tree plugin that
isolates, it makes the storage API check and describe the create and
update parameters per type, as an installed isolating third-party
plugin already does. For the in-tree types, the web UI and pvesm work
as before. A third-party plugin now has to list the sensitive
properties it uses in options() on every installation, which the
TrueNAS, Lightbits, simplyblock and Pure Storage plugins do. The API
viewer lists 186 parameters for creating a storage instead of 66, one
per property and type, and the pvesm man page grows from 880 to 1108
lines. pve-api-types does not generate these two calls
- the namespace ID left the content listing, where nothing read it;
style fixes, and the plugin module uses v5.36 and signatures
When applying, pve-manager needs a versioned dependency on the
libpve-storage-perl with this series, as its node API loads the new
PVE::API2::NVMeOF, and on the pve-doc-generator (build) and pve-docs
with the NVMe over Fabrics chapter, for its help links.
For v1 I tested this on a six-node nested cluster against a Linux nvmet
target and a NetApp AFF A20, each with two portals: both guided setup
variants, also with a node without access at first, path faults and a
stopped multipathd in the cluster-wide status, a guest on shared LVM on
a NetApp namespace through snapshot, rollback, live migration and a path
cut under I/O, the wipe and its refusals, and reconnecting after a node
reboot.
For v2 I upgraded that cluster and ran the new refusals (a process on
the only path, a second storage for a subsystem from CLI, API and
dialog), the discovery through another node, and a volume named after a
namespace of another subsystem. After the rebase onto v6 of the SAN
series, the guided setup ran again on the nvmet target, and the guest of
the SAN series' test had a data disk on such a namespace through
snapshots, live migrations and a node reboot. The controller list showed
1000 controllers in the web UI. The refusal for a controller outside of
native multipath and the status update that does not wait have unit
tests only. With the isolated properties, I added, edited and removed
such a storage from the CLI and the web UI, ran the guided setup up to a
new connection storage, and removed a NetApp controller on one node,
which connected again from the portals of its storage. On the build on
top of v7 of the SAN series, a guest with a partition of a namespace as
disk showed in the LUN list and kept the wipe from running.
[0]: https://lore.proxmox.com/pve-devel/20261118202646.3017286-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20261113030541.1591528-1-t.lamprecht@proxmox.com/
pve-storage:
Thomas Lamprecht (9):
diskmanage: skip SMART queries for NVMe fabric namespaces
nvmeof: add a storage for NVMe over Fabrics subsystems
lvm: allow a volume group on an NVMe over Fabrics namespace
api: scan: add NVMe over Fabrics discovery
pvesm: add a scan command for NVMe over Fabrics
api: scan: san-luns: attribute NVMe namespaces to storage
api: add node-level NVMe over Fabrics status and controller removal
multipath: report the NVMe host NQN of each node
multipath: report NVMe over Fabrics namespaces in the cluster status
ApiChangeLog | 7 +-
debian/control | 1 +
src/PVE/API2/Makefile | 1 +
src/PVE/API2/Multipath.pm | 13 +-
src/PVE/API2/NVMeOF.pm | 182 +++++++++++++
src/PVE/API2/Storage/Scan.pm | 58 ++++-
src/PVE/CLI/pvesm.pm | 13 +
src/PVE/Diskmanage.pm | 22 +-
src/PVE/Makefile | 1 +
src/PVE/Multipath/Status.pm | 63 ++++-
src/PVE/NVMeOF.pm | 380 ++++++++++++++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/LVMPlugin.pm | 3 +-
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 223 ++++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 29 ++-
src/test/Makefile | 7 +-
src/test/disklist_test.pm | 14 +
src/test/run_multipath_api_tests.pl | 107 +++++++-
src/test/run_nvmeof_api_tests.pl | 178 +++++++++++++
src/test/run_nvmeof_taint_tests.pl | 65 +++++
src/test/run_nvmeof_tests.pl | 375 +++++++++++++++++++++++++++
src/test/run_san_lun_scan_tests.pl | 28 ++
src/test/run_san_nvme_tests.pl | 33 +++
25 files changed, 1770 insertions(+), 38 deletions(-)
pve-docs:
Thomas Lamprecht (1):
storage: document NVMe over Fabrics storages
pve-storage-multipath.adoc | 4 +-
pve-storage-nvmeof.adoc | 167 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 20 +++--
3 files changed, 183 insertions(+), 8 deletions(-)
pve-manager:
Thomas Lamprecht (7):
api: nodes: mount the NVMe over Fabrics endpoints
ui: storage: add NVMe over Fabrics storage
ui: lvm: offer NVMe over Fabrics storages as base storage
ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics
ui: node: san: list NVMe over Fabrics controllers
ui: dc: san: show the NVMe host NQN of each node
ui: dc: san: show that a namespace uses native multipath
PVE/API2/Nodes.pm | 7 +
www/manager6/Makefile | 4 +-
www/manager6/SANUtils.js | 6 +
www/manager6/Utils.js | 7 +
www/manager6/dc/SAN.js | 41 +++--
www/manager6/dc/StorageView.js | 5 +-
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 115 +++++++++++++
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/LVMEdit.js | 12 +-
www/manager6/storage/NVMeOFEdit.js | 140 ++++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 34 ++--
www/manager6/storage/wizard/NodeIdentities.js | 45 +++---
.../storage/wizard/{IScsi.js => Target.js} | 153 ++++++++++++------
www/manager6/storage/wizard/Wizard.js | 43 ++---
www/manager6/window/SANLunState.js | 23 ++-
16 files changed, 529 insertions(+), 120 deletions(-)
^ permalink raw reply [relevance 10%]
* [PATCH v2 manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (9 preceding siblings ...)
2026-11-18 20:42 20% ` [PATCH v2 docs 10/17] storage: document NVMe over Fabrics storages Thomas Lamprecht
@ 2026-11-18 20:42 6% ` Thomas Lamprecht
2026-11-18 20:42 18% ` [PATCH v2 manager 12/17] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
` (5 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
Make the node status, the controller list and the disconnect call of
pve-storage reachable at /nodes/{node}/nvmeof for the web UI.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
PVE/API2/Nodes.pm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 49039bc30..0cfb7b79c 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -54,6 +54,7 @@ use PVE::API2::Hardware;
use PVE::API2::ISCSI;
use PVE::API2::LXC::Status;
use PVE::API2::LXC;
+use PVE::API2::NVMeOF;
use PVE::API2::Network;
use PVE::API2::Network::SDN::Nodes::Status;
use PVE::API2::NodeConfig;
@@ -167,6 +168,11 @@ __PACKAGE__->register_method({
path => 'iscsi',
});
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::NVMeOF",
+ path => 'nvmeof',
+});
+
__PACKAGE__->register_method({
subclass => "PVE::API2::Capabilities",
path => 'capabilities',
@@ -259,6 +265,7 @@ __PACKAGE__->register_method({
{ name => 'migrateall' },
{ name => 'netstat' },
{ name => 'network' },
+ { name => 'nvmeof' },
{ name => 'qemu' },
{ name => 'query-oci-repo-tags' },
{ name => 'query-url-metadata' },
^ permalink raw reply related [relevance 6%]
* [PATCH v2 manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (11 preceding siblings ...)
2026-11-18 20:42 18% ` [PATCH v2 manager 12/17] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-18 20:42 18% ` Thomas Lamprecht
2026-11-18 20:42 19% ` [PATCH v2 manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
` (3 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
A namespace of an NVMe over Fabrics storage can hold the volume group
of an LVM storage like an iSCSI LUN, so list such storages in the base
storage selector as well and name the type of each.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/storage/LVMEdit.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index d3f068166..a8c9bba00 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -70,10 +70,13 @@ Ext.define('PVE.storage.BaseStorageSelector', {
let store = Ext.create('Ext.data.Store', {
autoLoad: {
addRecords: true,
- params: {
- type: 'iscsi',
- },
},
+ filters: [
+ {
+ filterFn: (rec) =>
+ !rec.get('storage') || ['iscsi', 'nvmeof'].includes(rec.get('type')),
+ },
+ ],
fields: [
'storage',
'type',
@@ -82,7 +85,8 @@ Ext.define('PVE.storage.BaseStorageSelector', {
name: 'text',
convert: function (value, record) {
if (record.data.storage) {
- return record.data.storage + ' (iSCSI)';
+ let type = PVE.Utils.format_storage_type(record.data.type);
+ return `${record.data.storage} (${type})`;
} else {
return me.existingGroupsText;
}
^ permalink raw reply related [relevance 18%]
* [PATCH v2 storage 08/17] multipath: report the NVMe host NQN of each node
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (6 preceding siblings ...)
2026-11-18 20:42 14% ` [PATCH v2 storage 07/17] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
@ 2026-11-18 20:42 10% ` Thomas Lamprecht
2026-11-18 20:42 16% ` [PATCH v2 storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
` (8 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
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/Multipath.pm | 2 +-
src/PVE/Multipath/Status.pm | 5 ++++-
src/test/run_multipath_api_tests.pl | 12 +++++++++++-
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/PVE/API2/Multipath.pm b/src/PVE/API2/Multipath.pm
index 8e60f70a..e69919c2 100644
--- a/src/PVE/API2/Multipath.pm
+++ b/src/PVE/API2/Multipath.pm
@@ -94,7 +94,7 @@ my $node_schema = {
. ' base volume of a storage or to hold its volume group.',
},
map { $_ => { type => 'string', optional => 1 } }
- qw(error apply-error iscsi-initiator-name),
+ qw(error apply-error iscsi-initiator-name nvme-host-nqn),
},
};
diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm
index 8e4b4eb7..ae386164 100644
--- a/src/PVE/Multipath/Status.pm
+++ b/src/PVE/Multipath/Status.pm
@@ -52,6 +52,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();
@@ -171,7 +174,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 6955076b..078ba66d 100755
--- a/src/test/run_multipath_api_tests.pl
+++ b/src/test/run_multipath_api_tests.pl
@@ -15,6 +15,7 @@ use Test::More;
use Test::MockModule;
use PVE::API2::Multipath;
use PVE::Multipath::Generator;
+use PVE::NVMeOF;
use PVE::Storage;
subtest 'explicit entries are ordinary configuration writes' => sub {
@@ -205,9 +206,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();
@@ -383,11 +387,15 @@ 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)], 'single call owns ordering');
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();
@@ -396,6 +404,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();
@@ -450,7 +459,7 @@ subtest 'API returns final node and LUN states' => sub {
},
],
}),
- n2 => encode_json({ time => $NOW, luns => [] }),
+ n2 => encode_json({ time => $NOW, luns => [], 'nvme-host-nqn' => 'nqn.test:n2' }),
n3 => encode_json({ time => $NOW - 181, luns => [] }),
n4 => encode_json({ time => $NOW, luns => [] }),
n5 => encode_json({ time => $NOW, error => 'multipath-tools is not installed' }),
@@ -481,6 +490,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');
^ permalink raw reply related [relevance 10%]
* [PATCH v2 storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (4 preceding siblings ...)
2026-11-18 20:42 9% ` [PATCH v2 storage 05/17] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
@ 2026-11-18 20:42 21% ` Thomas Lamprecht
2026-11-18 20:42 14% ` [PATCH v2 storage 07/17] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
` (10 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
The SAN LUN inventory lists NVMe namespaces with their subsystem, but
without relation to an NVMe over Fabrics storage. Expect one path per
portal of the storage that connects the subsystem of a namespace, so
that a namespace with fewer paths shows as degraded.
A namespace counts as used by the LVM storage that has it as base
volume, else by the storage of its subsystem if that one serves the
namespaces as images.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 9 +++++----
src/PVE/Storage/SAN.pm | 16 +++++++++++++---
src/test/run_san_lun_scan_tests.pl | 28 ++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index 84848847..7d3fd242 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -499,8 +499,9 @@ __PACKAGE__->register_method({
'paths-expected' => {
description => "The number of paths the LUN should have on this node: the"
. " highest of the count of its multipath entry and, for each managed"
- . " iSCSI storage of the LUN, the number of its portals. Absent if no"
- . " count is known.",
+ . " iSCSI storage of the LUN, the number of its portals. For a namespace"
+ . " of an NVMe over Fabrics storage, the number of its portals. Absent if"
+ . " no count is known.",
type => 'integer',
optional => 1,
},
@@ -579,8 +580,8 @@ __PACKAGE__->register_method({
},
'used-by-storage' => {
description => "The storage that uses the LUN: as its base volume or"
- . " through the volume group on it, or as an iSCSI storage that serves the"
- . " LUNs of its target as images.",
+ . " through the volume group on it, or as an iSCSI or NVMe over Fabrics"
+ . " storage that serves the LUNs of its target or subsystem as images.",
type => 'string',
optional => 1,
},
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index 86469f5c..abf992d9 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -16,6 +16,7 @@ use PVE::Multipath;
use PVE::Multipath::Config;
use PVE::Multipath::Generator;
use PVE::Multipath::Identity;
+use PVE::NVMeOF;
use PVE::Storage;
use PVE::Storage::LVMPlugin;
@@ -42,7 +43,8 @@ sub scan_luns($cfg) {
PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
- my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %targets, %paths, %unmapped);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %nvme_owner, %targets, %paths);
+ my %unmapped;
for my $sid (sort keys %$derived) {
for my $wwid (keys $derived->{$sid}->{wwids}->%*) {
@@ -61,7 +63,8 @@ sub scan_luns($cfg) {
$target_owner{ $scfg->{target} } //= $sid
if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
$base_owner{$1} //= $sid
- if ($scfg->{base} // '') =~ m/(?:^|\.)(?:dm-uuid-(?:part\d+-)?mpath|scsi)-(.+)$/;
+ if ($scfg->{base} // '') =~ m/(?:^|[.:])(?:dm-uuid-(?:part\d+-)?mpath|scsi|nvme)-(.+)$/;
+ $nvme_owner{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
}
my %rows;
@@ -106,6 +109,10 @@ sub scan_luns($cfg) {
$row->{'nvme-subsystem'} = $nqn;
my $nsid = file_read_firstline("/sys/block/$name/nsid");
$row->{'nvme-nsid'} = int($nsid) if defined($nsid) && $nsid =~ /^\d+$/;
+ if (my $sid = $nvme_owner{$nqn}) {
+ $row->{'paths-expected'} =
+ scalar(PVE::NVMeOF::storage_paths($cfg->{ids}->{$sid})->@*);
+ }
}
}
for my $key (qw(transport vendor model serial)) {
@@ -205,9 +212,12 @@ sub scan_luns($cfg) {
$row->{'paths-expected'},
);
}
+ my $nvme = $nvme_owner{ $row->{'nvme-subsystem'} // '' };
+ undef $nvme if $nvme && !PVE::Storage::san_storage_serves_images($cfg->{ids}->{$nvme});
my ($target) =
map { $target_owner{$_} // () } sort keys(($targets{ $row->{wwid} } // {})->%*);
- my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target;
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target
+ // $nvme;
$row->{'used-by-storage'} = $owner if defined($owner);
}
return [map { $rows{$_} } sort keys %rows];
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
index a98e2563..06db1202 100755
--- a/src/test/run_san_lun_scan_tests.pl
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -304,6 +304,12 @@ is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id lin
$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
$scan->mock(file_read_firstline => sub { $_[0] =~ m{/nsid$} ? 1 : 'eui.0123456789abcdef' });
$disk->mock(read_subsysnqn => sub { 'nqn.test' });
+$cfg->{ids}->{fabric} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ portals => '192.0.2.1,192.0.2.2',
+ content => { images => 1 },
+};
$scan->unmock('stable_path');
$scan->mock(abs_path => sub { '/dev/nvme0n1' });
$rows = PVE::Storage::SAN::scan_luns($cfg);
@@ -321,6 +327,28 @@ eval { PVE::JSONSchema::validate($rows, $schema) };
is($@, '', 'native row matches the API schema');
is($rows->[0]->{'nvme-subsystem'}, 'nqn.test', 'subsystem NQN exposed');
is($rows->[0]->{'nvme-nsid'}, 1, 'namespace ID exposed');
+is($rows->[0]->{'used-by-storage'}, 'fabric', 'a storage serving the namespaces uses them');
+is($rows->[0]->{'paths-expected'}, 2, 'one expected path per configured portal');
+
+for my $count (1, 3) {
+ $config->mock(
+ read_config => sub { {
+ ids => { 'eui.0123456789abcdef' => { type => 'wwid', 'paths-expected' => $count } },
+ } },
+ );
+ my $entry = PVE::Storage::SAN::scan_luns($cfg);
+ is($entry->[0]->{'paths-expected'}, 2, "a multipath entry does not change it ($count)");
+}
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+{
+ local $cfg->{ids}->{fabric}->{content} = { none => 1 };
+ my $plain = PVE::Storage::SAN::scan_luns($cfg);
+ is($plain->[0]->{'used-by-storage'}, undef, 'a connection storage does not');
+ is($plain->[0]->{'paths-expected'}, 2, 'but still tells the expected paths');
+}
+$cfg->{ids}->{data}->{base} = 'fabric:nvme-eui.0123456789abcdef';
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{'used-by-storage'}, 'data', 'LVM base consumer takes precedence');
$disk->mock(is_partition => sub { 1 });
ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
^ permalink raw reply related [relevance 21%]
* [PATCH v2 storage 04/17] api: scan: add NVMe over Fabrics discovery
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-18 20:42 16% ` [PATCH v2 storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
@ 2026-11-18 20:42 16% ` Thomas Lamprecht
2026-11-18 20:42 9% ` [PATCH v2 storage 05/17] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
` (12 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
Setting up an NVMe over Fabrics storage needs the NQN of the
subsystem and its portals. Add /nodes/{node}/scan/nvmeof, which asks
the discovery service at a portal for the NVMe/TCP subsystems it
offers to the node and lists them with their portals.
Without a port, it tries the discovery port 8009 and then the I/O
port 4420, where Linux targets answer discovery too. The scan needs
Datastore.Allocate on /storage, like the iSCSI scan.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 49 ++++++++++++++++++++++
src/PVE/NVMeOF.pm | 65 ++++++++++++++++++++++++++++++
src/test/run_nvmeof_taint_tests.pl | 5 +++
src/test/run_nvmeof_tests.pl | 54 +++++++++++++++++++++++++
4 files changed, 173 insertions(+)
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index cf19f835..84848847 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -6,6 +6,7 @@ use warnings;
# NOTE: This API endpoints are mounted by pve-manager's API2::Node module and pvesm CLI
use PVE::JSONSchema qw(get_standard_option);
+use PVE::NVMeOF;
use PVE::RESTHandler;
use PVE::RPCEnvironment;
use PVE::SafeSyslog;
@@ -50,6 +51,7 @@ __PACKAGE__->register_method({
{ method => 'iscsi' },
{ method => 'lvm' },
{ method => 'nfs' },
+ { method => 'nvmeof' },
{ method => 'pbs' },
{ method => 'san-luns' },
{ method => 'zfs' },
@@ -302,6 +304,53 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'nvmeofscan',
+ path => 'nvmeof',
+ method => 'GET',
+ description =>
+ 'List the NVMe over TCP subsystems offered to this node by a discovery controller.',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/storage', ['Datastore.Allocate']] },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ portal => {
+ description => 'IPv4 or bracketed IPv6 discovery address with an optional port.'
+ . ' Without a port, try 8009 then 4420.',
+ type => 'string',
+ format => 'pve-storage-nvme-portal',
+ },
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ portals => {
+ type => 'string',
+ description => 'The discovered TCP portals, comma separated.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+ my $res = PVE::NVMeOF::discover($param->{portal});
+ return [
+ map { {
+ subsysnqn => $_,
+ portals => join(',', map { PVE::NVMeOF::format_path($_) } $res->{$_}->@*),
+ } } sort keys %$res
+ ];
+ },
+});
+
__PACKAGE__->register_method({
name => 'lvmscan',
path => 'lvm',
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index ebaedf9b..f9a293d9 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -5,9 +5,11 @@ use v5.36;
use Digest::SHA qw(sha1_hex);
use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
use File::Path qw(make_path);
+use JSON qw(decode_json);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use PVE::JSONSchema;
+use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
use PVE::Diskmanage;
@@ -241,4 +243,67 @@ sub connect_path($scfg, $path) {
});
}
+sub parse_discovery_log($raw) {
+ my $log = decode_json($raw);
+ die "invalid NVMe discovery log\n"
+ if ref($log) ne 'HASH' || ref($log->{records}) ne 'ARRAY';
+ my (%seen, %res);
+ for my $record ($log->{records}->@*) {
+ next
+ if ($record->{subtype} // '') ne 'nvme subsystem' || ($record->{trtype} // '') ne 'tcp';
+ my $nqn = $record->{subnqn} // next;
+ if (
+ $nqn !~ /^$NQN_PATTERN$/
+ || length($nqn) > 223
+ || $nqn eq 'nqn.2014-08.org.nvmexpress.discovery'
+ ) {
+ next;
+ }
+ my $addr = $record->{traddr} // '';
+ my $port = $record->{trsvcid} // '';
+ my $path = parse_portal(($addr =~ /:/ ? "[$addr]" : $addr) . ":$port") // next;
+ next if $seen{$nqn}->{ format_path($path) }++;
+ push $res{$nqn}->@*, $path;
+ }
+ return \%res;
+}
+
+sub discover($portal) {
+ my $path = parse_portal($portal) // die "invalid portal '$portal'\n";
+ my @ports = $portal =~ /:[0-9]+$/ ? ($path->{trsvcid}) : (8009, 4420);
+ my $error;
+ for my $port (@ports) {
+ my $result = eval {
+ die "no answer from portal\n" if !PVE::Network::tcp_ping($path->{traddr}, $port, 2);
+ with_lock(sub {
+ assert_support();
+ my $host = host_identity();
+ my $out = '';
+ run_command(
+ [
+ $NVME,
+ 'discover',
+ '--transport=tcp',
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $port,
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--output-format=json',
+ ],
+ timeout => 30,
+ outfunc => sub($line) { $out .= "$line\n" },
+ );
+ return parse_discovery_log($out);
+ });
+ };
+ $error = $@;
+ return $result if !$error;
+ }
+ die "discovery at portal '$portal' failed - $error";
+}
+
1;
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
index 62405291..c6546c30 100755
--- a/src/test/run_nvmeof_taint_tests.pl
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -38,6 +38,7 @@ $nvme->mock(
'all connect operands are validated and untainted',
);
PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ $opts{outfunc}->('{"records":[]}') if $opts{outfunc};
},
);
my $path = PVE::NVMeOF::parse_portal($portal);
@@ -53,6 +54,10 @@ for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.disc
eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
}
+my $net = Test::MockModule->new('PVE::Network');
+$net->mock(tcp_ping => sub { 1 });
+eval { PVE::NVMeOF::discover($portal) };
+is($@, '', 'discovery can execute with file-backed host identity in taint mode');
file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
eval { PVE::NVMeOF::host_identity() };
like($@, qr/nonzero UUID/, 'zero host ID refused');
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index b75f7a5a..ffbaa45f 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -5,6 +5,7 @@ use lib qw(..);
use Fcntl qw(:flock);
use File::Path qw(make_path);
use File::Temp qw(tempdir);
+use JSON qw(encode_json);
use Test::MockModule;
use Test::More;
@@ -12,6 +13,7 @@ use PVE::Tools qw(file_set_contents);
use PVE::NVMeOF;
use PVE::Storage;
+use PVE::API2::Storage::Scan;
my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
local $PVE::NVMeOF::RUN_DIR = "$dir/run";
@@ -299,4 +301,56 @@ subtest 'local disk setup rejects fabric namespaces by transport' => sub {
}
};
+subtest 'TCP discovery, fallback and API result' => sub {
+ my $record = {
+ subtype => 'nvme subsystem',
+ trtype => 'tcp',
+ subnqn => 'nqn.test',
+ traddr => '192.0.2.1',
+ trsvcid => '4420',
+ };
+ my $raw = encode_json({
+ records =>
+ [$record, $record, { %$record, trtype => 'rdma' }, { %$record, trsvcid => 70000 }],
+ });
+ is_deeply(
+ PVE::NVMeOF::parse_discovery_log($raw),
+ { 'nqn.test' => [{ traddr => '192.0.2.1', trsvcid => 4420 }] },
+ 'TCP only, unique valid portals',
+ );
+ for my $bad ('garbage', '{}', '[]') {
+ eval { PVE::NVMeOF::parse_discovery_log($bad) };
+ ok($@, 'malformed discovery is not an empty success');
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my (@ports, @commands);
+ our $locked;
+ $nvme->mock(with_lock => sub { local $locked = 1; $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'id' } });
+ $net->mock(tcp_ping => sub { push @ports, $_[1]; $_[1] != 8009 });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'discovery holds the NVMe lock');
+ is($opts{timeout}, 30, 'discovery command timeout');
+ push @commands, $cmd;
+ $opts{outfunc}->($raw);
+ },
+ );
+ my $rows = PVE::API2::Storage::Scan->nvmeofscan({ node => 'n1', portal => '192.0.2.1' });
+ is_deeply(\@ports, [8009, 4420], 'unspecified port tries discovery then I/O port');
+ is_deeply($rows, [{ subsysnqn => 'nqn.test', portals => '192.0.2.1:4420' }], 'API shape');
+ eval {
+ PVE::JSONSchema::validate(
+ $rows,
+ PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns},
+ );
+ };
+ is($@, '', 'API schema accepts result');
+ @ports = ();
+ PVE::NVMeOF::discover('[2001:db8::1]:4421');
+ is_deeply(\@ports, [4421], 'explicit port does not fall back');
+};
+
done_testing();
^ permalink raw reply related [relevance 16%]
* [PATCH v2 storage 05/17] pvesm: add a scan command for NVMe over Fabrics
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (3 preceding siblings ...)
2026-11-18 20:42 16% ` [PATCH v2 storage 04/17] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
@ 2026-11-18 20:42 9% ` Thomas Lamprecht
2026-11-18 20:42 21% ` [PATCH v2 storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage Thomas Lamprecht
` (11 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
Add 'pvesm scan nvmeof <portal>', which prints the subsystems a
portal offers to the node with their portals, like the iSCSI scan
prints targets. That gives the values for a new storage on the
command line, with the usual output formats for scripts.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/CLI/pvesm.pm | 13 +++++++++++++
src/test/run_nvmeof_tests.pl | 12 ++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 8c3a2eda..b60b733b 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -736,6 +736,19 @@ our $cmddef = {
$print_api_result,
$PVE::RESTHandler::standard_output_options,
],
+ nvmeof => [
+ "PVE::API2::Storage::Scan",
+ 'nvmeofscan',
+ ['portal'],
+ { node => $nodename },
+ sub {
+ my ($data, $schema, $options) = @_;
+ PVE::CLIFormatter::print_api_result(
+ $data, $schema, [qw(subsysnqn portals)], $options,
+ );
+ },
+ $PVE::RESTHandler::standard_output_options,
+ ],
'san-luns' => [
"PVE::API2::Storage::Scan",
'sanlunscan',
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index ffbaa45f..90b34857 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -14,6 +14,7 @@ use PVE::Tools qw(file_set_contents);
use PVE::NVMeOF;
use PVE::Storage;
use PVE::API2::Storage::Scan;
+use PVE::CLI::pvesm;
my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
local $PVE::NVMeOF::RUN_DIR = "$dir/run";
@@ -351,6 +352,17 @@ subtest 'TCP discovery, fallback and API result' => sub {
@ports = ();
PVE::NVMeOF::discover('[2001:db8::1]:4421');
is_deeply(\@ports, [4421], 'explicit port does not fall back');
+ my $formatter = Test::MockModule->new('PVE::CLIFormatter');
+ my $schema = PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns};
+ $formatter->mock(
+ print_api_result => sub {
+ is($_[0], $rows, 'CLI forwards complete discovery rows');
+ is($_[1], $schema, 'CLI forwards discovery schema');
+ is($_[3]->{'output-format'}, 'json', 'CLI supports structured output');
+ },
+ );
+ $PVE::CLI::pvesm::cmddef->{scan}->{nvmeof}->[4]
+ ->($rows, $schema, { 'output-format' => 'json' });
};
done_testing();
^ permalink raw reply related [relevance 9%]
* [PATCH v2 storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-18 20:42 8% ` Thomas Lamprecht
2026-11-18 20:42 17% ` [PATCH v2 storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
` (15 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
The disk list queries the SMART health of every disk. For an NVMe
namespace attached over TCP or RDMA, the query goes to the target and
can stall the listing while a path recovers.
Skip the query for these transports. It depends on the transport of
the namespace only, so namespaces connected by hand are covered too.
Their health shows as unknown, local NVMe drives are queried as
before.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 4 +++-
src/test/disklist_test.pm | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 557a8a4a..8fda7afc 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -694,7 +694,9 @@ sub get_disks {
}
my ($health, $wearout) = ('UNKNOWN', 'N/A');
- if (!$nosmart) {
+ # SMART queries over fabrics can stall while a path recovers.
+ my $remote_nvme = defined($nvme_transport) && $nvme_transport =~ /^(?:tcp|rdma)$/;
+ if (!$nosmart && !$remote_nvme) {
eval {
my $smartdata = get_smart_data($devpath, !is_ssdlike($type));
$health = $smartdata->{health} if $smartdata->{health};
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index f79c59d3..74ca3b2d 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -284,6 +284,20 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if ($testcasedir eq 'nvme_smart') {
+ my $smart_calls;
+ $diskmanage_module->mock(get_smart_data => sub { $smart_calls++; return {} });
+ for my $transport (qw(tcp rdma pcie)) {
+ $smart_calls = 0;
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ PVE::Diskmanage::get_disks();
+ $testcount++;
+ is($smart_calls, $transport eq 'pcie' ? 1 : 0, "SMART queries for $transport");
+ }
+ $diskmanage_module->unmock('get_smart_data');
+ $diskmanage_module->unmock('get_nvme_transport');
+ }
+
if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
my $status = PVE::Multipath::path_status_by_wwid();
my $expected_status =
^ permalink raw reply related [relevance 8%]
* [PATCH v2 storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-18 20:42 8% ` [PATCH v2 storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-18 20:42 17% ` [PATCH v2 storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
@ 2026-11-18 20:42 16% ` Thomas Lamprecht
2026-11-18 20:42 16% ` [PATCH v2 storage 04/17] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
` (13 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:42 UTC (permalink / raw)
To: pve-devel
An LVM storage only accepts an iSCSI LUN as base volume. Accept a
namespace of an NVMe over Fabrics storage too. Adding such an LVM
storage connects the subsystem, waits for the namespace and creates
the volume group on it, and activating it on another node connects
that node first.
The creation treats the namespace like any SAN LUN: it takes the
cluster-wide lock of the LUN and refuses a namespace that another
storage references.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 3 +--
src/test/run_san_nvme_tests.pl | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index b9f7f34d..cccf3bb8 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -1194,9 +1194,8 @@ sub on_add_hook {
my $basecfg = PVE::Storage::storage_config($cfg, $baseid, 1);
die "base storage ID '$baseid' does not exist\n" if !$basecfg;
- # we only support iscsi for now
die "unsupported base type '$basecfg->{type}'"
- if $basecfg->{type} ne 'iscsi';
+ if $basecfg->{type} ne 'iscsi' && $basecfg->{type} ne 'nvmeof';
# Managed multipath requires the coalesced map or a partition of it, never a transient
# single-path PV.
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index c74b638a..7df849e3 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -133,4 +133,21 @@ is_deeply(
);
is_deeply(\@opens, [$link], 'VG creation holds the native by-id device');
+$cfg->{ids} = { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } };
+my @activation;
+$storage->mock(path => sub { $link });
+$storage->mock(activate_storage => sub { push @activation, 'storage' });
+$storage->mock(activate_volumes => sub { push @activation, 'volume' });
+$lvm->mock(
+ lvm_create_volume_group => sub {
+ is($_[0], $link, 'add hook passes native base');
+ is($_[3]->{exempt}, 'data', 'add hook exempts new storage');
+ },
+);
+PVE::Storage::LVMPlugin->on_add_hook(
+ 'data',
+ { base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'data', shared => 1 },
+);
+is_deeply(\@activation, ['storage', 'volume'], 'LVM activates the NVMe base before creation');
+
done_testing();
^ permalink raw reply related [relevance 16%]
* [PATCH v7 storage 18/43] api: scan: add a SAN LUN inventory
2026-11-18 20:25 6% [PATCH v7 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-18 20:25 13% ` [PATCH v7 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
2026-11-18 20:25 13% ` [PATCH v7 storage 05/43] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
@ 2026-11-18 20:26 9% ` Thomas Lamprecht
2026-11-18 20:26 10% ` [PATCH v7 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:26 UTC (permalink / raw)
To: pve-devel
Add /nodes/{node}/scan/san-luns, which lists the LUNs a node sees
over iSCSI, Fibre Channel or NVMe over Fabrics, one row per WWID with
the paths folded into their multipath map. The node disk list has
neither the maps nor a relation to volume groups and storages.
A row has the device to use, its size and transport, how multipath
handles the LUN, the health and state of its paths, and the known
usage with the volume group and storage. The usage comes from cached
data only, as probing a LUN whose paths are down can block.
A LUN without a map has its devices as paths, in the state that the
kernel reports for each, so that a LUN with a single path also shows
whether it is up. A LUN names its iSCSI target and a namespace its NVMe
subsystem.
The paths of a map are left out of the disk list, which reads sysfs
for each disk it returns. A node with a thousand LUNs has several
thousand of them, and the views poll this list every few seconds.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 218 +++++++++++++++
src/PVE/Diskmanage.pm | 15 +
src/PVE/Multipath.pm | 24 ++
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 221 +++++++++++++++
src/test/Makefile | 8 +-
src/test/disk_tests/multipath/multipathd | 124 +++++++++
.../multipath/multipathd_status_expected.json | 40 +++
src/test/disklist_test.pm | 15 +
src/test/run_san_api_tests.pl | 24 ++
src/test/run_san_lun_scan_tests.pl | 260 ++++++++++++++++++
11 files changed, 950 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/Storage/SAN.pm
create mode 100644 src/test/disk_tests/multipath/multipathd
create mode 100644 src/test/disk_tests/multipath/multipathd_status_expected.json
create mode 100755 src/test/run_san_api_tests.pl
create mode 100755 src/test/run_san_lun_scan_tests.pl
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index d8bd0a96..f3e2dc1e 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -12,6 +12,7 @@ use PVE::SafeSyslog;
use PVE::Storage::LVMPlugin;
use PVE::Storage::LvmThinPlugin;
use PVE::Storage::PBSPlugin;
+use PVE::Storage::SAN;
use PVE::Storage;
use base qw(PVE::RESTHandler);
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'nfs' },
{ method => 'pbs' },
+ { method => 'san-luns' },
{ method => 'zfs' },
];
@@ -375,6 +377,222 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'sanlunscan',
+ path => 'san-luns',
+ method => 'GET',
+ description => "List SAN LUNs with their paths and cached usage.",
+ protected => 1,
+ proxyto => "node",
+ permissions => {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ devpath => {
+ description => "The device path.",
+ type => 'string',
+ },
+ size => {
+ description => "The device size in bytes.",
+ type => 'integer',
+ renderer => 'bytes',
+ optional => 1,
+ },
+ transport => {
+ description =>
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'iscsi', 'nvme', 'nvme-fc', or 'nvme-tcp'.",
+ type => 'string',
+ optional => 1,
+ },
+ vendor => { type => 'string', optional => 1 },
+ model => { type => 'string', optional => 1 },
+ serial => { type => 'string', optional => 1 },
+ state => {
+ description => 'The health of the LUN from the state of its paths, when'
+ . ' that is known. Absent while a requested multipath map is missing.',
+ type => 'string',
+ enum => ['optimal', 'degraded', 'failed'],
+ optional => 1,
+ },
+ 'paths-total' => {
+ description => "The number of paths of a multipath mapped device or of"
+ . " an NVMe namespace attached through multiple controllers, or the"
+ . " number of SCSI devices of a LUN without a map.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-active' => {
+ description =>
+ "The number of active paths whose checker state is ready, ghost,"
+ . " or not reported. Native NVMe paths count when their controller is live"
+ . " and their ANA state is optimized, non-optimized, or not reported. A"
+ . " device of a LUN without a map counts while the kernel reports it as"
+ . " running.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-expected' => {
+ description => "The number of paths the LUN should have on this node: the"
+ . " highest of the count of its multipath entry and, for each managed"
+ . " iSCSI storage of the LUN, the number of its portals. Absent if no"
+ . " count is known.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'path-list' => {
+ description => "The member paths of the device with their state.",
+ type => 'array',
+ optional => 1,
+ items => {
+ type => 'object',
+ properties => {
+ device => {
+ description => "The path block device, or the NVMe"
+ . " controller device the path uses.",
+ type => 'string',
+ },
+ state => {
+ description => "The device mapper state of the path (for"
+ . " example active or failed), the state of the NVMe"
+ . " controller (for example live or connecting), or for a"
+ . " LUN without a map the kernel state of the device (for"
+ . " example running or transport-offline).",
+ type => 'string',
+ },
+ 'checker-state' => {
+ description => "The state reported by the multipathd path"
+ . " checker, for example ready, ghost or faulty.",
+ type => 'string',
+ optional => 1,
+ },
+ 'ana-state' => {
+ description => "The Asymmetric Namespace Access state of"
+ . " the namespace on this path, for example optimized"
+ . " or inaccessible.",
+ type => 'string',
+ optional => 1,
+ },
+ 'host-wwpn' => {
+ description => "The WWPN of the host (initiator) port of"
+ . " Fibre Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ 'target-wwpn' => {
+ description => "The WWPN of the target port of Fibre"
+ . " Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ address => {
+ description => "The address of the NVMe controller the"
+ . " path uses.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ usage => {
+ description => "The usage indicated by cached device metadata.",
+ type => 'string',
+ enum => ['unused', 'lvm', 'other'],
+ },
+ vgname => {
+ description => "The name of the LVM volume group the device belongs to.",
+ type => 'string',
+ optional => 1,
+ },
+ 'by-id' => {
+ description =>
+ "A path under /dev/disk/by-id that encodes the device's identity"
+ . " and has been verified to resolve to this device. Absent when no such"
+ . " link could be verified.",
+ type => 'string',
+ optional => 1,
+ },
+ 'used-by-storage' => {
+ description => "The storage that uses the LUN: as its base volume or"
+ . " through the volume group on it, or as an iSCSI storage that serves the"
+ . " LUNs of its target as images.",
+ type => 'string',
+ optional => 1,
+ },
+ wwid => {
+ description => "The LUN WWID.",
+ type => 'string',
+ },
+ name => {
+ description => 'The map alias, when different from its WWID.',
+ type => 'string',
+ optional => 1,
+ },
+ multipath => {
+ description => "How the node manages multipath for the LUN: 'manual' for a"
+ . " map with an explicit entry, 'storage' for the map of an iSCSI storage"
+ . " with the 'managed-multipath' option, 'unmanaged' for any other map,"
+ . " 'pending' while a map that an entry, a storage or the allow-list of"
+ . " the node requests does not exist yet, 'none' without a map or"
+ . " request, 'native' for the kernel-native multipath of an NVMe"
+ . " namespace.",
+ type => 'string',
+ enum => ['none', 'pending', 'storage', 'manual', 'unmanaged', 'native'],
+ },
+ 'multipath-storage' => {
+ description =>
+ "The multipath-enabled storage the LUN belongs to, whether or"
+ . " not it also has an explicit multipath entry.",
+ type => 'string',
+ optional => 1,
+ },
+ 'nvme-subsystem' => {
+ description => 'The NVMe subsystem NQN.',
+ type => 'string',
+ optional => 1,
+ },
+ 'nvme-nsid' => {
+ description => 'The namespace ID within the NVMe subsystem.',
+ type => 'integer',
+ optional => 1,
+ },
+ 'iscsi-target' => {
+ description => "The IQN of the iSCSI target the LUN is attached through.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-lun' => {
+ description => "The number of the LUN on its iSCSI target.",
+ type => 'integer',
+ optional => 1,
+ },
+ detail => {
+ description => "The cached signature or usage when usage is 'other'.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ code => sub {
+ return PVE::Storage::SAN::scan_luns(PVE::Storage::config());
+ },
+});
+
__PACKAGE__->register_method({
name => 'zfsscan',
path => 'zfs',
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 9c16e6a6..c2c50bcc 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -534,6 +534,14 @@ sub dir_is_empty {
return 1;
}
+# Some controllers pad the NQN or derive it from padded serial/model fields.
+sub read_subsysnqn {
+ my ($path) = @_;
+ my $nqn = file_read_firstline($path) // return undef;
+ $nqn =~ s/\s+$//;
+ return $nqn;
+}
+
# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
# its controller, or from any controller of its subsystem for native NVMe multipath setups.
sub get_nvme_transport {
@@ -554,6 +562,13 @@ sub get_nvme_transport {
return $transport;
}
+# SAS does not distinguish local from remote attachments, so it is not classified as remote.
+sub is_remote_transport {
+ my ($transport) = @_;
+
+ return ($transport // '') =~ m/^(?:fc|fcoe|iscsi|nvme-(?:fc|tcp|rdma))$/;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
diff --git a/src/PVE/Multipath.pm b/src/PVE/Multipath.pm
index ec417381..027e6a53 100644
--- a/src/PVE/Multipath.pm
+++ b/src/PVE/Multipath.pm
@@ -2,7 +2,9 @@ package PVE::Multipath;
use v5.36;
+use Cwd qw(abs_path);
use Encode qw(decode encode);
+use File::Basename qw(basename);
use JSON qw(decode_json);
use PVE::Tools qw(run_command file_get_contents file_read_firstline dir_glob_foreach);
@@ -19,6 +21,12 @@ sub parse_dm_uuid($uuid) {
return { wwid => $wwid, defined($part) ? (partition => int($part)) : () };
}
+sub device_map($device) {
+ my $name = basename(abs_path($device) // $device);
+ return undef if $name !~ /^dm-\d+$/;
+ return parse_dm_uuid(file_read_firstline("/sys/block/$name/dm/uuid"));
+}
+
sub map_info() {
my $maps = {};
dir_glob_foreach(
@@ -159,6 +167,22 @@ sub get_maps() {
return $maps;
}
+sub path_status_by_wwid() {
+ my $res = {};
+ for my $map (get_maps()->@*) {
+ my $wwid = $map->{wwid} // next;
+ my @paths;
+ for my $path ($map->{paths}->@*) {
+ my $row = { device => "/dev/$path->{dev}", state => $path->{'dm-state'} // 'undef' };
+ $row->{'checker-state'} = $path->{'check-state'} if defined($path->{'check-state'});
+ $row->{$_} = $path->{$_} for grep { defined($path->{$_}) } qw(host-wwpn target-wwpn);
+ push @paths, $row;
+ }
+ $res->{$wwid} = { active => $map->{'paths-active'}, paths => \@paths };
+ }
+ return $res;
+}
+
sub wait_for_map($wwid, $timeout = 10) {
my $link = "/dev/disk/by-id/dm-uuid-mpath-$wwid";
my $deadline = time() + ($timeout // 10);
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a67dc25f..a2df83c0 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -14,7 +14,8 @@ SOURCES= \
PBSPlugin.pm \
BTRFSPlugin.pm \
LvmThinPlugin.pm \
- ESXiPlugin.pm
+ ESXiPlugin.pm \
+ SAN.pm
.PHONY: install
install:
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
new file mode 100644
index 00000000..6c4dac86
--- /dev/null
+++ b/src/PVE/Storage/SAN.pm
@@ -0,0 +1,221 @@
+package PVE::Storage::SAN;
+
+use v5.36;
+
+use Cwd qw(abs_path);
+use File::Basename qw(basename);
+
+use PVE::INotify;
+use PVE::Tools qw(file_read_firstline dir_glob_foreach);
+
+use PVE::Diskmanage;
+use PVE::ISCSI::Topology;
+use PVE::Multipath;
+use PVE::Multipath::Config;
+use PVE::Multipath::Generator;
+use PVE::Multipath::Identity;
+use PVE::Storage;
+use PVE::Storage::LVMPlugin;
+
+sub scan_luns($cfg) {
+ my $ids = PVE::Multipath::Identity::collect(all => 1);
+ my $map_info = PVE::Multipath::map_info();
+ my $members = PVE::Multipath::member_map($map_info);
+ # A map stands for its paths, of which a node with many LUNs has thousands. Leave them out of
+ # the disk list, which reads the sysfs attributes and partitions of each disk it returns.
+ my @names;
+ dir_glob_foreach(
+ '/sys/block',
+ '(?:sd[a-z]+|nvme\d+n\d+)',
+ sub($name, @) { push @names, $name if !$members->{$name} },
+ );
+ my $disks = PVE::Diskmanage::get_disks(\@names, 1, 0, 1);
+ my $maps = PVE::Diskmanage::get_multipath_disks($map_info);
+ my $sessions = PVE::ISCSI::Topology::device_map();
+ my $status = eval { PVE::Multipath::path_status_by_wwid() } // {};
+ my $nvme = PVE::Diskmanage::get_nvme_path_status();
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups() // {};
+ my $mpcfg = PVE::Multipath::Config::read_config();
+ my %explicit = map { $_ => 1 }
+ PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
+ my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
+ my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %targets, %unmapped);
+
+ for my $sid (sort keys %$derived) {
+ for my $wwid (keys $derived->{$sid}->{wwids}->%*) {
+ $storage{$wwid} //= $sid;
+ my $count = $derived->{$sid}->{wwids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ }
+ for my $wwid (keys %explicit) {
+ my $count = $mpcfg->{ids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
+ $target_owner{ $scfg->{target} } //= $sid
+ if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
+ $base_owner{$1} //= $sid
+ if ($scfg->{base} // '') =~ m/(?:^|\.)(?:dm-uuid-(?:part\d+-)?mpath|scsi)-(.+)$/;
+ }
+
+ my %rows;
+ my $add = sub($disk, $map = 0) {
+ my $name = basename(abs_path($disk->{devpath}) // $disk->{devpath});
+ my $info =
+ { map => $map, transport => $disk->{transport}, session => $sessions->{$name} };
+ return if !is_san_device($disk->{devpath}, $info);
+ my $wwid = $map ? $disk->{wwn} : PVE::Multipath::Identity::path_wwid($ids, $name);
+ $wwid //= file_read_firstline("/sys/class/block/$name/wwid") if $name =~ /^nvme/;
+ return if !defined($wwid) || !length($wwid);
+
+ my $row = $rows{$wwid} //= {
+ wwid => $wwid,
+ devpath => $disk->{devpath},
+ size => $disk->{size},
+ usage => 'unused',
+ multipath => $listed{$wwid}
+ || $explicit{$wwid}
+ || $storage{$wwid} ? 'pending' : 'none',
+ };
+ my $link = stable_path($disk->{devpath}, $wwid, $map);
+ # The device and its by-id name come from one disk. A map replaces a single path.
+ if ($map || (defined($link) && !$row->{'by-id'})) {
+ delete $row->{'by-id'};
+ $row->{devpath} = $disk->{devpath};
+ $row->{size} = $disk->{size};
+ $row->{'by-id'} = $link if defined($link);
+ }
+ if ($map) {
+ my $alias = basename($disk->{devpath});
+ $row->{name} = $alias if $alias ne $wwid;
+ $row->{multipath} =
+ $explicit{$wwid} ? 'manual'
+ : $storage{$wwid} ? 'storage'
+ : 'unmanaged';
+ }
+ if ($name =~ /^nvme\d+n\d+$/) {
+ $row->{multipath} = 'native' if $nvme->{$name};
+ my $nqn = PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn");
+ if (defined($nqn)) {
+ $row->{'nvme-subsystem'} = $nqn;
+ my $nsid = file_read_firstline("/sys/block/$name/nsid");
+ $row->{'nvme-nsid'} = int($nsid) if defined($nsid) && $nsid =~ /^\d+$/;
+ }
+ }
+ for my $key (qw(transport vendor model serial)) {
+ my $value = $disk->{$key};
+ $row->{$key} //= $value if defined($value) && $value ne 'unknown';
+ }
+ for my $member (map { basename($_) } ($disk->{slaves} // [$disk->{devpath}])->@*) {
+ my $session = $sessions->{$member} // next;
+ $targets{$wwid}->{ $session->{target} } = 1;
+ $row->{'iscsi-target'} //= $session->{target};
+ $row->{'iscsi-lun'} //= $session->{lun};
+ $row->{transport} = 'iscsi';
+ }
+ my $used = $disk->{used};
+ if (defined($used)) {
+ if ($used eq 'LVM' || $used eq 'LVM2_member') {
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ } elsif ($row->{usage} ne 'lvm') {
+ $row->{usage} = 'other';
+ $row->{detail} = $used;
+ }
+ }
+ my $vg = $pv_vgs->{ abs_path($disk->{devpath}) // $disk->{devpath} };
+ if (defined($vg)) {
+ $row->{vgname} //= $vg;
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ }
+ my $paths = $map ? $status->{$wwid} : $nvme->{$name};
+ if ($paths) {
+ $row->{'path-list'} = $paths->{paths};
+ $row->{'paths-total'} = scalar($paths->{paths}->@*);
+ $row->{'paths-active'} = $paths->{active};
+ } elsif ($map) {
+ $row->{'paths-total'} = $disk->{paths};
+ }
+ $unmapped{$wwid}->{$name} = 1 if !$map && $name =~ /^sd[a-z]+$/;
+ $row->{'multipath-storage'} = $storage{$wwid} if defined($storage{$wwid});
+ # multipath entries and iSCSI portals are for maps, not for native NVMe multipath
+ $row->{'paths-expected'} = $expected{$wwid}
+ if defined($expected{$wwid}) && $row->{multipath} ne 'native';
+ };
+ for my $name (sort keys %$disks) {
+ my $disk = $disks->{$name};
+ next if $members->{$name};
+ $add->($disk);
+ }
+ $add->($maps->{$_}, 1) for sort keys %$maps;
+ # Without a map, the paths of a LUN are disks of their own, each in the state that the kernel
+ # keeps for it, which is 'running' while it takes I/O.
+ for my $wwid (sort keys %unmapped) {
+ my $row = $rows{$wwid};
+ next if defined($row->{'paths-total'});
+ my @paths = map { { device => "/dev/$_", state => device_state($_) // 'unknown' } }
+ sort keys $unmapped{$wwid}->%*;
+ $row->{'path-list'} = \@paths;
+ $row->{'paths-total'} = scalar(@paths);
+ $row->{'paths-active'} = scalar(grep { $_->{state} eq 'running' } @paths);
+ }
+ for my $row (values %rows) {
+ # the devices of a LUN whose requested map is missing do not tell the state of the LUN
+ if (defined($row->{'paths-active'}) && $row->{multipath} ne 'pending') {
+ $row->{state} = PVE::Multipath::derive_health(
+ $row->{'paths-active'},
+ $row->{'paths-total'},
+ $row->{'paths-expected'},
+ );
+ }
+ my ($target) =
+ map { $target_owner{$_} // () } sort keys(($targets{ $row->{wwid} } // {})->%*);
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target;
+ $row->{'used-by-storage'} = $owner if defined($owner);
+ }
+ return [map { $rows{$_} } sort keys %rows];
+}
+
+sub device_state($name) {
+ return file_read_firstline("/sys/block/$name/device/state");
+}
+
+sub stable_path($device, $wwid, $map = 0) {
+ my $prefix = $map ? 'dm-uuid-mpath' : basename($device) =~ /^nvme/ ? 'nvme' : 'scsi';
+ my ($link) = "/dev/disk/by-id/$prefix-$wwid" =~ m{\A(/dev/disk/by-id/[A-Za-z0-9_.:+-]+)\z};
+ return undef if !defined($link);
+ return $link if (abs_path($link) // '') eq (abs_path($device) // $device);
+ return undef;
+}
+
+sub is_san_device($device, $info = undef) {
+ if (!$info) {
+ my $path = abs_path($device) // $device;
+ my $map = PVE::Multipath::device_map($path);
+ # the partitions of a LUN are handled like local devices, also the ones that kpartx maps
+ return 0 if PVE::Diskmanage::is_partition($path) || ($map && $map->{partition});
+ my $name = basename($path);
+ my $transport;
+ if ($name =~ /^nvme/) {
+ $transport = 'nvme-' . (PVE::Diskmanage::get_nvme_transport("/sys/block/$name") // '');
+ } elsif ((readlink("/sys/block/$name") // '') =~ m{/rport-\d+}) {
+ $transport = 'fc';
+ }
+ $info = {
+ map => $map,
+ transport => $transport,
+ session => PVE::Diskmanage::is_iscsi_device($name),
+ };
+ }
+ return
+ $info->{map}
+ || $info->{session}
+ || PVE::Diskmanage::is_remote_transport($info->{transport}) ? 1 : 0;
+}
+
+1;
diff --git a/src/test/Makefile b/src/test/Makefile
index bfef56d6..2f6f4cd7 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -71,3 +71,9 @@ test_multipath_api: run_multipath_api_tests.pl
test_san_taint: run_san_taint_tests.pl
perl -T ./run_san_taint_tests.pl
+
+test_san_lun_scan: run_san_lun_scan_tests.pl
+ ./run_san_lun_scan_tests.pl
+
+test_san_api: run_san_api_tests.pl
+ ./run_san_api_tests.pl
diff --git a/src/test/disk_tests/multipath/multipathd b/src/test/disk_tests/multipath/multipathd
new file mode 100644
index 00000000..40243f91
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd
@@ -0,0 +1,124 @@
+{
+ "major_version": 0,
+ "minor_version": 1,
+ "maps": [{
+ "name" : "mpatha",
+ "uuid" : "3600140500000000000000000000000001",
+ "sysfs" : "dm-0",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 0,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sda",
+ "dev_t" : "8:0",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdb",
+ "dev_t" : "8:16",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ },
+ {
+ "name" : "mpathb",
+ "uuid" : "3600140500000000000000000000000002",
+ "sysfs" : "dm-1",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 3,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sdc",
+ "dev_t" : "8:32",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdd",
+ "dev_t" : "8:48",
+ "dm_st" : "failed",
+ "dev_st" : "running",
+ "chk_st" : "faulty",
+ "checker" : "tur",
+ "pri" : 0,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ }]
+}
diff --git a/src/test/disk_tests/multipath/multipathd_status_expected.json b/src/test/disk_tests/multipath/multipathd_status_expected.json
new file mode 100644
index 00000000..df5a24da
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd_status_expected.json
@@ -0,0 +1,40 @@
+{
+ "3600140500000000000000000000000001": {
+ "active": 2,
+ "paths": [
+ {
+ "device": "/dev/sda",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdb",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ },
+ "3600140500000000000000000000000002": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/sdc",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdd",
+ "state": "failed",
+ "checker-state": "faulty",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 305bab8e..f79c59d3 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -82,6 +82,8 @@ sub mocked_run_command {
$content = '{}';
}
@$outputlines = split(/\n/, $content);
+ } elsif ($cmd->[0] =~ m/multipathd/i) {
+ @$outputlines = split(/\n/, read_test_file('multipathd'));
} else {
die "unexpected run_command call: '@$cmd', aborting\n";
}
@@ -282,6 +284,16 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
+ my $status = PVE::Multipath::path_status_by_wwid();
+ my $expected_status =
+ decode_json(read_test_file('multipathd_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'multipath status should be the same');
+ }
+
if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
my $status = PVE::Diskmanage::get_nvme_path_status();
my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
@@ -366,8 +378,11 @@ print("\tMocked get_sysdir_size\n");
$diskmanage_module->mock('assert_blockdev' => sub { return 1; });
print("\tMocked assert_blockdev\n");
$multipath_module = Test::MockModule->new('PVE::Multipath', no_auto => 1);
+$multipath_module->mock('run_command' => \&mocked_run_command);
+$multipath_module->mock('is_supported' => sub { return 1; });
$multipath_module->mock('dir_glob_foreach' => \&mocked_dir_glob_foreach);
$multipath_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked PVE::Multipath run_command and is_supported\n");
$diskmanage_module->mock(
'dir_is_empty' => sub {
my $val = shift;
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
new file mode 100755
index 00000000..4bd7d2d7
--- /dev/null
+++ b/src/test/run_san_api_tests.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw(. ..);
+use PVE::API2::Storage::Scan;
+
+for my $case (['PVE::API2::Storage::Scan', 'sanlunscan']) {
+ my ($class, @names) = @$case;
+ for my $name (@names) {
+ is_deeply(
+ $class->map_method_by_name($name)->{permissions}->{check},
+ [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ "$class $name read permission",
+ );
+ }
+}
+
+done_testing();
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
new file mode 100755
index 00000000..586fcf44
--- /dev/null
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -0,0 +1,260 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(..);
+use Test::More;
+use Test::MockModule;
+
+use PVE::Storage::SAN;
+use PVE::API2::Storage::Scan;
+
+my $disk = Test::MockModule->new('PVE::Diskmanage');
+my $mp = Test::MockModule->new('PVE::Multipath');
+my $id = Test::MockModule->new('PVE::Multipath::Identity');
+my $config = Test::MockModule->new('PVE::Multipath::Config');
+my $storage = Test::MockModule->new('PVE::Storage');
+my $iscsi = Test::MockModule->new('PVE::ISCSI::Topology');
+my $scan = Test::MockModule->new('PVE::Storage::SAN');
+my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+my $hints;
+$lvm->mock(file_get_contents => sub { $hints // die "No such file\n" });
+$lvm->mock(abs_path => sub { $_[0] });
+$lvm->mock(run_command => sub { die "unexpected LVM device probe\n" });
+
+my $disks = {
+ sda => { devpath => '/dev/sda', size => 100, transport => 'sata' },
+ sdb => { devpath => '/dev/sdb', size => 200, transport => 'iscsi' },
+ sdc => { devpath => '/dev/sdc', size => 200, transport => 'iscsi', used => 'LVM2_member' },
+ sdd =>
+ { devpath => '/dev/sdd', size => 300, transport => 'fc', multipath => '/dev/mapper/lun' },
+ sde => { devpath => '/dev/sde', size => 400, transport => 'fc' },
+};
+my $maps = {
+ 'dm-0' => {
+ devpath => '/dev/mapper/lun',
+ size => 300,
+ wwn => '3600map',
+ paths => 2,
+ slaves => ['/dev/sdd', '/dev/sdf'],
+ transport => 'fc',
+ },
+};
+$id->mock(collect => sub { {} });
+$id->mock(path_wwid => sub { $_[1] =~ /^(sdb|sdc)$/ ? '3600plain' : undef });
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+my $generator = Test::MockModule->new('PVE::Multipath::Generator');
+$generator->mock(derived_wwids => sub { {} });
+$iscsi->mock(
+ device_map => sub {
+ return { map { $_ => { target => 'iqn.test', lun => 1 } } qw(sdb sdc) };
+ },
+);
+my @listed;
+$scan->redefine(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $code) = @_;
+ return PVE::Tools::dir_glob_foreach($dir, $regex, $code) if $dir ne '/sys/block';
+ $code->($_) for grep { /^$regex$/ } qw(sda sdb sdc sdd sde sdf dm-0 loop0 nvme0n1);
+ },
+);
+$disk->mock(
+ get_disks => sub {
+ ok($_[3], 'SAN inventory opts into iSCSI');
+ @listed = sort $_[0]->@*;
+ return $disks;
+ },
+ get_multipath_disks => sub { $maps },
+ get_nvme_path_status => sub { {} },
+ run_command => sub { die 'unexpected device probe' },
+);
+$mp->mock(list_etc_multipath_wwids => sub { [] });
+$mp->mock(
+ map_info => sub {
+ return {
+ map {
+ $_ => {
+ wwid => $maps->{$_}->{wwn},
+ slaves => [map { s{^/dev/}{}r } $maps->{$_}->{slaves}->@*],
+ }
+ } keys %$maps
+ };
+ },
+);
+$mp->mock(
+ path_status_by_wwid => sub {
+ return {
+ '3600map' => {
+ active => 1,
+ paths => [
+ { device => '/dev/sdd', state => 'active', 'checker-state' => 'ghost' },
+ { device => '/dev/sdf', state => 'failed', 'checker-state' => 'faulty' },
+ ],
+ },
+ };
+ },
+);
+$scan->mock(abs_path => sub { $_[0] });
+$scan->mock(stable_path => sub { '/dev/disk/by-id/scsi-' . $_[1] });
+my %device_state;
+$scan->mock(
+ device_state => sub { exists($device_state{ $_[0] }) ? $device_state{ $_[0] } : 'running' },
+);
+my $cfg =
+ { ids => { direct => { type => 'iscsi', target => 'iqn.test', content => { images => 1 } } } };
+my $rows = PVE::Storage::SAN::scan_luns($cfg);
+is(scalar(@$rows), 2, 'only identified SAN LUNs, one row per identity');
+is_deeply(
+ \@listed,
+ [qw(nvme0n1 sda sdb sdc sde)],
+ 'the paths of a map are left out of the disk list',
+);
+my %row = map { $_->{wwid} => $_ } @$rows;
+is($row{'3600plain'}->{usage}, 'lvm', 'positive usage from any path survives folding');
+is($row{'3600plain'}->{'used-by-storage'}, 'direct', 'a storage serving the LUNs uses them');
+{
+ local $cfg->{ids}->{direct}->{content} = { none => 1 };
+ my %plain = map { $_->{wwid} => $_ } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($plain{'3600plain'}->{'used-by-storage'}, undef, 'a connection storage does not');
+}
+is_deeply(
+ $row{'3600plain'}->{'path-list'},
+ [map { { device => $_, state => 'running' } } qw(/dev/sdb /dev/sdc)],
+ 'without a map, the devices of a LUN are its paths',
+);
+is($row{'3600plain'}->{state}, 'optimal', 'their kernel state gives the health of the LUN');
+{
+ local $device_state{sdc} = 'transport-offline';
+ my ($down) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($down->{'paths-active'}, 1, 'only a running device takes I/O');
+ is($down->{state}, 'degraded', 'a LUN with a device down is degraded');
+ $device_state{sdc} = undef;
+ ($down) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($down->{'path-list'}->[1]->{state}, 'unknown', 'a device without a state');
+ is($down->{'paths-active'}, 1, 'does not count as running');
+}
+{
+ # a LUN whose requested map is missing
+ $mp->mock(list_etc_multipath_wwids => sub { ['3600plain'] });
+ my ($pending) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($pending->{multipath}, 'pending', 'waits for its map');
+ is(scalar($pending->{'path-list'}->@*), 2, 'lists its devices');
+ ok(!exists($pending->{state}), 'but has no state from them');
+ $mp->mock(list_etc_multipath_wwids => sub { [] });
+}
+{
+ # a LUN with a single path and no map
+ $id->mock(path_wwid => sub { $_[1] eq 'sdb' ? '3600plain' : undef });
+ my ($single) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($single->{'paths-total'}, 1, 'one device, one path');
+ is($single->{state}, 'optimal', 'which the web UI shows as OK with one path');
+ local $device_state{sdb} = 'blocked';
+ ($single) = grep { $_->{wwid} eq '3600plain' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($single->{state}, 'failed', 'a blocked device takes no I/O');
+ $id->mock(path_wwid => sub { $_[1] =~ /^(sdb|sdc)$/ ? '3600plain' : undef });
+}
+is($row{'3600map'}->{state}, 'degraded', 'final state counts usable paths');
+is($row{'3600map'}->{multipath}, 'manual', 'explicit map');
+is($row{'3600map'}->{devpath}, '/dev/mapper/lun', 'map is the selected device');
+my $schema = PVE::API2::Storage::Scan->map_method_by_name('sanlunscan')->{returns};
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'rows match the public schema');
+is($row{'3600map'}->{name}, 'lun', 'map alias is exposed');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/3600map';
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unnamed) = grep { $_->{wwid} eq '3600map' } @$rows;
+ok(!exists($unnamed->{name}), 'WWID is not repeated as an alias');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/lun';
+
+{
+ my $healthy = {
+ '3600map' => {
+ active => 2,
+ paths => [map { { device => $_, state => 'active' } } qw(/dev/sdd /dev/sdf)],
+ },
+ };
+ $mp->mock(path_status_by_wwid => sub { $healthy });
+ my ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{state}, 'optimal', 'all paths usable without an expected count');
+ $config->mock(
+ read_config =>
+ sub { { ids => { '3600map' => { type => 'wwid', 'paths-expected' => 3 } } } },
+ );
+ ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{'paths-expected'}, 3, 'expected count of the entry');
+ is($map->{state}, 'degraded', 'fewer paths than the entry expects');
+ $config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+}
+
+$mp->mock(path_status_by_wwid => sub { {} });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unobserved) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($unobserved->{'paths-total'}, 2, 'map membership supplies total without daemon status');
+ok(!exists($unobserved->{'paths-active'}), 'no invented active count');
+ok(!exists($unobserved->{state}), 'no false failed state');
+
+$cfg->{ids}->{data} = { type => 'lvm', vgname => 'data' };
+$hints = "hints_version: 2.1\nscan:/dev/mapper/lun pvid:abc devn:253:0 vg:data\n";
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($cached) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($cached->{vgname}, 'data', 'hints supply the display VG');
+is($cached->{usage}, 'lvm', 'hints also supply cached usage evidence');
+is($cached->{'used-by-storage'}, 'data', 'VG allows storage attribution');
+for my $contents (undef, '', "scan=/dev/mapper/lun vg=data\n") {
+ $hints = $contents;
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is(scalar(@$rows), 2, 'missing or unrecognized hints do not lose LUNs');
+ my ($uncached) = grep { $_->{wwid} eq '3600map' } @$rows;
+ ok(!exists($uncached->{vgname}), 'VG name is absent without a hint');
+ ok(!exists($uncached->{'used-by-storage'}), 'VG-derived attribution is also absent');
+ is($uncached->{usage}, 'unused', 'usage falls back to other cached evidence');
+}
+{
+ # a base volume by the name that an iSCSI storage gives it without multipath
+ local $cfg->{ids}->{legacy} =
+ { type => 'lvm', vgname => 'legacy', base => 'direct:0.0.1.scsi-3600map' };
+ my ($based) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($based->{'used-by-storage'}, 'legacy', 'the storage of a SCSI base volume, without hints');
+}
+
+$disks->{sdc}->{used} = 'ext4';
+$maps = {};
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{usage}, 'other', 'foreign data from a sibling path is retained');
+is($rows->[0]->{detail}, 'ext4', 'signature detail');
+$scan->mock(stable_path => sub { $_[0] eq '/dev/sdc' ? '/dev/disk/by-id/scsi-3600plain' : undef });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/scsi-3600plain', 'by-id link of the second path');
+is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id link resolves to');
+
+$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
+$scan->mock(file_read_firstline => sub { $_[0] =~ m{/nsid$} ? 1 : 'eui.0123456789abcdef' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
+$scan->unmock('stable_path');
+$scan->mock(abs_path => sub { '/dev/nvme0n1' });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'none', 'NVMe without native multipath paths');
+$disk->mock(
+ get_nvme_path_status => sub {
+ { nvme0n1 =>
+ { active => 1, paths => [{ device => '/dev/nvme0c0n1', state => 'live' }] } };
+ },
+);
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'native', 'NVMe uses kernel-native multipath');
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/nvme-eui.0123456789abcdef', 'NVMe stable name');
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'native row matches the API schema');
+is($rows->[0]->{'nvme-subsystem'}, 'nqn.test', 'subsystem NQN exposed');
+is($rows->[0]->{'nvme-nsid'}, 1, 'namespace ID exposed');
+
+$disk->mock(is_partition => sub { 1 });
+ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
+$disk->mock(is_partition => sub { 0 });
+my $mp_module = Test::MockModule->new('PVE::Multipath');
+$mp_module->redefine(device_map => sub { { wwid => '3600a', partition => 1 } });
+ok(!PVE::Storage::SAN::is_san_device('/dev/dm-5'), 'neither is one that kpartx maps');
+$mp_module->redefine(device_map => sub { { wwid => '3600a' } });
+ok(PVE::Storage::SAN::is_san_device('/dev/dm-4'), 'while the map itself is');
+
+done_testing();
^ permalink raw reply related [relevance 9%]
* [PATCH v7 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel
2026-11-18 20:25 6% [PATCH v7 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-18 20:26 9% ` [PATCH v7 storage 18/43] api: scan: add a SAN LUN inventory Thomas Lamprecht
@ 2026-11-18 20:26 10% ` Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:26 UTC (permalink / raw)
To: pve-devel
Fibre Channel LUNs show up as block devices on the nodes, without a
storage that connects to them, so Datacenter > Storage > Add has no
dialog to start from. Add a Fibre Channel entry to the guided setup of
the SAN view. The entry offers SCSI LUNs only. An NVMe/FC namespace uses
the native multipath of the kernel and has no storage that connects it,
so the cluster-wide status could not show its state on the nodes.
The setup enables multipath for the LUN if needed, so its menu entry
needs Sys.Modify as well. Then the setup creates the volume group on the
name of the map under /dev/disk/by-id, through the node serving the web
UI, and adds the shared LVM storage itself. The node disk API would add
the storage for all nodes and without the snapshot setting. Before it
changes anything, the setup checks that the storage ID is free, as it
cannot create the volume group a second time.
As the setup adds the storage, it waits for the volume group task on its
own, not in a task window. Closing a task window would end the setup
with a volume group and no storage. For the same reason, the setup
cannot be closed until the wait is over. If the task state cannot be
read for a while, the setup ends and says how to add the storage by
hand, as the task may still succeed and must not be started again.
No storage knows how many paths a node should have to a Fibre Channel
LUN. So a multipath entry that the setup adds expects as many paths as
the map has on the node serving the web UI. A node zoned to fewer
fabrics, or one that lost a path, then shows the LUN as degraded.
Nodes do not scan for a LUN that gets mapped to them after their login
to the array, so the setup points to the rescan of the Fibre Channel
hosts.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/dc/SAN.js | 5 +-
www/manager6/storage/wizard/FibreChannel.js | 187 ++++++++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 20 +++
www/manager6/storage/wizard/Wizard.js | 131 +++++++++++++-
www/manager6/window/SANLunState.js | 10 +-
6 files changed, 341 insertions(+), 13 deletions(-)
create mode 100644 www/manager6/storage/wizard/FibreChannel.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 09a02a9c4..1644e1d41 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -390,6 +390,7 @@ JSSRC= \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
storage/wizard/IScsi.js \
+ storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index 72cb96291..e9a5e5ccc 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -111,9 +111,10 @@ Ext.define('PVE.dc.SANView', {
autoShow: true,
apiCallDone: (success) => success && reload(),
});
- let setupItem = (wizardType) => ({
+ let setupItem = (wizardType, disabled) => ({
text: PVE.storage.wizard.subject(wizardType),
iconCls: 'fa fa-fw fa-building',
+ disabled,
handler: () =>
Ext.create('PVE.storage.wizard.SAN', {
wizardType,
@@ -125,7 +126,7 @@ Ext.define('PVE.dc.SANView', {
{
text: gettext('Guided Setup'),
disabled: !canSetup,
- menu: [setupItem('iscsi')],
+ menu: [setupItem('iscsi'), setupItem('fc', !canModify)],
},
];
me.items = [
diff --git a/www/manager6/storage/wizard/FibreChannel.js b/www/manager6/storage/wizard/FibreChannel.js
new file mode 100644
index 000000000..c3b688337
--- /dev/null
+++ b/www/manager6/storage/wizard/FibreChannel.js
@@ -0,0 +1,187 @@
+PVE.storage.wizard.createFC = function (wizard, values, lun) {
+ let fail = (response) => wizard.showError(response.htmlStatus);
+ let create = function (row) {
+ if (wizard.destroyed) {
+ return;
+ }
+ // the request starts the task that waitForTask() then waits for, so keep the setup open
+ let keepOpen = () => false;
+ wizard.on('beforeclose', keepOpen);
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${Proxmox.NodeName}/disks/lvm`,
+ method: 'POST',
+ params: { name: values.vgname, device: row['by-id'] },
+ waitMsgTarget: wizard,
+ callback: () => wizard.un('beforeclose', keepOpen),
+ failure: fail,
+ success: function (response) {
+ if (wizard.destroyed) {
+ return;
+ }
+ let recovery = (text) =>
+ Ext.htmlEncode(Ext.String.format(text, values.vgname, values.storage));
+ let addStorage = () =>
+ wizard.addLVMStorage(values, (res) =>
+ wizard.stopWithError(
+ res.htmlStatus +
+ '<br>' +
+ recovery(
+ gettext(
+ 'Volume group "{0}" was created, but adding storage "{1}" failed. Add it under Datacenter > Storage > Add > LVM with Shared enabled and the same nodes and snapshot setting as in the setup.',
+ ),
+ ),
+ ),
+ );
+ let lost = (status) =>
+ wizard.stopWithError(
+ status +
+ '<br>' +
+ recovery(
+ gettext(
+ 'Could not read the task status. The volume group creation task may still be running. Check its log under Node > Task History. If it succeeds, add volume group "{0}" as storage "{1}" under Datacenter > Storage > Add > LVM with Shared enabled and the same nodes and snapshot setting as in the setup.',
+ ),
+ ),
+ );
+ let message = gettext('Creating the volume group...');
+ wizard.waitForTask(response.result.data, message, addStorage, lost);
+ },
+ });
+ };
+ let hasMultipath = (row) => ['manual', 'storage', 'unmanaged'].includes(row.multipath);
+ // the volume group is created on the by-id path of the map, which names the WWID
+ let ready = (row) => hasMultipath(row) && !!row['by-id'];
+ // Fibre Channel has no storage that knows how many paths a node should have, so an entry the
+ // setup adds expects the paths of this node. A node with fewer paths then shows as degraded.
+ // The wizard remembers the entry it added, so that a retry still sets the expected paths before
+ // it creates the volume group.
+ let expectPaths = function (row) {
+ if (!(row['paths-total'] >= 2)) {
+ delete wizard.addedEntry;
+ create(row);
+ return;
+ }
+ Proxmox.Utils.API2Request({
+ url: `/cluster/multipath/wwid/${encodeURIComponent(lun.wwid)}`,
+ method: 'PUT',
+ params: { 'paths-expected': row['paths-total'] },
+ waitMsgTarget: wizard,
+ failure: fail,
+ success: () => {
+ delete wizard.addedEntry;
+ create(row);
+ },
+ });
+ };
+ let waitForMap = function () {
+ if (wizard.destroyed) {
+ return;
+ }
+ let store = Ext.create('Proxmox.data.UpdateStore', {
+ storeid: 'san-wizard-map',
+ model: 'pve-san-lun',
+ interval: 3000,
+ proxy: { type: 'proxmox', url: `/api2/json/nodes/${Proxmox.NodeName}/scan/san-luns` },
+ });
+ let timer = Ext.defer(function () {
+ store.destroy();
+ if (!wizard.destroyed) {
+ wizard.setLoading(false);
+ wizard.showError(
+ gettext(
+ 'The multipath map or its name under /dev/disk/by-id did not appear within 90 seconds. Check Node > SAN, then reload the LUN list.',
+ ),
+ );
+ }
+ }, 90000);
+ wizard.on(
+ 'destroy',
+ () => {
+ clearTimeout(timer);
+ if (!store.destroyed) {
+ store.destroy();
+ }
+ },
+ null,
+ { single: true },
+ );
+ wizard.setLoading(gettext('Waiting for the multipath map...'));
+ store.on('load', function (s, records, success, operation) {
+ if (wizard.destroyed) {
+ return;
+ }
+ let row = records?.find((rec) => rec.get('wwid') === lun.wwid)?.data;
+ if (!success || (row && ready(row))) {
+ clearTimeout(timer);
+ store.destroy();
+ wizard.setLoading(false);
+ if (success) {
+ wizard.down('#luns').down('grid').getSelection()[0].set(row);
+ if (wizard.addedEntry === lun.wwid) {
+ expectPaths(row);
+ } else {
+ create(row);
+ }
+ } else {
+ wizard.showError(Proxmox.Utils.getResponseErrorMessage(operation.getError()));
+ }
+ }
+ });
+ store.startUpdate();
+ };
+ let setup = function () {
+ if (ready(lun)) {
+ if (wizard.addedEntry === lun.wwid) {
+ expectPaths(lun);
+ } else {
+ create(lun);
+ }
+ } else if (
+ hasMultipath(lun) ||
+ lun.multipath === 'pending' ||
+ wizard.addedEntry === lun.wwid
+ ) {
+ waitForMap();
+ } else {
+ let params = { wwid: lun.wwid };
+ if (values.nodes) {
+ params.nodes = values.nodes;
+ }
+ Proxmox.Utils.API2Request({
+ url: '/cluster/multipath/wwid',
+ method: 'POST',
+ params,
+ waitMsgTarget: wizard,
+ failure: fail,
+ success: () => {
+ wizard.addedEntry = lun.wwid;
+ waitForMap();
+ },
+ });
+ }
+ };
+ // The storage is added last. Its ID has to be free before anything is created: once the volume
+ // group exists, the setup cannot create it again.
+ Proxmox.Utils.API2Request({
+ url: '/storage',
+ method: 'GET',
+ waitMsgTarget: wizard,
+ failure: fail,
+ success: function (response) {
+ if (wizard.destroyed) {
+ return;
+ }
+ if (response.result.data.some((entry) => entry.storage === values.storage)) {
+ wizard.showError(
+ Ext.htmlEncode(
+ Ext.String.format(
+ gettext('Storage ID "{0}" is already in use. Choose another ID.'),
+ values.storage,
+ ),
+ ),
+ );
+ return;
+ }
+ setup();
+ },
+ });
+};
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index e42779927..985131c00 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -23,6 +23,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let grid = me.down('grid');
me.rstore.stopUpdate();
let connection = wizard.connection;
+ if (!connection) {
+ me.rstore.startUpdate();
+ return;
+ }
// The scan names one target per LUN, also for a LUN reached through several. The content
// listing has the LUNs of the connection, and a LUN that shows up later is listed once the
// scan names the target of the connection for it.
@@ -88,6 +92,15 @@ Ext.define('PVE.storage.wizard.LunSelect', {
'A LUN that is in use cannot be selected. A LUN with data that is no longer needed has to be wiped under Node > SAN first.',
),
},
+ ...(me.rescanNote
+ ? [
+ {
+ xtype: 'component',
+ margin: '0 0 10 0',
+ html: `<span class="pmx-hint">${Ext.htmlEncode(gettext('Note:'))}</span> ${me.rescanNote}`,
+ },
+ ]
+ : []),
{
xtype: 'grid',
flex: 1,
@@ -189,6 +202,13 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let search = me.down('pveRecordSearchField');
me.on('activate', function () {
search.setTargetStore(me.store);
+ if (me.up('window').wizardType === 'fc') {
+ me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ me.store.addFilter({
+ id: 'transport',
+ filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')),
+ });
+ }
me.reload();
});
// The setup can update the selected row after this step, which the search must not hide.
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index 3b4d4b8eb..bfcc5a6cb 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -1,7 +1,10 @@
Ext.ns('PVE.storage.wizard');
PVE.storage.wizard.subject = (type) =>
- Ext.String.format(gettext('LVM on {0}'), PVE.Utils.format_storage_type(type));
+ Ext.String.format(
+ gettext('LVM on {0}'),
+ type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
+ );
PVE.storage.wizard.validateNodes = function () {
let nodes = [].concat(this.getValue() || []).filter(Boolean);
@@ -20,6 +23,11 @@ Ext.define('PVE.storage.wizard.SAN', {
width: 1050,
height: 620,
+ stopWithError: function (message) {
+ this.close();
+ Ext.Msg.alert(gettext('Error'), message);
+ },
+
showError: function (message) {
if (this.destroyed) {
return;
@@ -28,6 +36,65 @@ Ext.define('PVE.storage.wizard.SAN', {
Ext.Msg.alert(gettext('Error'), message);
},
+ // Waits for a task with the setup masked and continues with next() once it succeeded. A task
+ // window of its own could be closed while the task runs, which would end the setup there. The
+ // setup cannot be closed during the wait either, for example with the Escape key.
+ // If the state of the task cannot be read for some time, lost() gets the error: the task may
+ // still be running then, so the setup must not start it again.
+ waitForTask: function (upid, message, next, lost) {
+ let me = this;
+ let task = Proxmox.Utils.parse_task_upid(upid);
+ let failures = 0;
+ let keepOpen = () => false;
+ let done = function (error) {
+ if (me.destroyed) {
+ return;
+ }
+ me.un('beforeclose', keepOpen);
+ me.setLoading(false);
+ if (error === undefined) {
+ next();
+ } else {
+ me.showError(error);
+ }
+ };
+ let poll = function () {
+ if (me.destroyed) {
+ return;
+ }
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${task.node}/tasks/${encodeURIComponent(upid)}/status`,
+ method: 'GET',
+ failure: function (response) {
+ if (me.destroyed) {
+ return;
+ }
+ if (++failures < 5) {
+ Ext.defer(poll, 2000);
+ return;
+ }
+ me.un('beforeclose', keepOpen);
+ me.setLoading(false);
+ lost(response.htmlStatus);
+ },
+ success: function (response) {
+ failures = 0;
+ let { status, exitstatus } = response.result.data;
+ if (status !== 'stopped') {
+ Ext.defer(poll, 1000);
+ return;
+ }
+ let result = Proxmox.Utils.parse_task_status(exitstatus);
+ let failed = result === 'error' || result === 'unknown';
+ done(failed ? Ext.htmlEncode(exitstatus) : undefined);
+ },
+ });
+ };
+ me.on('beforeclose', keepOpen);
+ me.setLoading(message);
+ poll();
+ },
+
volumeSettings: function () {
let me = this;
let value = (name) => me.down(`field[name=${name}]`).getValue();
@@ -35,7 +102,13 @@ Ext.define('PVE.storage.wizard.SAN', {
storage: value('storage'),
vgname: value('vgname'),
'snapshot-as-volume-chain': value('snapshot-as-volume-chain') ? 1 : 0,
- nodes: me.connection.nodes,
+ nodes:
+ me.wizardType === 'fc'
+ ? []
+ .concat(value('nodes') || [])
+ .filter(Boolean)
+ .join(',')
+ : me.connection.nodes,
};
},
@@ -64,6 +137,7 @@ Ext.define('PVE.storage.wizard.SAN', {
wwid,
storage: values.storage,
nodes: params.nodes,
+ fc: me.wizardType === 'fc',
autoShow: true,
});
},
@@ -71,11 +145,18 @@ Ext.define('PVE.storage.wizard.SAN', {
},
multipathSummary: function (lun) {
+ let me = this;
// an explicit entry takes precedence, also for a LUN of the connection storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
}
- return PVE.SANUtils.multipathText('storage', this.connection.storage);
+ if (me.connection) {
+ return PVE.SANUtils.multipathText('storage', me.connection.storage);
+ }
+ // the Fibre Channel setup adds an entry for a LUN without multipath
+ return lun.multipath === 'none'
+ ? gettext('Explicit entry, added by this setup')
+ : PVE.SANUtils.multipathText(lun.multipath, lun['multipath-storage']);
},
updateSummary: function () {
@@ -83,7 +164,6 @@ Ext.define('PVE.storage.wizard.SAN', {
let values = me.volumeSettings();
let lun = me.down('#luns').getSelection();
let rows = [
- [gettext('Connection Storage'), me.connection.storage],
[gettext('Storage ID'), values.storage],
[gettext('Volume Group'), values.vgname],
['WWID', lun.wwid],
@@ -95,6 +175,9 @@ Ext.define('PVE.storage.wizard.SAN', {
Proxmox.Utils.format_boolean(values['snapshot-as-volume-chain']),
],
];
+ if (me.connection) {
+ rows.unshift([gettext('Connection Storage'), me.connection.storage]);
+ }
me.down('#summary')
.getStore()
.setData(rows.map(([key, value]) => ({ key, value })));
@@ -105,11 +188,19 @@ Ext.define('PVE.storage.wizard.SAN', {
let values = me.volumeSettings();
let lun = me.down('#luns').getSelection();
me.down('#submit').disable();
- PVE.storage.wizard.createIScsiLVM(me, values, lun);
+ if (me.wizardType === 'fc') {
+ PVE.storage.wizard.createFC(me, values, lun);
+ } else {
+ PVE.storage.wizard.createIScsiLVM(me, values, lun);
+ }
},
initComponent: function () {
let me = this;
+ if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ throw 'no SAN storage type specified';
+ }
+ let iscsi = me.wizardType === 'iscsi';
me.subject = PVE.storage.wizard.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
let common = PVE.panel.StorageBase.commonFields(true);
@@ -129,13 +220,35 @@ Ext.define('PVE.storage.wizard.SAN', {
PVE.panel.StorageBase.volumeChainField(true, 'lvm'),
],
};
+ if (!iscsi) {
+ settings.advancedItems = [
+ { ...common.nodes, validator: PVE.storage.wizard.validateNodes },
+ ];
+ }
me.items = [
- { xtype: 'pveStorageWizardIScsiTarget', title: gettext('Target'), itemId: 'target' },
+ ...(iscsi
+ ? [
+ {
+ xtype: 'pveStorageWizardIScsiTarget',
+ title: gettext('Target'),
+ itemId: 'target',
+ },
+ ]
+ : []),
{
xtype: 'pveStorageWizardLunSelect',
title: 'LUN',
itemId: 'luns',
onlineHelp: 'storage_multipath',
+ // the nodes only see a newly mapped Fibre Channel LUN after a rescan
+ rescanNote: iscsi
+ ? undefined
+ : Ext.String.format(
+ gettext(
+ 'After mapping a new LUN on the array, rescan the Fibre Channel hosts of each node (<a href="{0}" target="_blank" rel="noopener noreferrer">documentation</a>).',
+ ),
+ Ext.htmlEncode(Proxmox.Utils.get_help_link('storage_multipath')),
+ ),
},
settings,
{
@@ -170,14 +283,16 @@ Ext.define('PVE.storage.wizard.SAN', {
me.callParent();
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (tab === me.down('#luns')) {
+ if (iscsi && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- me.down('#submit').setText(gettext('Next'));
+ if (iscsi) {
+ me.down('#submit').setText(gettext('Next'));
+ }
me.on('destroy', () => me.reloadCallback?.());
},
});
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index 6d5221329..6215f8e57 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -55,9 +55,13 @@ Ext.define('PVE.window.SANLunState', {
margin: '0 0 10 0',
html: Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
- ),
+ me.fc
+ ? gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.',
+ )
+ : gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
+ ),
me.storage,
),
),
^ permalink raw reply related [relevance 10%]
* [PATCH v7 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM
@ 2026-11-18 20:25 6% Thomas Lamprecht
2026-11-18 20:25 13% ` [PATCH v7 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
` (3 more replies)
0 siblings, 4 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:25 UTC (permalink / raw)
To: pve-devel
This is v7 of the combined and reduced series of the cluster-wide
multipath work [0][1] and Dietmar's RFC for guided remote storage setup
and SAN visibility [2].
v7 is v6 [8] plus what some independent reviews and further lab testing
of v6 turned up, i.e.:
- The checks before a wipe or volume group creation take the members
of a map from the kernel too, not only those whose WWID multipathd
or udev reports, so a guest on such a path or its target is found.
The LUN list names a guest that writes to a partition of a LUN, which
the wipe refused but the list showed as unused.
- The web UI no longer falls back to a device name like /dev/sdX for a
wipe or for the Fibre Channel volume group: a name that passed to
another LUN in between would lead there. A LUN without a name under
/dev/disk/by-id cannot be wiped from the list, which the node refused
anyway, and the Fibre Channel setup waits for that name of the map.
- A drop-in is only replaced if its first line is the generated one,
v6 also took "# Not managed by Proxmox VE", and a node checks all
drop-ins before it changes one. The overrides refuse text after a
'{' and a '}' that is not alone on its line: multipath ignores the
rest of such a line, and with it the sections after it.
- A LUN that a storage requests, but that no node has assembled, shows
as Missing in the SAN view instead of not at all. An LVM base named
after the scsi- link of a LUN is attributed to its storage.
- pvestatd applies the multipath configuration right before the
storage status, so the node and guest status do not wait for it.
- The iSCSI setup offers the LUNs that the connection storage lists,
also one that the scan attributes to another target of the array,
finds a LUN by name, WWID or path, and says which storage blocks the
reuse of a target and why. The initiator names and the window at the
end follow the nodes of the new storage. The Fibre Channel recovery
texts name the volume group and storage ID.
- Enable Multipath under Node > SAN is offered for Fibre Channel LUNs
only, not for an NVMe namespace without native multipath.
- The LUN list names a guest only to users who may see it.
- Smaller ones: the status summary is described as the worst known
state, Expected Paths as the highest of the entry and the portal
counts, the Node > Disks > LVM dialog says that Add Storage on a SAN
LUN creates a shared storage for all nodes, error messages name what
to use instead, and the chapter says what a reader of a LUN and a
kernel partition of it mean for the checks.
What I left as is: findings that repeat points decided for v5 [3],
except the first-target filter of the iSCSI setup, which the content
listing now makes cheap to fix, and master's behavior, such as a kernel
partition of a LUN that is selected on its own, which the chapter now
mentions. wipefs on the claimed device does not re-read the partition
table, but udev does once the wipe closes the device, as the lab showed.
Overview of what an admin gets with this:
- Datacenter > Storage > SAN, a new entry below Storage, shows the
multipath state of every node and of the LUNs that Proxmox VE
manages or has a storage on, and edits the multipath entries and
array-specific overrides. I explicitly chose this over the
client/plugin side of Storage, as we do not have e.g. Ceph or
ZFS/LVM/... creation in there either. We might want to rethink and
consolidate our storage interface vs. management story in the
future, but IMO a partial switch now is not worth it, that would add
even more potential for confusion than the new SAN view.
- Its Guided Setup menu leads through shared LVM on a LUN: for iSCSI it
connects or reuses a target, with the initiator names of its nodes at
hand, for Fibre Channel it takes a LUN the nodes already see. Both
set up multipath and end with the state of the LUN on every node.
- Datacenter > Storage > Add keeps its dialogs. The iSCSI one gets a
Multipath option and the LVM one enables Shared for a base storage,
and both point to the SAN view.
- Node > SAN lists the LUNs of a node with their paths and usage, can
wipe a LUN that no storage uses, and shows the iSCSI sessions.
The rules the series follows since v4: nodes add WWIDs and maps but
never remove them, a write is checked where it happens, lists do not
probe devices, there are no new iSCSI operations, the guided setup makes
the API calls an admin would make by hand, and multipath management is
turned on by the admin. The v4 cover [7] has the reasons.
Two things an admin will likely miss: there is no notification when a
LUN loses path redundancy, the state only shows on the SAN pages and in
the API. And Fibre Channel starts at a LUN the nodes already see; the
chapter gives the commands to list WWPNs and rescan the HBAs.
How it works:
- /etc/pve/multipath.cfg holds explicit entries per WWID,
/etc/pve/multipath-overrides.conf array settings; patch 01
registers both. An iSCSI storage with the 'managed-multipath' option
supplies its LUNs without entries. The option is not named
'multipath', as third-party plugins use that name, and the storage
layer leaves out a third-party plugin that declares a property of
another plugin.
- pvestatd calls one function of pve-storage per pass. It adds the
WWIDs the node needs to /etc/multipath/wwids, writes the drop-ins
/etc/multipath/conf.d/pve-*.conf, reloads multipathd after a change,
and publishes the state of the maps that Proxmox VE manages or that a
storage builds on through the node key-value store.
- /cluster/multipath/status aggregates these reports;
/cluster/multipath/{wwid,overrides} edit the two files;
/nodes/{node}/scan/san-luns lists the LUNs of a node and
/nodes/{node}/iscsi its sessions.
- The volumes of an iSCSI storage with the option are named after the
multipath map, so an LVM storage uses them through 'base' as before.
- Volume group creation and wipe run under a cluster lock per LUN. They
refuse a LUN that a storage uses or a process of the node has open,
also through another path. Opens through another device node, such as
one of a container, and users on other hosts are not seen.
Patches:
- cluster 01: register the two configuration files
- storage 02-26: helpers for the disk and iSCSI session inventory
(mostly Dietmar's), the multipath library and configuration, the
iSCSI option, the per-node apply and status with their API, the disk
list of many disks, the LUN inventory, the read-only iSCSI status and
the portal of an iSCSI path, volume groups on LUNs, the wipe and the
process that has a LUN open
- docs 27-28: the multipath chapter, rewritten around tasks, and the
paragraph for a LUN that a process has open
- manager 29-43: the pvestatd call, report and API mounts, then the
views, the two dialog changes, the two guided setups, the note in the
add dialogs, and the guest or process and the target of a LUN
Other changes since v6 [8]:
- rebased onto current master; for pve-manager and pve-docs that has a
commit each that ends the technology preview status of snapshots as
volume chains, as they are ready for production use. The guided
setup and the chapter no longer call them a technology preview
either
- the node list of Datacenter > Storage > SAN links each node to its
Node > SAN view, like the content of a storage links a volume to its
guest
- Blockbridge tested v6 with their storage plugin, which runs its own
sessions, thanks! From that: Node > SAN shows a LUN without a
multipath map with its devices as paths, in the state that the kernel
reports for each, so a LUN with a single path also shows whether it
is up. Its Multipath column says Single path for one device, and an
iSCSI path names the portal of its session. The target column also
shows the subsystem of an NVMe namespace, and the LUN lists sort by
the names and uses they show
- the Wipe button under Node > SAN sits apart from the other buttons,
and its dialog also asks to confirm that no other host uses the LUN,
as the checks before the wipe only see such a use through a storage
- the subject of patch 3 spells NVMe over Fabrics like the rest
When applying, versioned dependencies have to be set: pve-manager on
libpve-storage-perl, and libpve-storage-perl (also as build dependency)
on the libpve-cluster-perl with patch 01, as PVE::Storage
registers the two files when it is loaded. pve-cluster with the same
patch keeps the version counters of the two files; with an older pmxcfs
they are read and parsed again on every request. pve-manager also needs
the pve-doc-generator (build) and pve-docs with the multipath chapter,
for its help links. If the bound for LVM status commands [4] gets
applied too, whichever is applied second has to pass the status cache to
the two lvm_vgs() calls of the base volume activation, as they can block
a status pass otherwise. Both mark the cache of the status update with
'status_only', in the same line.
The per-node target and portal series [5][6] are independent of this
one. It takes the LUNs of an iSCSI storage from the sessions of its one
target, so if a storage can have several targets per node, whichever is
applied second has to cover that.
I tested v7 on the lab of v4 [7] to v6, upgraded from the v6 build,
with the NVMe over Fabrics series and [4] on top. The checks of the
fixes ran there: a drop-in with a near-match first line stayed and the
node reported the conflict without touching another file, overrides
on one line were refused, a guest with a partition of an NVMe/TCP
namespace as disk showed in the LUN list and kept the wipe from running,
a storage administrator without VM.Audit got the process but not the
guest, and the button states under Node > SAN were as described. The
iSCSI setup ran on the NetApp with a search, two of six nodes and the
reuse of the connection storage, the target conflict with two storages,
and the Fibre Channel setup with a new entry, once to the end and once
with the task status lost. The link of a node in the SAN view and the
storage dialogs and setup without the technology preview hint I checked
on the final build. A node logged in to an iSCSI target without a map,
as a plugin with its own sessions does, showed OK (1 path) and Single
path, then Failed with the path blocked when its portal was cut, and
with a second portal Optimal and Degraded; the LUN list took 0.6 s
during the cut. The partition lookup of the LUN list costs about 34 us
per device, so 0.1 s for 1000 LUNs with two paths. I looked at each
changed view and dialog. For the rest, the tests of v6 [8] still apply;
I did not repeat the guest, path cut of maps and scale tests.
[0]: https://lore.proxmox.com/pve-devel/20260626121000.2095591-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20260703124707.1172980-2-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20260731102156.3947857-1-dietmar@proxmox.com/
[3]: https://lore.proxmox.com/pve-devel/20261116012355.3187417-1-t.lamprecht@proxmox.com/
[4]: https://lore.proxmox.com/pve-devel/20261111015217.941220-1-t.lamprecht@proxmox.com/
[5]: https://lore.proxmox.com/pve-devel/20260430173220.441001-1-m.limbeck@proxmox.com/
[6]: https://lore.proxmox.com/pve-devel/20260804090819.2136483-1-dietmar@proxmox.com/
[7]: https://lore.proxmox.com/pve-devel/20261113030146.1559030-1-t.lamprecht@proxmox.com/
[8]: https://lore.proxmox.com/pve-devel/20261118065302.3033937-1-t.lamprecht@proxmox.com/
pve-cluster:
Thomas Lamprecht (1):
cfs: observe the multipath configuration files
src/PVE/Cluster.pm | 2 ++
src/pmxcfs/status.c | 2 ++
2 files changed, 4 insertions(+)
pve-storage:
Dietmar Maurer (8):
diskmanage: collect disk transport type from lsblk
diskmanage: qualify NVMe over Fabrics transport
diskmanage: optionally include iSCSI session devices in disk enumeration
diskmanage: collect native NVMe multipath path state
iscsi: factor out session device map from device list
diskmanage: add helper to list multipath devices
pvesm: expose the SAN LUN inventory
api: add node-level iSCSI status
Thomas Lamprecht (17):
multipath: add a library around multipathd
multipath: add a cluster-wide configuration
iscsi: add an option to manage storage LUNs with multipath
lvm: activate a missing base volume before using the volume group
multipath: apply the configuration on every node
multipath: publish per-node status
api: add endpoints for the cluster-wide multipath configuration
api: multipath: add the cluster-wide health status
diskmanage: look up the requested disks by name
diskmanage: read the udev data of all disks with one call
api: scan: add a SAN LUN inventory
api: scan: name the portal of an iSCSI path
disks: lvm: drop unused imports
disks: lvm: allow volume groups on SAN LUNs and multipath maps
disks: lvm: refuse to destroy the volume group of a shared storage
disks: allow wiping a SAN LUN that no storage uses
api: scan: report the process that has a SAN LUN open
debian/control | 3 +-
src/PVE/API2/Disks.pm | 46 +-
src/PVE/API2/Disks/LVM.pm | 80 ++-
src/PVE/API2/ISCSI.pm | 166 +++++
src/PVE/API2/Makefile | 2 +
src/PVE/API2/Multipath.pm | 451 ++++++++++++++
src/PVE/API2/Storage/Scan.pm | 244 ++++++++
src/PVE/CLI/pvesm.pm | 15 +
src/PVE/Diskmanage.pm | 383 ++++++++++--
src/PVE/ISCSI/Topology.pm | 89 +++
src/PVE/Makefile | 6 +
src/PVE/Multipath.pm | 213 +++++++
src/PVE/Multipath/Config.pm | 209 +++++++
src/PVE/Multipath/Generator.pm | 128 ++++
src/PVE/Multipath/Identity.pm | 44 ++
src/PVE/Multipath/Status.pm | 228 +++++++
src/PVE/Storage.pm | 2 +-
src/PVE/Storage/ISCSIPlugin.pm | 219 ++++---
src/PVE/Storage/LVMPlugin.pm | 156 ++++-
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 457 ++++++++++++++
src/test/Makefile | 37 +-
src/test/disk_api_test.pm | 314 ++++++++++
src/test/disk_tests/iscsi/disklist | 1 +
.../disk_tests/iscsi/disklist_expected.json | 19 +
src/test/disk_tests/iscsi/lsblk | 5 +
src/test/disk_tests/iscsi/sda/device/model | 1 +
src/test/disk_tests/iscsi/sda/device/vendor | 1 +
.../disk_tests/iscsi/sda/queue/rotational | 1 +
src/test/disk_tests/iscsi/sda/size | 1 +
src/test/disk_tests/iscsi/sda_udevadm | 21 +
src/test/disk_tests/multipath/disklist | 11 +
.../multipath/disklist_expected.json | 107 ++++
src/test/disk_tests/multipath/dm-0/dm/name | 1 +
src/test/disk_tests/multipath/dm-0/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-0/size | 1 +
src/test/disk_tests/multipath/dm-0_slaves | 4 +
src/test/disk_tests/multipath/dm-1/dm/name | 1 +
src/test/disk_tests/multipath/dm-1/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-1/size | 1 +
src/test/disk_tests/multipath/dm-1_slaves | 4 +
src/test/disk_tests/multipath/dm-2/dm/name | 1 +
src/test/disk_tests/multipath/dm-2/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-2/size | 1 +
src/test/disk_tests/multipath/dm-2_slaves | 0
src/test/disk_tests/multipath/dm-3/dm/name | 1 +
src/test/disk_tests/multipath/dm-3/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-3/size | 1 +
src/test/disk_tests/multipath/dm-3_slaves | 0
src/test/disk_tests/multipath/dm-4/dm/name | 1 +
src/test/disk_tests/multipath/dm-4/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-4/size | 1 +
src/test/disk_tests/multipath/dm-4_slaves | 0
src/test/disk_tests/multipath/lsblk | 77 +++
src/test/disk_tests/multipath/lvs | 0
src/test/disk_tests/multipath/mounts | 1 +
.../multipath/multipath_expected.json | 59 ++
src/test/disk_tests/multipath/multipathd | 124 ++++
.../multipath/multipathd_status_expected.json | 40 ++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 +
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/nvme5/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +
.../multipath/nvme_path_status_expected.json | 19 +
src/test/disk_tests/multipath/partlist | 0
src/test/disk_tests/multipath/pvs | 1 +
.../disk_tests/multipath/sda/device/model | 1 +
.../disk_tests/multipath/sda/device/vendor | 1 +
.../disk_tests/multipath/sda/holders/holder | 1 +
.../disk_tests/multipath/sda/queue/rotational | 1 +
src/test/disk_tests/multipath/sda/size | 1 +
src/test/disk_tests/multipath/sda_udevadm | 18 +
.../disk_tests/multipath/sdb/device/model | 1 +
.../disk_tests/multipath/sdb/device/vendor | 1 +
.../disk_tests/multipath/sdb/holders/holder | 1 +
.../disk_tests/multipath/sdb/queue/rotational | 1 +
src/test/disk_tests/multipath/sdb/size | 1 +
src/test/disk_tests/multipath/sdb_udevadm | 18 +
.../disk_tests/multipath/sdc/device/model | 1 +
.../disk_tests/multipath/sdc/device/vendor | 1 +
.../disk_tests/multipath/sdc/holders/holder | 1 +
.../disk_tests/multipath/sdc/queue/rotational | 1 +
src/test/disk_tests/multipath/sdc/size | 1 +
src/test/disk_tests/multipath/sdc_udevadm | 18 +
.../disk_tests/multipath/sdd/device/model | 1 +
.../disk_tests/multipath/sdd/device/vendor | 1 +
.../disk_tests/multipath/sdd/holders/holder | 1 +
.../disk_tests/multipath/sdd/queue/rotational | 1 +
src/test/disk_tests/multipath/sdd/size | 1 +
src/test/disk_tests/multipath/sdd_udevadm | 18 +
src/test/disk_tests/multipath/zpool | 1 +
.../disk_tests/sas/disklist_expected.json | 1 +
src/test/disk_tests/sas/lsblk | 5 +
src/test/disklist_test.pm | 179 +++++-
src/test/multipath-three-states.json | 52 ++
src/test/plugin_properties_test.pm | 1 +
src/test/run_disk_api_tests.pl | 11 +
src/test/run_iscsi_activation_tests.pl | 109 ++++
src/test/run_lun_identity_tests.pl | 57 ++
src/test/run_multipath_api_tests.pl | 584 ++++++++++++++++++
src/test/run_multipath_tests.pl | 175 ++++++
src/test/run_san_api_tests.pl | 124 ++++
src/test/run_san_library_tests.pl | 135 ++++
src/test/run_san_lun_scan_tests.pl | 334 ++++++++++
src/test/run_san_nvme_tests.pl | 120 ++++
src/test/run_san_taint_tests.pl | 60 ++
src/test/run_san_wipe_tests.pl | 271 ++++++++
src/test/run_san_write_check_tests.pl | 219 +++++++
src/test/run_test_lvm_base_activation.pl | 121 ++++
src/test/run_test_lvm_base_volume.pl | 16 +-
src/test/run_test_lvm_create.pl | 46 ++
126 files changed, 6566 insertions(+), 197 deletions(-)
pve-docs:
Thomas Lamprecht (2):
storage: document the cluster-wide multipath management
storage: multipath: describe the use shown for an open LUN
pmxcfs.adoc | 2 +
pve-storage-iscsi.adoc | 11 ++
pve-storage-iscsidirect.adoc | 2 +-
pve-storage-lvm.adoc | 3 +
pve-storage-multipath.adoc | 313 +++++++++++++++++++++++++++++++++++
pvesm.adoc | 18 +-
6 files changed, 343 insertions(+), 6 deletions(-)
pve-manager:
Dietmar Maurer (2):
api: nodes: expose the iSCSI status
ui: node: san: show iSCSI targets and sessions
Thomas Lamprecht (13):
pvestatd: apply the multipath configuration and report the node status
report: add the managed multipath configuration
api: cluster: add the multipath endpoints
ui: dc: add a SAN view
ui: storage: iscsi: add the multipath option
ui: lvm: enable shared when a base storage is selected
ui: node: add SAN LUNs panel
ui: node: san: wipe a LUN that no storage uses
ui: dc: san: add a guided setup for shared LVM on iSCSI
ui: dc: san: add a guided setup for shared LVM on Fibre Channel
ui: storage: point the iSCSI and LVM add dialogs to the SAN view
ui: san: show the guest or process that has a LUN open
ui: node: san: add a column for the target or subsystem of a LUN
PVE/API2/Cluster.pm | 7 +
PVE/API2/Nodes.pm | 7 +
PVE/Report.pm | 3 +
PVE/Service/pvestatd.pm | 7 +
www/manager6/Makefile | 12 +
www/manager6/SANUtils.js | 232 ++++++++++
www/manager6/Utils.js | 19 +
www/manager6/dc/Config.js | 23 +-
www/manager6/dc/MultipathWwidEdit.js | 81 ++++
www/manager6/dc/SAN.js | 400 ++++++++++++++++++
www/manager6/node/Config.js | 24 ++
www/manager6/node/ISCSITargets.js | 150 +++++++
www/manager6/node/LVM.js | 5 +
www/manager6/node/SANLuns.js | 233 ++++++++++
www/manager6/storage/Base.js | 5 +
www/manager6/storage/IScsiEdit.js | 46 ++
www/manager6/storage/LVMEdit.js | 6 +
www/manager6/storage/wizard/FibreChannel.js | 187 ++++++++
www/manager6/storage/wizard/IScsi.js | 297 +++++++++++++
www/manager6/storage/wizard/LunSelect.js | 224 ++++++++++
www/manager6/storage/wizard/NodeIdentities.js | 94 ++++
www/manager6/storage/wizard/Wizard.js | 298 +++++++++++++
www/manager6/window/SANLunState.js | 119 ++++++
www/manager6/window/SANLunWipe.js | 64 +++
24 files changed, 2537 insertions(+), 6 deletions(-)
^ permalink raw reply [relevance 6%]
* [PATCH v7 storage 03/43] diskmanage: qualify NVMe over Fabrics transport
2026-11-18 20:25 6% [PATCH v7 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
@ 2026-11-18 20:25 13% ` Thomas Lamprecht
2026-11-18 20:25 13% ` [PATCH v7 storage 05/43] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
` (2 subsequent siblings)
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:25 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
lsblk reports 'nvme' for namespaces attached over a fabric too, so
they cannot be told from local PCIe drives. Read the transport from
the controller, or from a controller of the subsystem with native
multipath, and report nvme-fc, nvme-tcp, nvme-rdma or nvme-loop for
such namespaces.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: add the test case with the two namespaces only, as the multipath
devices it was part of follow later; mention the new values in the
transport description; call the wrapped test function with arrow
syntax]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Disks.pm | 3 +-
src/PVE/Diskmanage.pm | 27 ++++++++++++++
src/test/disk_tests/multipath/disklist | 2 ++
.../multipath/disklist_expected.json | 35 +++++++++++++++++++
src/test/disk_tests/multipath/lsblk | 18 ++++++++++
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 ++++++++
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +++++++
src/test/disklist_test.pm | 12 +++++++
17 files changed, 131 insertions(+), 1 deletion(-)
create mode 100644 src/test/disk_tests/multipath/disklist
create mode 100644 src/test/disk_tests/multipath/disklist_expected.json
create mode 100644 src/test/disk_tests/multipath/lsblk
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme8n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme8n1/size
create mode 100644 src/test/disk_tests/multipath/nvme8n1_udevadm
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/vendor
create mode 100644 src/test/disk_tests/multipath/nvme9n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme9n1/size
create mode 100644 src/test/disk_tests/multipath/nvme9n1_udevadm
diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index 1abab820..980ba7ff 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -138,7 +138,8 @@ __PACKAGE__->register_method({
transport => {
type => 'string',
description =>
- "The device transport, for example 'sata', 'sas', 'usb', 'fc', or 'nvme'.",
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'nvme', 'nvme-fc', or 'nvme-tcp'.",
optional => 1,
},
parent => {
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 4d66902b..7862bcd4 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -505,6 +505,26 @@ sub is_iscsi {
return 0;
}
+# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
+# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+sub get_nvme_transport {
+ my ($sysdir) = @_;
+
+ my $transport = file_read_firstline("$sysdir/device/transport");
+ return $transport if defined($transport);
+
+ dir_glob_foreach(
+ "$sysdir/device",
+ 'nvme\d+',
+ sub {
+ my ($controller) = @_;
+ $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ },
+ );
+
+ return $transport;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
@@ -597,6 +617,9 @@ sub get_disks {
# we do not want iscsi devices
return if is_iscsi($sysdir);
+ my $nvme_transport;
+ $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
+
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
@@ -648,7 +671,11 @@ sub get_disks {
wearout => $wearout,
};
+ # lsblk reports plain 'nvme' for fabrics attached namespaces
my $transport = $lsblk_info->{$devpath}->{tran};
+ if (defined($nvme_transport) && $nvme_transport ne 'pcie') {
+ $transport = "nvme-$nvme_transport";
+ }
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
diff --git a/src/test/disk_tests/multipath/disklist b/src/test/disk_tests/multipath/disklist
new file mode 100644
index 00000000..b5e636a5
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist
@@ -0,0 +1,2 @@
+nvme8n1
+nvme9n1
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
new file mode 100644
index 00000000..908c2b56
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -0,0 +1,35 @@
+{
+ "nvme8n1": {
+ "devpath": "/dev/nvme8n1",
+ "size": 10737418240,
+ "vendor": "unknown",
+ "model": "FCMODEL",
+ "serial": "FCNVME1",
+ "wwn": "uuid.20000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
+ "transport": "nvme-fc"
+ },
+ "nvme9n1": {
+ "devpath": "/dev/nvme9n1",
+ "size": 10737418240,
+ "vendor": "FABVEND",
+ "model": "FABRICS CTRL",
+ "serial": "FAB1",
+ "wwn": "uuid.10000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "transport": "nvme-tcp"
+ }
+}
diff --git a/src/test/disk_tests/multipath/lsblk b/src/test/disk_tests/multipath/lsblk
new file mode 100644
index 00000000..597adf94
--- /dev/null
+++ b/src/test/disk_tests/multipath/lsblk
@@ -0,0 +1,18 @@
+{
+ "blockdevices": [
+ {
+ "path": "/dev/nvme8n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ },
+ {
+ "path": "/dev/nvme9n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ }
+ ]
+}
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/model b/src/test/disk_tests/multipath/nvme8n1/device/model
new file mode 100644
index 00000000..1aac689e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/model
@@ -0,0 +1 @@
+FCMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/transport b/src/test/disk_tests/multipath/nvme8n1/device/transport
new file mode 100644
index 00000000..8b517d01
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/transport
@@ -0,0 +1 @@
+fc
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/queue/rotational b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/size b/src/test/disk_tests/multipath/nvme8n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1_udevadm b/src/test/disk_tests/multipath/nvme8n1_udevadm
new file mode 100644
index 00000000..d0cd5ea9
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1_udevadm
@@ -0,0 +1,14 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+N: nvme8n1
+S: disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVLINKS=/dev/disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVNAME=/dev/nvme8n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+E: DEVTYPE=disk
+E: ID_MODEL=FCMODEL
+E: ID_SERIAL=FCNVME_1
+E: ID_SERIAL_SHORT=FCNVME1
+E: ID_WWN=uuid.20000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=1
+E: SUBSYSTEM=block
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/model b/src/test/disk_tests/multipath/nvme9n1/device/model
new file mode 100644
index 00000000..aa0287c7
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/model
@@ -0,0 +1 @@
+FABMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/transport
new file mode 100644
index 00000000..f5483dbf
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/transport
@@ -0,0 +1 @@
+tcp
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/vendor b/src/test/disk_tests/multipath/nvme9n1/device/vendor
new file mode 100644
index 00000000..cdc6ddfa
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/vendor
@@ -0,0 +1 @@
+FABVEND
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/queue/rotational b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/size b/src/test/disk_tests/multipath/nvme9n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1_udevadm b/src/test/disk_tests/multipath/nvme9n1_udevadm
new file mode 100644
index 00000000..b6d13ccb
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1_udevadm
@@ -0,0 +1,12 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+N: nvme9n1
+E: DEVNAME=/dev/nvme9n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+E: DEVTYPE=disk
+E: ID_MODEL=FABRICS CTRL
+E: ID_SERIAL=FABRICS_1
+E: ID_SERIAL_SHORT=FAB1
+E: ID_WWN=uuid.10000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=0
+E: SUBSYSTEM=block
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index a0dc01f6..c7374fd5 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -101,6 +101,16 @@ sub mocked_is_iscsi {
return 0;
}
+sub mocked_file_read_firstline {
+ my ($path) = @_;
+
+ my $originalsub = $diskmanage_module->original('file_read_firstline');
+
+ $path =~ s|^/sys/block|disk_tests/$testcasedir|;
+
+ return $originalsub->($path);
+}
+
sub mocked_dir_glob_foreach {
my ($dir, $regex, $sub) = @_;
@@ -248,6 +258,8 @@ $diskmanage_module->mock(
},
);
print("\tMocked dir_is_empty\n");
+$diskmanage_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked file_read_firstline\n");
$diskmanage_module->mock('check_bin' => sub { return 1; });
print("\tMocked check_bin\n");
my $tools_module = Test::MockModule->new('PVE::ProcFSTools', no_auto => 1);
^ permalink raw reply related [relevance 13%]
* [PATCH v7 storage 05/43] diskmanage: collect native NVMe multipath path state
2026-11-18 20:25 6% [PATCH v7 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-18 20:25 13% ` [PATCH v7 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
@ 2026-11-18 20:25 13% ` Thomas Lamprecht
2026-11-18 20:26 9% ` [PATCH v7 storage 18/43] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-18 20:26 10% ` [PATCH v7 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 20:25 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
NVMe over Fabrics usually uses native multipath, whose paths
multipathd does not know. Collect the controller state and address
and the ANA state of each path from sysfs, grouped by namespace, so
the SAN LUN inventory can report path health for both multipath
stacks. Devices with a single local controller have no per-path
entries and are left out.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: drop redundant comments; call the wrapped test function with
arrow syntax]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 60 +++++++++++++++++++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../nvme9n1/device/{ => nvme5}/transport | 0
.../multipath/nvme_path_status_expected.json | 19 ++++++
src/test/disklist_test.pm | 20 +++++++
12 files changed, 107 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
rename src/test/disk_tests/multipath/nvme9n1/device/{ => nvme5}/transport (100%)
create mode 100644 src/test/disk_tests/multipath/nvme_path_status_expected.json
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index c342abcd..516c108d 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -818,6 +818,66 @@ sub get_disks {
return $disklist;
}
+# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
+# single-controller devices lack these children and are omitted.
+sub get_nvme_path_status {
+ my $res = {};
+
+ dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ 'nvme-subsys\d+',
+ sub {
+ my ($subsys) = @_;
+ my $subsysdir = "/sys/class/nvme-subsystem/$subsys";
+
+ dir_glob_foreach(
+ $subsysdir,
+ 'nvme\d+',
+ sub {
+ my ($ctrl) = @_;
+ my $ctrldir = "$subsysdir/$ctrl";
+ my $state = file_read_firstline("$ctrldir/state") // return;
+ my $address = file_read_firstline("$ctrldir/address");
+
+ dir_glob_foreach(
+ $ctrldir,
+ 'nvme\d+c\d+n\d+',
+ sub {
+ my ($pathdev) = @_;
+ return if $pathdev !~ m/^nvme(\d+)c\d+n(\d+)$/;
+ my $head = "nvme$1n$2";
+
+ my $entry = { device => "/dev/$ctrl", state => $state };
+ $entry->{address} = $address
+ if defined($address) && $address ne '';
+ my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
+ $entry->{'ana-state'} = $ana if defined($ana);
+
+ # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
+ # cannot serve IO even on a live controller
+ my $usable = $state eq 'live'
+ && (!defined($ana)
+ || $ana eq 'optimized'
+ || $ana eq 'non-optimized');
+
+ my $status = $res->{$head} //= { active => 0, paths => [] };
+ $status->{active}++ if $usable;
+ push @{ $status->{paths} }, $entry;
+ },
+ );
+ },
+ );
+ },
+ );
+
+ for my $status (values %$res) {
+ @{ $status->{paths} } =
+ sort { $a->{device} cmp $b->{device} } @{ $status->{paths} };
+ }
+
+ return $res;
+}
+
sub get_partnum {
my ($part_path) = @_;
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
new file mode 100644
index 00000000..803fab3e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
@@ -0,0 +1 @@
+traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
new file mode 100644
index 00000000..e48c58f5
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
@@ -0,0 +1 @@
+optimized
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
new file mode 100644
index 00000000..36618744
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
@@ -0,0 +1 @@
+traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
new file mode 100644
index 00000000..436c48ee
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
@@ -0,0 +1 @@
+inaccessible
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
new file mode 100644
index 00000000..f99fcb14
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
@@ -0,0 +1 @@
+0000:02:00.0
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/nvme5/transport
similarity index 100%
rename from src/test/disk_tests/multipath/nvme9n1/device/transport
rename to src/test/disk_tests/multipath/nvme9n1/device/nvme5/transport
diff --git a/src/test/disk_tests/multipath/nvme_path_status_expected.json b/src/test/disk_tests/multipath/nvme_path_status_expected.json
new file mode 100644
index 00000000..62611b3f
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme_path_status_expected.json
@@ -0,0 +1,19 @@
+{
+ "nvme2n1": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/nvme3",
+ "state": "live",
+ "address": "traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "optimized"
+ },
+ {
+ "device": "/dev/nvme4",
+ "state": "live",
+ "address": "traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "inaccessible"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 4c85d9e9..889475f6 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -103,6 +103,7 @@ sub mocked_file_read_firstline {
my $originalsub = $diskmanage_module->original('file_read_firstline');
$path =~ s|^/sys/block|disk_tests/$testcasedir|;
+ $path =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|;
return $originalsub->($path);
}
@@ -112,6 +113,16 @@ sub mocked_dir_glob_foreach {
my $lines = [];
+ # nvme subsystem trees and the controllers of a namespace are provided as directories, glob
+ # them like production code
+ if (
+ $dir =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|
+ || $dir =~ s|^/sys/block/(nvme\d+n\d+/device)$|disk_tests/$testcasedir/$1|
+ ) {
+ my $originalsub = $diskmanage_module->original('dir_glob_foreach');
+ return $originalsub->($dir, $regex, $sub);
+ }
+
# read lines in from file
if ($dir =~ m{^/sys/block$}) {
@$lines = split(/\n/, read_test_file('disklist'));
@@ -230,6 +241,15 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'nvme path status should be the same');
+ }
+
done_testing($testcount);
};
}
^ permalink raw reply related [relevance 13%]
* [PATCH v6 storage 18/42] api: scan: add a SAN LUN inventory
2026-11-18 6:52 6% [PATCH v6 cluster,storage,docs,manager 00/42] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-18 6:52 13% ` [PATCH v6 storage 03/42] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
2026-11-18 6:52 13% ` [PATCH v6 storage 05/42] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
@ 2026-11-18 6:52 9% ` Thomas Lamprecht
2026-11-18 6:52 10% ` [PATCH v6 manager 39/42] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 6:52 UTC (permalink / raw)
To: pve-devel
Add /nodes/{node}/scan/san-luns, which lists the LUNs a node sees
over iSCSI, Fibre Channel or NVMe over Fabrics, one row per WWID with
the paths folded into their multipath map. The node disk list has
neither the maps nor a relation to volume groups and storages.
A row has the device to use, its size and transport, how multipath
handles the LUN, the health and state of its paths, and the known
usage with the volume group and storage. The usage comes from cached
data only, as probing a LUN whose paths are down can block.
The paths of a map are left out of the disk list, which reads sysfs
for each disk it returns. A node with a thousand LUNs has several
thousand of them, and the views poll this list every few seconds.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 202 +++++++++++++++++
src/PVE/Diskmanage.pm | 7 +
src/PVE/Multipath.pm | 24 ++
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 196 ++++++++++++++++
src/test/Makefile | 8 +-
src/test/disk_tests/multipath/multipathd | 124 ++++++++++
.../multipath/multipathd_status_expected.json | 40 ++++
src/test/disklist_test.pm | 15 ++
src/test/run_san_api_tests.pl | 24 ++
src/test/run_san_lun_scan_tests.pl | 211 ++++++++++++++++++
11 files changed, 852 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/Storage/SAN.pm
create mode 100644 src/test/disk_tests/multipath/multipathd
create mode 100644 src/test/disk_tests/multipath/multipathd_status_expected.json
create mode 100755 src/test/run_san_api_tests.pl
create mode 100755 src/test/run_san_lun_scan_tests.pl
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index d8bd0a96..0e7667c8 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -12,6 +12,7 @@ use PVE::SafeSyslog;
use PVE::Storage::LVMPlugin;
use PVE::Storage::LvmThinPlugin;
use PVE::Storage::PBSPlugin;
+use PVE::Storage::SAN;
use PVE::Storage;
use base qw(PVE::RESTHandler);
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'nfs' },
{ method => 'pbs' },
+ { method => 'san-luns' },
{ method => 'zfs' },
];
@@ -375,6 +377,206 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'sanlunscan',
+ path => 'san-luns',
+ method => 'GET',
+ description => "List SAN LUNs with their paths and cached usage.",
+ protected => 1,
+ proxyto => "node",
+ permissions => {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ devpath => {
+ description => "The device path.",
+ type => 'string',
+ },
+ size => {
+ description => "The device size in bytes.",
+ type => 'integer',
+ renderer => 'bytes',
+ optional => 1,
+ },
+ transport => {
+ description =>
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'iscsi', 'nvme', 'nvme-fc', or 'nvme-tcp'.",
+ type => 'string',
+ optional => 1,
+ },
+ vendor => { type => 'string', optional => 1 },
+ model => { type => 'string', optional => 1 },
+ serial => { type => 'string', optional => 1 },
+ state => {
+ description =>
+ 'The health of the multipath LUN when path status is available.',
+ type => 'string',
+ enum => ['optimal', 'degraded', 'failed'],
+ optional => 1,
+ },
+ 'paths-total' => {
+ description => "The number of paths of a multipath mapped device or of"
+ . " an NVMe namespace attached through multiple controllers.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-active' => {
+ description =>
+ "The number of active paths whose checker state is ready, ghost,"
+ . " or not reported. Native NVMe paths count when their controller is live"
+ . " and their ANA state is optimized, non-optimized, or not reported.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-expected' => {
+ description => "The number of paths the LUN should have according to the"
+ . " storage configuration, one per portal for iSCSI; absent when it is"
+ . " not known.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'path-list' => {
+ description => "The member paths of the device with their state.",
+ type => 'array',
+ optional => 1,
+ items => {
+ type => 'object',
+ properties => {
+ device => {
+ description => "The path block device, or the NVMe"
+ . " controller device the path uses.",
+ type => 'string',
+ },
+ state => {
+ description => "The device mapper state of the path (for"
+ . " example active or failed) or the state of the NVMe"
+ . " controller (for example live or connecting).",
+ type => 'string',
+ },
+ 'checker-state' => {
+ description => "The state reported by the multipathd path"
+ . " checker, for example ready, ghost or faulty.",
+ type => 'string',
+ optional => 1,
+ },
+ 'ana-state' => {
+ description => "The Asymmetric Namespace Access state of"
+ . " the namespace on this path, for example optimized"
+ . " or inaccessible.",
+ type => 'string',
+ optional => 1,
+ },
+ 'host-wwpn' => {
+ description => "The WWPN of the host (initiator) port of"
+ . " Fibre Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ 'target-wwpn' => {
+ description => "The WWPN of the target port of Fibre"
+ . " Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ address => {
+ description => "The address of the NVMe controller the"
+ . " path uses.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ usage => {
+ description => "The usage indicated by cached device metadata.",
+ type => 'string',
+ enum => ['unused', 'lvm', 'other'],
+ },
+ vgname => {
+ description => "The name of the LVM volume group the device belongs to.",
+ type => 'string',
+ optional => 1,
+ },
+ 'by-id' => {
+ description =>
+ "A path under /dev/disk/by-id that encodes the device's identity"
+ . " and has been verified to resolve to this device. Absent when no such"
+ . " link could be verified.",
+ type => 'string',
+ optional => 1,
+ },
+ 'used-by-storage' => {
+ description => "The storage that uses the LUN: as its base volume or"
+ . " through the volume group on it, or as an iSCSI storage that serves the"
+ . " LUNs of its target as images.",
+ type => 'string',
+ optional => 1,
+ },
+ wwid => {
+ description => "The LUN WWID.",
+ type => 'string',
+ },
+ name => {
+ description => 'The map alias, when different from its WWID.',
+ type => 'string',
+ optional => 1,
+ },
+ multipath => {
+ description => "How the node manages multipath for the LUN: 'manual' for a"
+ . " map with an explicit entry, 'storage' for the map of an iSCSI storage"
+ . " with the 'managed-multipath' option, 'unmanaged' for any other map,"
+ . " 'pending' while a map that an entry, a storage or the allow-list of"
+ . " the node requests does not exist yet, 'none' without a map or"
+ . " request, 'native' for the kernel-native multipath of an NVMe"
+ . " namespace.",
+ type => 'string',
+ enum => ['none', 'pending', 'storage', 'manual', 'unmanaged', 'native'],
+ },
+ 'multipath-storage' => {
+ description =>
+ "The multipath-enabled storage the LUN belongs to, whether or"
+ . " not it also has an explicit multipath entry.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-target' => {
+ description => "The IQN of the iSCSI target the LUN is attached through.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-lun' => {
+ description => "The number of the LUN on its iSCSI target.",
+ type => 'integer',
+ optional => 1,
+ },
+ detail => {
+ description => "The cached signature or usage when usage is 'other'.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ code => sub {
+ return PVE::Storage::SAN::scan_luns(PVE::Storage::config());
+ },
+});
+
__PACKAGE__->register_method({
name => 'zfsscan',
path => 'zfs',
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 07694e2e..c31cf991 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -554,6 +554,13 @@ sub get_nvme_transport {
return $transport;
}
+# SAS does not distinguish local from remote attachments, so it is not classified as remote.
+sub is_remote_transport {
+ my ($transport) = @_;
+
+ return ($transport // '') =~ m/^(?:fc|fcoe|iscsi|nvme-(?:fc|tcp|rdma))$/;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
diff --git a/src/PVE/Multipath.pm b/src/PVE/Multipath.pm
index ec417381..027e6a53 100644
--- a/src/PVE/Multipath.pm
+++ b/src/PVE/Multipath.pm
@@ -2,7 +2,9 @@ package PVE::Multipath;
use v5.36;
+use Cwd qw(abs_path);
use Encode qw(decode encode);
+use File::Basename qw(basename);
use JSON qw(decode_json);
use PVE::Tools qw(run_command file_get_contents file_read_firstline dir_glob_foreach);
@@ -19,6 +21,12 @@ sub parse_dm_uuid($uuid) {
return { wwid => $wwid, defined($part) ? (partition => int($part)) : () };
}
+sub device_map($device) {
+ my $name = basename(abs_path($device) // $device);
+ return undef if $name !~ /^dm-\d+$/;
+ return parse_dm_uuid(file_read_firstline("/sys/block/$name/dm/uuid"));
+}
+
sub map_info() {
my $maps = {};
dir_glob_foreach(
@@ -159,6 +167,22 @@ sub get_maps() {
return $maps;
}
+sub path_status_by_wwid() {
+ my $res = {};
+ for my $map (get_maps()->@*) {
+ my $wwid = $map->{wwid} // next;
+ my @paths;
+ for my $path ($map->{paths}->@*) {
+ my $row = { device => "/dev/$path->{dev}", state => $path->{'dm-state'} // 'undef' };
+ $row->{'checker-state'} = $path->{'check-state'} if defined($path->{'check-state'});
+ $row->{$_} = $path->{$_} for grep { defined($path->{$_}) } qw(host-wwpn target-wwpn);
+ push @paths, $row;
+ }
+ $res->{$wwid} = { active => $map->{'paths-active'}, paths => \@paths };
+ }
+ return $res;
+}
+
sub wait_for_map($wwid, $timeout = 10) {
my $link = "/dev/disk/by-id/dm-uuid-mpath-$wwid";
my $deadline = time() + ($timeout // 10);
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a67dc25f..a2df83c0 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -14,7 +14,8 @@ SOURCES= \
PBSPlugin.pm \
BTRFSPlugin.pm \
LvmThinPlugin.pm \
- ESXiPlugin.pm
+ ESXiPlugin.pm \
+ SAN.pm
.PHONY: install
install:
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
new file mode 100644
index 00000000..788bb577
--- /dev/null
+++ b/src/PVE/Storage/SAN.pm
@@ -0,0 +1,196 @@
+package PVE::Storage::SAN;
+
+use v5.36;
+
+use Cwd qw(abs_path);
+use File::Basename qw(basename);
+
+use PVE::INotify;
+use PVE::Tools qw(file_read_firstline dir_glob_foreach);
+
+use PVE::Diskmanage;
+use PVE::ISCSI::Topology;
+use PVE::Multipath;
+use PVE::Multipath::Config;
+use PVE::Multipath::Generator;
+use PVE::Multipath::Identity;
+use PVE::Storage;
+use PVE::Storage::LVMPlugin;
+
+sub scan_luns($cfg) {
+ my $ids = PVE::Multipath::Identity::collect(all => 1);
+ my $map_info = PVE::Multipath::map_info();
+ my $members = PVE::Multipath::member_map($map_info);
+ # A map stands for its paths, of which a node with many LUNs has thousands. Leave them out of
+ # the disk list, which reads the sysfs attributes and partitions of each disk it returns.
+ my @names;
+ dir_glob_foreach(
+ '/sys/block',
+ '(?:sd[a-z]+|nvme\d+n\d+)',
+ sub($name, @) { push @names, $name if !$members->{$name} },
+ );
+ my $disks = PVE::Diskmanage::get_disks(\@names, 1, 0, 1);
+ my $maps = PVE::Diskmanage::get_multipath_disks($map_info);
+ my $sessions = PVE::ISCSI::Topology::device_map();
+ my $status = eval { PVE::Multipath::path_status_by_wwid() } // {};
+ my $nvme = PVE::Diskmanage::get_nvme_path_status();
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups() // {};
+ my $mpcfg = PVE::Multipath::Config::read_config();
+ my %explicit = map { $_ => 1 }
+ PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
+ my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
+ my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %targets);
+
+ for my $sid (sort keys %$derived) {
+ for my $wwid (keys $derived->{$sid}->{wwids}->%*) {
+ $storage{$wwid} //= $sid;
+ my $count = $derived->{$sid}->{wwids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ }
+ for my $wwid (keys %explicit) {
+ my $count = $mpcfg->{ids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
+ $target_owner{ $scfg->{target} } //= $sid
+ if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
+ $base_owner{$1} //= $sid
+ if ($scfg->{base} // '') =~ m/(?:^|\.)dm-uuid-(?:part\d+-)?mpath-(.+)$/;
+ }
+
+ my %rows;
+ my $add = sub($disk, $map = 0) {
+ my $name = basename(abs_path($disk->{devpath}) // $disk->{devpath});
+ my $info =
+ { map => $map, transport => $disk->{transport}, session => $sessions->{$name} };
+ return if !is_san_device($disk->{devpath}, $info);
+ my $wwid = $map ? $disk->{wwn} : PVE::Multipath::Identity::path_wwid($ids, $name);
+ $wwid //= file_read_firstline("/sys/class/block/$name/wwid") if $name =~ /^nvme/;
+ return if !defined($wwid) || !length($wwid);
+
+ my $row = $rows{$wwid} //= {
+ wwid => $wwid,
+ devpath => $disk->{devpath},
+ size => $disk->{size},
+ usage => 'unused',
+ multipath => $listed{$wwid}
+ || $explicit{$wwid}
+ || $storage{$wwid} ? 'pending' : 'none',
+ };
+ my $link = stable_path($disk->{devpath}, $wwid, $map);
+ # The device and its by-id name come from one disk. A map replaces a single path.
+ if ($map || (defined($link) && !$row->{'by-id'})) {
+ delete $row->{'by-id'};
+ $row->{devpath} = $disk->{devpath};
+ $row->{size} = $disk->{size};
+ $row->{'by-id'} = $link if defined($link);
+ }
+ if ($map) {
+ my $alias = basename($disk->{devpath});
+ $row->{name} = $alias if $alias ne $wwid;
+ $row->{multipath} =
+ $explicit{$wwid} ? 'manual'
+ : $storage{$wwid} ? 'storage'
+ : 'unmanaged';
+ }
+ $row->{multipath} = 'native' if $name =~ /^nvme\d+n\d+$/ && $nvme->{$name};
+ for my $key (qw(transport vendor model serial)) {
+ my $value = $disk->{$key};
+ $row->{$key} //= $value if defined($value) && $value ne 'unknown';
+ }
+ for my $member (map { basename($_) } ($disk->{slaves} // [$disk->{devpath}])->@*) {
+ my $session = $sessions->{$member} // next;
+ $targets{$wwid}->{ $session->{target} } = 1;
+ $row->{'iscsi-target'} //= $session->{target};
+ $row->{'iscsi-lun'} //= $session->{lun};
+ $row->{transport} = 'iscsi';
+ }
+ my $used = $disk->{used};
+ if (defined($used)) {
+ if ($used eq 'LVM' || $used eq 'LVM2_member') {
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ } elsif ($row->{usage} ne 'lvm') {
+ $row->{usage} = 'other';
+ $row->{detail} = $used;
+ }
+ }
+ my $vg = $pv_vgs->{ abs_path($disk->{devpath}) // $disk->{devpath} };
+ if (defined($vg)) {
+ $row->{vgname} //= $vg;
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ }
+ my $paths = $map ? $status->{$wwid} : $nvme->{$name};
+ if ($paths) {
+ $row->{'path-list'} = $paths->{paths};
+ $row->{'paths-total'} = scalar($paths->{paths}->@*);
+ $row->{'paths-active'} = $paths->{active};
+ } elsif ($map) {
+ $row->{'paths-total'} = $disk->{paths};
+ }
+ $row->{'multipath-storage'} = $storage{$wwid} if defined($storage{$wwid});
+ # multipath entries and iSCSI portals are for maps, not for native NVMe multipath
+ $row->{'paths-expected'} = $expected{$wwid}
+ if defined($expected{$wwid}) && $row->{multipath} ne 'native';
+ };
+ for my $name (sort keys %$disks) {
+ my $disk = $disks->{$name};
+ next if $members->{$name};
+ $add->($disk);
+ }
+ $add->($maps->{$_}, 1) for sort keys %$maps;
+ for my $row (values %rows) {
+ if (defined($row->{'paths-active'})) {
+ $row->{state} = PVE::Multipath::derive_health(
+ $row->{'paths-active'},
+ $row->{'paths-total'},
+ $row->{'paths-expected'},
+ );
+ }
+ my ($target) =
+ map { $target_owner{$_} // () } sort keys(($targets{ $row->{wwid} } // {})->%*);
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' } // $target;
+ $row->{'used-by-storage'} = $owner if defined($owner);
+ }
+ return [map { $rows{$_} } sort keys %rows];
+}
+
+sub stable_path($device, $wwid, $map = 0) {
+ my $prefix = $map ? 'dm-uuid-mpath' : basename($device) =~ /^nvme/ ? 'nvme' : 'scsi';
+ my ($link) = "/dev/disk/by-id/$prefix-$wwid" =~ m{\A(/dev/disk/by-id/[A-Za-z0-9_.:+-]+)\z};
+ return undef if !defined($link);
+ return $link if (abs_path($link) // '') eq (abs_path($device) // $device);
+ return undef;
+}
+
+sub is_san_device($device, $info = undef) {
+ if (!$info) {
+ my $path = abs_path($device) // $device;
+ my $map = PVE::Multipath::device_map($path);
+ # the partitions of a LUN are handled like local devices, also the ones that kpartx maps
+ return 0 if PVE::Diskmanage::is_partition($path) || ($map && $map->{partition});
+ my $name = basename($path);
+ my $transport;
+ if ($name =~ /^nvme/) {
+ $transport = 'nvme-' . (PVE::Diskmanage::get_nvme_transport("/sys/block/$name") // '');
+ } elsif ((readlink("/sys/block/$name") // '') =~ m{/rport-\d+}) {
+ $transport = 'fc';
+ }
+ $info = {
+ map => $map,
+ transport => $transport,
+ session => PVE::Diskmanage::is_iscsi_device($name),
+ };
+ }
+ return
+ $info->{map}
+ || $info->{session}
+ || PVE::Diskmanage::is_remote_transport($info->{transport}) ? 1 : 0;
+}
+
+1;
diff --git a/src/test/Makefile b/src/test/Makefile
index bfef56d6..2f6f4cd7 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_sensitive_properties test_import_stream test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -71,3 +71,9 @@ test_multipath_api: run_multipath_api_tests.pl
test_san_taint: run_san_taint_tests.pl
perl -T ./run_san_taint_tests.pl
+
+test_san_lun_scan: run_san_lun_scan_tests.pl
+ ./run_san_lun_scan_tests.pl
+
+test_san_api: run_san_api_tests.pl
+ ./run_san_api_tests.pl
diff --git a/src/test/disk_tests/multipath/multipathd b/src/test/disk_tests/multipath/multipathd
new file mode 100644
index 00000000..40243f91
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd
@@ -0,0 +1,124 @@
+{
+ "major_version": 0,
+ "minor_version": 1,
+ "maps": [{
+ "name" : "mpatha",
+ "uuid" : "3600140500000000000000000000000001",
+ "sysfs" : "dm-0",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 0,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sda",
+ "dev_t" : "8:0",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdb",
+ "dev_t" : "8:16",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ },
+ {
+ "name" : "mpathb",
+ "uuid" : "3600140500000000000000000000000002",
+ "sysfs" : "dm-1",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 3,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sdc",
+ "dev_t" : "8:32",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdd",
+ "dev_t" : "8:48",
+ "dm_st" : "failed",
+ "dev_st" : "running",
+ "chk_st" : "faulty",
+ "checker" : "tur",
+ "pri" : 0,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ }]
+}
diff --git a/src/test/disk_tests/multipath/multipathd_status_expected.json b/src/test/disk_tests/multipath/multipathd_status_expected.json
new file mode 100644
index 00000000..df5a24da
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd_status_expected.json
@@ -0,0 +1,40 @@
+{
+ "3600140500000000000000000000000001": {
+ "active": 2,
+ "paths": [
+ {
+ "device": "/dev/sda",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdb",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ },
+ "3600140500000000000000000000000002": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/sdc",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdd",
+ "state": "failed",
+ "checker-state": "faulty",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 4e0b12ae..dbc1d855 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -82,6 +82,8 @@ sub mocked_run_command {
$content = '{}';
}
@$outputlines = split(/\n/, $content);
+ } elsif ($cmd->[0] =~ m/multipathd/i) {
+ @$outputlines = split(/\n/, read_test_file('multipathd'));
} else {
die "unexpected run_command call: '@$cmd', aborting\n";
}
@@ -278,6 +280,16 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
+ my $status = PVE::Multipath::path_status_by_wwid();
+ my $expected_status =
+ decode_json(read_test_file('multipathd_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'multipath status should be the same');
+ }
+
if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
my $status = PVE::Diskmanage::get_nvme_path_status();
my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
@@ -362,8 +374,11 @@ print("\tMocked get_sysdir_size\n");
$diskmanage_module->mock('assert_blockdev' => sub { return 1; });
print("\tMocked assert_blockdev\n");
$multipath_module = Test::MockModule->new('PVE::Multipath', no_auto => 1);
+$multipath_module->mock('run_command' => \&mocked_run_command);
+$multipath_module->mock('is_supported' => sub { return 1; });
$multipath_module->mock('dir_glob_foreach' => \&mocked_dir_glob_foreach);
$multipath_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked PVE::Multipath run_command and is_supported\n");
$diskmanage_module->mock(
'dir_is_empty' => sub {
my $val = shift;
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
new file mode 100755
index 00000000..4bd7d2d7
--- /dev/null
+++ b/src/test/run_san_api_tests.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw(. ..);
+use PVE::API2::Storage::Scan;
+
+for my $case (['PVE::API2::Storage::Scan', 'sanlunscan']) {
+ my ($class, @names) = @$case;
+ for my $name (@names) {
+ is_deeply(
+ $class->map_method_by_name($name)->{permissions}->{check},
+ [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ "$class $name read permission",
+ );
+ }
+}
+
+done_testing();
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
new file mode 100755
index 00000000..abfdfa28
--- /dev/null
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -0,0 +1,211 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(..);
+use Test::More;
+use Test::MockModule;
+
+use PVE::Storage::SAN;
+use PVE::API2::Storage::Scan;
+
+my $disk = Test::MockModule->new('PVE::Diskmanage');
+my $mp = Test::MockModule->new('PVE::Multipath');
+my $id = Test::MockModule->new('PVE::Multipath::Identity');
+my $config = Test::MockModule->new('PVE::Multipath::Config');
+my $storage = Test::MockModule->new('PVE::Storage');
+my $iscsi = Test::MockModule->new('PVE::ISCSI::Topology');
+my $scan = Test::MockModule->new('PVE::Storage::SAN');
+my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+my $hints;
+$lvm->mock(file_get_contents => sub { $hints // die "No such file\n" });
+$lvm->mock(abs_path => sub { $_[0] });
+$lvm->mock(run_command => sub { die "unexpected LVM device probe\n" });
+
+my $disks = {
+ sda => { devpath => '/dev/sda', size => 100, transport => 'sata' },
+ sdb => { devpath => '/dev/sdb', size => 200, transport => 'iscsi' },
+ sdc => { devpath => '/dev/sdc', size => 200, transport => 'iscsi', used => 'LVM2_member' },
+ sdd =>
+ { devpath => '/dev/sdd', size => 300, transport => 'fc', multipath => '/dev/mapper/lun' },
+ sde => { devpath => '/dev/sde', size => 400, transport => 'fc' },
+};
+my $maps = {
+ 'dm-0' => {
+ devpath => '/dev/mapper/lun',
+ size => 300,
+ wwn => '3600map',
+ paths => 2,
+ slaves => ['/dev/sdd', '/dev/sdf'],
+ transport => 'fc',
+ },
+};
+$id->mock(collect => sub { {} });
+$id->mock(path_wwid => sub { $_[1] =~ /^(sdb|sdc)$/ ? '3600plain' : undef });
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+my $generator = Test::MockModule->new('PVE::Multipath::Generator');
+$generator->mock(derived_wwids => sub { {} });
+$iscsi->mock(
+ device_map => sub {
+ return { map { $_ => { target => 'iqn.test', lun => 1 } } qw(sdb sdc) };
+ },
+);
+my @listed;
+$scan->redefine(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $code) = @_;
+ return PVE::Tools::dir_glob_foreach($dir, $regex, $code) if $dir ne '/sys/block';
+ $code->($_) for grep { /^$regex$/ } qw(sda sdb sdc sdd sde sdf dm-0 loop0 nvme0n1);
+ },
+);
+$disk->mock(
+ get_disks => sub {
+ ok($_[3], 'SAN inventory opts into iSCSI');
+ @listed = sort $_[0]->@*;
+ return $disks;
+ },
+ get_multipath_disks => sub { $maps },
+ get_nvme_path_status => sub { {} },
+ run_command => sub { die 'unexpected device probe' },
+);
+$mp->mock(list_etc_multipath_wwids => sub { [] });
+$mp->mock(
+ map_info => sub {
+ return {
+ map {
+ $_ => {
+ wwid => $maps->{$_}->{wwn},
+ slaves => [map { s{^/dev/}{}r } $maps->{$_}->{slaves}->@*],
+ }
+ } keys %$maps
+ };
+ },
+);
+$mp->mock(
+ path_status_by_wwid => sub {
+ return {
+ '3600map' => {
+ active => 1,
+ paths => [
+ { device => '/dev/sdd', state => 'active', 'checker-state' => 'ghost' },
+ { device => '/dev/sdf', state => 'failed', 'checker-state' => 'faulty' },
+ ],
+ },
+ };
+ },
+);
+$scan->mock(abs_path => sub { $_[0] });
+$scan->mock(stable_path => sub { '/dev/disk/by-id/scsi-' . $_[1] });
+my $cfg =
+ { ids => { direct => { type => 'iscsi', target => 'iqn.test', content => { images => 1 } } } };
+my $rows = PVE::Storage::SAN::scan_luns($cfg);
+is(scalar(@$rows), 2, 'only identified SAN LUNs, one row per identity');
+is_deeply(
+ \@listed,
+ [qw(nvme0n1 sda sdb sdc sde)],
+ 'the paths of a map are left out of the disk list',
+);
+my %row = map { $_->{wwid} => $_ } @$rows;
+is($row{'3600plain'}->{usage}, 'lvm', 'positive usage from any path survives folding');
+is($row{'3600plain'}->{'used-by-storage'}, 'direct', 'a storage serving the LUNs uses them');
+{
+ local $cfg->{ids}->{direct}->{content} = { none => 1 };
+ my %plain = map { $_->{wwid} => $_ } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($plain{'3600plain'}->{'used-by-storage'}, undef, 'a connection storage does not');
+}
+ok(!exists($row{'3600plain'}->{state}), 'single path devices have no multipath health');
+is($row{'3600map'}->{state}, 'degraded', 'final state counts usable paths');
+is($row{'3600map'}->{multipath}, 'manual', 'explicit map');
+is($row{'3600map'}->{devpath}, '/dev/mapper/lun', 'map is the selected device');
+my $schema = PVE::API2::Storage::Scan->map_method_by_name('sanlunscan')->{returns};
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'rows match the public schema');
+is($row{'3600map'}->{name}, 'lun', 'map alias is exposed');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/3600map';
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unnamed) = grep { $_->{wwid} eq '3600map' } @$rows;
+ok(!exists($unnamed->{name}), 'WWID is not repeated as an alias');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/lun';
+
+{
+ my $healthy = {
+ '3600map' => {
+ active => 2,
+ paths => [map { { device => $_, state => 'active' } } qw(/dev/sdd /dev/sdf)],
+ },
+ };
+ $mp->mock(path_status_by_wwid => sub { $healthy });
+ my ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{state}, 'optimal', 'all paths usable without an expected count');
+ $config->mock(
+ read_config =>
+ sub { { ids => { '3600map' => { type => 'wwid', 'paths-expected' => 3 } } } },
+ );
+ ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{'paths-expected'}, 3, 'expected count of the entry');
+ is($map->{state}, 'degraded', 'fewer paths than the entry expects');
+ $config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+}
+
+$mp->mock(path_status_by_wwid => sub { {} });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unobserved) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($unobserved->{'paths-total'}, 2, 'map membership supplies total without daemon status');
+ok(!exists($unobserved->{'paths-active'}), 'no invented active count');
+ok(!exists($unobserved->{state}), 'no false failed state');
+
+$cfg->{ids}->{data} = { type => 'lvm', vgname => 'data' };
+$hints = "hints_version: 2.1\nscan:/dev/mapper/lun pvid:abc devn:253:0 vg:data\n";
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($cached) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($cached->{vgname}, 'data', 'hints supply the display VG');
+is($cached->{usage}, 'lvm', 'hints also supply cached usage evidence');
+is($cached->{'used-by-storage'}, 'data', 'VG allows storage attribution');
+for my $contents (undef, '', "scan=/dev/mapper/lun vg=data\n") {
+ $hints = $contents;
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is(scalar(@$rows), 2, 'missing or unrecognized hints do not lose LUNs');
+ my ($uncached) = grep { $_->{wwid} eq '3600map' } @$rows;
+ ok(!exists($uncached->{vgname}), 'VG name is absent without a hint');
+ ok(!exists($uncached->{'used-by-storage'}), 'VG-derived attribution is also absent');
+ is($uncached->{usage}, 'unused', 'usage falls back to other cached evidence');
+}
+
+$disks->{sdc}->{used} = 'ext4';
+$maps = {};
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{usage}, 'other', 'foreign data from a sibling path is retained');
+is($rows->[0]->{detail}, 'ext4', 'signature detail');
+$scan->mock(stable_path => sub { $_[0] eq '/dev/sdc' ? '/dev/disk/by-id/scsi-3600plain' : undef });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/scsi-3600plain', 'by-id link of the second path');
+is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id link resolves to');
+
+$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
+$scan->mock(file_read_firstline => sub { 'eui.0123456789abcdef' });
+$scan->unmock('stable_path');
+$scan->mock(abs_path => sub { '/dev/nvme0n1' });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'none', 'NVMe without native multipath paths');
+$disk->mock(
+ get_nvme_path_status => sub {
+ { nvme0n1 =>
+ { active => 1, paths => [{ device => '/dev/nvme0c0n1', state => 'live' }] } };
+ },
+);
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'native', 'NVMe uses kernel-native multipath');
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/nvme-eui.0123456789abcdef', 'NVMe stable name');
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'native row matches the API schema');
+
+$disk->mock(is_partition => sub { 1 });
+ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
+$disk->mock(is_partition => sub { 0 });
+my $mp_module = Test::MockModule->new('PVE::Multipath');
+$mp_module->redefine(device_map => sub { { wwid => '3600a', partition => 1 } });
+ok(!PVE::Storage::SAN::is_san_device('/dev/dm-5'), 'neither is one that kpartx maps');
+$mp_module->redefine(device_map => sub { { wwid => '3600a' } });
+ok(PVE::Storage::SAN::is_san_device('/dev/dm-4'), 'while the map itself is');
+
+done_testing();
^ permalink raw reply related [relevance 9%]
* [PATCH v6 manager 39/42] ui: dc: san: add a guided setup for shared LVM on Fibre Channel
2026-11-18 6:52 6% [PATCH v6 cluster,storage,docs,manager 00/42] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-18 6:52 9% ` [PATCH v6 storage 18/42] api: scan: add a SAN LUN inventory Thomas Lamprecht
@ 2026-11-18 6:52 10% ` Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 6:52 UTC (permalink / raw)
To: pve-devel
Fibre Channel LUNs show up as block devices on the nodes, without a
storage that connects to them, so Datacenter > Storage > Add has no
dialog to start from. Add a Fibre Channel entry to the guided setup of
the SAN view. The entry offers SCSI LUNs only. An NVMe/FC namespace uses
the native multipath of the kernel and has no storage that connects it,
so the cluster-wide status could not show its state on the nodes.
The setup enables multipath for the LUN if needed, so its menu entry
needs Sys.Modify as well. Then the setup creates the volume group
through the node serving the web UI and adds the shared LVM storage
itself. The node disk API would add the storage for all nodes and
without the snapshot setting. Before it changes anything, the setup
checks that the storage ID is free, as it cannot create the volume group
a second time.
As the setup adds the storage, it waits for the volume group task on its
own, not in a task window. Closing a task window would end the setup
with a volume group and no storage. For the same reason, the setup
cannot be closed until the wait is over. If the task state cannot be
read for a while, the setup ends and says how to add the storage by
hand, as the task may still succeed and must not be started again.
No storage knows how many paths a node should have to a Fibre Channel
LUN. So a multipath entry that the setup adds expects as many paths as
the map has on the node serving the web UI. A node zoned to fewer
fabrics, or one that lost a path, then shows the LUN as degraded.
Nodes do not scan for a LUN that gets mapped to them after their login
to the array, so the setup points to the rescan of the Fibre Channel
hosts.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/dc/SAN.js | 5 +-
www/manager6/storage/wizard/FibreChannel.js | 175 ++++++++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 23 ++-
www/manager6/storage/wizard/Wizard.js | 131 ++++++++++++++-
www/manager6/window/SANLunState.js | 10 +-
6 files changed, 331 insertions(+), 14 deletions(-)
create mode 100644 www/manager6/storage/wizard/FibreChannel.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 09a02a9c4..1644e1d41 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -390,6 +390,7 @@ JSSRC= \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
storage/wizard/IScsi.js \
+ storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index 9255d2f6a..165411314 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -111,9 +111,10 @@ Ext.define('PVE.dc.SANView', {
autoShow: true,
apiCallDone: (success) => success && reload(),
});
- let setupItem = (wizardType) => ({
+ let setupItem = (wizardType, disabled) => ({
text: PVE.storage.wizard.subject(wizardType),
iconCls: 'fa fa-fw fa-building',
+ disabled,
handler: () =>
Ext.create('PVE.storage.wizard.SAN', {
wizardType,
@@ -125,7 +126,7 @@ Ext.define('PVE.dc.SANView', {
{
text: gettext('Guided Setup'),
disabled: !canSetup,
- menu: [setupItem('iscsi')],
+ menu: [setupItem('iscsi'), setupItem('fc', !canModify)],
},
];
me.items = [
diff --git a/www/manager6/storage/wizard/FibreChannel.js b/www/manager6/storage/wizard/FibreChannel.js
new file mode 100644
index 000000000..200e7d83a
--- /dev/null
+++ b/www/manager6/storage/wizard/FibreChannel.js
@@ -0,0 +1,175 @@
+PVE.storage.wizard.createFC = function (wizard, values, lun) {
+ let fail = (response) => wizard.showError(response.htmlStatus);
+ let create = function (row) {
+ if (wizard.destroyed) {
+ return;
+ }
+ // the request starts the task that waitForTask() then waits for, so keep the setup open
+ let keepOpen = () => false;
+ wizard.on('beforeclose', keepOpen);
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${Proxmox.NodeName}/disks/lvm`,
+ method: 'POST',
+ params: { name: values.vgname, device: row['by-id'] || row.devpath },
+ waitMsgTarget: wizard,
+ callback: () => wizard.un('beforeclose', keepOpen),
+ failure: fail,
+ success: function (response) {
+ if (wizard.destroyed) {
+ return;
+ }
+ let addStorage = () =>
+ wizard.addLVMStorage(values, (res) =>
+ wizard.stopWithError(
+ res.htmlStatus +
+ '<br>' +
+ gettext(
+ 'The volume group was created, but adding the storage failed. Add it under Datacenter > Storage > Add > LVM with Shared enabled.',
+ ),
+ ),
+ );
+ let lost = (status) =>
+ wizard.stopWithError(
+ status +
+ '<br>' +
+ gettext(
+ 'Could not read the task status. The volume group creation task may still be running. Check its log under Node > Task History. If it succeeds, add the volume group under Datacenter > Storage > Add > LVM with Shared enabled.',
+ ),
+ );
+ let message = gettext('Creating the volume group...');
+ wizard.waitForTask(response.result.data, message, addStorage, lost);
+ },
+ });
+ };
+ let hasMultipath = (row) => ['manual', 'storage', 'unmanaged'].includes(row.multipath);
+ // Fibre Channel has no storage that knows how many paths a node should have, so an entry the
+ // setup adds expects the paths of this node. A node with fewer paths then shows as degraded.
+ // The wizard remembers the entry it added, so that a retry still sets the expected paths before
+ // it creates the volume group.
+ let expectPaths = function (row) {
+ if (!(row['paths-total'] >= 2)) {
+ delete wizard.addedEntry;
+ create(row);
+ return;
+ }
+ Proxmox.Utils.API2Request({
+ url: `/cluster/multipath/wwid/${encodeURIComponent(lun.wwid)}`,
+ method: 'PUT',
+ params: { 'paths-expected': row['paths-total'] },
+ waitMsgTarget: wizard,
+ failure: fail,
+ success: () => {
+ delete wizard.addedEntry;
+ create(row);
+ },
+ });
+ };
+ let waitForMap = function () {
+ if (wizard.destroyed) {
+ return;
+ }
+ let store = Ext.create('Proxmox.data.UpdateStore', {
+ storeid: 'san-wizard-map',
+ model: 'pve-san-lun',
+ interval: 3000,
+ proxy: { type: 'proxmox', url: `/api2/json/nodes/${Proxmox.NodeName}/scan/san-luns` },
+ });
+ let timer = Ext.defer(function () {
+ store.destroy();
+ if (!wizard.destroyed) {
+ wizard.setLoading(false);
+ wizard.showError(
+ gettext(
+ 'The multipath map did not appear within 90 seconds. Check Node > SAN, then reload the LUN list.',
+ ),
+ );
+ }
+ }, 90000);
+ wizard.on(
+ 'destroy',
+ () => {
+ clearTimeout(timer);
+ if (!store.destroyed) {
+ store.destroy();
+ }
+ },
+ null,
+ { single: true },
+ );
+ wizard.setLoading(gettext('Waiting for the multipath map...'));
+ store.on('load', function (s, records, success, operation) {
+ if (wizard.destroyed) {
+ return;
+ }
+ let row = records?.find((rec) => rec.get('wwid') === lun.wwid)?.data;
+ if (!success || (row && hasMultipath(row))) {
+ clearTimeout(timer);
+ store.destroy();
+ wizard.setLoading(false);
+ if (success) {
+ wizard.down('#luns').down('grid').getSelection()[0].set(row);
+ if (wizard.addedEntry === lun.wwid) {
+ expectPaths(row);
+ } else {
+ create(row);
+ }
+ } else {
+ wizard.showError(Proxmox.Utils.getResponseErrorMessage(operation.getError()));
+ }
+ }
+ });
+ store.startUpdate();
+ };
+ let setup = function () {
+ if (hasMultipath(lun)) {
+ if (wizard.addedEntry === lun.wwid) {
+ expectPaths(lun);
+ } else {
+ create(lun);
+ }
+ } else if (lun.multipath === 'pending' || wizard.addedEntry === lun.wwid) {
+ waitForMap();
+ } else {
+ let params = { wwid: lun.wwid };
+ if (values.nodes) {
+ params.nodes = values.nodes;
+ }
+ Proxmox.Utils.API2Request({
+ url: '/cluster/multipath/wwid',
+ method: 'POST',
+ params,
+ waitMsgTarget: wizard,
+ failure: fail,
+ success: () => {
+ wizard.addedEntry = lun.wwid;
+ waitForMap();
+ },
+ });
+ }
+ };
+ // The storage is added last. Its ID has to be free before anything is created: once the volume
+ // group exists, the setup cannot create it again.
+ Proxmox.Utils.API2Request({
+ url: '/storage',
+ method: 'GET',
+ waitMsgTarget: wizard,
+ failure: fail,
+ success: function (response) {
+ if (wizard.destroyed) {
+ return;
+ }
+ if (response.result.data.some((entry) => entry.storage === values.storage)) {
+ wizard.showError(
+ Ext.htmlEncode(
+ Ext.String.format(
+ gettext('Storage ID "{0}" is already in use. Choose another ID.'),
+ values.storage,
+ ),
+ ),
+ );
+ return;
+ }
+ setup();
+ },
+ });
+};
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index dbf789f4e..0a6d5c4a4 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -22,6 +22,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
let wizard = me.up('window');
let grid = me.down('grid');
me.rstore.stopUpdate();
+ if (!wizard.connection) {
+ me.rstore.startUpdate();
+ return;
+ }
me.store.setFilters([
{ property: 'iscsi-target', value: wizard.connection.target, exactMatch: true },
]);
@@ -68,6 +72,15 @@ Ext.define('PVE.storage.wizard.LunSelect', {
'A LUN that is in use cannot be selected. A LUN with data that is no longer needed has to be wiped under Node > SAN first.',
),
},
+ ...(me.rescanNote
+ ? [
+ {
+ xtype: 'component',
+ margin: '0 0 10 0',
+ html: `<span class="pmx-hint">${Ext.htmlEncode(gettext('Note:'))}</span> ${me.rescanNote}`,
+ },
+ ]
+ : []),
{
xtype: 'grid',
flex: 1,
@@ -146,7 +159,15 @@ Ext.define('PVE.storage.wizard.LunSelect', {
me.callParent();
Proxmox.Utils.monStoreErrors(me.down('grid'), me.rstore);
me.mon(me.rstore, 'load', updateSelection);
- me.on('activate', () => me.reload());
+ me.on('activate', function () {
+ if (me.up('window').wizardType === 'fc') {
+ me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ me.store.setFilters([
+ { filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')) },
+ ]);
+ }
+ me.reload();
+ });
me.on('deactivate', () => me.rstore.stopUpdate());
me.on('destroy', () => {
me.store.destroy();
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index 1f3975b75..2affda528 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -1,7 +1,10 @@
Ext.ns('PVE.storage.wizard');
PVE.storage.wizard.subject = (type) =>
- Ext.String.format(gettext('LVM on {0}'), PVE.Utils.format_storage_type(type));
+ Ext.String.format(
+ gettext('LVM on {0}'),
+ type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type),
+ );
PVE.storage.wizard.validateNodes = function () {
let nodes = [].concat(this.getValue() || []).filter(Boolean);
@@ -20,6 +23,11 @@ Ext.define('PVE.storage.wizard.SAN', {
width: 1050,
height: 620,
+ stopWithError: function (message) {
+ this.close();
+ Ext.Msg.alert(gettext('Error'), message);
+ },
+
showError: function (message) {
if (this.destroyed) {
return;
@@ -28,6 +36,65 @@ Ext.define('PVE.storage.wizard.SAN', {
Ext.Msg.alert(gettext('Error'), message);
},
+ // Waits for a task with the setup masked and continues with next() once it succeeded. A task
+ // window of its own could be closed while the task runs, which would end the setup there. The
+ // setup cannot be closed during the wait either, for example with the Escape key.
+ // If the state of the task cannot be read for some time, lost() gets the error: the task may
+ // still be running then, so the setup must not start it again.
+ waitForTask: function (upid, message, next, lost) {
+ let me = this;
+ let task = Proxmox.Utils.parse_task_upid(upid);
+ let failures = 0;
+ let keepOpen = () => false;
+ let done = function (error) {
+ if (me.destroyed) {
+ return;
+ }
+ me.un('beforeclose', keepOpen);
+ me.setLoading(false);
+ if (error === undefined) {
+ next();
+ } else {
+ me.showError(error);
+ }
+ };
+ let poll = function () {
+ if (me.destroyed) {
+ return;
+ }
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${task.node}/tasks/${encodeURIComponent(upid)}/status`,
+ method: 'GET',
+ failure: function (response) {
+ if (me.destroyed) {
+ return;
+ }
+ if (++failures < 5) {
+ Ext.defer(poll, 2000);
+ return;
+ }
+ me.un('beforeclose', keepOpen);
+ me.setLoading(false);
+ lost(response.htmlStatus);
+ },
+ success: function (response) {
+ failures = 0;
+ let { status, exitstatus } = response.result.data;
+ if (status !== 'stopped') {
+ Ext.defer(poll, 1000);
+ return;
+ }
+ let result = Proxmox.Utils.parse_task_status(exitstatus);
+ let failed = result === 'error' || result === 'unknown';
+ done(failed ? Ext.htmlEncode(exitstatus) : undefined);
+ },
+ });
+ };
+ me.on('beforeclose', keepOpen);
+ me.setLoading(message);
+ poll();
+ },
+
volumeSettings: function () {
let me = this;
let value = (name) => me.down(`field[name=${name}]`).getValue();
@@ -35,7 +102,13 @@ Ext.define('PVE.storage.wizard.SAN', {
storage: value('storage'),
vgname: value('vgname'),
'snapshot-as-volume-chain': value('snapshot-as-volume-chain') ? 1 : 0,
- nodes: me.connection.nodes,
+ nodes:
+ me.wizardType === 'fc'
+ ? []
+ .concat(value('nodes') || [])
+ .filter(Boolean)
+ .join(',')
+ : me.connection.nodes,
};
},
@@ -63,6 +136,7 @@ Ext.define('PVE.storage.wizard.SAN', {
Ext.create('PVE.window.SANLunState', {
wwid,
storage: values.storage,
+ fc: me.wizardType === 'fc',
autoShow: true,
});
},
@@ -70,11 +144,18 @@ Ext.define('PVE.storage.wizard.SAN', {
},
multipathSummary: function (lun) {
+ let me = this;
// an explicit entry takes precedence, also for a LUN of the connection storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
}
- return PVE.SANUtils.multipathText('storage', this.connection.storage);
+ if (me.connection) {
+ return PVE.SANUtils.multipathText('storage', me.connection.storage);
+ }
+ // the Fibre Channel setup adds an entry for a LUN without multipath
+ return lun.multipath === 'none'
+ ? gettext('Explicit entry, added by this setup')
+ : PVE.SANUtils.multipathText(lun.multipath, lun['multipath-storage']);
},
updateSummary: function () {
@@ -82,7 +163,6 @@ Ext.define('PVE.storage.wizard.SAN', {
let values = me.volumeSettings();
let lun = me.down('#luns').getSelection();
let rows = [
- [gettext('Connection Storage'), me.connection.storage],
[gettext('Storage ID'), values.storage],
[gettext('Volume Group'), values.vgname],
['WWID', lun.wwid],
@@ -94,6 +174,9 @@ Ext.define('PVE.storage.wizard.SAN', {
Proxmox.Utils.format_boolean(values['snapshot-as-volume-chain']),
],
];
+ if (me.connection) {
+ rows.unshift([gettext('Connection Storage'), me.connection.storage]);
+ }
me.down('#summary')
.getStore()
.setData(rows.map(([key, value]) => ({ key, value })));
@@ -104,11 +187,19 @@ Ext.define('PVE.storage.wizard.SAN', {
let values = me.volumeSettings();
let lun = me.down('#luns').getSelection();
me.down('#submit').disable();
- PVE.storage.wizard.createIScsiLVM(me, values, lun);
+ if (me.wizardType === 'fc') {
+ PVE.storage.wizard.createFC(me, values, lun);
+ } else {
+ PVE.storage.wizard.createIScsiLVM(me, values, lun);
+ }
},
initComponent: function () {
let me = this;
+ if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ throw 'no SAN storage type specified';
+ }
+ let iscsi = me.wizardType === 'iscsi';
me.subject = PVE.storage.wizard.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
let common = PVE.panel.StorageBase.commonFields(true);
@@ -130,13 +221,35 @@ Ext.define('PVE.storage.wizard.SAN', {
snapshots.hint,
],
};
+ if (!iscsi) {
+ settings.advancedItems = [
+ { ...common.nodes, validator: PVE.storage.wizard.validateNodes },
+ ];
+ }
me.items = [
- { xtype: 'pveStorageWizardIScsiTarget', title: gettext('Target'), itemId: 'target' },
+ ...(iscsi
+ ? [
+ {
+ xtype: 'pveStorageWizardIScsiTarget',
+ title: gettext('Target'),
+ itemId: 'target',
+ },
+ ]
+ : []),
{
xtype: 'pveStorageWizardLunSelect',
title: 'LUN',
itemId: 'luns',
onlineHelp: 'storage_multipath',
+ // the nodes only see a newly mapped Fibre Channel LUN after a rescan
+ rescanNote: iscsi
+ ? undefined
+ : Ext.String.format(
+ gettext(
+ 'After mapping a new LUN on the array, rescan the Fibre Channel hosts of each node (<a href="{0}" target="_blank" rel="noopener noreferrer">documentation</a>).',
+ ),
+ Ext.htmlEncode(Proxmox.Utils.get_help_link('storage_multipath')),
+ ),
},
settings,
{
@@ -171,14 +284,16 @@ Ext.define('PVE.storage.wizard.SAN', {
me.callParent();
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (tab === me.down('#luns')) {
+ if (iscsi && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- me.down('#submit').setText(gettext('Next'));
+ if (iscsi) {
+ me.down('#submit').setText(gettext('Next'));
+ }
me.on('destroy', () => me.reloadCallback?.());
},
});
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index 154836f3b..a0a6d514d 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -51,9 +51,13 @@ Ext.define('PVE.window.SANLunState', {
margin: '0 0 10 0',
html: Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
- ),
+ me.fc
+ ? gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.',
+ )
+ : gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
+ ),
me.storage,
),
),
^ permalink raw reply related [relevance 10%]
* [PATCH v6 cluster,storage,docs,manager 00/42] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM
@ 2026-11-18 6:52 6% Thomas Lamprecht
2026-11-18 6:52 13% ` [PATCH v6 storage 03/42] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
` (3 more replies)
0 siblings, 4 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 6:52 UTC (permalink / raw)
To: pve-devel
This is v6 of the combined and reduced series of the cluster-wide
multipath work [0][1] and Dietmar's RFC for guided remote storage setup
and SAN visibility [2].
v6 is v5 [3] rebased onto current master, where plugin API 17 with the
volume types, the plugin metadata for the web UI and the property
isolation for plugins landed underneath, plus what an independent review
of v5 turned up:
- The status update no longer waits for the missing map of an LVM base
volume, nor asks a hanging multipathd for its paths. With three such
storages a pass took 32 seconds instead of 1.2 in my lab. Activating
a volume for a guest still waits.
- An existing volume group on a partition of a multipath map can be
added again, also with the Multipath option of the iSCSI storage.
- The node disk API only creates the storage of a volume group on a
LUN; v5 could join a storage added meanwhile with another volume
group.
- The Fibre Channel setup waits for the volume group task itself and
cannot be closed meanwhile. Closing the task window ended it with a
volume group and no storage.
- The setup menu also needs Datastore.Audit or Datastore.AllocateSpace.
- The first status pass removed a drop-in with one of the generated
names under /etc/multipath/conf.d, also one that Proxmox VE had not
written. Such a file now stays, and the node reports an error while
it needs that name.
- The volume group creation and the wipe also refuse a LUN that is in
use through another of its SCSI paths, for example by a guest started
before the map existed. A name in the request has to lead to the same
device after the LUN lookup still.
- A node only reported the first of the storages that request a map.
- Node > Disks > LVM creates a shared storage on a SAN LUN, on a single
path for a Fibre Channel LUN without a map. Its dialog now points to
the guided setup.
- Enable Multipath under Node > SAN opens the entry dialog, where the
admin sees and chooses the nodes, instead of adding an entry for all.
- Smaller ones: partition bases and LUNs reached through two targets
are attributed to their storage, Node > SAN shows the path counts of
a degraded LUN, and the SAN view names the nodes in Unknown.
- let the disk wipe take by-id, dm-N and mapper names for any device,
so it also wiped a logical volume with a guest disk by such a name.
These names are now accepted for a LUN only.
BlockBridge was very reactive here and tested v5 with 1000 LUNs or
namespaces on a node, one per guest disk. For them LUN inventory took
over ten seconds. New patches 16 and 17 look the disks up by name and
read the udev data with one call, which brought it to under a second for
1000 NVMe/TCP namespaces in my lab. The test also showed the disks of
running guests as unused, as no storage references them. New patches 25,
27, 41 and 42 show the guest or process that has a LUN open for writing,
and a hidden column for the iSCSI target, which names the volume for a
plugin with one target per volume. They come last in their repositories,
so that they can be left out; the NVMe over Fabrics series then applies
up to its last manager patch. A LUN that stays attached with nothing
holding it, for example after a failed detach, still shows as unused:
telling whose it is needs the plugin, and I left that for later.
What I left as is for now: lsblk for the usage of a LUN, as it opens no
device without a udev entry (measured again); 'auto_resize grow_only'
for all maps of a node, as multipath has no other form of it, documented
with how to turn it off; a node that drops the new option when it writes
storage.cfg before it is upgraded, which the chapter covers; and an
empty volume group that another node wipes right after its creation.
Overview of what an admin gets with this:
- Datacenter > Storage > SAN, a new entry below Storage, shows the
multipath state of every node and of the LUNs that Proxmox VE
manages or has a storage on, and edits the multipath entries and
array-specific overrides. I explicitly chose this over the
client/plugin side of Storage, as we do not have e.g. Ceph or
ZFS/LVM/... creation in there either. We might want to rethink and
consolidate our storage interface vs. management story in the
future, but IMO a partial switch now is not worth it, that would add
even more potential for confusion than the new SAN view.
- Its Guided Setup menu leads through shared LVM on a LUN: for iSCSI it
connects or reuses a target, with the initiator names of all nodes at
hand, for Fibre Channel it takes a LUN the nodes already see. Both
set up multipath and end with the state of the LUN on every node.
- Datacenter > Storage > Add keeps its dialogs. The iSCSI one gets a
Multipath option and the LVM one enables Shared for a base storage,
and both point to the SAN view.
- Node > SAN lists the LUNs of a node with their paths and usage, can
wipe a LUN that no storage uses, and shows the iSCSI sessions.
The rules the series follows since v4: nodes add WWIDs and maps but
never remove them, a write is checked where it happens, lists do not
probe devices, there are no new iSCSI operations, the guided setup makes
the API calls an admin would make by hand, and multipath management is
turned on by the admin. The v4 cover [7] has the reasons.
Two things an admin will likely miss: there is no notification when a
LUN loses path redundancy, the state only shows on the SAN pages and in
the API. And Fibre Channel starts at a LUN the nodes already see; the
chapter gives the commands to list WWPNs and rescan the HBAs.
How it works:
- /etc/pve/multipath.cfg holds explicit entries per WWID,
/etc/pve/multipath-overrides.conf array settings; patch 01
registers both. An iSCSI storage with the 'managed-multipath' option
supplies its LUNs without entries. The option is not named
'multipath', as third-party plugins use that name, and the storage
layer leaves out a third-party plugin that declares a property of
another plugin.
- pvestatd calls one function of pve-storage per pass. It adds the
WWIDs the node needs to /etc/multipath/wwids, writes the drop-ins
/etc/multipath/conf.d/pve-*.conf, reloads multipathd after a change,
and publishes the state of the maps that Proxmox VE manages or that a
storage builds on through the node key-value store.
- /cluster/multipath/status aggregates these reports;
/cluster/multipath/{wwid,overrides} edit the two files;
/nodes/{node}/scan/san-luns lists the LUNs of a node and
/nodes/{node}/iscsi its sessions.
- The volumes of an iSCSI storage with the option are named after the
multipath map, so an LVM storage uses them through 'base' as before.
- Volume group creation and wipe run under a cluster lock per LUN. They
refuse a LUN that a storage uses or a process of the node has open,
also through another path. Opens through another device node, such as
one of a container, and users on other hosts are not seen.
Patches:
- cluster 01: register the two configuration files
- storage 02-25: helpers for the disk and iSCSI session inventory
(mostly Dietmar's), the multipath library and configuration, the
iSCSI option, the per-node apply and status with their API, the disk
list of many disks, the LUN inventory, the read-only iSCSI status,
volume groups on LUNs, the wipe and the process that has a LUN open
- docs 26-27: the multipath chapter, rewritten around tasks, and the
paragraph for a LUN that a process has open
- manager 28-42: the pvestatd call, report and API mounts, then the
views, the two dialog changes, the two guided setups, the note in the
add dialogs, and the guest or process and the target of a LUN
Other changes since v5 [3]:
- rebased onto current master in all four repositories, with the plugin
metadata for the iSCSI option and its entry in the pinned property
list
- the setup menu is named Guided Setup instead of Add Storage, as three
different things in two views were called add
- search fields in the LUN lists and the iSCSI tree, which on a node
also match path devices and WWPNs, for example one from the kernel
log
- the process check compares device numbers, and the volume group check
refuses a volume group that any storage names
- style fixes, warnings of three test files, and shorter commit
messages
When applying, versioned dependencies have to be set: pve-manager on
libpve-storage-perl, and libpve-storage-perl (also as build dependency)
on the libpve-cluster-perl with patch 01, as PVE::Storage
registers the two files when it is loaded. pve-manager also needs the
pve-doc-generator (build) and pve-docs with the multipath chapter, for
its help links. If the bound for LVM status commands [4] gets applied
too, whichever is applied second has to pass the status cache to the two
lvm_vgs() calls of the base volume activation, as they can block a
status pass otherwise. Both mark the cache of the status update with
'status_only', in the same line.
The per-node target and portal series [5][6] are independent of this
one. It takes the LUNs of an iSCSI storage from the sessions of its one
target, so if a storage can have several targets per node, whichever is
applied second has to cover that.
I tested on the lab of v4 [7] and v5: a six-node nested cluster with a
NetApp AFF A20 (three iSCSI portals, NVMe/TCP), Linux LIO targets and
software FCoE, upgraded from the v5 build, with the NVMe over Fabrics
series and [4] on top. Most review fixes ran as drills against the fault
they fix, a few have unit tests only. Both guided setups ended optimal
on six nodes, the Fibre Channel one also with a failing task, delayed
and cut-off status requests and Escape pressed during the wait. A guest
on NetApp, Fibre Channel and NVMe/TCP disks went through snapshots, live
migrations, a path cut under I/O, an online resize and a node reboot
with checksums compared. The scale test ran with 1000 NVMe/TCP
namespaces and with 1000 iSCSI LUNs with maps; the disk list and the LUN
inventory gave the same result with the one udev call and with a query
per disk, also on the other five nodes. Guests with a NetApp map, a
Fibre Channel LUN or an NVMe/TCP namespace as disk, also on one path of
a map, showed in the LUN lists, and the wipe and the volume group
creation refused these LUNs. Most of this ran on builds before the last
fixes, which got drills of their own. I looked at each changed view and
dialog in the web UI.
Not repeated for v6: a path cut on Fibre Channel, the CLI procedure, a
LUN that one node is not allowed to see, all paths down with queued I/O,
the SAN views with a stopped multipathd, the multipath status of a node
with 1000 foreign maps and the series installed alone.
[0]: https://lore.proxmox.com/pve-devel/20260626121000.2095591-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20260703124707.1172980-2-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20260731102156.3947857-1-dietmar@proxmox.com/
[3]: https://lore.proxmox.com/pve-devel/20261116012355.3187417-1-t.lamprecht@proxmox.com/
[4]: https://lore.proxmox.com/pve-devel/20261111015217.941220-1-t.lamprecht@proxmox.com/
[5]: https://lore.proxmox.com/pve-devel/20260430173220.441001-1-m.limbeck@proxmox.com/
[6]: https://lore.proxmox.com/pve-devel/20260804090819.2136483-1-dietmar@proxmox.com/
[7]: https://lore.proxmox.com/pve-devel/20261113030146.1559030-1-t.lamprecht@proxmox.com/
pve-cluster:
Thomas Lamprecht (1):
cfs: observe the multipath configuration files
src/PVE/Cluster.pm | 2 ++
src/pmxcfs/status.c | 2 ++
2 files changed, 4 insertions(+)
pve-storage:
Dietmar Maurer (8):
diskmanage: collect disk transport type from lsblk
diskmanage: qualify NVMe over fabrics transport
diskmanage: optionally include iSCSI session devices in disk enumeration
diskmanage: collect native NVMe multipath path state
iscsi: factor out session device map from device list
diskmanage: add helper to list multipath devices
pvesm: expose the SAN LUN inventory
api: add node-level iSCSI status
Thomas Lamprecht (16):
multipath: add a library around multipathd
multipath: add a cluster-wide configuration
iscsi: add an option to manage storage LUNs with multipath
lvm: activate a missing base volume before using the volume group
multipath: apply the configuration on every node
multipath: publish per-node status
api: add endpoints for the cluster-wide multipath configuration
api: multipath: add the cluster-wide health status
diskmanage: look up the requested disks by name
diskmanage: read the udev data of all disks with one call
api: scan: add a SAN LUN inventory
disks: lvm: drop unused imports
disks: lvm: allow volume groups on SAN LUNs and multipath maps
disks: lvm: refuse to destroy the volume group of a shared storage
disks: allow wiping a SAN LUN that no storage uses
api: scan: report the process that has a SAN LUN open
debian/control | 3 +-
src/PVE/API2/Disks.pm | 46 +-
src/PVE/API2/Disks/LVM.pm | 77 ++-
src/PVE/API2/ISCSI.pm | 166 ++++++
src/PVE/API2/Makefile | 2 +
src/PVE/API2/Multipath.pm | 451 +++++++++++++++
src/PVE/API2/Storage/Scan.pm | 216 ++++++++
src/PVE/CLI/pvesm.pm | 14 +
src/PVE/Diskmanage.pm | 375 +++++++++++--
src/PVE/ISCSI/Topology.pm | 88 +++
src/PVE/Makefile | 6 +
src/PVE/Multipath.pm | 213 ++++++++
src/PVE/Multipath/Config.pm | 204 +++++++
src/PVE/Multipath/Generator.pm | 120 ++++
src/PVE/Multipath/Identity.pm | 44 ++
src/PVE/Multipath/Status.pm | 215 ++++++++
src/PVE/Storage.pm | 2 +-
src/PVE/Storage/ISCSIPlugin.pm | 219 +++++---
src/PVE/Storage/LVMPlugin.pm | 151 ++++-
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 409 ++++++++++++++
src/test/Makefile | 37 +-
src/test/disk_api_test.pm | 314 +++++++++++
src/test/disk_tests/iscsi/disklist | 1 +
.../disk_tests/iscsi/disklist_expected.json | 19 +
src/test/disk_tests/iscsi/lsblk | 5 +
src/test/disk_tests/iscsi/sda/device/model | 1 +
src/test/disk_tests/iscsi/sda/device/vendor | 1 +
.../disk_tests/iscsi/sda/queue/rotational | 1 +
src/test/disk_tests/iscsi/sda/size | 1 +
src/test/disk_tests/iscsi/sda_udevadm | 21 +
src/test/disk_tests/multipath/disklist | 11 +
.../multipath/disklist_expected.json | 107 ++++
src/test/disk_tests/multipath/dm-0/dm/name | 1 +
src/test/disk_tests/multipath/dm-0/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-0/size | 1 +
src/test/disk_tests/multipath/dm-0_slaves | 4 +
src/test/disk_tests/multipath/dm-1/dm/name | 1 +
src/test/disk_tests/multipath/dm-1/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-1/size | 1 +
src/test/disk_tests/multipath/dm-1_slaves | 4 +
src/test/disk_tests/multipath/dm-2/dm/name | 1 +
src/test/disk_tests/multipath/dm-2/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-2/size | 1 +
src/test/disk_tests/multipath/dm-2_slaves | 0
src/test/disk_tests/multipath/dm-3/dm/name | 1 +
src/test/disk_tests/multipath/dm-3/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-3/size | 1 +
src/test/disk_tests/multipath/dm-3_slaves | 0
src/test/disk_tests/multipath/dm-4/dm/name | 1 +
src/test/disk_tests/multipath/dm-4/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-4/size | 1 +
src/test/disk_tests/multipath/dm-4_slaves | 0
src/test/disk_tests/multipath/lsblk | 77 +++
src/test/disk_tests/multipath/lvs | 0
src/test/disk_tests/multipath/mounts | 1 +
.../multipath/multipath_expected.json | 59 ++
src/test/disk_tests/multipath/multipathd | 124 +++++
.../multipath/multipathd_status_expected.json | 40 ++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 +
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +
.../multipath/nvme_path_status_expected.json | 19 +
src/test/disk_tests/multipath/partlist | 0
src/test/disk_tests/multipath/pvs | 1 +
.../disk_tests/multipath/sda/device/model | 1 +
.../disk_tests/multipath/sda/device/vendor | 1 +
.../disk_tests/multipath/sda/holders/holder | 1 +
.../disk_tests/multipath/sda/queue/rotational | 1 +
src/test/disk_tests/multipath/sda/size | 1 +
src/test/disk_tests/multipath/sda_udevadm | 18 +
.../disk_tests/multipath/sdb/device/model | 1 +
.../disk_tests/multipath/sdb/device/vendor | 1 +
.../disk_tests/multipath/sdb/holders/holder | 1 +
.../disk_tests/multipath/sdb/queue/rotational | 1 +
src/test/disk_tests/multipath/sdb/size | 1 +
src/test/disk_tests/multipath/sdb_udevadm | 18 +
.../disk_tests/multipath/sdc/device/model | 1 +
.../disk_tests/multipath/sdc/device/vendor | 1 +
.../disk_tests/multipath/sdc/holders/holder | 1 +
.../disk_tests/multipath/sdc/queue/rotational | 1 +
src/test/disk_tests/multipath/sdc/size | 1 +
src/test/disk_tests/multipath/sdc_udevadm | 18 +
.../disk_tests/multipath/sdd/device/model | 1 +
.../disk_tests/multipath/sdd/device/vendor | 1 +
.../disk_tests/multipath/sdd/holders/holder | 1 +
.../disk_tests/multipath/sdd/queue/rotational | 1 +
src/test/disk_tests/multipath/sdd/size | 1 +
src/test/disk_tests/multipath/sdd_udevadm | 18 +
src/test/disk_tests/multipath/zpool | 1 +
.../disk_tests/sas/disklist_expected.json | 1 +
src/test/disk_tests/sas/lsblk | 5 +
src/test/disklist_test.pm | 175 +++++-
src/test/multipath-three-states.json | 52 ++
src/test/plugin_properties_test.pm | 1 +
src/test/run_disk_api_tests.pl | 11 +
src/test/run_iscsi_activation_tests.pl | 109 ++++
src/test/run_lun_identity_tests.pl | 57 ++
src/test/run_multipath_api_tests.pl | 515 ++++++++++++++++++
src/test/run_multipath_tests.pl | 169 ++++++
src/test/run_san_api_tests.pl | 94 ++++
src/test/run_san_library_tests.pl | 135 +++++
src/test/run_san_lun_scan_tests.pl | 252 +++++++++
src/test/run_san_nvme_tests.pl | 120 ++++
src/test/run_san_taint_tests.pl | 60 ++
src/test/run_san_wipe_tests.pl | 255 +++++++++
src/test/run_san_write_check_tests.pl | 205 +++++++
src/test/run_test_lvm_base_activation.pl | 121 ++++
src/test/run_test_lvm_base_volume.pl | 12 +-
src/test/run_test_lvm_create.pl | 46 ++
126 files changed, 6224 insertions(+), 194 deletions(-)
pve-docs:
Thomas Lamprecht (2):
storage: document the cluster-wide multipath management
storage: multipath: describe the use shown for an open LUN
pmxcfs.adoc | 2 +
pve-storage-iscsi.adoc | 11 ++
pve-storage-iscsidirect.adoc | 2 +-
pve-storage-lvm.adoc | 3 +
pve-storage-multipath.adoc | 309 +++++++++++++++++++++++++++++++++++
pvesm.adoc | 18 +-
6 files changed, 339 insertions(+), 6 deletions(-)
pve-manager:
Dietmar Maurer (2):
api: nodes: expose the iSCSI status
ui: node: san: show iSCSI targets and sessions
Thomas Lamprecht (13):
pvestatd: apply the multipath configuration and report the node status
report: add the managed multipath configuration
api: cluster: add the multipath endpoints
ui: dc: add a SAN view
ui: storage: iscsi: add the multipath option
ui: lvm: enable shared when a base storage is selected
ui: node: add SAN LUNs panel
ui: node: san: wipe a LUN that no storage uses
ui: dc: san: add a guided setup for shared LVM on iSCSI
ui: dc: san: add a guided setup for shared LVM on Fibre Channel
ui: storage: point the iSCSI and LVM add dialogs to the SAN view
ui: san: show the guest or process that has a LUN open
ui: node: san: add a column for the iSCSI target of a LUN
PVE/API2/Cluster.pm | 7 +
PVE/API2/Nodes.pm | 7 +
PVE/Report.pm | 3 +
PVE/Service/pvestatd.pm | 7 +
www/manager6/Makefile | 12 +
www/manager6/SANUtils.js | 202 ++++++++++
www/manager6/Utils.js | 19 +
www/manager6/dc/Config.js | 23 +-
www/manager6/dc/MultipathWwidEdit.js | 81 ++++
www/manager6/dc/SAN.js | 374 ++++++++++++++++++
www/manager6/node/Config.js | 24 ++
www/manager6/node/ISCSITargets.js | 150 +++++++
www/manager6/node/LVM.js | 3 +
www/manager6/node/SANLuns.js | 229 +++++++++++
www/manager6/storage/Base.js | 5 +
www/manager6/storage/IScsiEdit.js | 46 +++
www/manager6/storage/LVMEdit.js | 6 +
www/manager6/storage/wizard/FibreChannel.js | 175 ++++++++
www/manager6/storage/wizard/IScsi.js | 274 +++++++++++++
www/manager6/storage/wizard/LunSelect.js | 177 +++++++++
www/manager6/storage/wizard/NodeIdentities.js | 83 ++++
www/manager6/storage/wizard/Wizard.js | 299 ++++++++++++++
www/manager6/window/SANLunState.js | 115 ++++++
www/manager6/window/SANLunWipe.js | 52 +++
24 files changed, 2367 insertions(+), 6 deletions(-)
^ permalink raw reply [relevance 6%]
* [PATCH v6 storage 05/42] diskmanage: collect native NVMe multipath path state
2026-11-18 6:52 6% [PATCH v6 cluster,storage,docs,manager 00/42] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-18 6:52 13% ` [PATCH v6 storage 03/42] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
@ 2026-11-18 6:52 13% ` Thomas Lamprecht
2026-11-18 6:52 9% ` [PATCH v6 storage 18/42] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-18 6:52 10% ` [PATCH v6 manager 39/42] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 6:52 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
NVMe over Fabrics usually uses native multipath, whose paths
multipathd does not know. Collect the controller state and address
and the ANA state of each path from sysfs, grouped by namespace, so
the SAN LUN inventory can report path health for both multipath
stacks. Devices with a single local controller have no per-path
entries and are left out.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: drop redundant comments; call the wrapped test function with
arrow syntax]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 60 +++++++++++++++++++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../multipath/nvme_path_status_expected.json | 19 ++++++
src/test/disklist_test.pm | 16 +++++
11 files changed, 103 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
create mode 100644 src/test/disk_tests/multipath/nvme_path_status_expected.json
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index c342abcd..516c108d 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -818,6 +818,66 @@ sub get_disks {
return $disklist;
}
+# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
+# single-controller devices lack these children and are omitted.
+sub get_nvme_path_status {
+ my $res = {};
+
+ dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ 'nvme-subsys\d+',
+ sub {
+ my ($subsys) = @_;
+ my $subsysdir = "/sys/class/nvme-subsystem/$subsys";
+
+ dir_glob_foreach(
+ $subsysdir,
+ 'nvme\d+',
+ sub {
+ my ($ctrl) = @_;
+ my $ctrldir = "$subsysdir/$ctrl";
+ my $state = file_read_firstline("$ctrldir/state") // return;
+ my $address = file_read_firstline("$ctrldir/address");
+
+ dir_glob_foreach(
+ $ctrldir,
+ 'nvme\d+c\d+n\d+',
+ sub {
+ my ($pathdev) = @_;
+ return if $pathdev !~ m/^nvme(\d+)c\d+n(\d+)$/;
+ my $head = "nvme$1n$2";
+
+ my $entry = { device => "/dev/$ctrl", state => $state };
+ $entry->{address} = $address
+ if defined($address) && $address ne '';
+ my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
+ $entry->{'ana-state'} = $ana if defined($ana);
+
+ # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
+ # cannot serve IO even on a live controller
+ my $usable = $state eq 'live'
+ && (!defined($ana)
+ || $ana eq 'optimized'
+ || $ana eq 'non-optimized');
+
+ my $status = $res->{$head} //= { active => 0, paths => [] };
+ $status->{active}++ if $usable;
+ push @{ $status->{paths} }, $entry;
+ },
+ );
+ },
+ );
+ },
+ );
+
+ for my $status (values %$res) {
+ @{ $status->{paths} } =
+ sort { $a->{device} cmp $b->{device} } @{ $status->{paths} };
+ }
+
+ return $res;
+}
+
sub get_partnum {
my ($part_path) = @_;
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
new file mode 100644
index 00000000..803fab3e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
@@ -0,0 +1 @@
+traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
new file mode 100644
index 00000000..e48c58f5
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
@@ -0,0 +1 @@
+optimized
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
new file mode 100644
index 00000000..36618744
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
@@ -0,0 +1 @@
+traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
new file mode 100644
index 00000000..436c48ee
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
@@ -0,0 +1 @@
+inaccessible
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
new file mode 100644
index 00000000..f99fcb14
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
@@ -0,0 +1 @@
+0000:02:00.0
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme_path_status_expected.json b/src/test/disk_tests/multipath/nvme_path_status_expected.json
new file mode 100644
index 00000000..62611b3f
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme_path_status_expected.json
@@ -0,0 +1,19 @@
+{
+ "nvme2n1": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/nvme3",
+ "state": "live",
+ "address": "traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "optimized"
+ },
+ {
+ "device": "/dev/nvme4",
+ "state": "live",
+ "address": "traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "inaccessible"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 4c85d9e9..a7c00d2d 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -103,6 +103,7 @@ sub mocked_file_read_firstline {
my $originalsub = $diskmanage_module->original('file_read_firstline');
$path =~ s|^/sys/block|disk_tests/$testcasedir|;
+ $path =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|;
return $originalsub->($path);
}
@@ -112,6 +113,12 @@ sub mocked_dir_glob_foreach {
my $lines = [];
+ # nvme subsystem trees are provided as directories, glob them like production code
+ if ($dir =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|) {
+ my $originalsub = $diskmanage_module->original('dir_glob_foreach');
+ return $originalsub->($dir, $regex, $sub);
+ }
+
# read lines in from file
if ($dir =~ m{^/sys/block$}) {
@$lines = split(/\n/, read_test_file('disklist'));
@@ -230,6 +237,15 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'nvme path status should be the same');
+ }
+
done_testing($testcount);
};
}
^ permalink raw reply related [relevance 13%]
* [PATCH v6 storage 03/42] diskmanage: qualify NVMe over fabrics transport
2026-11-18 6:52 6% [PATCH v6 cluster,storage,docs,manager 00/42] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
@ 2026-11-18 6:52 13% ` Thomas Lamprecht
2026-11-18 6:52 13% ` [PATCH v6 storage 05/42] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
` (2 subsequent siblings)
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-18 6:52 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
lsblk reports 'nvme' for namespaces attached over a fabric too, so
they cannot be told from local PCIe drives. Read the transport from
the controller, or from a controller of the subsystem with native
multipath, and report nvme-fc, nvme-tcp, nvme-rdma or nvme-loop for
such namespaces.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: add the test case with the two namespaces only, as the multipath
devices it was part of follow later; mention the new values in the
transport description; call the wrapped test function with arrow
syntax]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Disks.pm | 3 +-
src/PVE/Diskmanage.pm | 27 ++++++++++++++
src/test/disk_tests/multipath/disklist | 2 ++
.../multipath/disklist_expected.json | 35 +++++++++++++++++++
src/test/disk_tests/multipath/lsblk | 18 ++++++++++
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 ++++++++
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +++++++
src/test/disklist_test.pm | 12 +++++++
17 files changed, 131 insertions(+), 1 deletion(-)
create mode 100644 src/test/disk_tests/multipath/disklist
create mode 100644 src/test/disk_tests/multipath/disklist_expected.json
create mode 100644 src/test/disk_tests/multipath/lsblk
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme8n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme8n1/size
create mode 100644 src/test/disk_tests/multipath/nvme8n1_udevadm
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/vendor
create mode 100644 src/test/disk_tests/multipath/nvme9n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme9n1/size
create mode 100644 src/test/disk_tests/multipath/nvme9n1_udevadm
diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index 1abab820..980ba7ff 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -138,7 +138,8 @@ __PACKAGE__->register_method({
transport => {
type => 'string',
description =>
- "The device transport, for example 'sata', 'sas', 'usb', 'fc', or 'nvme'.",
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'nvme', 'nvme-fc', or 'nvme-tcp'.",
optional => 1,
},
parent => {
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 4d66902b..7862bcd4 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -505,6 +505,26 @@ sub is_iscsi {
return 0;
}
+# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
+# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+sub get_nvme_transport {
+ my ($sysdir) = @_;
+
+ my $transport = file_read_firstline("$sysdir/device/transport");
+ return $transport if defined($transport);
+
+ dir_glob_foreach(
+ "$sysdir/device",
+ 'nvme\d+',
+ sub {
+ my ($controller) = @_;
+ $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ },
+ );
+
+ return $transport;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
@@ -597,6 +617,9 @@ sub get_disks {
# we do not want iscsi devices
return if is_iscsi($sysdir);
+ my $nvme_transport;
+ $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
+
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
@@ -648,7 +671,11 @@ sub get_disks {
wearout => $wearout,
};
+ # lsblk reports plain 'nvme' for fabrics attached namespaces
my $transport = $lsblk_info->{$devpath}->{tran};
+ if (defined($nvme_transport) && $nvme_transport ne 'pcie') {
+ $transport = "nvme-$nvme_transport";
+ }
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
diff --git a/src/test/disk_tests/multipath/disklist b/src/test/disk_tests/multipath/disklist
new file mode 100644
index 00000000..b5e636a5
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist
@@ -0,0 +1,2 @@
+nvme8n1
+nvme9n1
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
new file mode 100644
index 00000000..908c2b56
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -0,0 +1,35 @@
+{
+ "nvme8n1": {
+ "devpath": "/dev/nvme8n1",
+ "size": 10737418240,
+ "vendor": "unknown",
+ "model": "FCMODEL",
+ "serial": "FCNVME1",
+ "wwn": "uuid.20000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
+ "transport": "nvme-fc"
+ },
+ "nvme9n1": {
+ "devpath": "/dev/nvme9n1",
+ "size": 10737418240,
+ "vendor": "FABVEND",
+ "model": "FABRICS CTRL",
+ "serial": "FAB1",
+ "wwn": "uuid.10000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "transport": "nvme-tcp"
+ }
+}
diff --git a/src/test/disk_tests/multipath/lsblk b/src/test/disk_tests/multipath/lsblk
new file mode 100644
index 00000000..597adf94
--- /dev/null
+++ b/src/test/disk_tests/multipath/lsblk
@@ -0,0 +1,18 @@
+{
+ "blockdevices": [
+ {
+ "path": "/dev/nvme8n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ },
+ {
+ "path": "/dev/nvme9n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ }
+ ]
+}
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/model b/src/test/disk_tests/multipath/nvme8n1/device/model
new file mode 100644
index 00000000..1aac689e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/model
@@ -0,0 +1 @@
+FCMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/transport b/src/test/disk_tests/multipath/nvme8n1/device/transport
new file mode 100644
index 00000000..8b517d01
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/transport
@@ -0,0 +1 @@
+fc
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/queue/rotational b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/size b/src/test/disk_tests/multipath/nvme8n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1_udevadm b/src/test/disk_tests/multipath/nvme8n1_udevadm
new file mode 100644
index 00000000..d0cd5ea9
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1_udevadm
@@ -0,0 +1,14 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+N: nvme8n1
+S: disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVLINKS=/dev/disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVNAME=/dev/nvme8n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+E: DEVTYPE=disk
+E: ID_MODEL=FCMODEL
+E: ID_SERIAL=FCNVME_1
+E: ID_SERIAL_SHORT=FCNVME1
+E: ID_WWN=uuid.20000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=1
+E: SUBSYSTEM=block
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/model b/src/test/disk_tests/multipath/nvme9n1/device/model
new file mode 100644
index 00000000..aa0287c7
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/model
@@ -0,0 +1 @@
+FABMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/transport
new file mode 100644
index 00000000..f5483dbf
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/transport
@@ -0,0 +1 @@
+tcp
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/vendor b/src/test/disk_tests/multipath/nvme9n1/device/vendor
new file mode 100644
index 00000000..cdc6ddfa
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/vendor
@@ -0,0 +1 @@
+FABVEND
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/queue/rotational b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/size b/src/test/disk_tests/multipath/nvme9n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1_udevadm b/src/test/disk_tests/multipath/nvme9n1_udevadm
new file mode 100644
index 00000000..b6d13ccb
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1_udevadm
@@ -0,0 +1,12 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+N: nvme9n1
+E: DEVNAME=/dev/nvme9n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+E: DEVTYPE=disk
+E: ID_MODEL=FABRICS CTRL
+E: ID_SERIAL=FABRICS_1
+E: ID_SERIAL_SHORT=FAB1
+E: ID_WWN=uuid.10000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=0
+E: SUBSYSTEM=block
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index a0dc01f6..c7374fd5 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -101,6 +101,16 @@ sub mocked_is_iscsi {
return 0;
}
+sub mocked_file_read_firstline {
+ my ($path) = @_;
+
+ my $originalsub = $diskmanage_module->original('file_read_firstline');
+
+ $path =~ s|^/sys/block|disk_tests/$testcasedir|;
+
+ return $originalsub->($path);
+}
+
sub mocked_dir_glob_foreach {
my ($dir, $regex, $sub) = @_;
@@ -248,6 +258,8 @@ $diskmanage_module->mock(
},
);
print("\tMocked dir_is_empty\n");
+$diskmanage_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked file_read_firstline\n");
$diskmanage_module->mock('check_bin' => sub { return 1; });
print("\tMocked check_bin\n");
my $tools_module = Test::MockModule->new('PVE::ProcFSTools', no_auto => 1);
^ permalink raw reply related [relevance 13%]
* [PATCH v5 storage 16/36] api: scan: add a SAN LUN inventory
2026-11-16 1:23 5% [PATCH v5 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-16 1:23 13% ` [PATCH v5 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
2026-11-16 1:23 13% ` [PATCH v5 storage 05/36] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
@ 2026-11-16 1:23 9% ` Thomas Lamprecht
2026-11-16 1:23 9% ` [PATCH v5 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-16 1:23 UTC (permalink / raw)
To: pve-devel
Add /nodes/{node}/scan/san-luns, which lists the LUNs a node sees
over iSCSI, Fibre Channel or NVMe over Fabrics, one row per WWID with
the paths folded into their multipath map. The node disk list has
neither the maps nor a relation to volume groups and storages.
A row has the device to use, its size and transport, how multipath
handles the LUN, the health and state of its paths, and the known
usage with the volume group and storage. The usage comes from cached
data only, as probing a LUN whose paths are down can block.
The paths of a map are left out before the disk list queries udev
for each device. A node with a thousand LUNs has several thousand of
them, and the views poll this list every few seconds.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 202 ++++++++++++++++++
src/PVE/Diskmanage.pm | 7 +
src/PVE/Multipath.pm | 24 +++
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 197 +++++++++++++++++
src/test/Makefile | 8 +-
src/test/disk_tests/multipath/multipathd | 124 +++++++++++
.../multipath/multipathd_status_expected.json | 40 ++++
src/test/disklist_test.pm | 15 ++
src/test/run_san_api_tests.pl | 24 +++
src/test/run_san_lun_scan_tests.pl | 197 +++++++++++++++++
11 files changed, 839 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/Storage/SAN.pm
create mode 100644 src/test/disk_tests/multipath/multipathd
create mode 100644 src/test/disk_tests/multipath/multipathd_status_expected.json
create mode 100755 src/test/run_san_api_tests.pl
create mode 100755 src/test/run_san_lun_scan_tests.pl
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index a58bdd80..b4273f5c 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -12,6 +12,7 @@ use PVE::SafeSyslog;
use PVE::Storage::LVMPlugin;
use PVE::Storage::LvmThinPlugin;
use PVE::Storage::PBSPlugin;
+use PVE::Storage::SAN;
use PVE::Storage;
use base qw(PVE::RESTHandler);
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'nfs' },
{ method => 'pbs' },
+ { method => 'san-luns' },
{ method => 'zfs' },
];
@@ -373,6 +375,206 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'sanlunscan',
+ path => 'san-luns',
+ method => 'GET',
+ description => "List SAN LUNs with their paths and cached usage.",
+ protected => 1,
+ proxyto => "node",
+ permissions => {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ devpath => {
+ description => "The device path.",
+ type => 'string',
+ },
+ size => {
+ description => "The device size in bytes.",
+ type => 'integer',
+ renderer => 'bytes',
+ optional => 1,
+ },
+ transport => {
+ description =>
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'iscsi', 'nvme', 'nvme-fc', or 'nvme-tcp'.",
+ type => 'string',
+ optional => 1,
+ },
+ vendor => { type => 'string', optional => 1 },
+ model => { type => 'string', optional => 1 },
+ serial => { type => 'string', optional => 1 },
+ state => {
+ description =>
+ 'The health of the multipath LUN when path status is available.',
+ type => 'string',
+ enum => ['optimal', 'degraded', 'failed'],
+ optional => 1,
+ },
+ 'paths-total' => {
+ description => "The number of paths of a multipath mapped device or of"
+ . " an NVMe namespace attached through multiple controllers.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-active' => {
+ description =>
+ "The number of active paths whose checker state is ready, ghost,"
+ . " or not reported. Native NVMe paths count when their controller is live"
+ . " and their ANA state is optimized, non-optimized, or not reported.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-expected' => {
+ description => "The number of paths the LUN should have according to the"
+ . " storage configuration, one per portal for iSCSI; absent when it is"
+ . " not known.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'path-list' => {
+ description => "The member paths of the device with their state.",
+ type => 'array',
+ optional => 1,
+ items => {
+ type => 'object',
+ properties => {
+ device => {
+ description => "The path block device, or the NVMe"
+ . " controller device the path uses.",
+ type => 'string',
+ },
+ state => {
+ description => "The device mapper state of the path (for"
+ . " example active or failed) or the state of the NVMe"
+ . " controller (for example live or connecting).",
+ type => 'string',
+ },
+ 'checker-state' => {
+ description => "The state reported by the multipathd path"
+ . " checker, for example ready, ghost or faulty.",
+ type => 'string',
+ optional => 1,
+ },
+ 'ana-state' => {
+ description => "The Asymmetric Namespace Access state of"
+ . " the namespace on this path, for example optimized"
+ . " or inaccessible.",
+ type => 'string',
+ optional => 1,
+ },
+ 'host-wwpn' => {
+ description => "The WWPN of the host (initiator) port of"
+ . " Fibre Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ 'target-wwpn' => {
+ description => "The WWPN of the target port of Fibre"
+ . " Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ address => {
+ description => "The address of the NVMe controller the"
+ . " path uses.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ usage => {
+ description => "The usage indicated by cached device metadata.",
+ type => 'string',
+ enum => ['unused', 'lvm', 'other'],
+ },
+ vgname => {
+ description => "The name of the LVM volume group the device belongs to.",
+ type => 'string',
+ optional => 1,
+ },
+ 'by-id' => {
+ description =>
+ "A path under /dev/disk/by-id that encodes the device's identity"
+ . " and has been verified to resolve to this device. Absent when no such"
+ . " link could be verified.",
+ type => 'string',
+ optional => 1,
+ },
+ 'used-by-storage' => {
+ description => "The storage that uses the LUN: through the volume group"
+ . " on it, or as an iSCSI storage that serves the LUNs of its target as"
+ . " images.",
+ type => 'string',
+ optional => 1,
+ },
+ wwid => {
+ description => "The LUN WWID.",
+ type => 'string',
+ },
+ name => {
+ description => 'The map alias, when different from its WWID.',
+ type => 'string',
+ optional => 1,
+ },
+ multipath => {
+ description => "How the node manages multipath for the LUN: 'manual' for a"
+ . " map with an explicit entry, 'storage' for the map of an iSCSI storage"
+ . " with the 'managed-multipath' option, 'unmanaged' for any other map,"
+ . " 'pending' while a map that an entry, a storage or the allow-list of"
+ . " the node requests does not exist yet, 'none' without a map or"
+ . " request, 'native' for the kernel-native multipath of an NVMe"
+ . " namespace.",
+ type => 'string',
+ enum => ['none', 'pending', 'storage', 'manual', 'unmanaged', 'native'],
+ },
+ 'multipath-storage' => {
+ description =>
+ "The multipath-enabled storage the LUN belongs to, whether or"
+ . " not it also has an explicit multipath entry.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-target' => {
+ description => "The IQN of the iSCSI target the LUN is attached through.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-lun' => {
+ description => "The number of the LUN on its iSCSI target.",
+ type => 'integer',
+ optional => 1,
+ },
+ detail => {
+ description => "The cached signature or usage when usage is 'other'.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ code => sub {
+ return PVE::Storage::SAN::scan_luns(PVE::Storage::config());
+ },
+});
+
__PACKAGE__->register_method({
name => 'zfsscan',
path => 'zfs',
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index f1a5cd18..8670165c 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -525,6 +525,13 @@ sub get_nvme_transport {
return $transport;
}
+# SAS does not distinguish local from remote attachments, so it is not classified as remote.
+sub is_remote_transport {
+ my ($transport) = @_;
+
+ return ($transport // '') =~ m/^(?:fc|fcoe|iscsi|nvme-(?:fc|tcp|rdma))$/;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
diff --git a/src/PVE/Multipath.pm b/src/PVE/Multipath.pm
index ec417381..027e6a53 100644
--- a/src/PVE/Multipath.pm
+++ b/src/PVE/Multipath.pm
@@ -2,7 +2,9 @@ package PVE::Multipath;
use v5.36;
+use Cwd qw(abs_path);
use Encode qw(decode encode);
+use File::Basename qw(basename);
use JSON qw(decode_json);
use PVE::Tools qw(run_command file_get_contents file_read_firstline dir_glob_foreach);
@@ -19,6 +21,12 @@ sub parse_dm_uuid($uuid) {
return { wwid => $wwid, defined($part) ? (partition => int($part)) : () };
}
+sub device_map($device) {
+ my $name = basename(abs_path($device) // $device);
+ return undef if $name !~ /^dm-\d+$/;
+ return parse_dm_uuid(file_read_firstline("/sys/block/$name/dm/uuid"));
+}
+
sub map_info() {
my $maps = {};
dir_glob_foreach(
@@ -159,6 +167,22 @@ sub get_maps() {
return $maps;
}
+sub path_status_by_wwid() {
+ my $res = {};
+ for my $map (get_maps()->@*) {
+ my $wwid = $map->{wwid} // next;
+ my @paths;
+ for my $path ($map->{paths}->@*) {
+ my $row = { device => "/dev/$path->{dev}", state => $path->{'dm-state'} // 'undef' };
+ $row->{'checker-state'} = $path->{'check-state'} if defined($path->{'check-state'});
+ $row->{$_} = $path->{$_} for grep { defined($path->{$_}) } qw(host-wwpn target-wwpn);
+ push @paths, $row;
+ }
+ $res->{$wwid} = { active => $map->{'paths-active'}, paths => \@paths };
+ }
+ return $res;
+}
+
sub wait_for_map($wwid, $timeout = 10) {
my $link = "/dev/disk/by-id/dm-uuid-mpath-$wwid";
my $deadline = time() + ($timeout // 10);
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a67dc25f..a2df83c0 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -14,7 +14,8 @@ SOURCES= \
PBSPlugin.pm \
BTRFSPlugin.pm \
LvmThinPlugin.pm \
- ESXiPlugin.pm
+ ESXiPlugin.pm \
+ SAN.pm
.PHONY: install
install:
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
new file mode 100644
index 00000000..5e742523
--- /dev/null
+++ b/src/PVE/Storage/SAN.pm
@@ -0,0 +1,197 @@
+package PVE::Storage::SAN;
+
+use v5.36;
+
+use Cwd qw(abs_path);
+use File::Basename qw(basename);
+
+use PVE::INotify;
+use PVE::Tools qw(file_read_firstline dir_glob_foreach);
+
+use PVE::Diskmanage;
+use PVE::ISCSI::Topology;
+use PVE::Multipath;
+use PVE::Multipath::Config;
+use PVE::Multipath::Generator;
+use PVE::Multipath::Identity;
+use PVE::Storage;
+use PVE::Storage::LVMPlugin;
+
+sub scan_luns($cfg) {
+ my $ids = PVE::Multipath::Identity::collect(all => 1);
+ my $map_info = PVE::Multipath::map_info();
+ my $members = PVE::Multipath::member_map($map_info);
+ # A map stands for its paths, of which a node with many LUNs has thousands. Leave them out
+ # before the disk list queries udev for each device.
+ my @names;
+ dir_glob_foreach(
+ '/sys/block',
+ '(?:sd[a-z]+|nvme\d+n\d+)',
+ sub($name, @) { push @names, $name if !$members->{$name} },
+ );
+ my $disks = PVE::Diskmanage::get_disks(\@names, 1, 0, 1);
+ my $maps = PVE::Diskmanage::get_multipath_disks($map_info);
+ my $sessions = PVE::ISCSI::Topology::device_map();
+ my $status = eval { PVE::Multipath::path_status_by_wwid() } // {};
+ my $nvme = PVE::Diskmanage::get_nvme_path_status();
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups() // {};
+ my $mpcfg = PVE::Multipath::Config::read_config();
+ my %explicit = map { $_ => 1 }
+ PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
+ my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
+ my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner);
+
+ for my $sid (sort keys %$derived) {
+ for my $wwid (keys $derived->{$sid}->{wwids}->%*) {
+ $storage{$wwid} //= $sid;
+ my $count = $derived->{$sid}->{wwids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ }
+ for my $wwid (keys %explicit) {
+ my $count = $mpcfg->{ids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
+ $target_owner{ $scfg->{target} } //= $sid
+ if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
+ $base_owner{$1} //= $sid if ($scfg->{base} // '') =~ m/(?:^|\.)dm-uuid-mpath-(.+)$/;
+ }
+
+ my %rows;
+ my $add = sub($disk, $map = 0) {
+ my $name = basename(abs_path($disk->{devpath}) // $disk->{devpath});
+ return
+ if !is_san_device(
+ $disk->{devpath},
+ {
+ map => $map,
+ transport => $disk->{transport},
+ session => $sessions->{$name},
+ },
+ );
+ my $wwid = $map ? $disk->{wwn} : PVE::Multipath::Identity::path_wwid($ids, $name);
+ $wwid //= file_read_firstline("/sys/class/block/$name/wwid") if $name =~ /^nvme/;
+ return if !defined($wwid) || !length($wwid);
+
+ my $row = $rows{$wwid} //= {
+ wwid => $wwid,
+ devpath => $disk->{devpath},
+ size => $disk->{size},
+ usage => 'unused',
+ multipath => $listed{$wwid}
+ || $explicit{$wwid}
+ || $storage{$wwid} ? 'pending' : 'none',
+ };
+ my $link = stable_path($disk->{devpath}, $wwid, $map);
+ # The device and its by-id name come from one disk. A map replaces a single path.
+ if ($map || (defined($link) && !$row->{'by-id'})) {
+ delete $row->{'by-id'};
+ $row->{devpath} = $disk->{devpath};
+ $row->{size} = $disk->{size};
+ $row->{'by-id'} = $link if defined($link);
+ }
+ if ($map) {
+ my $alias = basename($disk->{devpath});
+ $row->{name} = $alias if $alias ne $wwid;
+ $row->{multipath} =
+ $explicit{$wwid} ? 'manual'
+ : $storage{$wwid} ? 'storage'
+ : 'unmanaged';
+ }
+ $row->{multipath} = 'native' if $name =~ /^nvme\d+n\d+$/;
+ for my $key (qw(transport vendor model serial)) {
+ my $value = $disk->{$key};
+ $row->{$key} //= $value if defined($value) && $value ne 'unknown';
+ }
+ for my $member (map { basename($_) } ($disk->{slaves} // [$disk->{devpath}])->@*) {
+ my $session = $sessions->{$member} // next;
+ $row->{'iscsi-target'} //= $session->{target};
+ $row->{'iscsi-lun'} //= $session->{lun};
+ $row->{transport} = 'iscsi';
+ }
+ my $used = $disk->{used};
+ if (defined($used)) {
+ if ($used eq 'LVM' || $used eq 'LVM2_member') {
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ } elsif ($row->{usage} ne 'lvm') {
+ $row->{usage} = 'other';
+ $row->{detail} = $used;
+ }
+ }
+ my $vg = $pv_vgs->{ abs_path($disk->{devpath}) // $disk->{devpath} };
+ if (defined($vg)) {
+ $row->{vgname} //= $vg;
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ }
+ my $paths = $map ? $status->{$wwid} : $nvme->{$name};
+ if ($paths) {
+ $row->{'path-list'} = $paths->{paths};
+ $row->{'paths-total'} = scalar($paths->{paths}->@*);
+ $row->{'paths-active'} = $paths->{active};
+ } elsif ($map) {
+ $row->{'paths-total'} = $disk->{paths};
+ }
+ $row->{'multipath-storage'} = $storage{$wwid} if defined($storage{$wwid});
+ # multipath entries and iSCSI portals are for maps, not for native NVMe multipath
+ $row->{'paths-expected'} = $expected{$wwid}
+ if defined($expected{$wwid}) && $row->{multipath} ne 'native';
+ };
+ for my $name (sort keys %$disks) {
+ my $disk = $disks->{$name};
+ next if $members->{$name};
+ $add->($disk);
+ }
+ $add->($maps->{$_}, 1) for sort keys %$maps;
+ for my $row (values %rows) {
+ if (defined($row->{'paths-active'})) {
+ $row->{state} = PVE::Multipath::derive_health(
+ $row->{'paths-active'},
+ $row->{'paths-total'},
+ $row->{'paths-expected'},
+ );
+ }
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' }
+ // $target_owner{ $row->{'iscsi-target'} // '' };
+ $row->{'used-by-storage'} = $owner if defined($owner);
+ }
+ return [map { $rows{$_} } sort keys %rows];
+}
+
+sub stable_path($device, $wwid, $map = 0) {
+ my $prefix = $map ? 'dm-uuid-mpath' : basename($device) =~ /^nvme/ ? 'nvme' : 'scsi';
+ my ($link) = "/dev/disk/by-id/$prefix-$wwid" =~ m{\A(/dev/disk/by-id/[A-Za-z0-9_.:+-]+)\z};
+ return undef if !defined($link);
+ return $link if (abs_path($link) // '') eq (abs_path($device) // $device);
+ return undef;
+}
+
+sub is_san_device($device, $info = undef) {
+ if (!$info) {
+ my $path = abs_path($device) // $device;
+ return 0 if PVE::Diskmanage::is_partition($path);
+ my $name = basename($path);
+ my $transport;
+ if ($name =~ /^nvme/) {
+ $transport = 'nvme-' . (PVE::Diskmanage::get_nvme_transport("/sys/block/$name") // '');
+ } elsif ((readlink("/sys/block/$name") // '') =~ m{/rport-\d+}) {
+ $transport = 'fc';
+ }
+ $info = {
+ map => PVE::Multipath::device_map($path),
+ transport => $transport,
+ session => PVE::Diskmanage::is_iscsi_device($name),
+ };
+ }
+ return
+ $info->{map}
+ || $info->{session}
+ || PVE::Diskmanage::is_remote_transport($info->{transport}) ? 1 : 0;
+}
+
+1;
diff --git a/src/test/Makefile b/src/test/Makefile
index a758e593..6348c61e 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -65,3 +65,9 @@ test_multipath_api: run_multipath_api_tests.pl
test_san_taint: run_san_taint_tests.pl
perl -T ./run_san_taint_tests.pl
+
+test_san_lun_scan: run_san_lun_scan_tests.pl
+ ./run_san_lun_scan_tests.pl
+
+test_san_api: run_san_api_tests.pl
+ ./run_san_api_tests.pl
diff --git a/src/test/disk_tests/multipath/multipathd b/src/test/disk_tests/multipath/multipathd
new file mode 100644
index 00000000..40243f91
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd
@@ -0,0 +1,124 @@
+{
+ "major_version": 0,
+ "minor_version": 1,
+ "maps": [{
+ "name" : "mpatha",
+ "uuid" : "3600140500000000000000000000000001",
+ "sysfs" : "dm-0",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 0,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sda",
+ "dev_t" : "8:0",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdb",
+ "dev_t" : "8:16",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ },
+ {
+ "name" : "mpathb",
+ "uuid" : "3600140500000000000000000000000002",
+ "sysfs" : "dm-1",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 3,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sdc",
+ "dev_t" : "8:32",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdd",
+ "dev_t" : "8:48",
+ "dm_st" : "failed",
+ "dev_st" : "running",
+ "chk_st" : "faulty",
+ "checker" : "tur",
+ "pri" : 0,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ }]
+}
diff --git a/src/test/disk_tests/multipath/multipathd_status_expected.json b/src/test/disk_tests/multipath/multipathd_status_expected.json
new file mode 100644
index 00000000..df5a24da
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd_status_expected.json
@@ -0,0 +1,40 @@
+{
+ "3600140500000000000000000000000001": {
+ "active": 2,
+ "paths": [
+ {
+ "device": "/dev/sda",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdb",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ },
+ "3600140500000000000000000000000002": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/sdc",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdd",
+ "state": "failed",
+ "checker-state": "faulty",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index caa60e79..2f22fae8 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -70,6 +70,8 @@ sub mocked_run_command {
$content = '{}';
}
@$outputlines = split(/\n/, $content);
+ } elsif ($cmd->[0] =~ m/multipathd/i) {
+ @$outputlines = split(/\n/, read_test_file('multipathd'));
} else {
die "unexpected run_command call: '@$cmd', aborting\n";
}
@@ -264,6 +266,16 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
+ my $status = PVE::Multipath::path_status_by_wwid();
+ my $expected_status =
+ decode_json(read_test_file('multipathd_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'multipath status should be the same');
+ }
+
if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
my $status = PVE::Diskmanage::get_nvme_path_status();
my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
@@ -296,8 +308,11 @@ print("\tMocked get_sysdir_size\n");
$diskmanage_module->mock('assert_blockdev' => sub { return 1; });
print("\tMocked assert_blockdev\n");
$multipath_module = Test::MockModule->new('PVE::Multipath', no_auto => 1);
+$multipath_module->mock('run_command' => \&mocked_run_command);
+$multipath_module->mock('is_supported' => sub { return 1; });
$multipath_module->mock('dir_glob_foreach' => \&mocked_dir_glob_foreach);
$multipath_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked PVE::Multipath run_command and is_supported\n");
$diskmanage_module->mock(
'dir_is_empty' => sub {
my $val = shift;
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
new file mode 100755
index 00000000..4bd7d2d7
--- /dev/null
+++ b/src/test/run_san_api_tests.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw(. ..);
+use PVE::API2::Storage::Scan;
+
+for my $case (['PVE::API2::Storage::Scan', 'sanlunscan']) {
+ my ($class, @names) = @$case;
+ for my $name (@names) {
+ is_deeply(
+ $class->map_method_by_name($name)->{permissions}->{check},
+ [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ "$class $name read permission",
+ );
+ }
+}
+
+done_testing();
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
new file mode 100755
index 00000000..b9e128cc
--- /dev/null
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -0,0 +1,197 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(..);
+use Test::More;
+use Test::MockModule;
+
+use PVE::Storage::SAN;
+use PVE::API2::Storage::Scan;
+
+my $disk = Test::MockModule->new('PVE::Diskmanage');
+my $mp = Test::MockModule->new('PVE::Multipath');
+my $id = Test::MockModule->new('PVE::Multipath::Identity');
+my $config = Test::MockModule->new('PVE::Multipath::Config');
+my $storage = Test::MockModule->new('PVE::Storage');
+my $iscsi = Test::MockModule->new('PVE::ISCSI::Topology');
+my $scan = Test::MockModule->new('PVE::Storage::SAN');
+my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+my $hints;
+$lvm->mock(file_get_contents => sub { $hints // die "No such file\n" });
+$lvm->mock(abs_path => sub { $_[0] });
+$lvm->mock(run_command => sub { die "unexpected LVM device probe\n" });
+
+my $disks = {
+ sda => { devpath => '/dev/sda', size => 100, transport => 'sata' },
+ sdb => { devpath => '/dev/sdb', size => 200, transport => 'iscsi' },
+ sdc => { devpath => '/dev/sdc', size => 200, transport => 'iscsi', used => 'LVM2_member' },
+ sdd =>
+ { devpath => '/dev/sdd', size => 300, transport => 'fc', multipath => '/dev/mapper/lun' },
+ sde => { devpath => '/dev/sde', size => 400, transport => 'fc' },
+};
+my $maps = {
+ 'dm-0' => {
+ devpath => '/dev/mapper/lun',
+ size => 300,
+ wwn => '3600map',
+ paths => 2,
+ slaves => ['/dev/sdd', '/dev/sdf'],
+ transport => 'fc',
+ },
+};
+$id->mock(collect => sub { {} });
+$id->mock(path_wwid => sub { $_[1] =~ /^(sdb|sdc)$/ ? '3600plain' : undef });
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+my $generator = Test::MockModule->new('PVE::Multipath::Generator');
+$generator->mock(derived_wwids => sub { {} });
+$iscsi->mock(
+ device_map => sub {
+ return { map { $_ => { target => 'iqn.test', lun => 1 } } qw(sdb sdc) };
+ },
+);
+my @listed;
+$scan->redefine(
+ dir_glob_foreach => sub {
+ my ($dir, $regex, $code) = @_;
+ return PVE::Tools::dir_glob_foreach($dir, $regex, $code) if $dir ne '/sys/block';
+ $code->($_) for grep { /^$regex$/ } qw(sda sdb sdc sdd sde sdf dm-0 loop0 nvme0n1);
+ },
+);
+$disk->mock(
+ get_disks => sub {
+ ok($_[3], 'SAN inventory opts into iSCSI');
+ @listed = sort $_[0]->@*;
+ return $disks;
+ },
+ get_multipath_disks => sub { $maps },
+ get_nvme_path_status => sub { {} },
+ run_command => sub { die 'unexpected device probe' },
+);
+$mp->mock(list_etc_multipath_wwids => sub { [] });
+$mp->mock(
+ map_info => sub {
+ return {
+ map {
+ $_ => {
+ wwid => $maps->{$_}->{wwn},
+ slaves => [map { s{^/dev/}{}r } $maps->{$_}->{slaves}->@*],
+ }
+ } keys %$maps
+ };
+ },
+);
+$mp->mock(
+ path_status_by_wwid => sub {
+ return {
+ '3600map' => {
+ active => 1,
+ paths => [
+ { device => '/dev/sdd', state => 'active', 'checker-state' => 'ghost' },
+ { device => '/dev/sdf', state => 'failed', 'checker-state' => 'faulty' },
+ ],
+ },
+ };
+ },
+);
+$scan->mock(abs_path => sub { $_[0] });
+$scan->mock(stable_path => sub { '/dev/disk/by-id/scsi-' . $_[1] });
+my $cfg =
+ { ids => { direct => { type => 'iscsi', target => 'iqn.test', content => { images => 1 } } } };
+my $rows = PVE::Storage::SAN::scan_luns($cfg);
+is(scalar(@$rows), 2, 'only identified SAN LUNs, one row per identity');
+is_deeply(
+ \@listed,
+ [qw(nvme0n1 sda sdb sdc sde)],
+ 'the paths of a map are left out of the disk list',
+);
+my %row = map { $_->{wwid} => $_ } @$rows;
+is($row{'3600plain'}->{usage}, 'lvm', 'positive usage from any path survives folding');
+is($row{'3600plain'}->{'used-by-storage'}, 'direct', 'a storage serving the LUNs uses them');
+{
+ local $cfg->{ids}->{direct}->{content} = { none => 1 };
+ my %plain = map { $_->{wwid} => $_ } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($plain{'3600plain'}->{'used-by-storage'}, undef, 'a connection storage does not');
+}
+ok(!exists($row{'3600plain'}->{state}), 'single path devices have no multipath health');
+is($row{'3600map'}->{state}, 'degraded', 'final state counts usable paths');
+is($row{'3600map'}->{multipath}, 'manual', 'explicit map');
+is($row{'3600map'}->{devpath}, '/dev/mapper/lun', 'map is the selected device');
+my $schema = PVE::API2::Storage::Scan->map_method_by_name('sanlunscan')->{returns};
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'rows match the public schema');
+is($row{'3600map'}->{name}, 'lun', 'map alias is exposed');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/3600map';
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unnamed) = grep { $_->{wwid} eq '3600map' } @$rows;
+ok(!exists($unnamed->{name}), 'WWID is not repeated as an alias');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/lun';
+
+{
+ my $healthy = {
+ '3600map' => {
+ active => 2,
+ paths => [map { { device => $_, state => 'active' } } qw(/dev/sdd /dev/sdf)],
+ },
+ };
+ $mp->mock(path_status_by_wwid => sub { $healthy });
+ my ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{state}, 'optimal', 'all paths usable without an expected count');
+ $config->mock(
+ read_config =>
+ sub { { ids => { '3600map' => { type => 'wwid', 'paths-expected' => 3 } } } },
+ );
+ ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{'paths-expected'}, 3, 'expected count of the entry');
+ is($map->{state}, 'degraded', 'fewer paths than the entry expects');
+ $config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+}
+
+$mp->mock(path_status_by_wwid => sub { {} });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unobserved) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($unobserved->{'paths-total'}, 2, 'map membership supplies total without daemon status');
+ok(!exists($unobserved->{'paths-active'}), 'no invented active count');
+ok(!exists($unobserved->{state}), 'no false failed state');
+
+$cfg->{ids}->{data} = { type => 'lvm', vgname => 'data' };
+$hints = "hints_version: 2.1\nscan:/dev/mapper/lun pvid:abc devn:253:0 vg:data\n";
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($cached) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($cached->{vgname}, 'data', 'hints supply the display VG');
+is($cached->{usage}, 'lvm', 'hints also supply cached usage evidence');
+is($cached->{'used-by-storage'}, 'data', 'VG allows storage attribution');
+for my $contents (undef, '', "scan=/dev/mapper/lun vg=data\n") {
+ $hints = $contents;
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is(scalar(@$rows), 2, 'missing or unrecognized hints do not lose LUNs');
+ my ($uncached) = grep { $_->{wwid} eq '3600map' } @$rows;
+ ok(!exists($uncached->{vgname}), 'VG name is absent without a hint');
+ ok(!exists($uncached->{'used-by-storage'}), 'VG-derived attribution is also absent');
+ is($uncached->{usage}, 'unused', 'usage falls back to other cached evidence');
+}
+
+$disks->{sdc}->{used} = 'ext4';
+$maps = {};
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{usage}, 'other', 'foreign data from a sibling path is retained');
+is($rows->[0]->{detail}, 'ext4', 'signature detail');
+$scan->mock(stable_path => sub { $_[0] eq '/dev/sdc' ? '/dev/disk/by-id/scsi-3600plain' : undef });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/scsi-3600plain', 'by-id link of the second path');
+is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id link resolves to');
+
+$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
+$scan->mock(file_read_firstline => sub { 'eui.0123456789abcdef' });
+$scan->unmock('stable_path');
+$scan->mock(abs_path => sub { '/dev/nvme0n1' });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'native', 'NVMe uses kernel-native multipath');
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/nvme-eui.0123456789abcdef', 'NVMe stable name');
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'native row matches the API schema');
+
+$disk->mock(is_partition => sub { 1 });
+ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
+
+done_testing();
^ permalink raw reply related [relevance 9%]
* [PATCH v5 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view
2026-11-16 1:23 5% [PATCH v5 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-16 1:23 9% ` [PATCH v5 storage 16/36] api: scan: add a SAN LUN inventory Thomas Lamprecht
@ 2026-11-16 1:23 9% ` Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-16 1:23 UTC (permalink / raw)
To: pve-devel
Admins new to Proxmox VE look for adding their SAN under Datacenter >
Storage > Add. There, the iSCSI dialog connects a target without a
volume group on top and, by default, without multipath, so they end up
with neither a storage that can allocate guest disks nor path
redundancy. The guided setups that do both are in the SAN view, which
nothing in these dialogs mentions.
Add a note to the add dialogs of iSCSI and LVM that names the SAN view.
Its link closes the dialog and opens the view. The dialogs stay as they
are for attaching existing targets and volume groups. The storage panel
base shows the note for panels that set one, so the NVMe over Fabrics
dialog can use it as well.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/SANUtils.js | 38 +++++++++++++++++++++++++++++++
www/manager6/storage/Base.js | 5 ++++
www/manager6/storage/IScsiEdit.js | 3 +++
www/manager6/storage/LVMEdit.js | 3 +++
4 files changed, 49 insertions(+)
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index 8947d83e5..c08ac2a1a 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -103,6 +103,44 @@ Ext.define('PVE.SANUtils', {
return Ext.htmlEncode(PVE.SANUtils.usageText(rec.data));
},
+ // Selects Datacenter > Storage > SAN, as the TFA entry of the user menu does for its panel.
+ showSANView: function () {
+ Ext.state.Manager.getProvider().set('dctab', { value: 'san' }, true);
+ Ext.ComponentQuery.query('pveStdWorkspace')[0]?.selectById('root');
+ },
+
+ // A note for the add dialogs of storages on a SAN, which points to the guided setups of the
+ // SAN view. Its link closes the dialog and opens the view.
+ sanViewNote: function (text) {
+ let path = `${gettext('Datacenter')} > ${gettext('Storage')} > SAN`;
+ let link = `<a href="#" style="white-space: nowrap;">${Ext.htmlEncode(path)}</a>`;
+ return {
+ xtype: 'component',
+ margin: '5 0 0 0',
+ html:
+ `<span class="pmx-hint">${Ext.htmlEncode(gettext('Note:'))}</span> ` +
+ Ext.String.format(Ext.htmlEncode(text), link),
+ listeners: {
+ afterrender: function (cmp) {
+ let follow = function (event) {
+ event.stopEvent();
+ cmp.up('window')?.close();
+ PVE.SANUtils.showSANView();
+ };
+ cmp.mon(cmp.getEl(), 'click', follow, null, { delegate: 'a' });
+ // an edit window handles Enter for its default button, so no click follows it
+ cmp.mon(
+ cmp.getEl(),
+ 'keydown',
+ (event) => event.getKey() === event.ENTER && follow(event),
+ null,
+ { delegate: 'a' },
+ );
+ },
+ },
+ };
+ },
+
renderSanTransport: function (value) {
return Ext.htmlEncode(
{
diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index 04f5f706f..58e77c05c 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -131,6 +131,11 @@ Ext.define('PVE.panel.StorageBase', {
me.advancedColumnB.unshift(volumeChain.hint);
}
+ // the add dialog of a SAN storage points to the guided setups of the SAN view
+ if (me.isCreate && me.sanNote) {
+ me.columnB = [...(me.columnB ?? []), PVE.SANUtils.sanViewNote(me.sanNote)];
+ }
+
me.callParent();
},
});
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index 0d6768b20..037c205ea 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -75,6 +75,9 @@ Ext.define('PVE.storage.IScsiInputPanel', {
onlineHelp: 'storage_open_iscsi',
+ // TRANSLATORS: "Add Storage" is a button of the SAN view, {0} the menu path of that view.
+ sanNote: gettext('To set up shared LVM with multipath on a LUN, use Add Storage in {0}.'),
+
// Loading sets the value before its original value, so use the dirty state.
updateMultipathActivation: function () {
let me = this;
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 0c56455df..9c4df2609 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -148,6 +148,9 @@ Ext.define('PVE.storage.LVMInputPanel', {
onlineHelp: 'storage_lvm',
+ // TRANSLATORS: "Add Storage" is a button of the SAN view, {0} the menu path of that view.
+ sanNote: gettext('To set up shared LVM on a SAN LUN, use Add Storage in {0}.'),
+
column1: [
{
xtype: 'pveBaseStorageSelector',
^ permalink raw reply related [relevance 9%]
* [PATCH v5 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM
@ 2026-11-16 1:23 5% Thomas Lamprecht
2026-11-16 1:23 13% ` [PATCH v5 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
` (3 more replies)
0 siblings, 4 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-16 1:23 UTC (permalink / raw)
To: pve-devel
This is v5 of the combined and reduced series of the cluster-wide
multipath work [0][1] and Dietmar's RFC for guided remote storage setup
and SAN visibility [2].
Most changes since v4 [3] come from feedback from Blockbridge – a
third-party storage plugin vendor. Their plugin attaches one LUN per
guest disk, so a plain upgrade hits nodes with several hundred multipath
maps that are not ours:
- The iSCSI storage option is named 'managed-multipath' now. Their
plugin defines a 'multipath' property, and a property that two
plugins define stops PVE::Storage from loading. Per-plugin property
isolation would be the real answer, but a single plugin that opts
in switches the storage API to a schema in which updates need the
type, so 'pvesm set' and the edit dialogs fail for all storages of
that node. We (I and/or Max, Wolfgang) will look into completing that
separately.
- A node reports the maps that Proxmox VE manages or has a storage
on, and counts the rest. Before, every map got a row, and beyond
about 185 of them the report no longer fit into the 32 KiB of a
value in the node key-value store, which cost the node the state of
our LUNs as well.
- The LUN scan no longer queries udev for the paths of a map. With
1000 additional maps on a node that was one udevadm call for each of
2000 path devices and 13 seconds per scan, for views that poll it
every few seconds. It is 2 seconds now.
- Writing to a LUN, for a new volume group or a wipe, is refused while
a process of the node has it open. A guest that got the LUN from a
plugin or by its device path is neither a holder nor a storage
reference, and such a node lists hundreds of them. v3 had a broader
census of device users, which I dropped in v4 with the rest of that
machinery; this is the cheap part of it.
The alleged long multipathd query time on every status pass I could not
reproduce as a problem, as it took 30 ms for those 1000 maps on a small
nested node and the status loop stayed in its normal cycle.
Overview of what an admin gets with this:
- Datacenter > Storage > SAN, a new entry below Storage, shows the
multipath state of every node and of the LUNs that Proxmox VE
manages or has a storage on, and edits the multipath entries and
array-specific overrides. I explicitly chose this over the
client/plugin side of Storage, as we do not have e.g. Ceph or
ZFS/LVM/... creation in there either. We might want to rethink and
consolidate our storage interface vs. management story in the
future, but IMO a partial switch now is not worth it, that would add
even more potential for confusion than the new SAN view.
- Its Add Storage menu guides through shared LVM on a LUN: for iSCSI
it connects or reuses a target, with the initiator names of all
nodes at hand, for Fibre Channel it takes a LUN the nodes already
see. Both set up multipath for the LUN and end with its state on
every node of the new storage.
- Datacenter > Storage > Add keeps its dialogs. The iSCSI one gets a
Multipath option and the LVM one enables Shared for a base storage,
so the same works there in two steps. Both name the SAN view in a
note whose link opens it, as admins coming from other platforms look
for their SAN there first.
- Node > SAN lists the LUNs of a node with their paths and usage, can
wipe a LUN that no storage uses, and shows the iSCSI sessions.
The rules the series follows since v4, in short: nodes add WWIDs and
maps but never remove them, a write is checked where it happens, lists
do not probe devices, there are no new iSCSI operations, the guided
setup makes the API calls an admin would make by hand, and multipath
management is turned on by the admin. The v4 cover [3] has the reasons
and what each of them costs.
Two things an admin will likely miss: there is no notification when a
LUN loses path redundancy, the state only shows on the SAN pages and in
the API. A node with fewer paths than its iSCSI portals or the expected
paths of the LUN's entry at least shows as degraded there, and a LUN
that only has one path reads "OK (1 path)" instead of optimal. And Fibre
Channel starts at a LUN the nodes already see, the web UI neither lists
the WWPNs of the nodes nor rescans their HBAs; the chapter gives the
commands for both, and the setup points to the rescan.
How it works:
- /etc/pve/multipath.cfg holds explicit entries per WWID (nodes, alias,
no-path-retry, expected paths), /etc/pve/multipath-overrides.conf
array settings in multipath.conf syntax; patch 01 registers
both. An iSCSI storage with the new 'managed-multipath' option
supplies its LUNs without entries, a Fibre Channel LUN gets an
explicit entry unless it has a map already.
- pvestatd calls one function of pve-storage per pass. It adds the
WWIDs the node needs to /etc/multipath/wwids, writes the drop-ins
/etc/multipath/conf.d/pve-*.conf (entries, overrides and one
generated default, auto_resize grow_only) and reloads multipathd
when something changed. The same call publishes the state of the
maps that the node manages or that hold the volume group of a
storage, and the number of its other maps, through the node
key-value store (key 'multipath').
- /cluster/multipath/status aggregates these reports, derives
'missing' from the configuration and names the storage that requests
each map; /cluster/multipath/{wwid,overrides} edit the two files.
- The volumes of an iSCSI storage with the option end in
dm-uuid-mpath-<wwid> instead of the name of one path, so an LVM
storage uses them through the existing 'base' mechanism.
- /nodes/{node}/scan/san-luns and 'pvesm scan san-luns' return one row
per LUN with a WWID, /nodes/{node}/iscsi/{status,target} the
read-only session view.
- Volume group creation and wipe run under a cluster lock per LUN
(cfs_lock_domain) and do not hold the storage configuration lock
while they write. Adding an LVM storage with a new base volume still
does, as before. Both refuse a LUN that a process of the node has
open.
- multipath-tools becomes a Recommends of libpve-storage-perl. Nodes
without it report that; plain iSCSI and LVM are unaffected.
Patches:
- cluster 01: register the two configuration files
- storage 02-22: helpers for the disk and iSCSI session inventory
(mostly Dietmar's), the multipath library and configuration, the
iSCSI option, the per-node apply and status with their API, the LUN
inventory, the read-only iSCSI status, volume groups on LUNs and the
wipe, in that order
- docs 23: the multipath chapter, rewritten around tasks
- manager 24-36: the pvestatd call, report and API mounts, then
the views, the two dialog changes, the two guided setups and the
note in the add dialogs
Changes since v4 [3]:
- renamed the iSCSI storage option 'multipath' to 'managed-multipath'
in storage.cfg, API and CLI; the web UI keeps the label Multipath
- the node report has rows for maps with an explicit entry for the
node, of an iSCSI storage with the option, that are the base volume
of an LVM storage or that hold the volume group of a storage, and
the new 'other-maps' count for the rest. The SAN panel shows that
count in a column of the node list once a node has such maps. The
volume groups come from LVM's hint file; a node that leaves maps
out without one says so, and counts as unknown instead of missing
for a LUN that only a volume group relates to a storage there. A
report over the size limit keeps the initiator name, and the
chapter names the limit
- the LUN scan leaves the paths of maps out before the disk
enumeration
- volume group creation on a LUN and the wipe check for processes
that have the LUN open. That reads /proc/<pid>/fd, so it does not
see an open through another device node, for example one of a
container
- both also stop if a device name they use no longer means the LUN
they hold open, the wipe also for the partitions it clears and for
its exclusive descriptor. Creating a volume group checked and
initialized the kernel name it was called with, but cleared the
first sector through the by-id name, and a map can get another name
while the lock is awaited
- a volume group on a partition of a multipath map counts for the map
- the Fibre Channel setup offers SCSI LUNs only. It also listed
NVMe/FC namespaces, which the cluster-wide status does not cover, so
its closing window stayed empty for them
- the LUN step only asks to wipe data that is no longer needed, and
the chapter says how to keep a volume group that a LUN already has
- from an automated review of v4: the multipath values of the LUN
scan are described in the API, the portal label is translatable,
imports are grouped, the new iSCSI topology module uses signatures,
WWID and map UUID patterns use ASCII digit classes, three statement
modifiers after multi-line calls became blocks, some comments and
commit messages got reworded
- rebased onto current master in pve-storage, pve-manager and
pve-cluster
When applying, versioned dependencies have to be set: pve-manager on
libpve-storage-perl, and libpve-storage-perl (also as build dependency)
on the libpve-cluster-perl with patch 01, as PVE::Storage
registers the two files when it is loaded. If the bound for LVM status
commands [4] gets applied too, whichever is applied second has to pass
the status cache to the two lvm_vgs() calls of the base volume
activation, they can block a status pass otherwise.
The per-node target and portal series [5][6] are independent of this
one. It takes the LUNs of an iSCSI storage from the sessions of its one
target, so if a storage can have several targets per node, whichever is
applied second has to cover that.
For v4 I tested this on a six-node nested cluster attached to a NetApp
AFF A20 with three iSCSI portals and to Linux LIO targets with two: the
guided iSCSI setup with a new and with a reused connection storage, the
same through the plain dialogs and from the CLI as documented, a LUN
that one node is not allowed to see and gets access later, the Fibre
Channel flow through the web UI, also as an administrator other than
root@pam, a guest on the resulting storages (snapshot, rollback, online
resize, live migration, one path cut under I/O), growing a LUN, wipe and
its refusals, one path and all paths down with queued I/O, a stopped
multipathd, a node reboot and the documented LUN removal. The lab has no
FC hardware, so I emulated it with software FCoE in VN2VN mode and an
LIO tcm_fc target on two fabrics: the nodes get real FC host and remote
port objects, and the documented WWPN listing, rescan and LUN growth
work there as written. The guided Fibre Channel setup ran on such a LUN,
with one node on one fabric only and one node that saw the LUN only
after the rescan. The setup records the paths it sees in the LUN's
entry, so the node on one fabric shows as degraded, and a fabric cut
stays degraded also after the kernel removed the lost paths (66 seconds
dev_loss_tmo of the LIO profile). Real HBA drivers were not tested. Most
of that ran with the NVMe over Fabrics series on top and with the LVM
status patch [4] applied, the series alone ran on one node of that
cluster for the guided setups, the CLI procedure and the views. Without
[4] a stuck LVM command blocks pvestatd as on master.
For v5 I upgraded that cluster from the v4 build, renamed the option in
its storage.cfg and checked that the storages on the NetApp and LIO LUNs
stay active with their guests running. I emulated the plugin vendor's
case with scsi_debug, two hosts with the same LUN identities, so 1000
additional maps with two paths each on one node: report, status loop and
scan before and after the changes, both SAN views after them. The wipe
refusal for an open LUN ran on such a map, with a process holding it
open, the one of volume group creation on a LIO LUN, followed by the
creation without the process. A hand-made map under a shared LVM storage
on two nodes covered the case of a node without LVM hints and the one of
a volume group on a partition of the map. The guided iSCSI setup ran
once more on a NetApp LUN, from wiping its old volume group to the
documented removal. The rest of the list above was not repeated for v5,
although the changes touch what those flows use: the LUN scan, the
status report, the write checks and the LUN selection of the Fibre
Channel setup.
[0]: https://lore.proxmox.com/pve-devel/20260626121000.2095591-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20260703124707.1172980-2-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20260731102156.3947857-1-dietmar@proxmox.com/
[3]: https://lore.proxmox.com/pve-devel/20261113030146.1559030-1-t.lamprecht@proxmox.com/
[4]: https://lore.proxmox.com/pve-devel/20261111015217.941220-1-t.lamprecht@proxmox.com/
[5]: https://lore.proxmox.com/pve-devel/20260430173220.441001-1-m.limbeck@proxmox.com/
[6]: https://lore.proxmox.com/pve-devel/20260804090819.2136483-1-dietmar@proxmox.com/
pve-cluster:
Thomas Lamprecht (1):
cfs: observe the multipath configuration files
src/PVE/Cluster.pm | 2 ++
src/pmxcfs/status.c | 2 ++
2 files changed, 4 insertions(+)
pve-storage:
Dietmar Maurer (8):
diskmanage: collect disk transport type from lsblk
diskmanage: qualify NVMe over fabrics transport
diskmanage: optionally include iSCSI session devices in disk enumeration
diskmanage: collect native NVMe multipath path state
iscsi: factor out session device map from device list
diskmanage: add helper to list multipath devices
pvesm: expose the SAN LUN inventory
api: add node-level iSCSI status
Thomas Lamprecht (13):
multipath: add a library around multipathd
multipath: add a cluster-wide configuration
iscsi: add an option to manage storage LUNs with multipath
lvm: activate a missing base volume before using the volume group
multipath: apply the configuration on every node
multipath: publish per-node status
api: add endpoints for the cluster-wide multipath configuration
api: multipath: add the cluster-wide health status
api: scan: add a SAN LUN inventory
disks: lvm: drop unused imports
disks: lvm: allow volume groups on SAN LUNs and multipath maps
disks: lvm: refuse to destroy the volume group of a shared storage
disks: allow wiping a SAN LUN that no storage uses
debian/control | 3 +-
src/PVE/API2/Disks.pm | 36 +-
src/PVE/API2/Disks/LVM.pm | 64 ++-
src/PVE/API2/ISCSI.pm | 166 +++++++
src/PVE/API2/Makefile | 2 +
src/PVE/API2/Multipath.pm | 454 ++++++++++++++++++
src/PVE/API2/Storage/Scan.pm | 202 ++++++++
src/PVE/CLI/pvesm.pm | 14 +
src/PVE/Diskmanage.pm | 277 +++++++++--
src/PVE/ISCSI/Topology.pm | 86 ++++
src/PVE/Makefile | 6 +
src/PVE/Multipath.pm | 213 ++++++++
src/PVE/Multipath/Config.pm | 205 ++++++++
src/PVE/Multipath/Generator.pm | 114 +++++
src/PVE/Multipath/Identity.pm | 44 ++
src/PVE/Multipath/Status.pm | 220 +++++++++
src/PVE/Storage/ISCSIPlugin.pm | 212 ++++----
src/PVE/Storage/LVMPlugin.pm | 146 +++++-
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 352 ++++++++++++++
src/test/Makefile | 34 +-
src/test/disk_api_test.pm | 256 ++++++++++
src/test/disk_tests/iscsi/disklist | 1 +
.../disk_tests/iscsi/disklist_expected.json | 19 +
src/test/disk_tests/iscsi/lsblk | 5 +
src/test/disk_tests/iscsi/sda/device/model | 1 +
src/test/disk_tests/iscsi/sda/device/vendor | 1 +
.../disk_tests/iscsi/sda/queue/rotational | 1 +
src/test/disk_tests/iscsi/sda/size | 1 +
src/test/disk_tests/iscsi/sda_udevadm | 21 +
src/test/disk_tests/multipath/disklist | 11 +
.../multipath/disklist_expected.json | 107 +++++
src/test/disk_tests/multipath/dm-0/dm/name | 1 +
src/test/disk_tests/multipath/dm-0/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-0/size | 1 +
src/test/disk_tests/multipath/dm-0_slaves | 4 +
src/test/disk_tests/multipath/dm-1/dm/name | 1 +
src/test/disk_tests/multipath/dm-1/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-1/size | 1 +
src/test/disk_tests/multipath/dm-1_slaves | 4 +
src/test/disk_tests/multipath/dm-2/dm/name | 1 +
src/test/disk_tests/multipath/dm-2/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-2/size | 1 +
src/test/disk_tests/multipath/dm-2_slaves | 0
src/test/disk_tests/multipath/dm-3/dm/name | 1 +
src/test/disk_tests/multipath/dm-3/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-3/size | 1 +
src/test/disk_tests/multipath/dm-3_slaves | 0
src/test/disk_tests/multipath/dm-4/dm/name | 1 +
src/test/disk_tests/multipath/dm-4/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-4/size | 1 +
src/test/disk_tests/multipath/dm-4_slaves | 0
src/test/disk_tests/multipath/lsblk | 77 +++
src/test/disk_tests/multipath/lvs | 0
src/test/disk_tests/multipath/mounts | 1 +
.../multipath/multipath_expected.json | 59 +++
src/test/disk_tests/multipath/multipathd | 124 +++++
.../multipath/multipathd_status_expected.json | 40 ++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 +
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +
.../multipath/nvme_path_status_expected.json | 19 +
src/test/disk_tests/multipath/partlist | 0
src/test/disk_tests/multipath/pvs | 1 +
.../disk_tests/multipath/sda/device/model | 1 +
.../disk_tests/multipath/sda/device/vendor | 1 +
.../disk_tests/multipath/sda/holders/holder | 1 +
.../disk_tests/multipath/sda/queue/rotational | 1 +
src/test/disk_tests/multipath/sda/size | 1 +
src/test/disk_tests/multipath/sda_udevadm | 18 +
.../disk_tests/multipath/sdb/device/model | 1 +
.../disk_tests/multipath/sdb/device/vendor | 1 +
.../disk_tests/multipath/sdb/holders/holder | 1 +
.../disk_tests/multipath/sdb/queue/rotational | 1 +
src/test/disk_tests/multipath/sdb/size | 1 +
src/test/disk_tests/multipath/sdb_udevadm | 18 +
.../disk_tests/multipath/sdc/device/model | 1 +
.../disk_tests/multipath/sdc/device/vendor | 1 +
.../disk_tests/multipath/sdc/holders/holder | 1 +
.../disk_tests/multipath/sdc/queue/rotational | 1 +
src/test/disk_tests/multipath/sdc/size | 1 +
src/test/disk_tests/multipath/sdc_udevadm | 18 +
.../disk_tests/multipath/sdd/device/model | 1 +
.../disk_tests/multipath/sdd/device/vendor | 1 +
.../disk_tests/multipath/sdd/holders/holder | 1 +
.../disk_tests/multipath/sdd/queue/rotational | 1 +
src/test/disk_tests/multipath/sdd/size | 1 +
src/test/disk_tests/multipath/sdd_udevadm | 18 +
src/test/disk_tests/multipath/zpool | 1 +
.../disk_tests/sas/disklist_expected.json | 1 +
src/test/disk_tests/sas/lsblk | 5 +
src/test/disklist_test.pm | 107 ++++-
src/test/multipath-three-states.json | 52 ++
src/test/run_disk_api_tests.pl | 11 +
src/test/run_iscsi_activation_tests.pl | 86 ++++
src/test/run_lun_identity_tests.pl | 48 ++
src/test/run_multipath_api_tests.pl | 444 +++++++++++++++++
src/test/run_multipath_tests.pl | 169 +++++++
src/test/run_san_api_tests.pl | 94 ++++
src/test/run_san_library_tests.pl | 135 ++++++
src/test/run_san_lun_scan_tests.pl | 197 ++++++++
src/test/run_san_nvme_tests.pl | 108 +++++
src/test/run_san_taint_tests.pl | 60 +++
src/test/run_san_wipe_tests.pl | 190 ++++++++
src/test/run_test_lvm_base_activation.pl | 118 +++++
src/test/run_test_lvm_base_conflicts.pl | 233 ++++++---
src/test/run_test_lvm_create.pl | 41 ++
123 files changed, 5622 insertions(+), 234 deletions(-)
pve-docs:
Thomas Lamprecht (1):
storage: document the cluster-wide multipath management
pmxcfs.adoc | 2 +
pve-storage-iscsi.adoc | 11 ++
pve-storage-iscsidirect.adoc | 2 +-
pve-storage-lvm.adoc | 3 +
pve-storage-multipath.adoc | 282 +++++++++++++++++++++++++++++++++++
pvesm.adoc | 18 ++-
6 files changed, 312 insertions(+), 6 deletions(-)
pve-manager:
Dietmar Maurer (2):
api: nodes: expose the iSCSI status
ui: node: san: show iSCSI targets and sessions
Thomas Lamprecht (11):
pvestatd: apply the multipath configuration and report the node status
report: add the managed multipath configuration
api: cluster: add the multipath endpoints
ui: dc: add a SAN view
ui: storage: iscsi: add the multipath option
ui: lvm: enable shared when a base storage is selected
ui: node: add SAN LUNs panel
ui: node: san: wipe a LUN that no storage uses
ui: dc: san: add a guided setup for shared LVM on iSCSI
ui: dc: san: add a guided setup for shared LVM on Fibre Channel
ui: storage: point the iSCSI and LVM add dialogs to the SAN view
PVE/API2/Cluster.pm | 7 +
PVE/API2/Nodes.pm | 7 +
PVE/Report.pm | 3 +
PVE/Service/pvestatd.pm | 7 +
www/manager6/Makefile | 12 +
www/manager6/SANUtils.js | 161 ++++++++
www/manager6/Utils.js | 14 +
www/manager6/dc/Config.js | 23 +-
www/manager6/dc/MultipathWwidEdit.js | 81 ++++
www/manager6/dc/SAN.js | 347 ++++++++++++++++++
www/manager6/node/Config.js | 24 ++
www/manager6/node/ISCSITargets.js | 122 ++++++
www/manager6/node/SANLuns.js | 184 ++++++++++
www/manager6/storage/Base.js | 5 +
www/manager6/storage/IScsiEdit.js | 46 +++
www/manager6/storage/LVMEdit.js | 6 +
www/manager6/storage/wizard/FibreChannel.js | 162 ++++++++
www/manager6/storage/wizard/IScsi.js | 272 ++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 179 +++++++++
www/manager6/storage/wizard/NodeIdentities.js | 83 +++++
www/manager6/storage/wizard/Wizard.js | 258 +++++++++++++
www/manager6/window/SANLunState.js | 115 ++++++
www/manager6/window/SANLunWipe.js | 53 +++
23 files changed, 2165 insertions(+), 6 deletions(-)
^ permalink raw reply [relevance 5%]
* [PATCH v5 storage 03/36] diskmanage: qualify NVMe over fabrics transport
2026-11-16 1:23 5% [PATCH v5 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
@ 2026-11-16 1:23 13% ` Thomas Lamprecht
2026-11-16 1:23 13% ` [PATCH v5 storage 05/36] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
` (2 subsequent siblings)
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-16 1:23 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
lsblk reports 'nvme' for namespaces attached over a fabric too, so
they cannot be told from local PCIe drives. Read the transport from
the controller, or from a controller of the subsystem with native
multipath, and report nvme-fc, nvme-tcp, nvme-rdma or nvme-loop for
such namespaces.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: add the test case with the two namespaces only, as the multipath
devices it was part of follow later; mention the new values in the
transport description]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Disks.pm | 3 +-
src/PVE/Diskmanage.pm | 27 ++++++++++++++
src/test/disk_tests/multipath/disklist | 2 ++
.../multipath/disklist_expected.json | 35 +++++++++++++++++++
src/test/disk_tests/multipath/lsblk | 18 ++++++++++
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 ++++++++
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +++++++
src/test/disklist_test.pm | 12 +++++++
17 files changed, 131 insertions(+), 1 deletion(-)
create mode 100644 src/test/disk_tests/multipath/disklist
create mode 100644 src/test/disk_tests/multipath/disklist_expected.json
create mode 100644 src/test/disk_tests/multipath/lsblk
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme8n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme8n1/size
create mode 100644 src/test/disk_tests/multipath/nvme8n1_udevadm
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/vendor
create mode 100644 src/test/disk_tests/multipath/nvme9n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme9n1/size
create mode 100644 src/test/disk_tests/multipath/nvme9n1_udevadm
diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index 1abab820..980ba7ff 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -138,7 +138,8 @@ __PACKAGE__->register_method({
transport => {
type => 'string',
description =>
- "The device transport, for example 'sata', 'sas', 'usb', 'fc', or 'nvme'.",
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'nvme', 'nvme-fc', or 'nvme-tcp'.",
optional => 1,
},
parent => {
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 4d66902b..7862bcd4 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -505,6 +505,26 @@ sub is_iscsi {
return 0;
}
+# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
+# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+sub get_nvme_transport {
+ my ($sysdir) = @_;
+
+ my $transport = file_read_firstline("$sysdir/device/transport");
+ return $transport if defined($transport);
+
+ dir_glob_foreach(
+ "$sysdir/device",
+ 'nvme\d+',
+ sub {
+ my ($controller) = @_;
+ $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ },
+ );
+
+ return $transport;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
@@ -597,6 +617,9 @@ sub get_disks {
# we do not want iscsi devices
return if is_iscsi($sysdir);
+ my $nvme_transport;
+ $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
+
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
@@ -648,7 +671,11 @@ sub get_disks {
wearout => $wearout,
};
+ # lsblk reports plain 'nvme' for fabrics attached namespaces
my $transport = $lsblk_info->{$devpath}->{tran};
+ if (defined($nvme_transport) && $nvme_transport ne 'pcie') {
+ $transport = "nvme-$nvme_transport";
+ }
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
diff --git a/src/test/disk_tests/multipath/disklist b/src/test/disk_tests/multipath/disklist
new file mode 100644
index 00000000..b5e636a5
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist
@@ -0,0 +1,2 @@
+nvme8n1
+nvme9n1
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
new file mode 100644
index 00000000..908c2b56
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -0,0 +1,35 @@
+{
+ "nvme8n1": {
+ "devpath": "/dev/nvme8n1",
+ "size": 10737418240,
+ "vendor": "unknown",
+ "model": "FCMODEL",
+ "serial": "FCNVME1",
+ "wwn": "uuid.20000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
+ "transport": "nvme-fc"
+ },
+ "nvme9n1": {
+ "devpath": "/dev/nvme9n1",
+ "size": 10737418240,
+ "vendor": "FABVEND",
+ "model": "FABRICS CTRL",
+ "serial": "FAB1",
+ "wwn": "uuid.10000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "transport": "nvme-tcp"
+ }
+}
diff --git a/src/test/disk_tests/multipath/lsblk b/src/test/disk_tests/multipath/lsblk
new file mode 100644
index 00000000..597adf94
--- /dev/null
+++ b/src/test/disk_tests/multipath/lsblk
@@ -0,0 +1,18 @@
+{
+ "blockdevices": [
+ {
+ "path": "/dev/nvme8n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ },
+ {
+ "path": "/dev/nvme9n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ }
+ ]
+}
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/model b/src/test/disk_tests/multipath/nvme8n1/device/model
new file mode 100644
index 00000000..1aac689e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/model
@@ -0,0 +1 @@
+FCMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/transport b/src/test/disk_tests/multipath/nvme8n1/device/transport
new file mode 100644
index 00000000..8b517d01
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/transport
@@ -0,0 +1 @@
+fc
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/queue/rotational b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/size b/src/test/disk_tests/multipath/nvme8n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1_udevadm b/src/test/disk_tests/multipath/nvme8n1_udevadm
new file mode 100644
index 00000000..d0cd5ea9
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1_udevadm
@@ -0,0 +1,14 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+N: nvme8n1
+S: disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVLINKS=/dev/disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVNAME=/dev/nvme8n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+E: DEVTYPE=disk
+E: ID_MODEL=FCMODEL
+E: ID_SERIAL=FCNVME_1
+E: ID_SERIAL_SHORT=FCNVME1
+E: ID_WWN=uuid.20000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=1
+E: SUBSYSTEM=block
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/model b/src/test/disk_tests/multipath/nvme9n1/device/model
new file mode 100644
index 00000000..aa0287c7
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/model
@@ -0,0 +1 @@
+FABMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/transport
new file mode 100644
index 00000000..f5483dbf
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/transport
@@ -0,0 +1 @@
+tcp
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/vendor b/src/test/disk_tests/multipath/nvme9n1/device/vendor
new file mode 100644
index 00000000..cdc6ddfa
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/vendor
@@ -0,0 +1 @@
+FABVEND
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/queue/rotational b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/size b/src/test/disk_tests/multipath/nvme9n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1_udevadm b/src/test/disk_tests/multipath/nvme9n1_udevadm
new file mode 100644
index 00000000..b6d13ccb
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1_udevadm
@@ -0,0 +1,12 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+N: nvme9n1
+E: DEVNAME=/dev/nvme9n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+E: DEVTYPE=disk
+E: ID_MODEL=FABRICS CTRL
+E: ID_SERIAL=FABRICS_1
+E: ID_SERIAL_SHORT=FAB1
+E: ID_WWN=uuid.10000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=0
+E: SUBSYSTEM=block
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index a0dc01f6..51b20c53 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -101,6 +101,16 @@ sub mocked_is_iscsi {
return 0;
}
+sub mocked_file_read_firstline {
+ my ($path) = @_;
+
+ my $originalsub = $diskmanage_module->original('file_read_firstline');
+
+ $path =~ s|^/sys/block|disk_tests/$testcasedir|;
+
+ return &$originalsub($path);
+}
+
sub mocked_dir_glob_foreach {
my ($dir, $regex, $sub) = @_;
@@ -248,6 +258,8 @@ $diskmanage_module->mock(
},
);
print("\tMocked dir_is_empty\n");
+$diskmanage_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked file_read_firstline\n");
$diskmanage_module->mock('check_bin' => sub { return 1; });
print("\tMocked check_bin\n");
my $tools_module = Test::MockModule->new('PVE::ProcFSTools', no_auto => 1);
^ permalink raw reply related [relevance 13%]
* [PATCH v5 storage 05/36] diskmanage: collect native NVMe multipath path state
2026-11-16 1:23 5% [PATCH v5 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-16 1:23 13% ` [PATCH v5 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
@ 2026-11-16 1:23 13% ` Thomas Lamprecht
2026-11-16 1:23 9% ` [PATCH v5 storage 16/36] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-16 1:23 9% ` [PATCH v5 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-16 1:23 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
NVMe over Fabrics usually uses native multipath, whose paths
multipathd does not know. Collect the controller state and address
and the ANA state of each path from sysfs, grouped by namespace, so
the SAN LUN inventory can report path health for both multipath
stacks. Devices with a single local controller have no per-path
entries and are left out.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: drop redundant comments]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 60 +++++++++++++++++++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../multipath/nvme_path_status_expected.json | 19 ++++++
src/test/disklist_test.pm | 16 +++++
11 files changed, 103 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
create mode 100644 src/test/disk_tests/multipath/nvme_path_status_expected.json
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index c342abcd..516c108d 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -818,6 +818,66 @@ sub get_disks {
return $disklist;
}
+# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
+# single-controller devices lack these children and are omitted.
+sub get_nvme_path_status {
+ my $res = {};
+
+ dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ 'nvme-subsys\d+',
+ sub {
+ my ($subsys) = @_;
+ my $subsysdir = "/sys/class/nvme-subsystem/$subsys";
+
+ dir_glob_foreach(
+ $subsysdir,
+ 'nvme\d+',
+ sub {
+ my ($ctrl) = @_;
+ my $ctrldir = "$subsysdir/$ctrl";
+ my $state = file_read_firstline("$ctrldir/state") // return;
+ my $address = file_read_firstline("$ctrldir/address");
+
+ dir_glob_foreach(
+ $ctrldir,
+ 'nvme\d+c\d+n\d+',
+ sub {
+ my ($pathdev) = @_;
+ return if $pathdev !~ m/^nvme(\d+)c\d+n(\d+)$/;
+ my $head = "nvme$1n$2";
+
+ my $entry = { device => "/dev/$ctrl", state => $state };
+ $entry->{address} = $address
+ if defined($address) && $address ne '';
+ my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
+ $entry->{'ana-state'} = $ana if defined($ana);
+
+ # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
+ # cannot serve IO even on a live controller
+ my $usable = $state eq 'live'
+ && (!defined($ana)
+ || $ana eq 'optimized'
+ || $ana eq 'non-optimized');
+
+ my $status = $res->{$head} //= { active => 0, paths => [] };
+ $status->{active}++ if $usable;
+ push @{ $status->{paths} }, $entry;
+ },
+ );
+ },
+ );
+ },
+ );
+
+ for my $status (values %$res) {
+ @{ $status->{paths} } =
+ sort { $a->{device} cmp $b->{device} } @{ $status->{paths} };
+ }
+
+ return $res;
+}
+
sub get_partnum {
my ($part_path) = @_;
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
new file mode 100644
index 00000000..803fab3e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
@@ -0,0 +1 @@
+traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
new file mode 100644
index 00000000..e48c58f5
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
@@ -0,0 +1 @@
+optimized
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
new file mode 100644
index 00000000..36618744
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
@@ -0,0 +1 @@
+traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
new file mode 100644
index 00000000..436c48ee
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
@@ -0,0 +1 @@
+inaccessible
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
new file mode 100644
index 00000000..f99fcb14
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
@@ -0,0 +1 @@
+0000:02:00.0
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme_path_status_expected.json b/src/test/disk_tests/multipath/nvme_path_status_expected.json
new file mode 100644
index 00000000..62611b3f
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme_path_status_expected.json
@@ -0,0 +1,19 @@
+{
+ "nvme2n1": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/nvme3",
+ "state": "live",
+ "address": "traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "optimized"
+ },
+ {
+ "device": "/dev/nvme4",
+ "state": "live",
+ "address": "traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "inaccessible"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index bd70dc33..0d34c0db 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -103,6 +103,7 @@ sub mocked_file_read_firstline {
my $originalsub = $diskmanage_module->original('file_read_firstline');
$path =~ s|^/sys/block|disk_tests/$testcasedir|;
+ $path =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|;
return &$originalsub($path);
}
@@ -112,6 +113,12 @@ sub mocked_dir_glob_foreach {
my $lines = [];
+ # nvme subsystem trees are provided as directories, glob them like production code
+ if ($dir =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|) {
+ my $originalsub = $diskmanage_module->original('dir_glob_foreach');
+ return &$originalsub($dir, $regex, $sub);
+ }
+
# read lines in from file
if ($dir =~ m{^/sys/block$}) {
@$lines = split(/\n/, read_test_file('disklist'));
@@ -230,6 +237,15 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'nvme path status should be the same');
+ }
+
done_testing($testcount);
};
}
^ permalink raw reply related [relevance 13%]
* [PATCH storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-13 3:04 8% ` [PATCH storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
@ 2026-11-13 3:04 18% ` Thomas Lamprecht
2026-11-13 3:04 17% ` [PATCH storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
` (14 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
NVMe/TCP namespaces need a manual nvme-cli setup on every node so
far. Add a storage type that connects one subsystem through each
configured portal and offers its namespaces as raw volumes. Native
NVMe multipath joins the paths and the kernel reconnects lost ones.
Local disk setup refuses namespaces attached over a fabric, as for
iSCSI LUNs. Wiping a namespace or creating a volume group on it is
refused while a storage serves images from its subsystem. nvme-cli
is only recommended, as no other storage type needs it.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
debian/control | 1 +
src/PVE/Diskmanage.pm | 10 ++
src/PVE/Makefile | 1 +
src/PVE/NVMeOF.pm | 249 +++++++++++++++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 204 +++++++++++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 13 ++
src/test/Makefile | 6 +-
src/test/run_nvmeof_taint_tests.pl | 60 +++++++
src/test/run_nvmeof_tests.pl | 243 ++++++++++++++++++++++++++++
src/test/run_san_nvme_tests.pl | 13 ++
13 files changed, 803 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/NVMeOF.pm
create mode 100644 src/PVE/Storage/NVMeOFPlugin.pm
create mode 100755 src/test/run_nvmeof_taint_tests.pl
create mode 100755 src/test/run_nvmeof_tests.pl
diff --git a/debian/control b/debian/control
index 14d8a648..99b41f92 100644
--- a/debian/control
+++ b/debian/control
@@ -55,6 +55,7 @@ Depends: bzip2,
${misc:Depends},
${perl:Depends},
Recommends: multipath-tools,
+ nvme-cli,
pve-esxi-import-tools (>= 0.6.0),
skopeo,
zfsutils-linux (>= 2.4.1-pve2),
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 1fec9ec5..7bee3b08 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -108,6 +108,8 @@ sub disk_is_used {
my $disklist = get_disks($dev, 1, 1);
die "'$disk' is not a valid local disk\n" if !defined($disklist->{$dev});
+ die "'$disk' is not a valid local disk\n"
+ if ($disklist->{$dev}->{transport} // '') =~ /^nvme-(?:tcp|rdma|fc)$/;
return 1 if $disklist->{$dev}->{used};
return 0;
@@ -503,6 +505,14 @@ sub dir_is_empty {
return 1;
}
+# Some controllers pad the NQN or derive it from padded serial/model fields.
+sub read_subsysnqn {
+ my ($path) = @_;
+ my $nqn = file_read_firstline($path) // return undef;
+ $nqn =~ s/\s+$//;
+ return $nqn;
+}
+
# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
# its controller, or from any controller of its subsystem for native NVMe multipath setups.
sub get_nvme_transport {
diff --git a/src/PVE/Makefile b/src/PVE/Makefile
index 13fecbf8..238eefd4 100644
--- a/src/PVE/Makefile
+++ b/src/PVE/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Storage.pm ${DESTDIR}${PERLDIR}/PVE/Storage.pm
install -D -m 0644 Diskmanage.pm ${DESTDIR}${PERLDIR}/PVE/Diskmanage.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/NVMeOF.pm
install -D -m 0644 ISCSI/Topology.pm ${DESTDIR}${PERLDIR}/PVE/ISCSI/Topology.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/Multipath.pm
install -D -m 0644 Multipath/Config.pm ${DESTDIR}${PERLDIR}/PVE/Multipath/Config.pm
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
new file mode 100644
index 00000000..7a3140cb
--- /dev/null
+++ b/src/PVE/NVMeOF.pm
@@ -0,0 +1,249 @@
+package PVE::NVMeOF;
+
+use v5.36;
+
+use Digest::SHA qw(sha1_hex);
+use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
+use File::Path qw(make_path);
+use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
+
+use PVE::Diskmanage;
+use PVE::JSONSchema;
+use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
+
+our $NVME = '/usr/sbin/nvme';
+our $SYSFS = '/sys';
+our $HOSTNQN_FILE = '/etc/nvme/hostnqn';
+our $HOSTID_FILE = '/etc/nvme/hostid';
+our $RUN_DIR = '/run/pve/nvmeof';
+our $NQN_PATTERN = 'nqn\.[^\s,=]+';
+
+sub canonical_address($addr) {
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ return inet_ntop(AF_INET, $packed);
+ }
+ if (defined(my $packed = inet_pton(AF_INET6, $addr))) {
+ return inet_ntop(AF_INET, substr($packed, 12))
+ if substr($packed, 0, 12) eq ("\0" x 10) . "\xff\xff";
+ return inet_ntop(AF_INET6, $packed);
+ }
+ return lc($addr);
+}
+
+# Link-local IPv6 needs a node-specific interface and cannot identify a shared configured portal.
+sub parse_portal($portal) {
+ my ($addr, $port);
+ if ($portal =~ m/^\[([0-9a-fA-F:.]+)\](?::(\d+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } elsif ($portal =~ m/^(\d+\.\d+\.\d+\.\d+)(?::(\d+))?$/) {
+ ($addr, $port) = ($1, $2);
+ } else {
+ return undef;
+ }
+ return undef if defined($port) && ($port < 1 || $port > 65535);
+ $addr = canonical_address($addr);
+ if (defined(my $packed = inet_pton(AF_INET, $addr))) {
+ return undef
+ if $addr eq '0.0.0.0'
+ || $addr eq '255.255.255.255'
+ || (unpack('C', $packed) & 0xf0) == 0xe0;
+ } elsif (defined($packed = inet_pton(AF_INET6, $addr))) {
+ my $prefix = unpack('n', $packed);
+ return undef
+ if $addr eq '::' || ($prefix & 0xffc0) == 0xfe80 || ($prefix & 0xff00) == 0xff00;
+ } else {
+ return undef;
+ }
+ return { traddr => $addr, trsvcid => int($port // 4420) };
+}
+
+PVE::JSONSchema::register_format(
+ 'pve-storage-nvme-portal',
+ sub($portal, $noerr = undef) {
+ return $portal if parse_portal($portal);
+ return undef if $noerr;
+ die "value is not an IPv4 address or a bracketed IPv6 address with optional port\n";
+ },
+);
+
+sub format_path($path) {
+ my $addr = $path->{traddr} =~ /:/ ? "[$path->{traddr}]" : $path->{traddr};
+ return defined($path->{trsvcid}) ? "$addr:$path->{trsvcid}" : $addr;
+}
+
+sub storage_paths($scfg) {
+ return [map { parse_portal($_) // die "invalid portal '$_'\n" }
+ PVE::Tools::split_list($scfg->{'nvme-portals'})];
+}
+
+sub host_identity() {
+ my ($nqn) = (file_read_firstline($HOSTNQN_FILE) // '') =~ /\A($NQN_PATTERN)\z/;
+ my ($id) = (file_read_firstline($HOSTID_FILE) // '') =~
+ /\A([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\z/i;
+ die
+ "invalid or missing NVMe host NQN in '$HOSTNQN_FILE' - install nvme-cli and check the host identity\n"
+ if !defined($nqn) || length($nqn) > 223;
+ die "invalid or missing NVMe host ID in '$HOSTID_FILE' - expected a nonzero UUID\n"
+ if !defined($id) || $id =~ /^[0-]+$/;
+ return { nqn => $nqn, id => lc($id) };
+}
+
+sub is_supported() { return -x $NVME ? 1 : 0 }
+
+sub assert_support() {
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command(['modprobe', 'nvme-tcp'], timeout => 10)
+ if !-e "$SYSFS/module/nvme_tcp";
+ my $multipath = file_read_firstline("$SYSFS/module/nvme_core/parameters/multipath") // '';
+ die "native NVMe multipath is disabled - enable nvme_core.multipath\n" if $multipath ne 'Y';
+}
+
+sub controllers() {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-fabrics/ctl";
+ dir_glob_foreach(
+ $dir,
+ 'nvme\d+',
+ sub($name, @) {
+ my $address = file_read_firstline("$dir/$name/address") // return;
+ my %address = map { split(/=/, $_, 2) } grep { /=/ } split(/,/, $address);
+ return if !defined($address{traddr});
+ $res->{$name} = {
+ transport => file_read_firstline("$dir/$name/transport") // '',
+ subsystem => PVE::Diskmanage::read_subsysnqn("$dir/$name/subsysnqn") // '',
+ state => file_read_firstline("$dir/$name/state") // 'unknown',
+ traddr => canonical_address($address{traddr}),
+ trsvcid => $address{trsvcid},
+ };
+ },
+ );
+ return $res;
+}
+
+sub subsystem_controllers($subsystem) {
+ my $controllers = controllers();
+ return {
+ map { $_ => $controllers->{$_} } grep {
+ $controllers->{$_}->{subsystem} eq $subsystem
+ && $controllers->{$_}->{transport} eq 'tcp'
+ } keys %$controllers
+ };
+}
+
+sub path_controller($controllers, $path) {
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ return $name
+ if $ctrl->{traddr} eq $path->{traddr}
+ && ($ctrl->{trsvcid} // '') eq $path->{trsvcid};
+ }
+ return undef;
+}
+
+sub namespaces($subsystem) {
+ my $res = {};
+ my $dir = "$SYSFS/class/nvme-subsystem";
+ dir_glob_foreach(
+ $dir,
+ 'nvme-subsys\d+',
+ sub($subsys, @) {
+ my $nqn = PVE::Diskmanage::read_subsysnqn("$dir/$subsys/subsysnqn") // return;
+ return if $nqn ne $subsystem;
+ dir_glob_foreach(
+ "$dir/$subsys",
+ 'nvme\d+n\d+',
+ sub($dev, @) {
+ my $wwid = file_read_firstline("$SYSFS/block/$dev/wwid") // return;
+ my $size = file_read_firstline("$SYSFS/block/$dev/size") // return;
+ $res->{$dev} = {
+ nsid => int(file_read_firstline("$SYSFS/block/$dev/nsid") // 0),
+ wwid => $wwid,
+ size => int($size) * 512,
+ };
+ },
+ );
+ },
+ );
+ return $res;
+}
+
+sub with_lock($code) {
+ my ($res, $timeout) = PVE::Tools::run_fork_with_timeout(
+ 35,
+ sub {
+ make_path($RUN_DIR);
+ open(my $lock, '>>', "$RUN_DIR/fabrics.lock") or die "cannot open NVMe lock - $!\n";
+ flock($lock, LOCK_EX | LOCK_NB)
+ or die "NVMe over Fabrics is busy - another operation is still running\n";
+ # A command still in the kernel must retain serialization after its caller times out.
+ my $flags = fcntl($lock, F_GETFD, 0) // die "cannot read NVMe lock flags - $!\n";
+ fcntl($lock, F_SETFD, $flags & ~FD_CLOEXEC)
+ or die "cannot inherit NVMe lock - $!\n";
+ return $code->();
+ },
+ );
+ die "NVMe over Fabrics operation timed out - it may still be running\n" if $timeout;
+ return $res;
+}
+
+my sub retry_file($scfg, $path) {
+ my ($key) = sha1_hex(join("\0",
+ $scfg->{subsysnqn},
+ format_path($path),
+ $scfg->{'nvme-fast-io-fail-tmo'} // 120)) =~ /\A([0-9a-f]{40})\z/;
+ return "$RUN_DIR/retry/$key";
+}
+
+sub in_cooldown($scfg, $path) {
+ my $mtime = (stat(retry_file($scfg, $path)))[9] // return 0;
+ my $age = time() - $mtime;
+ return $age > -60 && $age < 60;
+}
+
+sub note_connect_failure($scfg, $path) {
+ make_path("$RUN_DIR/retry");
+ file_set_contents(retry_file($scfg, $path), '');
+}
+
+sub connect_path($scfg, $path) {
+ my ($nqn) = $scfg->{subsysnqn} =~ /\A($NQN_PATTERN)\z/;
+ die "invalid subsystem NQN\n"
+ if !defined($nqn)
+ || length($nqn) > 223
+ || $nqn eq 'nqn.2014-08.org.nvmexpress.discovery';
+ my ($fail) = ($scfg->{'nvme-fast-io-fail-tmo'} // 120) =~ /\A(-?\d+)\z/;
+ die "invalid fast I/O fail timeout\n" if !defined($fail) || $fail < -1;
+ return with_lock(sub {
+ return if path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ assert_support();
+ my $host = host_identity();
+ run_command(
+ [
+ $NVME,
+ 'connect',
+ '--transport=tcp',
+ '--nqn',
+ $nqn,
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $path->{trsvcid},
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--ctrl-loss-tmo=-1',
+ '--fast_io_fail_tmo',
+ $fail,
+ ],
+ timeout => 30,
+ );
+ # nvme-cli can exit successfully without having connected
+ die "no controller appeared\n"
+ if !path_controller(subsystem_controllers($scfg->{subsysnqn}), $path);
+ unlink(retry_file($scfg, $path));
+ return;
+ });
+}
+
+1;
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index be6e9743..287d64f0 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -32,6 +32,7 @@ use PVE::Storage::LvmThinPlugin;
use PVE::Storage::NFSPlugin;
use PVE::Storage::CIFSPlugin;
use PVE::Storage::ISCSIPlugin;
+use PVE::Storage::NVMeOFPlugin;
use PVE::Storage::RBDPlugin;
use PVE::Storage::CephFSPlugin;
use PVE::Storage::ISCSIDirectPlugin;
@@ -57,6 +58,7 @@ PVE::Storage::LvmThinPlugin->register();
PVE::Storage::NFSPlugin->register();
PVE::Storage::CIFSPlugin->register();
PVE::Storage::ISCSIPlugin->register();
+PVE::Storage::NVMeOFPlugin->register();
PVE::Storage::RBDPlugin->register();
PVE::Storage::CephFSPlugin->register();
PVE::Storage::ISCSIDirectPlugin->register();
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a2df83c0..7f2ff6c8 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -6,6 +6,7 @@ SOURCES= \
NFSPlugin.pm \
CIFSPlugin.pm \
ISCSIPlugin.pm \
+ NVMeOFPlugin.pm \
CephFSPlugin.pm \
RBDPlugin.pm \
ISCSIDirectPlugin.pm \
diff --git a/src/PVE/Storage/NVMeOFPlugin.pm b/src/PVE/Storage/NVMeOFPlugin.pm
new file mode 100644
index 00000000..4dc9803a
--- /dev/null
+++ b/src/PVE/Storage/NVMeOFPlugin.pm
@@ -0,0 +1,204 @@
+package PVE::Storage::NVMeOFPlugin;
+
+use strict;
+use warnings;
+
+use Cwd ();
+use Time::HiRes ();
+
+use PVE::Diskmanage;
+use PVE::Network;
+use PVE::NVMeOF;
+use PVE::Storage::Plugin;
+
+use base qw(PVE::Storage::Plugin);
+
+sub type { return 'nvmeof' }
+
+sub plugindata {
+ return {
+ content => [{ images => 1, none => 1 }, { images => 1 }],
+ select_existing => 1,
+ 'sensitive-properties' => {},
+ };
+}
+
+sub properties {
+ return {
+ subsysnqn => {
+ description => 'The NQN of the NVMe subsystem.',
+ type => 'string',
+ pattern => $PVE::NVMeOF::NQN_PATTERN,
+ maxLength => 223,
+ },
+ 'nvme-portals' => {
+ description =>
+ 'TCP portals of the NVMe subsystem, as IPv4 or bracketed IPv6 addresses'
+ . ' with an optional port (default 4420).',
+ type => 'string',
+ format => 'pve-storage-nvme-portal-list',
+ },
+ 'nvme-fast-io-fail-tmo' => {
+ description => 'Seconds before I/O through a reconnecting path fails. -1 disables'
+ . ' this timeout; I/O can remain queued while paths reconnect.',
+ type => 'integer',
+ minimum => -1,
+ default => 120,
+ },
+ };
+}
+
+sub options {
+ return {
+ subsysnqn => { fixed => 1 },
+ 'nvme-portals' => {},
+ 'nvme-fast-io-fail-tmo' => { optional => 1 },
+ nodes => { optional => 1 },
+ disable => { optional => 1 },
+ content => { optional => 1 },
+ bwlimit => { optional => 1 },
+ };
+}
+
+my sub assert_valid_config {
+ my ($scfg) = @_;
+ die "the discovery subsystem cannot be used as storage\n"
+ if $scfg->{subsysnqn} eq 'nqn.2014-08.org.nvmexpress.discovery';
+ my %seen;
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ my $portal = PVE::NVMeOF::format_path($path);
+ die "portal '$portal' is listed more than once\n" if $seen{$portal}++;
+ }
+}
+
+sub on_add_hook {
+ my ($class, $storeid, $scfg, %param) = @_;
+ assert_valid_config($scfg);
+ return;
+}
+
+sub on_update_hook_full {
+ my ($class, $storeid, $scfg, $update, $delete, $sensitive) = @_;
+ my $merged = { %$scfg, %$update };
+ delete $merged->{$_} for ($delete // [])->@*;
+ assert_valid_config($merged);
+ return $class->SUPER::on_update_hook_full($storeid, $scfg, $update, $delete, $sensitive);
+}
+
+sub parse_volname {
+ my ($class, $volname) = @_;
+ if ($volname =~ m!^(nvme-[a-zA-Z0-9_.:+-]+)$! && $volname !~ /-part\d+$/) {
+ return ('images', $1, undef, undef, undef, undef, 'raw');
+ }
+ die "unable to parse NVMe over Fabrics volume name '$volname'\n";
+}
+
+sub filesystem_path {
+ my ($class, $scfg, $volname, $snapname) = @_;
+ die "snapshot is not possible on NVMe over Fabrics storage\n" if defined($snapname);
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my $path = "/dev/disk/by-id/$name";
+ return wantarray ? ($path, $vmid, $vtype) : $path;
+}
+
+sub create_base { die "can't create base images in NVMe over Fabrics storage\n" }
+sub clone_image { die "can't clone images in NVMe over Fabrics storage\n" }
+sub alloc_image { die "can't allocate space in NVMe over Fabrics storage\n" }
+sub free_image { die "can't free space in NVMe over Fabrics storage\n" }
+sub volume_resize { die "volume resize is not possible on NVMe over Fabrics storage\n" }
+
+sub list_volumes {
+ my ($class, $storeid, $scfg, $vmid, $content_types) = @_;
+ my $res = $class->list_images($storeid, $scfg, $vmid);
+ $_->{content} = 'images' for @$res;
+ return $res;
+}
+
+sub list_images {
+ my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
+ return [] if defined($vmid) && !$vollist;
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ my $res = [];
+ for my $dev (sort keys %$namespaces) {
+ my $ns = $namespaces->{$dev};
+ my $volid = "$storeid:nvme-$ns->{wwid}";
+ next if $vollist && !grep { $_ eq $volid } @$vollist;
+ push @$res,
+ {
+ volid => $volid,
+ format => 'raw',
+ size => $ns->{size},
+ vmid => 0,
+ nsid => $ns->{nsid},
+ };
+ }
+ return $res;
+}
+
+sub status {
+ my ($class, $storeid, $scfg, $cache) = @_;
+ my $active = grep { $_->{state} eq 'live' }
+ values PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn})->%*;
+ return (0, 0, 0, $active ? 1 : 0);
+}
+
+sub activate_storage {
+ my ($class, $storeid, $scfg, $cache) = @_;
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ next if defined(PVE::NVMeOF::path_controller($controllers, $path));
+ next if PVE::NVMeOF::in_cooldown($scfg, $path);
+ eval {
+ die "no answer from portal\n"
+ if !PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::connect_path($scfg, $path);
+ };
+ if (my $err = $@) {
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ warn "storage '$storeid': connecting to '"
+ . PVE::NVMeOF::format_path($path)
+ . "' failed - $err";
+ }
+ }
+ return;
+}
+
+sub deactivate_storage { return }
+
+sub check_connection {
+ my ($class, $storeid, $scfg) = @_;
+ my $controllers = PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn});
+ return 1 if grep { $_->{state} eq 'live' } values %$controllers;
+ for my $path (PVE::NVMeOF::storage_paths($scfg)->@*) {
+ next if defined(PVE::NVMeOF::path_controller($controllers, $path));
+ next if PVE::NVMeOF::in_cooldown($scfg, $path);
+ return 1 if PVE::Network::tcp_ping($path->{traddr}, $path->{trsvcid}, 2);
+ PVE::NVMeOF::note_connect_failure($scfg, $path);
+ }
+ return 0;
+}
+
+sub activate_volume {
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
+ my $path = $class->filesystem_path($scfg, $volname, $snapname);
+ my $deadline = Time::HiRes::time() + 10;
+ while (!-b $path && Time::HiRes::time() < $deadline) {
+ last if !keys PVE::NVMeOF::subsystem_controllers($scfg->{subsysnqn})->%*;
+ Time::HiRes::usleep(250_000);
+ }
+ my $real = Cwd::realpath($path);
+ die "volume '$volname' is not available on this node\n" if !$real || !-b $real;
+ my ($dev) = $real =~ m!^/dev/(nvme\d+n\d+)$!;
+ die "volume '$volname' is not an NVMe namespace\n" if !defined($dev);
+ my $nqn = PVE::Diskmanage::read_subsysnqn("/sys/block/$dev/device/subsysnqn") // '';
+ die "volume '$volname' is not part of subsystem '$scfg->{subsysnqn}'\n"
+ if $nqn ne $scfg->{subsysnqn};
+}
+
+sub volume_has_feature {
+ my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
+ return 1 if $feature eq 'copy' && !defined($snapname);
+ return undef;
+}
+
+1;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index e4ad7e6f..783d4145 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -42,7 +42,7 @@ our @COMMON_TAR_FLAGS = qw(
);
our @SHARED_STORAGE = (
- 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs',
+ 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs', 'nvmeof',
);
our $QCOW2_PREALLOCATION = {
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index bba3c128..f3682106 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -232,6 +232,11 @@ sub lun_partitions($lun) {
}
sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
+ my $name = basename($lun->{devpath});
+ my $nqn =
+ $name =~ /^nvme\d+n\d+$/
+ ? PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn")
+ : undef;
my %vgs = map { $_ => 1 } PVE::Storage::LVMPlugin::lun_volume_groups(
[$lun->{devpath}, lun_partitions($lun)->@*],
)->@*;
@@ -253,6 +258,14 @@ sub assert_lun_unreferenced($cfg, $lun, $exempt = undef) {
) {
die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this target\n";
}
+ if (
+ $type eq 'nvmeof'
+ && defined($nqn)
+ && $scfg->{subsysnqn} eq $nqn
+ && PVE::Storage::san_storage_serves_images($scfg)
+ ) {
+ die "cannot use '$lun->{devpath}' - storage '$sid' serves images from this subsystem\n";
+ }
next if $type ne 'lvm' || !$scfg->{base};
my (undef, $volname) = PVE::Storage::Plugin::parse_volume_id($scfg->{base});
my ($wwid) = $volname =~ m/(?:^|\.)(?:dm-uuid-mpath|scsi|nvme)-(.+)$/;
diff --git a/src/test/Makefile b/src/test/Makefile
index c9bcea8f..124612da 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api test_disk_api
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api test_disk_api test_nvmeof
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -76,3 +76,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
+
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+ ./run_nvmeof_tests.pl
+ perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
new file mode 100755
index 00000000..3c19f8cc
--- /dev/null
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl -T
+
+use v5.36;
+use lib qw(..);
+use File::Temp qw(tempdir);
+use Scalar::Util qw(tainted);
+use Test::More;
+use Test::MockModule;
+use PVE::NVMeOF;
+use PVE::Tools qw(file_set_contents file_get_contents);
+
+$ENV{PATH} = '/usr/sbin:/usr/bin:/sbin:/bin';
+delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+my $dir = tempdir('nvmeof-taint-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::HOSTNQN_FILE = "$dir/hostnqn";
+local $PVE::NVMeOF::HOSTID_FILE = "$dir/hostid";
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+file_set_contents($PVE::NVMeOF::HOSTNQN_FILE, "nqn.host\n");
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "12345678-1234-1234-1234-123456789abc\n");
+file_set_contents("$dir/config", "nqn.test\n192.0.2.1\n120\n");
+my ($nqn, $portal, $fail) = split(/\n/, file_get_contents("$dir/config"));
+ok(tainted($nqn), 'configuration input is tainted');
+my $nvme = Test::MockModule->new('PVE::NVMeOF');
+$nvme->mock(with_lock => sub { $_[0]->() });
+my $commands = 0;
+$nvme->mock(
+ subsystem_controllers => sub {
+ return $commands ? { nvme0 => { traddr => '192.0.2.1', trsvcid => 4420 } } : {};
+ },
+);
+$nvme->mock(assert_support => sub { });
+$nvme->mock(
+ run_command => sub($cmd, %opts) {
+ $commands++;
+ is(
+ scalar(grep { tainted($_) } @$cmd),
+ 0,
+ 'all connect operands are validated and untainted',
+ );
+ PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ },
+);
+my $path = PVE::NVMeOF::parse_portal($portal);
+eval { PVE::NVMeOF::connect_path({ subsysnqn => $nqn, 'nvme-fast-io-fail-tmo' => $fail }, $path) };
+is($@, '', 'connect command can execute in taint mode');
+is($commands, 1, 'one connect');
+PVE::NVMeOF::note_connect_failure({ subsysnqn => $nqn }, $path);
+ok(
+ PVE::NVMeOF::in_cooldown({ subsysnqn => $nqn }, $path),
+ 'cooldown accepts validated file-backed configuration',
+);
+for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.discovery') {
+ eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
+ like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
+}
+file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
+eval { PVE::NVMeOF::host_identity() };
+like($@, qr/nonzero UUID/, 'zero host ID refused');
+
+done_testing();
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
new file mode 100755
index 00000000..5ff96833
--- /dev/null
+++ b/src/test/run_nvmeof_tests.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use File::Temp qw(tempdir);
+use File::Path qw(make_path);
+use Fcntl qw(:flock);
+use Test::More;
+use Test::MockModule;
+use PVE::NVMeOF;
+use PVE::Storage;
+use PVE::Tools qw(file_set_contents);
+
+my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
+local $PVE::NVMeOF::RUN_DIR = "$dir/run";
+local $PVE::NVMeOF::SYSFS = "$dir/sys";
+my $class = 'PVE::Storage::NVMeOFPlugin';
+my $cfg = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ 'nvme-portals' => '192.0.2.1,[2001:db8::2]:4421',
+ content => { none => 1 },
+};
+
+subtest 'configuration, portals and volumes' => sub {
+ is(PVE::Storage::Plugin->lookup('nvmeof'), $class, 'plugin registered');
+ is_deeply(
+ [sort keys $class->properties()->%*],
+ [qw(nvme-fast-io-fail-tmo nvme-portals subsysnqn)],
+ 'only three plugin-specific properties',
+ );
+ my $parsed = PVE::Storage::Plugin->parse_config(
+ 'storage.cfg',
+ "nvmeof: fabric\n\tsubsysnqn nqn.test\n\tnvme-portals 192.0.2.1\n\tcontent none\n",
+ );
+ is($parsed->{ids}->{fabric}->{subsysnqn}, 'nqn.test', 'storage.cfg accepts the plugin');
+ is_deeply(
+ $parsed->{ids}->{fabric}->{content},
+ { none => 1 },
+ 'connection-only content parses',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ { traddr => '192.0.2.1', trsvcid => 4420 },
+ 'default I/O port',
+ );
+ is_deeply(
+ PVE::NVMeOF::parse_portal('[2001:0db8::1]:4421'),
+ { traddr => '2001:db8::1', trsvcid => 4421 },
+ 'canonical IPv6',
+ );
+ for my $bad (
+ 'host.example', '1.2.3.4:0', '1.2.3.4:65536', '[fe80::1]', '[::]', '224.0.0.1',
+ ) {
+ ok(!PVE::NVMeOF::parse_portal($bad), "invalid portal $bad");
+ }
+ eval {
+ $class->on_add_hook('fabric', { %$cfg, 'nvme-portals' => '192.0.2.1,192.0.2.1:4420' });
+ };
+ like($@, qr/listed more than once/, 'duplicate portals refused');
+ eval {
+ $class->on_add_hook(
+ 'fabric',
+ { %$cfg, subsysnqn => 'nqn.2014-08.org.nvmexpress.discovery' },
+ );
+ };
+ like($@, qr/discovery subsystem/, 'discovery subsystem refused');
+ is(
+ scalar($class->filesystem_path($cfg, 'nvme-eui.0123456789abcdef')),
+ '/dev/disk/by-id/nvme-eui.0123456789abcdef',
+ 'stable volume path',
+ );
+ for my $bad ('nvme-../../sda', 'nvme-eui.abc-part1', 'sda') {
+ eval { $class->parse_volname($bad) };
+ like($@, qr/unable to parse/, "invalid volume $bad");
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ $nvme->mock(
+ namespaces => sub { { nvme0n1 => { wwid => 'eui.abc', size => 4096, nsid => 1 } } });
+ is(
+ $class->list_volumes('fabric', $cfg)->[0]->{volid},
+ 'fabric:nvme-eui.abc',
+ 'content none still offers bases',
+ );
+ is_deeply($class->list_images('fabric', $cfg, 100), [], 'namespaces have no VM owner');
+ $nvme->mock(subsystem_controllers => sub { {} });
+ eval { $class->activate_volume('fabric', $cfg, 'nvme-nonexistent-test') };
+ like($@, qr/not available/,
+ 'missing namespace fails without waiting on absent controllers');
+};
+
+subtest 'sysfs topology' => sub {
+ my $sys = $PVE::NVMeOF::SYSFS;
+ make_path(
+ "$sys/class/nvme-fabrics/ctl/nvme1",
+ "$sys/class/nvme-subsystem/nvme-subsys0/nvme0n1",
+ "$sys/block/nvme0n1",
+ );
+ my %attrs = (
+ address => 'traddr=192.0.2.1,trsvcid=4420',
+ transport => 'tcp',
+ subsysnqn => 'nqn.test',
+ state => 'connecting',
+ );
+ file_set_contents("$sys/class/nvme-fabrics/ctl/nvme1/$_", "$attrs{$_}\n") for keys %attrs;
+ file_set_contents("$sys/class/nvme-subsystem/nvme-subsys0/subsysnqn", "nqn.test\n");
+ file_set_contents("$sys/block/nvme0n1/wwid", "eui.abc\n");
+ file_set_contents("$sys/block/nvme0n1/size", "8\n");
+ file_set_contents("$sys/block/nvme0n1/nsid", "1\n");
+ is(
+ PVE::NVMeOF::controllers()->{nvme1}->{state},
+ 'connecting',
+ 'reconnecting controller is still present',
+ );
+ is(
+ PVE::NVMeOF::path_controller(
+ PVE::NVMeOF::subsystem_controllers('nqn.test'),
+ PVE::NVMeOF::parse_portal('192.0.2.1'),
+ ),
+ 'nvme1',
+ 'portal controller found',
+ );
+ is_deeply(
+ PVE::NVMeOF::namespaces('nqn.test'),
+ { nvme0n1 => { wwid => 'eui.abc', size => 4096, nsid => 1 } },
+ 'namespace facts',
+ );
+ is_deeply(PVE::NVMeOF::namespaces('nqn.other'), {}, 'other subsystem excluded');
+};
+
+subtest 'serialized commands inherit the lock' => sub {
+ my $value = PVE::NVMeOF::with_lock(sub {
+ my $out = '';
+ PVE::Tools::run_command(
+ [
+ '/usr/bin/perl',
+ '-MFcntl=:flock',
+ '-e',
+ 'my @held = grep { (readlink($_) // "") =~ /fabrics.lock$/ } glob("/proc/self/fd/*"); die "not inherited" if !@held; open(my $fh, ">>", $ARGV[0]) or die $!; die "lock missing" if flock($fh, LOCK_EX|LOCK_NB); print "locked\\n";',
+ "$PVE::NVMeOF::RUN_DIR/fabrics.lock",
+ ],
+ timeout => 5,
+ outfunc => sub { $out .= $_[0] },
+ );
+ return $out;
+ });
+ is($value, 'locked', 'exec cannot acquire the lock held by its parent');
+ open(my $lock, '>>', "$PVE::NVMeOF::RUN_DIR/fabrics.lock") or die $!;
+ flock($lock, LOCK_EX) or die $!;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'busy operation never enters callback');
+ close($lock);
+
+ my $tools = Test::MockModule->new('PVE::Tools');
+ my $timed_out = 1;
+ $tools->mock(run_fork_with_timeout => sub { return ($_[1]->(), $timed_out) });
+ my $retained;
+ eval {
+ PVE::NVMeOF::with_lock(sub {
+ my ($path) =
+ grep { (readlink($_) // '') =~ /fabrics.lock$/ } glob('/proc/self/fd/*');
+ my ($fd) = $path =~ m{/(\d+)$};
+ open($retained, '>&', $fd) or die $!;
+ return 1;
+ });
+ };
+ like($@, qr/timed out.*may still be running/, 'timeout does not claim deletion completed');
+ $timed_out = 0;
+ eval {
+ PVE::NVMeOF::with_lock(sub { die "must not count paths\n" });
+ };
+ like($@, qr/is busy/, 'retained descriptor keeps serialization after the caller returns');
+ close($retained);
+ is(PVE::NVMeOF::with_lock(sub { 1 }), 1, 'last descriptor close releases serialization');
+};
+
+subtest 'connect options, kernel reconnect and cooldown' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my @commands;
+ my $controllers = {};
+ $nvme->mock(with_lock => sub { $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity =>
+ sub { { nqn => 'nqn.host', id => '12345678-1234-1234-1234-123456789abc' } });
+ $nvme->mock(subsystem_controllers => sub { $controllers });
+ my $appear = 1;
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ is($opts{timeout}, 30, 'bounded connect');
+ push @commands, $cmd;
+ my %arg =
+ map { $cmd->[$_] => $cmd->[$_ + 1] } grep { $cmd->[$_] =~ /^--tr/ } 0 .. $#$cmd;
+ $controllers->{ 'nvme' . scalar(@commands) } =
+ { traddr => $arg{'--traddr'}, trsvcid => $arg{'--trsvcid'}, state => 'live' }
+ if $appear;
+ },
+ );
+ $net->mock(tcp_ping => sub { 1 });
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 2, 'one connect per missing portal');
+ ok(grep({ $_ eq '--ctrl-loss-tmo=-1' } $commands[0]->@*), 'kernel reconnects indefinitely');
+ is_deeply([@{ $commands[0] }[-2, -1]], ['--fast_io_fail_tmo', 120], 'fast failure default');
+ @commands = ();
+ $controllers = {
+ nvme1 => { traddr => '192.0.2.1', trsvcid => 4420, state => 'connecting' },
+ nvme2 => { traddr => '2001:db8::2', trsvcid => 4421, state => 'live' },
+ };
+ $class->activate_storage('fabric', $cfg);
+ is_deeply(\@commands, [],
+ 'existing controllers are never reconnected, regardless of state');
+ $class->deactivate_storage('fabric', $cfg);
+ is_deeply(\@commands, [], 'deactivation does not remove controllers');
+ $controllers = {};
+ my $path = PVE::NVMeOF::storage_paths($cfg)->[0];
+ PVE::NVMeOF::note_connect_failure($cfg, $path);
+ ok(PVE::NVMeOF::in_cooldown($cfg, $path), 'failure starts cooldown');
+ $class->activate_storage('fabric', $cfg);
+ is(scalar(@commands), 1, 'only the other portal connects');
+ ($controllers, $appear) = ({}, 0);
+ my $other = PVE::NVMeOF::storage_paths($cfg)->[1];
+ my $warning = '';
+ {
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ $class->activate_storage('fabric', $cfg);
+ }
+ like($warning, qr/no controller appeared/, 'a connect without a controller is a failure');
+ ok(PVE::NVMeOF::in_cooldown($cfg, $other), 'which starts the cooldown too');
+};
+
+subtest 'local disk setup rejects fabric namespaces by transport' => sub {
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ for my $transport (qw(nvme-tcp nvme-rdma nvme-fc)) {
+ $disk->mock(get_disks => sub { { nvme0n1 => { transport => $transport } } });
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/nvme0n1') };
+ like($@, qr/not a valid local disk/,
+ "$transport refuses without storage configuration");
+ }
+};
+
+done_testing();
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index c2f3c65e..b1a39629 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -38,6 +38,7 @@ $storage->mock(config => sub { $cfg });
$disk->mock(verify_blockdev_path => sub { $device });
$disk->mock(is_partition => sub { 0 });
$disk->mock(get_nvme_transport => sub { 'fc' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
$disk->mock(is_iscsi_device => sub { 0 });
$disk->mock(is_mounted => sub { 0 });
$disk->mock(has_holder => sub { 0 });
@@ -65,6 +66,18 @@ $disk->mock(is_partition => sub { 0 });
$cfg->{ids}->{data} = { type => 'lvm', base => 'fabric:nvme-eui.0123456789abcdef' };
eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
like($@, qr/base volume/, 'native base reference refuses');
+$cfg->{ids} =
+ { fabric =>
+ { type => 'nvmeof', subsysnqn => 'nqn.test', disable => 1, content => { images => 1 } } };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+like(
+ $@,
+ qr/serves images from this subsystem/,
+ 'direct namespace image use refuses even when disabled',
+);
+$cfg->{ids}->{fabric}->{content} = { none => 1 };
+eval { PVE::Storage::SAN::assert_lun_unreferenced($cfg, $lun) };
+is($@, '', 'connection-only storage permits namespace initialization');
$cfg->{ids} = {};
@order = @opens = ();
$tools->mock(file_get_contents => sub { 1024 });
^ permalink raw reply related [relevance 18%]
* [PATCH storage 07/17] api: add node-level NVMe over Fabrics status and controller removal
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (5 preceding siblings ...)
2026-11-13 3:04 21% ` [PATCH storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage Thomas Lamprecht
@ 2026-11-13 3:04 14% ` Thomas Lamprecht
2026-11-13 3:04 10% ` [PATCH storage 08/17] multipath: report the NVMe host NQN of each node Thomas Lamprecht
` (9 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
The host NQN for the access rules of an array and the controllers of
a node are only visible with nvme-cli on a shell. Add the API module
for /nodes/{node}/nvmeof with the host identity and the fabrics
controllers with their subsystem, portal, state and storage.
Removing a portal or the storage does not disconnect, so a controller
can be removed here, unless a namespace in use would lose its last
usable path. Reading needs Sys.Audit on the node or
Datastore.Allocate on /storage, the removal Sys.Modify on '/'.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Makefile | 1 +
src/PVE/API2/NVMeOF.pm | 182 +++++++++++++++++++++++++++++++
src/PVE/Diskmanage.pm | 16 +--
src/PVE/NVMeOF.pm | 41 +++++++
src/test/Makefile | 3 +-
src/test/run_nvmeof_api_tests.pl | 151 +++++++++++++++++++++++++
6 files changed, 385 insertions(+), 9 deletions(-)
create mode 100644 src/PVE/API2/NVMeOF.pm
create mode 100755 src/test/run_nvmeof_api_tests.pl
diff --git a/src/PVE/API2/Makefile b/src/PVE/API2/Makefile
index 9ab978b0..1be9ab04 100644
--- a/src/PVE/API2/Makefile
+++ b/src/PVE/API2/Makefile
@@ -4,6 +4,7 @@
install:
install -D -m 0644 Disks.pm ${DESTDIR}${PERLDIR}/PVE/API2/Disks.pm
install -D -m 0644 ISCSI.pm ${DESTDIR}${PERLDIR}/PVE/API2/ISCSI.pm
+ install -D -m 0644 NVMeOF.pm ${DESTDIR}${PERLDIR}/PVE/API2/NVMeOF.pm
install -D -m 0644 Multipath.pm ${DESTDIR}${PERLDIR}/PVE/API2/Multipath.pm
make -C Storage install
make -C Disks install
diff --git a/src/PVE/API2/NVMeOF.pm b/src/PVE/API2/NVMeOF.pm
new file mode 100644
index 00000000..57e70df4
--- /dev/null
+++ b/src/PVE/API2/NVMeOF.pm
@@ -0,0 +1,182 @@
+package PVE::API2::NVMeOF;
+
+use v5.36;
+
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::NVMeOF;
+use PVE::RESTHandler;
+use PVE::RPCEnvironment;
+use PVE::Storage;
+
+use base qw(PVE::RESTHandler);
+
+my $read_permissions = {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+};
+my $controller_schema = {
+ description => 'The fabrics controller name, for example nvme3.',
+ type => 'string',
+ pattern => 'nvme\d+',
+};
+
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ method => 'GET',
+ proxyto => 'node',
+ permissions => { user => 'all' },
+ description => 'Node NVMe over Fabrics index.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => { type => 'object', properties => { name => { type => 'string' } } },
+ links => [{ rel => 'child', href => '{name}' }],
+ },
+ code => sub { return [{ name => 'status' }, { name => 'controller' }] },
+});
+
+__PACKAGE__->register_method({
+ name => 'status',
+ path => 'status',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'Report the NVMe host identity and nvme-cli availability.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ supported => { type => 'boolean', description => 'Whether nvme-cli is installed.' },
+ 'host-nqn' => {
+ type => 'string',
+ optional => 1,
+ description => 'The host NQN for target access control.',
+ },
+ 'host-id' =>
+ { type => 'string', optional => 1, description => 'The persistent host UUID.' },
+ error => {
+ type => 'string',
+ optional => 1,
+ description => 'Why the host identity is unavailable.',
+ },
+ },
+ },
+ code => sub {
+ my $res = { supported => PVE::NVMeOF::is_supported() };
+ my $host = eval { PVE::NVMeOF::host_identity() };
+ if (my $error = $@) {
+ chomp $error;
+ $res->{error} = $error;
+ } else {
+ $res->{'host-nqn'} = $host->{nqn};
+ $res->{'host-id'} = $host->{id};
+ }
+ return $res;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'controllers',
+ path => 'controller',
+ method => 'GET',
+ protected => 1,
+ proxyto => 'node',
+ permissions => $read_permissions,
+ description => 'List connected NVMe over Fabrics controllers and their states.',
+ parameters =>
+ { additionalProperties => 0, properties => { node => get_standard_option('pve-node') } },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ controller => $controller_schema,
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ transport => { type => 'string', description => 'The controller transport.' },
+ portal => {
+ type => 'string',
+ description => 'The controller address and port, if applicable.',
+ },
+ state => {
+ type => 'string',
+ description => 'The controller state, such as live or connecting.',
+ },
+ namespaces => {
+ type => 'integer',
+ description => 'The number of namespace devices in the subsystem.',
+ },
+ 'used-by-storage' => {
+ type => 'string',
+ optional => 1,
+ description => 'An NVMe over Fabrics storage using the subsystem.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my $cfg = PVE::Storage::config();
+ my (%owners, %counts);
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $owners{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
+ }
+ my $controllers = PVE::NVMeOF::controllers();
+ my @rows;
+ for my $name (sort keys %$controllers) {
+ my $ctrl = $controllers->{$name};
+ my $nqn = $ctrl->{subsystem};
+ $counts{$nqn} //= scalar(keys PVE::NVMeOF::namespaces($nqn)->%*);
+ push @rows,
+ {
+ controller => $name,
+ subsysnqn => $nqn,
+ transport => $ctrl->{transport},
+ portal => PVE::NVMeOF::format_path($ctrl),
+ state => $ctrl->{state},
+ namespaces => $counts{$nqn},
+ defined($owners{$nqn}) ? ('used-by-storage' => $owners{$nqn}) : (),
+ };
+ }
+ return \@rows;
+ },
+});
+
+__PACKAGE__->register_method({
+ name => 'disconnect',
+ path => 'controller/{controller}',
+ method => 'DELETE',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/', ['Sys.Modify']] },
+ description => 'Disconnect one fabrics controller. Refuse when a namespace in use has no'
+ . ' other usable path. A storage still listing the portal reconnects it on activation.',
+ parameters => {
+ additionalProperties => 0,
+ properties =>
+ { node => get_standard_option('pve-node'), controller => $controller_schema },
+ },
+ returns => { type => 'string', description => 'The task identifier.' },
+ code => sub {
+ my ($param) = @_;
+ my $rpcenv = PVE::RPCEnvironment::get();
+ return $rpcenv->fork_worker(
+ 'nvmedisconnect',
+ $param->{controller},
+ $rpcenv->get_user(),
+ sub {
+ PVE::NVMeOF::disconnect_guarded($param->{controller});
+ },
+ );
+ },
+});
+
+1;
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 7bee3b08..3141ca7a 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -898,6 +898,13 @@ sub get_multipath_disks {
return $disklist;
}
+sub nvme_path_is_usable {
+ my ($path) = @_;
+ my $ana = $path->{'ana-state'};
+ return $path->{state} eq 'live'
+ && (!defined($ana) || $ana eq 'optimized' || $ana eq 'non-optimized');
+}
+
# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
# single-controller devices lack these children and are omitted.
sub get_nvme_path_status {
@@ -933,15 +940,8 @@ sub get_nvme_path_status {
my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
$entry->{'ana-state'} = $ana if defined($ana);
- # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
- # cannot serve IO even on a live controller
- my $usable = $state eq 'live'
- && (!defined($ana)
- || $ana eq 'optimized'
- || $ana eq 'non-optimized');
-
my $status = $res->{$head} //= { active => 0, paths => [] };
- $status->{active}++ if $usable;
+ $status->{active}++ if nvme_path_is_usable($entry);
push @{ $status->{paths} }, $entry;
},
);
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index d1dfe15b..c81cb72f 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -308,4 +308,45 @@ sub discover($portal) {
die "discovery at portal '$portal' failed - $error";
}
+sub disconnect_guarded($controller) {
+ my ($name) = $controller =~ /\A(nvme\d+)\z/;
+ die "invalid controller name '$controller'\n" if !defined($name);
+ return with_lock(sub {
+ require PVE::Storage::SAN;
+ my $ctrl = controllers()->{$name}
+ // die "'$name' is not an NVMe over Fabrics controller\n";
+ my $namespaces = namespaces($ctrl->{subsystem});
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %heads = map { $_ => 1 } keys %$namespaces;
+ for my $head (keys %$status) {
+ $heads{$head} = 1
+ if grep { $_->{device} eq "/dev/$name" } $status->{$head}->{paths}->@*;
+ }
+ PVE::Cluster::cfs_update(1);
+ my $cfg = PVE::Storage::config();
+ for my $head (sort keys %heads) {
+ my $paths = $status->{$head}->{paths} // [];
+ next
+ if grep { $_->{device} ne "/dev/$name" && PVE::Diskmanage::nvme_path_is_usable($_) }
+ @$paths;
+ my $ns = $namespaces->{$head} // die
+ "cannot disconnect '$name' - namespace '$head' has no device on this node to check for use\n";
+ my $device = "/dev/$head";
+ die
+ "cannot disconnect '$name' - namespace '$head' is in use and has no other usable path\n"
+ if PVE::Diskmanage::is_mounted($device) || PVE::Diskmanage::has_holder($device);
+ eval {
+ PVE::Storage::SAN::assert_lun_unreferenced(
+ $cfg,
+ { devpath => $device, wwid => $ns->{wwid} },
+ );
+ };
+ die "cannot disconnect '$name' - $@" if $@;
+ }
+ die "nvme-cli is not installed\n" if !is_supported();
+ run_command([$NVME, 'disconnect', '--device', "/dev/$name"], timeout => 30);
+ return;
+ });
+}
+
1;
diff --git a/src/test/Makefile b/src/test/Makefile
index 124612da..73183dc1 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -77,6 +77,7 @@ test_san_api: run_san_api_tests.pl run_san_wipe_tests.pl run_san_nvme_tests.pl
test_disk_api: run_disk_api_tests.pl
./run_disk_api_tests.pl
-test_nvmeof: run_nvmeof_tests.pl run_nvmeof_taint_tests.pl
+test_nvmeof: run_nvmeof_tests.pl run_nvmeof_api_tests.pl run_nvmeof_taint_tests.pl
./run_nvmeof_tests.pl
+ ./run_nvmeof_api_tests.pl
perl -T ./run_nvmeof_taint_tests.pl
diff --git a/src/test/run_nvmeof_api_tests.pl b/src/test/run_nvmeof_api_tests.pl
new file mode 100755
index 00000000..3849dba5
--- /dev/null
+++ b/src/test/run_nvmeof_api_tests.pl
@@ -0,0 +1,151 @@
+#!/usr/bin/perl
+
+use v5.36;
+use lib qw(..);
+use Test::More;
+use Test::MockModule;
+use PVE::API2::NVMeOF;
+use PVE::Storage::SAN;
+
+subtest 'last-path disconnect is checked inside serialization' => sub {
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $disk = Test::MockModule->new('PVE::Diskmanage');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $san = Test::MockModule->new('PVE::Storage::SAN');
+ my $cluster = Test::MockModule->new('PVE::Cluster');
+ our $locked;
+ my ($commands, $checks, $mounted, $busy, $headless) = (0, 0, 0, 0, 0);
+ my $other = { device => '/dev/nvme2', state => 'live', 'ana-state' => 'optimized' };
+ $nvme->mock(with_lock =>
+ sub { die "NVMe over Fabrics is busy\n" if $busy; local $locked = 1; $_[0]->() });
+ $nvme->mock(
+ controllers => sub {
+ ok($locked, 'controller snapshot is locked');
+ { nvme1 => { subsystem => 'nqn.test' } };
+ },
+ );
+ $nvme->mock(namespaces => sub { $headless ? {} : { nvme0n1 => { wwid => 'eui.abc' } } });
+ $nvme->mock(is_supported => sub { 1 });
+ $disk->mock(
+ get_nvme_path_status =>
+ sub { {
+ nvme0n1 => { paths => [{ device => '/dev/nvme1', state => 'live' }, $other] } } },
+ );
+ $disk->mock(is_mounted => sub { $mounted });
+ $disk->mock(has_holder => sub { 0 });
+ $cluster->mock(cfs_update => sub { ok($locked, 'configuration refreshed under lock') });
+ $storage->mock(config => sub { { ids => {} } });
+ $san->mock(
+ assert_lun_unreferenced => sub { $checks++; die "storage uses this namespace\n" });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'deletion keeps the lock');
+ is($opts{timeout}, 30, 'deletion is bounded');
+ is_deeply(
+ $cmd,
+ ['/usr/sbin/nvme', 'disconnect', '--device', '/dev/nvme1'],
+ 'only the selected controller is removed',
+ );
+ $commands++;
+ },
+ );
+ for my $ana ('optimized', 'non-optimized') {
+ $other->{'ana-state'} = $ana;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ }
+ is($commands, 2, 'another usable path permits removal');
+ is($checks, 0, 'no usage probe when another path is usable');
+ for my $ana ('inaccessible', 'persistent-loss', 'change') {
+ $other->{'ana-state'} = $ana;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, "$ana does not protect an in-use namespace");
+ }
+ $other = { device => '/dev/nvme2', state => 'connecting', 'ana-state' => 'optimized' };
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/storage uses this namespace/, 'reconnecting is not a usable path');
+ is($commands, 2, 'refusals never delete');
+ $san->mock(assert_lun_unreferenced => sub { $checks++ });
+ $mounted = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is in use/, 'local mount refuses');
+ $mounted = 0;
+ PVE::NVMeOF::disconnect_guarded('nvme1');
+ is($commands, 3, 'unused namespace can lose its final path');
+ $headless = 1;
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/has no device/, 'uncheckable namespace refuses');
+ $busy = 1;
+ $nvme->mock(controllers => sub { die "must not count paths\n" });
+ eval { PVE::NVMeOF::disconnect_guarded('nvme1') };
+ like($@, qr/is busy/, 'ongoing deletion blocks another snapshot');
+ eval { PVE::NVMeOF::disconnect_guarded('../nvme1') };
+ like($@, qr/invalid controller/, 'invalid controller refused before locking');
+};
+
+subtest 'node API contract' => sub {
+ my $api = 'PVE::API2::NVMeOF';
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ $storage->mock(
+ config =>
+ sub { { ids => { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } } } },
+ );
+ $nvme->mock(is_supported => sub { 0 });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'uuid' } });
+ my $status = $api->status({ node => 'n1' });
+ is($status->{supported}, 0, 'availability means nvme-cli, not identity or version');
+ is($status->{'host-nqn'}, 'nqn.host', 'host identity shown independently');
+ $nvme->mock(is_supported => sub { 1 });
+ $nvme->mock(host_identity => sub { die "missing host identity\n" });
+ $status = $api->status({ node => 'n1' });
+ is_deeply(
+ $status,
+ { supported => 1, error => 'missing host identity' },
+ 'identity error does not hide installed tools',
+ );
+ $nvme->mock(
+ controllers => sub { {
+ nvme1 => {
+ subsystem => 'nqn.test',
+ transport => 'tcp',
+ traddr => '192.0.2.1',
+ trsvcid => 4420,
+ state => 'connecting',
+ },
+ } },
+ );
+ $nvme->mock(namespaces => sub { { nvme0n1 => {} } });
+ my $rows = $api->controllers({ node => 'n1' });
+ is($rows->[0]->{'used-by-storage'}, 'fabric', 'controller attributed');
+ is($rows->[0]->{state}, 'connecting', 'kernel state remains visible');
+
+ for my $pair (['status', $status], ['controllers', $rows]) {
+ my $method = $api->map_method_by_name($pair->[0]);
+ eval { PVE::JSONSchema::validate($pair->[1], $method->{returns}) };
+ is($@, '', "$pair->[0] schema");
+ ok($method->{protected} && $method->{proxyto} eq 'node', 'protected and node-proxied');
+ }
+ is(
+ $api->map_method_by_name('disconnect')->{path},
+ 'controller/{controller}',
+ 'REST-shaped deletion',
+ );
+ my $rpc = Test::MockModule->new('PVE::RPCEnvironment');
+ {
+
+ package NVMeTestRPC;
+ sub get_user { 'root@pam' }
+ sub fork_worker { $_[4]->(); return 'UPID:test' }
+ }
+ $rpc->mock(get => sub { bless {}, 'NVMeTestRPC' });
+ my $removed;
+ $nvme->mock(disconnect_guarded => sub { $removed = $_[0] });
+ is(
+ $api->disconnect({ node => 'n1', controller => 'nvme1' }),
+ 'UPID:test',
+ 'API returns task identifier',
+ );
+ is($removed, 'nvme1', 'task calls guarded disconnect');
+};
+
+done_testing();
^ permalink raw reply related [relevance 14%]
* [PATCH storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (7 preceding siblings ...)
2026-11-13 3:04 10% ` [PATCH storage 08/17] multipath: report the NVMe host NQN of each node Thomas Lamprecht
@ 2026-11-13 3:04 15% ` Thomas Lamprecht
2026-11-13 3:04 21% ` [PATCH docs 10/17] storage: document NVMe over Fabrics storages Thomas Lamprecht
` (7 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the LUNs that multipathd handles on
each node. The namespaces of an NVMe over Fabrics storage use the
native multipath of the kernel and were missing from it, so a lost
path or a node without access to a namespace only showed in the LUN
list of that node.
Let each node report the namespaces of the subsystems such a storage
names, with the path counts its LUN list already shows, and expect
them on the nodes of the storage like the LUNs of an iSCSI storage.
They do not depend on multipathd, so a node without it reports them
as well and only the state of its maps stays unknown.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Multipath.pm | 6 ++
src/PVE/Multipath/Status.pm | 58 +++++++++++++++---
src/test/run_multipath_api_tests.pl | 91 ++++++++++++++++++++++++++++-
3 files changed, 145 insertions(+), 10 deletions(-)
diff --git a/src/PVE/API2/Multipath.pm b/src/PVE/API2/Multipath.pm
index 1d7f5707..82d14c9f 100644
--- a/src/PVE/API2/Multipath.pm
+++ b/src/PVE/API2/Multipath.pm
@@ -121,6 +121,12 @@ __PACKAGE__->register_method({
wwid => { type => 'string', description => 'The LUN WWID.' },
explicit =>
{ type => 'boolean', description => 'An explicit entry exists.' },
+ native => {
+ type => 'boolean',
+ optional => 1,
+ description => 'An NVMe namespace, which uses the native'
+ . ' multipath of the kernel.',
+ },
name => { type => 'string', optional => 1 },
'used-by-storage' => { type => 'string', optional => 1 },
'multipath-storage' => {
diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm
index 9dc8e2cf..092d26a6 100644
--- a/src/PVE/Multipath/Status.pm
+++ b/src/PVE/Multipath/Status.pm
@@ -3,6 +3,7 @@ package PVE::Multipath::Status;
use v5.36;
use JSON qw(decode_json);
use PVE::Cluster;
+use PVE::Diskmanage;
use PVE::INotify;
use PVE::Multipath;
use PVE::Multipath::Config;
@@ -21,6 +22,39 @@ sub worst_state(@states) {
return $worst;
}
+# Namespaces use the native multipath of the kernel, so their state does not depend on multipathd.
+my sub namespace_luns($pv_vgs) {
+ require PVE::Storage;
+ my $cfg = PVE::Storage::config();
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my %luns;
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ next if $scfg->{type} ne 'nvmeof';
+ my $expected = eval { scalar(PVE::NVMeOF::storage_paths($scfg)->@*) };
+ my $namespaces = PVE::NVMeOF::namespaces($scfg->{subsysnqn});
+ for my $name (sort keys %$namespaces) {
+ my $wwid = $namespaces->{$name}->{wwid};
+ next if $luns{$wwid};
+ my $paths = $status->{$name} // { active => 0, paths => [] };
+ my $total = scalar($paths->{paths}->@*);
+ my $lun = $luns{$wwid} = {
+ wwid => $wwid,
+ native => 1,
+ size => $namespaces->{$name}->{size},
+ storage => $sid,
+ 'paths-total' => $total,
+ 'paths-active' => $paths->{active},
+ state => PVE::Multipath::derive_health($paths->{active}, $total, $expected),
+ };
+ $lun->{'paths-expected'} = $expected if defined($expected);
+ my $vg = $pv_vgs->{"/dev/$name"};
+ $lun->{vgname} = $vg if defined($vg);
+ }
+ }
+ return [map { $luns{$_} } sort keys %luns];
+}
+
sub publish($report) {
my $node = PVE::INotify::nodename();
my $now = time();
@@ -51,11 +85,11 @@ sub update_node_status() {
require PVE::NVMeOF;
my $host = eval { PVE::NVMeOF::host_identity() };
$report->{'nvme-host-nqn'} = $host->{nqn} if $host;
+ require PVE::Storage::LVMPlugin;
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
eval {
die "multipath-tools is not installed\n" if !PVE::Multipath::is_supported();
die "multipathd is not running\n" if !PVE::Multipath::is_running();
- require PVE::Storage::LVMPlugin;
- my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
for my $map (PVE::Multipath::get_maps()->@*) {
my $wwid = $map->{wwid} // next;
my $info = $apply->{wwids}->{$wwid} // {};
@@ -82,8 +116,11 @@ sub update_node_status() {
if (my $error = $@) {
chomp $error;
$report->{error} = $error;
- delete $report->{luns};
+ $report->{luns} = [];
}
+ my $namespaces = eval { namespace_luns($pv_vgs) };
+ warn "multipath: cannot query NVMe namespaces - $@" if $@;
+ push $report->{luns}->@*, @$namespaces if $namespaces;
eval { publish($report) };
warn "multipath: cannot publish node status - $@" if $@;
}
@@ -96,7 +133,7 @@ sub cluster_status() {
my $all_nodes = PVE::Cluster::get_nodelist();
my $members = PVE::Cluster::get_members();
my $raw = PVE::Cluster::get_node_kv($KEY);
- my (%nodes, %luns, %expected, %observed, %vg_owner);
+ my (%nodes, %luns, %expected, %observed, %vg_owner, %lists);
my $storage_nodes = sub($scfg) {
return $scfg->{nodes} && $scfg->{nodes}->%* ? [keys $scfg->{nodes}->%*] : $all_nodes;
};
@@ -119,11 +156,12 @@ sub cluster_status() {
my $scfg = $storage->{ids}->{$sid};
$vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
next if $scfg->{type} ne 'lvm';
- my ($wwid) = ($scfg->{base} // '') =~ /(?:^|\.)dm-uuid-mpath-(\S+)$/;
+ my ($base, $volname) = PVE::Storage::parse_volume_id($scfg->{base} // '', 1);
+ my ($kind, $wwid) = ($volname // '') =~ /(?:^|\.)(dm-uuid-mpath|nvme)-(\S+)$/;
next if !defined($wwid);
$luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $luns{$wwid}->{native} = 1 if $kind eq 'nvme';
$luns{$wwid}->{'used-by-storage'} //= $sid;
- my ($base) = $scfg->{base} =~ /^([^:]+):/;
$luns{$wwid}->{'multipath-storage'} //= $base if $requests_maps->($base);
$expected{$wwid}->{$_} = 1 for $storage_nodes->($scfg)->@*;
}
@@ -140,11 +178,13 @@ sub cluster_status() {
for grep { defined($report->{$_}) }
qw(error apply-error iscsi-initiator-name nvme-host-nqn);
$entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok';
- next if $entry->{state} ne 'ok';
+ # an unavailable node lists its namespaces only, or nothing
+ $lists{$node} = 1 if $report->{luns};
for my $lun (($report->{luns} // [])->@*) {
my $wwid = $lun->{wwid} // next;
my $row = $luns{$wwid} //= { wwid => $wwid, explicit => 0 };
+ $row->{native} = 1 if $lun->{native};
$row->{$_} //= $lun->{$_} for grep { defined($lun->{$_}) } qw(name size);
my $owner = defined($lun->{vgname}) ? $vg_owner{ $lun->{vgname} } : undef;
$row->{'used-by-storage'} //= $owner if defined($owner);
@@ -176,8 +216,8 @@ sub cluster_status() {
if ($observed{$wwid}->{$node}) {
$row->{nodes}->{$node} = $observed{$wwid}->{$node};
} elsif ($expected{$wwid}->{$node}) {
- $row->{nodes}->{$node} =
- { state => $nodes{$node}->{state} eq 'ok' ? 'missing' : 'unknown' };
+ my $listed = $nodes{$node}->{state} eq 'ok' || ($row->{native} && $lists{$node});
+ $row->{nodes}->{$node} = { state => $listed ? 'missing' : 'unknown' };
}
}
$row->{state} = worst_state(map { $_->{state} } values $row->{nodes}->%*);
diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl
index 9bf44733..bd62f756 100755
--- a/src/test/run_multipath_api_tests.pl
+++ b/src/test/run_multipath_api_tests.pl
@@ -215,7 +215,12 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
my $status = Test::MockModule->new('PVE::Multipath::Status');
my $mp = Test::MockModule->new('PVE::Multipath');
my $iscsi = Test::MockModule->new('PVE::Storage::ISCSIPlugin');
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $disks = Test::MockModule->new('PVE::Diskmanage');
my ($report, @order);
+ my $ids = {};
+ $storage->mock(config => sub { { ids => $ids } });
+ $disks->mock(get_nvme_path_status => sub { { nvme1n1 => { active => 1, paths => [{}] } } });
$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' } });
@@ -249,6 +254,38 @@ subtest 'one entry point applies configuration and reports unavailable reasons'
is($report->{luns}->[0]->{'paths-expected'}, 3, 'expected count reported');
is($report->{luns}->[0]->{state}, 'degraded', 'fewer paths than expected');
ok(!exists($report->{supported}), 'no separate capability state');
+
+ $ids->{nvme} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test:sub',
+ 'nvme-portals' => '192.0.2.1,192.0.2.2',
+ };
+ $nvme->mock(
+ namespaces => sub($nqn) {
+ return $nqn eq 'nqn.test:sub'
+ ? { nvme1n1 => { wwid => 'uuid.1', size => 4096 } }
+ : {};
+ },
+ );
+ my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+ $lvm->mock(cached_pv_volume_groups => sub { { '/dev/nvme1n1' => 'vgns' } });
+ my $namespace = {
+ wwid => 'uuid.1',
+ native => 1,
+ size => 4096,
+ storage => 'nvme',
+ vgname => 'vgns',
+ 'paths-total' => 1,
+ 'paths-active' => 1,
+ 'paths-expected' => 2,
+ state => 'degraded',
+ };
+ PVE::Multipath::Status::update_node_status();
+ is_deeply($report->{luns}->[1], $namespace, 'namespace with fewer paths than portals');
+ $mp->mock(is_running => sub { 0 });
+ PVE::Multipath::Status::update_node_status();
+ is($report->{error}, 'multipathd is not running', 'stopped daemon still reported');
+ is_deeply($report->{luns}, [$namespace], 'namespaces do not need multipathd');
};
subtest 'API returns final node and LUN states' => sub {
@@ -285,12 +322,31 @@ subtest 'API returns final node and LUN states' => sub {
'paths-active' => 2,
storage => 'scoped',
},
+ {
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'optimal',
+ 'paths-total' => 2,
+ 'paths-active' => 2,
+ storage => 'nvme',
+ },
],
}),
n2 => encode_json({ time => $NOW, luns => [], 'nvme-host-nqn' => 'nqn.test:n2' }),
n3 => encode_json({ time => $NOW - 181, luns => [] }),
n4 => encode_json({ time => $NOW, luns => [] }),
- n5 => encode_json({ time => $NOW, error => 'multipath-tools is not installed' }),
+ n5 => encode_json({
+ time => $NOW,
+ error => 'multipath-tools is not installed',
+ luns => [{
+ wwid => 'uuid.1',
+ native => 1,
+ state => 'degraded',
+ 'paths-total' => 2,
+ 'paths-active' => 1,
+ storage => 'nvme',
+ }],
+ }),
);
$cluster->mock(get_node_kv => sub { \%raw });
$config->mock(read_config => sub { { ids => { '3600a' => { type => 'wwid' } } } });
@@ -306,6 +362,8 @@ subtest 'API returns final node and LUN states' => sub {
gone => { type => 'iscsi', multipath => 1, nodes => { departed => 1 } },
lvmgone => { type => 'lvm', base => 'gone:0.0.0.dm-uuid-mpath-3600e' },
scoped => { type => 'iscsi', multipath => 1, nodes => { n2 => 1 } },
+ nvme => { type => 'nvmeof', subsysnqn => 'nqn.test:sub' },
+ lvmns => { type => 'lvm', base => 'nvme:nvme-uuid.2', nodes => { n5 => 1 } },
},
} },
);
@@ -345,6 +403,37 @@ subtest 'API returns final node and LUN states' => sub {
'the nodes of a shared LVM expect the map',
);
is($lun{'3600d'}->{'used-by-storage'}, 'shared', 'shared LVM attributed by volume group');
+ my $namespace = $lun{'uuid.1'};
+ ok($namespace->{native}, 'namespace marked as native');
+ ok(!exists($namespace->{'multipath-storage'}), 'a namespace has no requested map');
+ is_deeply(
+ { map { $_ => $namespace->{nodes}->{$_}->{state} } keys $namespace->{nodes}->%* },
+ {
+ n1 => 'optimal',
+ n2 => 'missing',
+ n3 => 'unknown',
+ n4 => 'unknown',
+ n5 => 'degraded',
+ },
+ 'namespace state of a node without multipathd counts',
+ );
+ is($lun->{nodes}->{n5}->{state}, 'unknown', 'no map state from a node without multipathd');
+ is_deeply(
+ $lun{'uuid.2'},
+ {
+ wwid => 'uuid.2',
+ explicit => 0,
+ native => 1,
+ 'used-by-storage' => 'lvmns',
+ state => 'missing',
+ nodes => { n5 => { state => 'missing' } },
+ },
+ 'base namespace that a node without multipathd does not report',
+ );
+ $raw{n5} = encode_json({ time => $NOW, error => 'too many LUNs to report' });
+ $res = PVE::API2::Multipath->status({});
+ %lun = map { $_->{wwid} => $_ } $res->{luns}->@*;
+ is($lun{'uuid.2'}->{nodes}->{n5}->{state}, 'unknown', 'node without a list');
eval {
PVE::JSONSchema::validate(
$res,
^ permalink raw reply related [relevance 15%]
* [PATCH manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (12 preceding siblings ...)
2026-11-13 3:04 18% ` [PATCH manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
@ 2026-11-13 3:04 18% ` Thomas Lamprecht
2026-11-13 3:04 12% ` [PATCH manager 15/17] ui: node: san: list NVMe over Fabrics controllers Thomas Lamprecht
` (2 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
Add an NVMe over Fabrics entry to the guided setup of the SAN view,
with the same steps as for iSCSI: connect to the subsystem found at a
discovery portal, with the host NQNs of all nodes at hand for the
access rules of the array, select a namespace, name the volume group
and storage, and confirm.
The target step is shared with iSCSI, as only the storage type, its
scan and the node identities differ. The add dialog of NVMe over
Fabrics storages names the SAN view, as those of iSCSI and LVM do.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 2 +-
www/manager6/SANUtils.js | 2 +
www/manager6/dc/SAN.js | 2 +-
www/manager6/storage/NVMeOFEdit.js | 3 +
www/manager6/storage/wizard/LunSelect.js | 29 +++-
www/manager6/storage/wizard/NodeIdentities.js | 45 +++---
.../storage/wizard/{IScsi.js => Target.js} | 129 ++++++++++++------
www/manager6/storage/wizard/Wizard.js | 43 +++---
www/manager6/window/SANLunState.js | 23 +++-
9 files changed, 183 insertions(+), 95 deletions(-)
rename www/manager6/storage/wizard/{IScsi.js => Target.js} (64%)
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index fbd866b4b..ab4b85d0c 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -389,7 +389,7 @@ JSSRC= \
storage/wizard/Wizard.js \
storage/wizard/LunSelect.js \
storage/wizard/NodeIdentities.js \
- storage/wizard/IScsi.js \
+ storage/wizard/Target.js \
storage/wizard/FibreChannel.js \
Workspace.js \
# end of JSSRC list
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index c08ac2a1a..d61c74df4 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -23,6 +23,8 @@ Ext.define('pve-san-lun', {
'multipath-storage',
'iscsi-target',
'iscsi-lun',
+ 'nvme-subsystem',
+ 'nvme-nsid',
],
});
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index 6b32926c7..21f79272a 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -120,7 +120,7 @@ Ext.define('PVE.dc.SANView', {
{
text: gettext('Add Storage'),
disabled: !allCaps.storage['Datastore.Allocate'],
- menu: [setupItem('iscsi'), setupItem('fc', !canModify)],
+ menu: [setupItem('iscsi'), setupItem('fc', !canModify), setupItem('nvmeof')],
},
];
me.items = [
diff --git a/www/manager6/storage/NVMeOFEdit.js b/www/manager6/storage/NVMeOFEdit.js
index 92057dc4f..b23b828bc 100644
--- a/www/manager6/storage/NVMeOFEdit.js
+++ b/www/manager6/storage/NVMeOFEdit.js
@@ -30,6 +30,9 @@ Ext.define('PVE.storage.NVMeOFInputPanel', {
onlineHelp: 'storage_nvmeof',
+ // TRANSLATORS: "Add Storage" is a button of the SAN view, {0} the menu path of that view.
+ sanNote: gettext('To set up shared LVM on a namespace, use Add Storage in {0}.'),
+
onGetValues: function (values) {
let me = this;
diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js
index a34b95d29..18572015c 100644
--- a/www/manager6/storage/wizard/LunSelect.js
+++ b/www/manager6/storage/wizard/LunSelect.js
@@ -27,7 +27,11 @@ Ext.define('PVE.storage.wizard.LunSelect', {
return;
}
me.store.setFilters([
- { property: 'iscsi-target', value: wizard.connection.target, exactMatch: true },
+ {
+ property: wizard.wizardType === 'nvmeof' ? 'nvme-subsystem' : 'iscsi-target',
+ value: wizard.connection.target,
+ exactMatch: true,
+ },
]);
Proxmox.Utils.API2Request({
url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(wizard.connection.storage)}/content`,
@@ -67,9 +71,13 @@ Ext.define('PVE.storage.wizard.LunSelect', {
xtype: 'component',
cls: 'pmx-hint',
margin: '0 0 10 0',
- html: gettext(
- 'A LUN used by a storage cannot be selected. A LUN with other data has to be wiped under Node > SAN first.',
- ),
+ html: me.nvme
+ ? gettext(
+ 'A namespace used by a storage cannot be selected. A namespace with other data has to be wiped under Node > SAN first.',
+ )
+ : gettext(
+ 'A LUN used by a storage cannot be selected. A LUN with other data has to be wiped under Node > SAN first.',
+ ),
},
...(me.rescanNote
? [
@@ -84,7 +92,9 @@ Ext.define('PVE.storage.wizard.LunSelect', {
xtype: 'grid',
flex: 1,
store: me.store,
- emptyText: gettext('No LUNs found. Check connections and array access.'),
+ emptyText: me.nvme
+ ? gettext('No namespaces found. Check connections and array access.')
+ : gettext('No LUNs found. Check connections and array access.'),
viewConfig: {
enableTextSelection: true,
getRowClass: (rec) => (rec.get('used-by-storage') ? 'x-item-disabled' : ''),
@@ -102,6 +112,7 @@ Ext.define('PVE.storage.wizard.LunSelect', {
renderer: (value, md, rec) => Ext.htmlEncode(value || rec.get('wwid')),
},
{ text: 'LUN', dataIndex: 'iscsi-lun', width: 60 },
+ { text: 'NSID', dataIndex: 'nvme-nsid', width: 60 },
{
text: gettext('Model'),
dataIndex: 'model',
@@ -122,6 +133,8 @@ Ext.define('PVE.storage.wizard.LunSelect', {
text: gettext('Multipath'),
dataIndex: 'multipath',
width: 170,
+ // native NVMe multipath needs no setup per namespace
+ hidden: me.nvme,
renderer: PVE.SANUtils.renderSanLunMultipath,
},
{
@@ -162,8 +175,10 @@ Ext.define('PVE.storage.wizard.LunSelect', {
Proxmox.Utils.monStoreErrors(me.down('grid'), me.rstore);
me.mon(me.rstore, 'load', updateSelection);
me.on('activate', function () {
- if (me.up('window').wizardType === 'fc') {
- me.down('gridcolumn[dataIndex=iscsi-lun]').hide();
+ let type = me.up('window').wizardType;
+ me.down('gridcolumn[dataIndex=iscsi-lun]').setHidden(type !== 'iscsi');
+ me.down('gridcolumn[dataIndex=nvme-nsid]').setHidden(type !== 'nvmeof');
+ if (type === 'fc') {
me.store.setFilters([
{
filterFn: (rec) => ['fc', 'fcoe', 'nvme-fc'].includes(rec.get('transport')),
diff --git a/www/manager6/storage/wizard/NodeIdentities.js b/www/manager6/storage/wizard/NodeIdentities.js
index 9c7ab8cce..69c7fbca2 100644
--- a/www/manager6/storage/wizard/NodeIdentities.js
+++ b/www/manager6/storage/wizard/NodeIdentities.js
@@ -1,7 +1,7 @@
Ext.define('pve-san-node-identity', {
extend: 'Ext.data.Model',
idProperty: 'node',
- fields: ['node', 'state', 'iscsi-initiator-name'],
+ fields: ['node', 'state', 'iscsi-initiator-name', 'nvme-host-nqn'],
});
Ext.define('PVE.storage.wizard.NodeIdentities', {
@@ -10,24 +10,29 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
height: 220,
disableSelection: true,
viewConfig: { enableTextSelection: true },
- columns: [
- { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
- {
- text: gettext('State'),
- dataIndex: 'state',
- width: 175,
- renderer: PVE.SANUtils.renderState,
- },
- {
- text: gettext('Initiator Name'),
- dataIndex: 'iscsi-initiator-name',
- flex: 1,
- renderer: Ext.htmlEncode,
- },
- ],
+
+ identity: 'iscsi-initiator-name',
initComponent: function () {
let me = this;
+ let nvme = me.identity === 'nvme-host-nqn';
+ me.columns = [
+ { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode },
+ {
+ text: gettext('State'),
+ dataIndex: 'state',
+ width: 175,
+ renderer: PVE.SANUtils.renderState,
+ // the state of multipathd, which NVMe does not use
+ hidden: nvme,
+ },
+ {
+ text: nvme ? gettext('Host NQN') : gettext('Initiator Name'),
+ dataIndex: me.identity,
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ];
me.rstore = Ext.create('Proxmox.data.UpdateStore', {
storeid: 'san-wizard-identities',
model: 'pve-san-node-identity',
@@ -56,17 +61,19 @@ Ext.define('PVE.storage.wizard.NodeIdentities', {
me.tbar = [
{
xtype: 'tbtext',
- text: gettext('Allow these initiator names on the target.'),
+ text: nvme
+ ? gettext('Allow these host NQNs on the target.')
+ : gettext('Allow these initiator names on the target.'),
},
'->',
{
- text: gettext('Copy Initiator Names'),
+ text: nvme ? gettext('Copy Host NQNs') : gettext('Copy Initiator Names'),
iconCls: 'fa fa-clipboard',
handler: () =>
PVE.Utils.copyToClipboard(
me.store
.getRange()
- .map((rec) => rec.get('iscsi-initiator-name'))
+ .map((rec) => rec.get(me.identity))
.filter(Boolean)
.join('\n'),
),
diff --git a/www/manager6/storage/wizard/IScsi.js b/www/manager6/storage/wizard/Target.js
similarity index 64%
rename from www/manager6/storage/wizard/IScsi.js
rename to www/manager6/storage/wizard/Target.js
index 515d1206f..e505ddca0 100644
--- a/www/manager6/storage/wizard/IScsi.js
+++ b/www/manager6/storage/wizard/Target.js
@@ -1,13 +1,14 @@
-Ext.define('PVE.storage.wizard.IScsiTarget', {
+Ext.define('PVE.storage.wizard.Target', {
extend: 'Proxmox.panel.InputPanel',
- xtype: 'pveStorageWizardIScsiTarget',
- onlineHelp: 'storage_open_iscsi',
+ xtype: 'pveStorageWizardTarget',
+
+ storageType: 'iscsi',
updateConnectionField: function () {
let me = this;
let target = me.down('field[name=target]').getValue();
let storage = me.storages?.find(
- (entry) => entry.type === 'iscsi' && entry.target === target,
+ (entry) => entry.type === me.storageType && entry[me.targetKey] === target,
);
let field = me.down('field[name=connection]');
if (storage) {
@@ -20,16 +21,16 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
onSubmit: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
let wizard = me.up('window');
let values = me.getValues();
- let params = {
- type: 'iscsi',
- storage: values.connection,
- portal: values.portal,
- target: values.target,
- content: 'none',
- multipath: 1,
- };
+ let params = { type: me.storageType, storage: values.connection, content: 'none' };
+ if (nvme) {
+ params.subsysnqn = values.target;
+ params['nvme-portals'] = values['nvme-portals'];
+ } else {
+ Object.assign(params, { portal: values.portal, target: values.target, multipath: 1 });
+ }
let nodes = []
.concat(values.nodes || [])
.filter(Boolean)
@@ -59,18 +60,22 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
}
me.storages = response.result.data;
me.updateConnectionField();
- let users = me.storages.filter((entry) => entry.target === values.target);
+ let users = me.storages.filter((entry) => entry[me.targetKey] === values.target);
if (users.length) {
let base = users[0];
if (
users.length !== 1 ||
- base.type !== 'iscsi' ||
+ base.type !== me.storageType ||
`${base.content ?? ''}` !== 'none'
) {
wizard.showError(
- gettext(
- 'This target is already used by another storage. Check Datacenter > Storage.',
- ),
+ nvme
+ ? gettext(
+ 'This subsystem is already used by another storage. Check Datacenter > Storage.',
+ )
+ : gettext(
+ 'This target is already used by another storage. Check Datacenter > Storage.',
+ ),
);
return;
}
@@ -78,9 +83,13 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
wizard.showError(
Ext.htmlEncode(
Ext.String.format(
- gettext(
- 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
- ),
+ nvme
+ ? gettext(
+ 'Storage "{0}" connects to this subsystem, but it is disabled. Enable that storage first.',
+ )
+ : gettext(
+ 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.',
+ ),
base.storage,
),
),
@@ -116,10 +125,10 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
}
let connection = {
storage: base.storage,
- target: base.target,
+ target: values.target,
nodes: selectedNodes.join(','),
};
- if (!base.multipath) {
+ if (!nvme && !base.multipath) {
wizard.showError(
Ext.htmlEncode(
Ext.String.format(
@@ -142,7 +151,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
waitMsgTarget: wizard,
failure: fail,
success: () =>
- connected({ storage: params.storage, target: params.target, nodes }),
+ connected({ storage: params.storage, target: values.target, nodes }),
});
},
});
@@ -150,6 +159,10 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
initComponent: function () {
let me = this;
+ let nvme = me.storageType === 'nvmeof';
+ me.targetKey = nvme ? 'subsysnqn' : 'target';
+ me.onlineHelp = nvme ? 'storage_nvmeof' : 'storage_open_iscsi';
+ let targetLabel = nvme ? gettext('Subsystem') : gettext('Target');
let common = PVE.panel.StorageBase.commonFields(true);
// wide enough for the longest label of the step
let labelWidth = 150;
@@ -157,7 +170,7 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
{
xtype: 'textfield',
name: 'portal',
- fieldLabel: 'Portal',
+ fieldLabel: nvme ? gettext('Discovery Portal') : 'Portal',
labelWidth,
allowBlank: false,
listeners: {
@@ -173,33 +186,54 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
},
{
- xtype: 'pveIScsiScan',
+ xtype: nvme ? 'pveNVMeOFScan' : 'pveIScsiScan',
name: 'target',
- fieldLabel: gettext('Target'),
+ fieldLabel: targetLabel,
labelWidth,
disabled: true,
showNodeSelector: false,
nodename: Proxmox.NodeName,
- listeners: { change: () => me.updateConnectionField() },
+ listeners: {
+ change: function (field, value) {
+ me.updateConnectionField();
+ let rec = nvme
+ ? field.getStore().findRecord('subsysnqn', value, 0, false, true, true)
+ : undefined;
+ if (rec) {
+ me.down('field[name=nvme-portals]').setValue(rec.get('portals'));
+ }
+ },
+ },
listConfig: {
width: 650,
- emptyText: PVE.Utils.renderNotFound(gettext('iSCSI Target')),
+ emptyText: PVE.Utils.renderNotFound(targetLabel),
columns: [
{
- text: gettext('Target'),
- dataIndex: 'target',
+ text: targetLabel,
+ dataIndex: me.targetKey,
flex: 1,
renderer: Ext.htmlEncode,
},
{
text: gettext('Portals'),
- dataIndex: 'portal',
+ dataIndex: nvme ? 'portals' : 'portal',
width: 220,
renderer: Ext.htmlEncode,
},
],
},
},
+ ...(nvme
+ ? [
+ {
+ xtype: 'textfield',
+ name: 'nvme-portals',
+ fieldLabel: gettext('Portals'),
+ labelWidth,
+ allowBlank: false,
+ },
+ ]
+ : []),
{
...common.id,
name: 'connection',
@@ -210,12 +244,19 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
xtype: 'component',
margin: '0 0 10 0',
html: `<span class="pmx-hint">${Ext.htmlEncode(gettext('Note:'))}</span> ${Ext.htmlEncode(
- gettext(
- 'Next creates or reuses the connection storage before you select a LUN.',
- ),
+ nvme
+ ? gettext(
+ 'Next creates or reuses the connection storage before you select a namespace.',
+ )
+ : gettext(
+ 'Next creates or reuses the connection storage before you select a LUN.',
+ ),
)}`,
},
- { xtype: 'pveStorageWizardNodeIdentities' },
+ {
+ xtype: 'pveStorageWizardNodeIdentities',
+ identity: nvme ? 'nvme-host-nqn' : 'iscsi-initiator-name',
+ },
];
me.advancedItems = [
{ ...common.nodes, labelWidth, validator: PVE.storage.wizard.validateNodes },
@@ -242,8 +283,10 @@ Ext.define('PVE.storage.wizard.IScsiTarget', {
},
});
-PVE.storage.wizard.createIScsiLVM = function (wizard, values, lun) {
+PVE.storage.wizard.createLVMOnBase = function (wizard, values, lun) {
let connection = wizard.connection;
+ let suffix =
+ wizard.wizardType === 'nvmeof' ? `:nvme-${lun.wwid}` : `.dm-uuid-mpath-${lun.wwid}`;
let fail = (response) => wizard.showError(response.htmlStatus);
Proxmox.Utils.API2Request({
url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(connection.storage)}/content`,
@@ -255,14 +298,16 @@ PVE.storage.wizard.createIScsiLVM = function (wizard, values, lun) {
if (wizard.destroyed) {
return;
}
- let volume = response.result.data.find((entry) =>
- entry.volid.endsWith(`.dm-uuid-mpath-${lun.wwid}`),
- );
+ let volume = response.result.data.find((entry) => entry.volid.endsWith(suffix));
if (!volume) {
wizard.showError(
- gettext(
- 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
- ),
+ wizard.wizardType === 'nvmeof'
+ ? gettext(
+ 'The selected namespace is not available yet. Check Node > SAN, then retry.',
+ )
+ : gettext(
+ 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.',
+ ),
);
return;
}
diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js
index 9d4e6a256..2739cdeb3 100644
--- a/www/manager6/storage/wizard/Wizard.js
+++ b/www/manager6/storage/wizard/Wizard.js
@@ -92,6 +92,7 @@ Ext.define('PVE.storage.wizard.SAN', {
wwid,
storage: values.storage,
fc: me.wizardType === 'fc',
+ nvme: me.wizardType === 'nvmeof',
autoShow: true,
});
},
@@ -100,6 +101,9 @@ Ext.define('PVE.storage.wizard.SAN', {
multipathSummary: function (lun) {
let me = this;
+ if (me.wizardType === 'nvmeof') {
+ return PVE.SANUtils.multipathText('native');
+ }
// an explicit entry configures the map, also of a LUN of the connection storage
if (lun.multipath === 'manual') {
return PVE.SANUtils.multipathText('manual');
@@ -145,24 +149,25 @@ Ext.define('PVE.storage.wizard.SAN', {
if (me.wizardType === 'fc') {
PVE.storage.wizard.createFC(me, values, lun);
} else {
- PVE.storage.wizard.createIScsiLVM(me, values, lun);
+ PVE.storage.wizard.createLVMOnBase(me, values, lun);
}
},
initComponent: function () {
let me = this;
- if (!['iscsi', 'fc'].includes(me.wizardType)) {
+ if (!['iscsi', 'fc', 'nvmeof'].includes(me.wizardType)) {
throw 'no SAN storage type specified';
}
- let iscsi = me.wizardType === 'iscsi';
+ let fc = me.wizardType === 'fc';
me.subject = PVE.storage.wizard.subject(me.wizardType);
me.title = Proxmox.Utils.dialog_title(me.subject, true, true);
+ let onlineHelp = me.wizardType === 'nvmeof' ? 'storage_nvmeof' : 'storage_multipath';
let common = PVE.panel.StorageBase.commonFields(true);
let snapshots = PVE.panel.StorageBase.volumeChainFields(true, 'lvm');
let settings = {
xtype: 'inputpanel',
title: gettext('Volume Group'),
- onlineHelp: 'storage_multipath',
+ onlineHelp,
items: [
{ ...common.id, fieldLabel: gettext('Storage ID') },
{
@@ -176,35 +181,37 @@ Ext.define('PVE.storage.wizard.SAN', {
snapshots.hint,
],
};
- if (!iscsi) {
+ if (fc) {
settings.advancedItems = [
{ ...common.nodes, validator: PVE.storage.wizard.validateNodes },
];
}
me.items = [
- ...(iscsi
- ? [
+ ...(fc
+ ? []
+ : [
{
- xtype: 'pveStorageWizardIScsiTarget',
+ xtype: 'pveStorageWizardTarget',
title: gettext('Target'),
itemId: 'target',
+ storageType: me.wizardType,
},
- ]
- : []),
+ ]),
{
xtype: 'pveStorageWizardLunSelect',
- title: 'LUN',
+ title: me.wizardType === 'nvmeof' ? gettext('Namespace') : 'LUN',
itemId: 'luns',
- onlineHelp: 'storage_multipath',
+ nvme: me.wizardType === 'nvmeof',
+ onlineHelp,
// the nodes only see a newly mapped Fibre Channel LUN after a rescan
- rescanNote: iscsi
- ? undefined
- : Ext.String.format(
+ rescanNote: fc
+ ? Ext.String.format(
gettext(
'After mapping a new LUN on the array, rescan the Fibre Channel hosts of each node (<a href="{0}" target="_blank" rel="noopener noreferrer">documentation</a>).',
),
Ext.htmlEncode(Proxmox.Utils.get_help_link('storage_multipath')),
- ),
+ )
+ : undefined,
},
settings,
{
@@ -239,14 +246,14 @@ Ext.define('PVE.storage.wizard.SAN', {
me.callParent();
let tabs = me.down('#wizcontent');
tabs.on('tabchange', function (tp, tab) {
- if (iscsi && tab === me.down('#luns')) {
+ if (!fc && tab === me.down('#luns')) {
me.down('#back').disable();
}
me.down('#submit').setText(
tab === me.down('#target') ? gettext('Next') : gettext('Finish'),
);
});
- if (iscsi) {
+ if (!fc) {
me.down('#submit').setText(gettext('Next'));
}
me.on('destroy', () => me.reloadCallback?.());
diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js
index a0a6d514d..1de84ea2b 100644
--- a/www/manager6/window/SANLunState.js
+++ b/www/manager6/window/SANLunState.js
@@ -19,7 +19,10 @@ Ext.define('PVE.window.SANLunState', {
if (!me.wwid || !me.storage) {
throw 'no LUN or storage specified';
}
- me.title = Ext.String.format(gettext('Storage {0}: LUN State'), me.storage);
+ me.title = Ext.String.format(
+ me.nvme ? gettext('Storage {0}: Namespace State') : gettext('Storage {0}: LUN State'),
+ me.storage,
+ );
// The other nodes set up a new LUN with their next status updates.
let pendingUntil = Date.now() + 60000;
let rstore = Ext.create('Proxmox.data.UpdateStore', {
@@ -51,13 +54,17 @@ Ext.define('PVE.window.SANLunState', {
margin: '0 0 10 0',
html: Ext.htmlEncode(
Ext.String.format(
- me.fc
+ me.nvme
? gettext(
- 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.',
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the namespace on the array.',
)
- : gettext(
- 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
- ),
+ : me.fc
+ ? gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.',
+ )
+ : gettext(
+ 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.',
+ ),
me.storage,
),
),
@@ -67,7 +74,9 @@ Ext.define('PVE.window.SANLunState', {
flex: 1,
store,
disableSelection: true,
- emptyText: gettext('No node reported this LUN yet.'),
+ emptyText: me.nvme
+ ? gettext('No node reported this namespace yet.')
+ : gettext('No node reported this LUN yet.'),
columns: [
{
text: gettext('Node'),
^ permalink raw reply related [relevance 18%]
* [PATCH docs 10/17] storage: document NVMe over Fabrics storages
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (8 preceding siblings ...)
2026-11-13 3:04 15% ` [PATCH storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
@ 2026-11-13 3:04 21% ` Thomas Lamprecht
2026-11-13 3:04 6% ` [PATCH manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints Thomas Lamprecht
` (6 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
Add a chapter for the nvmeof storage type: prerequisites, setting up
shared LVM on a namespace with the guided setup or by hand, the
properties, checking and disconnecting paths, and the limits of this
first version.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
pve-storage-multipath.adoc | 4 +-
pve-storage-nvmeof.adoc | 161 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 20 +++--
3 files changed, 177 insertions(+), 8 deletions(-)
create mode 100644 pve-storage-nvmeof.adoc
diff --git a/pve-storage-multipath.adoc b/pve-storage-multipath.adoc
index d4503a7..c7b2143 100644
--- a/pve-storage-multipath.adoc
+++ b/pve-storage-multipath.adoc
@@ -14,8 +14,8 @@ Identifier (WWID) identifies the same LUN on every node.
{pve} configures maps cluster-wide and shows their state under *Datacenter ->
Storage -> SAN*. An iSCSI storage with *Multipath* enabled requests maps for its
LUNs; Fibre Channel LUNs need entries in `/etc/pve/multipath.cfg`. NVMe
-namespaces use kernel-native multipath instead; the procedures below cover SCSI
-LUNs.
+namespaces use kernel-native multipath instead, see
+xref:storage_nvmeof[NVMe over Fabrics]; the procedures below cover SCSI LUNs.
Prerequisites
~~~~~~~~~~~~~
diff --git a/pve-storage-nvmeof.adoc b/pve-storage-nvmeof.adoc
new file mode 100644
index 0000000..d2faf0f
--- /dev/null
+++ b/pve-storage-nvmeof.adoc
@@ -0,0 +1,161 @@
+[[storage_nvmeof]]
+NVMe over Fabrics Backend
+-------------------------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: NVMe over Fabrics
+endif::wiki[]
+
+Storage pool type: `nvmeof`
+
+NVMe over Fabrics (NVMe-oF) gives a node access to the namespaces of an NVMe
+subsystem on a storage array over TCP. Namespaces are the NVMe counterpart of
+LUNs. Use one as the base volume of a shared LVM storage, or use the namespaces
+directly as disk images.
+
+Each node connects one controller per portal of the storage. The kernel
+combines these paths into one device per namespace with its native NVMe
+multipath and reconnects lost paths on its own. `multipath-tools` is not
+involved.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+. Upgrade all nodes before adding the first NVMe over Fabrics storage.
+. Install `nvme-cli` on every participating node. The `libpve-storage-perl`
+ package recommends it, but installations without recommended packages need it
+ added separately. Its installation creates the node's host NQN in
+ `/etc/nvme/hostnqn` and host ID in `/etc/nvme/hostid`. Nodes cloned from one
+ image share them. Give each a new identity before it connects, with
+ `nvme gen-hostnqn > /etc/nvme/hostnqn` and `uuidgen > /etc/nvme/hostid`.
+. Allow each node's host NQN on the array. The names are shown under
+ *Datacenter -> Storage -> SAN* and in the guided setup.
+. Present the same empty namespace to all intended nodes. Portals are IP
+ addresses that every node can reach; host names are not accepted.
+. Keep native NVMe multipath enabled, which is the kernel default
+ (`nvme_core.multipath=Y`).
+
+[[storage_nvmeof_setup]]
+Setting Up Shared LVM
+~~~~~~~~~~~~~~~~~~~~~
+
+. Open *Datacenter -> Storage -> SAN* in the web UI on a node that can reach
+ the array and select *Add Storage -> LVM on NVMe over Fabrics*.
+. Enter a discovery portal, select the subsystem, check the portals and name
+ the connection storage. This storage connects to the subsystem with
+ `content none`, while the LVM storage manages guest disks. Continuing creates
+ or reuses the connection storage before you select a namespace.
+. Select the namespace, choose the storage ID and volume group, then confirm.
+ Leave *Nodes* empty for all nodes.
+. Check the state of the namespace on each node of the storage, which the
+ setup shows once the storage is added, as described for LUNs in
+ xref:storage_multipath_setup[Multipath]. For a node that stays *Missing*,
+ check its access to the namespace on the array before placing guests on the
+ storage.
+
+The discovery fills in *Portals*. Some targets, such as the Linux kernel
+target, report only the portal that was asked: add the others to the list.
+With a single portal, the state of the namespace reads *OK (1 path)*.
+Portals can also be changed later in the edit dialog of the connection storage;
+each node then connects new ones on its own.
+
+*Datacenter -> Storage -> Add -> NVMe over Fabrics* adds only the connection
+storage. Enable *Use namespaces directly* there to use whole namespaces as guest
+disks, or add an *LVM* storage on a namespace later, with the connection storage
+as *Base storage*.
+
+To set it up by hand, run these commands on a node that can reach the array:
+
+----
+# pvesm scan nvmeof <portal>
+# pvesm add nvmeof <connection> --subsysnqn <nqn> --nvme-portals <portals> --content none
+# pvesm list <connection>
+# pvesm add lvm <storage> --vgname <vg> --base <volume-id> --shared 1
+----
+
+Use the complete volume ID from the listing, `<connection>:nvme-<wwid>`. Adding
+the LVM storage creates the volume group if it does not exist yet. Creating it
+is refused if the namespace holds data or another storage references it. To
+reuse a namespace, wipe it as described for LUNs in
+xref:storage_multipath_setup[Multipath].
+
+Configuration
+~~~~~~~~~~~~~
+
+The backend supports the common storage properties `content`, `nodes`,
+`disable`, and the following NVMe over Fabrics specific properties:
+
+subsysnqn::
+
+The NQN of the NVMe subsystem. It cannot be changed later.
+
+nvme-portals::
+
+Comma-separated list of the subsystem's TCP portals, one per path. Each is an
+IPv4 address or an IPv6 address in brackets, with an optional port (default
+4420).
+
+nvme-fast-io-fail-tmo::
+
+Seconds a path may be reconnecting before I/O sent to it fails. The default is
+120: guests get I/O errors once all paths of a namespace were lost for that
+long. With `-1`, I/O waits until a path returns. A change applies to newly
+connected controllers only.
+
+.Configuration Example (`/etc/pve/storage.cfg`)
+----
+nvmeof: fabric
+ subsysnqn nqn.2010-06.com.example:array1
+ nvme-portals 192.0.2.10,192.0.2.11
+ content none
+----
+
+.Storage features for backend `nvmeof`
+[width="100%",cols="m,m,3*d",options="header"]
+|==============================================================================
+|Content types |Image formats |Shared |Snapshots |Clones
+|images none |raw |yes |no |no
+|==============================================================================
+
+{pve} does not create or delete namespaces; manage them on the array. A volume
+is named `nvme-<wwid>` after its namespace, like its link in `/dev/disk/by-id/`.
+
+Checking and Disconnecting Paths
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Datacenter -> Storage -> SAN* lists the namespaces of NVMe over Fabrics
+storages among the LUNs, with their state on each node of the storage and
+*Multipath* shown as *Native*, as does *Node -> SAN* for the namespaces of a
+node. Expand a namespace there to inspect its paths.
+Its *State* is *Degraded* while a path is unusable or fewer paths exist than
+the storage has portals, and *Failed* without a usable path. *Node -> SAN ->
+NVMe over Fabrics* lists the node's controllers, one per connected portal:
+*Connected*, or *Reconnecting* while the kernel retries a lost path.
+
+An enabled storage connects the portals a node has no controller for. A portal
+that failed is retried after a minute. Removing a portal, or disabling or
+removing the storage, does not disconnect anything. To remove such a path,
+select its controller under *Node -> SAN -> NVMe over Fabrics* on each node and
+press *Disconnect*, or run
+`pvesh delete /nodes/<node>/nvmeof/controller/<controller>`. This is refused if
+a namespace that is mounted, in use by another device, or referenced by a
+storage would lose its last usable path. A storage that still lists the portal
+connects to it again.
+
+Limits
+~~~~~~
+
+* Only the TCP transport is supported, without authentication or TLS. Use a
+ storage network that only trusted hosts can reach.
+* NVMe/FC namespaces need no storage of this type. Set them up with
+ *Datacenter -> Storage -> SAN -> Add Storage -> LVM on Fibre Channel*, see
+ xref:storage_multipath_setup[Multipath].
+
+ifdef::wiki[]
+
+See Also
+~~~~~~~~
+
+* link:/wiki/Storage[Storage]
+
+endif::wiki[]
diff --git a/pvesm.adoc b/pvesm.adoc
index 5668a41..442ac2d 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -79,6 +79,7 @@ nodes that can be accessed as RBD (RADOS Block Device).
|LVM-thin |lvmthin |block |no |yes |yes
|iSCSI/kernel |iscsi |block |yes^3^|yes^4^ |yes
|iSCSI/libiscsi |iscsidirect |block |yes^3^|yes^4^ |yes
+|NVMe-oF |nvmeof |block |yes^3^|yes^4^ |yes
|FC/SAS |native^6^ |block |yes^3^|yes^4^ |yes
|Ceph/RBD |rbd |block |yes |yes |yes
|ZFS over iSCSI |zfs |block |yes |yes |yes
@@ -96,10 +97,12 @@ TiB sized), these operations may take several minutes, or in extreme cases, even
hours. If your setup is affected, create and remove snapshots while the VM is
shut down, expecting a long task duration.
-^3^: With iSCSI, Fibre Channel (FC), or SAS block storage as shared storage in
-a cluster, LVM is used to split the LUN into virtual disks. A LUN is usually
-reachable over several paths; xref:storage_multipath[Multipath] describes how
-{pve} manages them in a cluster.
+^3^: With iSCSI, NVMe over Fabrics (NVMe-oF), Fibre Channel (FC), or SAS block
+storage as shared storage in a cluster, LVM is used to split the LUN or
+namespace into virtual disks. A LUN is usually reachable over several paths;
+xref:storage_multipath[Multipath] describes how {pve} manages them in a cluster.
+NVMe-oF namespaces use the kernel's native multipath instead, see
+xref:storage_nvmeof[NVMe over Fabrics].
^4^: Since {pve} 9, snapshots as a volume chain have been available for VMs.
These snapshots use separate volumes for the snapshot data and layer them. For
@@ -153,9 +156,10 @@ is available on all nodes, but it is physically different and can have
totally different content.
Add storage under *Datacenter -> Storage -> Add* in the web UI. For shared LVM
-on a xref:storage_multipath_setup[SAN LUN], use the guided setup under
+on a xref:storage_multipath_setup[SAN LUN] or an
+xref:storage_nvmeof_setup[NVMe namespace], use the guided setup under
*Datacenter -> Storage -> SAN -> Add Storage* instead. It creates the storages
-that are needed and enables multipath for the LUN.
+that are needed and enables multipath for a LUN.
Storage Pools
@@ -427,6 +431,8 @@ See Also
* link:/wiki/Storage:_Multipath[Storage: Multipath]
+* link:/wiki/Storage:_NVMe_over_Fabrics[Storage: NVMe over Fabrics]
+
* link:/wiki/Storage:_LVM[Storage: LVM]
* link:/wiki/Storage:_LVM_Thin[Storage: LVM Thin]
@@ -471,6 +477,8 @@ include::pve-storage-iscsidirect.adoc[]
include::pve-storage-multipath.adoc[]
+include::pve-storage-nvmeof.adoc[]
+
include::pve-storage-rbd.adoc[]
include::pve-storage-cephfs.adoc[]
^ permalink raw reply related [relevance 21%]
* [PATCH manager 12/17] ui: storage: add NVMe over Fabrics storage
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (10 preceding siblings ...)
2026-11-13 3:04 6% ` [PATCH manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints Thomas Lamprecht
@ 2026-11-13 3:04 16% ` Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
` (4 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
Show storages of the new type with their subsystem in the storage list
and add their dialog. Adding one lists the subsystems a discovery
portal reports and fills in the portals of the selected one, which can
be changed. Portals, nodes, content and the fast I/O fail timeout can
be edited later.
The subsystem selector builds on the iSCSI target selector, whose
store fields and sort key a subclass can now set.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/Utils.js | 6 ++
www/manager6/dc/StorageView.js | 5 +-
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/NVMeOFEdit.js | 127 +++++++++++++++++++++++++++++
5 files changed, 141 insertions(+), 3 deletions(-)
create mode 100644 www/manager6/storage/NVMeOFEdit.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index ebdc3f802..fbd866b4b 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -377,6 +377,7 @@ JSSRC= \
storage/LvmThinEdit.js \
storage/BTRFSEdit.js \
storage/NFSEdit.js \
+ storage/NVMeOFEdit.js \
storage/PBSEdit.js \
storage/RBDEdit.js \
storage/StatusView.js \
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 865ba44ff..4a97358ac 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -869,6 +869,12 @@ Ext.define('PVE.Utils', {
faIcon: 'building',
backups: false,
},
+ nvmeof: {
+ name: 'NVMe over Fabrics',
+ ipanel: 'NVMeOFInputPanel',
+ faIcon: 'building',
+ backups: false,
+ },
cephfs: {
name: 'CephFS',
ipanel: 'CephFSInputPanel',
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 54fbde711..4fc49f5cd 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -128,7 +128,9 @@ Ext.define(
sortable: true,
dataIndex: 'path',
renderer: function (value, metaData, record) {
- return Ext.htmlEncode(record.data.target || value);
+ return Ext.htmlEncode(
+ record.data.target || record.data.subsysnqn || value,
+ );
},
},
{
@@ -171,6 +173,7 @@ Ext.define(
'server',
'portal',
'target',
+ 'subsysnqn',
'export',
'storage',
{ name: 'shared', type: 'boolean' },
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index f11995585..83d31017f 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -5,6 +5,7 @@ Ext.define('PVE.storage.IScsiScan', {
queryParam: 'portal',
valueField: 'target',
displayField: 'target',
+ scanFields: ['target', 'portal'],
matchFieldWidth: false,
allowBlank: false,
@@ -53,13 +54,13 @@ Ext.define('PVE.storage.IScsiScan', {
}
let store = Ext.create('Ext.data.Store', {
- fields: ['target', 'portal'],
+ fields: me.scanFields,
proxy: {
type: 'proxmox',
url: `${me.apiBaseUrl}${me.nodename}${me.apiSuffix}`,
},
});
- store.sort('target', 'ASC');
+ store.sort(me.valueField, 'ASC');
Ext.apply(me, {
store: store,
diff --git a/www/manager6/storage/NVMeOFEdit.js b/www/manager6/storage/NVMeOFEdit.js
new file mode 100644
index 000000000..92057dc4f
--- /dev/null
+++ b/www/manager6/storage/NVMeOFEdit.js
@@ -0,0 +1,127 @@
+Ext.define('PVE.storage.NVMeOFScan', {
+ extend: 'PVE.storage.IScsiScan',
+ alias: 'widget.pveNVMeOFScan',
+
+ valueField: 'subsysnqn',
+ displayField: 'subsysnqn',
+ scanFields: ['subsysnqn', 'portals'],
+ showNodeSelector: false,
+
+ listConfig: {
+ width: 650,
+ columns: [
+ {
+ dataIndex: 'subsysnqn',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+ emptyText: PVE.Utils.renderNotFound(gettext('Subsystem')),
+ },
+
+ config: {
+ apiSuffix: '/scan/nvmeof',
+ },
+});
+
+Ext.define('PVE.storage.NVMeOFInputPanel', {
+ extend: 'PVE.panel.StorageBase',
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ onlineHelp: 'storage_nvmeof',
+
+ onGetValues: function (values) {
+ let me = this;
+
+ values.content = values.namespaces ? 'images' : 'none';
+ delete values.namespaces;
+
+ return me.callParent([values]);
+ },
+
+ setValues: function (values) {
+ values.namespaces = values.content.indexOf('images') !== -1;
+ this.callParent([values]);
+ },
+
+ column1: [
+ {
+ xtype: 'textfield',
+ name: 'discovery-portal',
+ fieldLabel: gettext('Discovery Portal'),
+ allowBlank: false,
+ submitValue: false,
+ cbind: {
+ hidden: '{!isCreate}',
+ disabled: '{!isCreate}',
+ },
+ listeners: {
+ change: {
+ fn: function (field, value) {
+ let scan = this.up('inputpanel').lookup('subsystemScan');
+ scan.setDisabled(!value);
+ scan.setPortal(value);
+ scan.setValue('');
+ },
+ buffer: 500,
+ },
+ },
+ },
+ {
+ xtype: 'checkbox',
+ name: 'namespaces',
+ boxLabel: gettext('Use namespaces directly'),
+ },
+ ],
+
+ // NQNs and portal lists are longer than a column is wide
+ columnB: [
+ {
+ cbind: {
+ xtype: (get) => (get('isCreate') ? 'pveNVMeOFScan' : 'displayfield'),
+ disabled: '{isCreate}',
+ },
+ name: 'subsysnqn',
+ value: '',
+ fieldLabel: gettext('Subsystem'),
+ allowBlank: false,
+ reference: 'subsystemScan',
+ listeners: {
+ change: function (field, value) {
+ let rec = field
+ .getStore?.()
+ .findRecord('subsysnqn', value, 0, false, true, true);
+ if (rec) {
+ field
+ .up('inputpanel')
+ .down('field[name=nvme-portals]')
+ .setValue(rec.get('portals'));
+ }
+ },
+ },
+ },
+ {
+ xtype: 'textfield',
+ name: 'nvme-portals',
+ fieldLabel: gettext('Portals'),
+ allowBlank: false,
+ },
+ ],
+
+ advancedColumn1: [
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'nvme-fast-io-fail-tmo',
+ fieldLabel: gettext('Fail I/O After (s)'),
+ minValue: -1,
+ emptyText: '120',
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Applies to newly connected paths. -1 disables the timeout.'),
+ },
+ },
+ ],
+});
^ permalink raw reply related [relevance 16%]
* [PATCH manager 15/17] ui: node: san: list NVMe over Fabrics controllers
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (13 preceding siblings ...)
2026-11-13 3:04 18% ` [PATCH manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
@ 2026-11-13 3:04 12% ` Thomas Lamprecht
2026-11-13 3:04 9% ` [PATCH manager 17/17] ui: dc: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-18 20:44 6% ` superseded: [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
Add a view below Node > SAN with the controllers of a node, one per
connected portal, their state and the storage they belong to, and the
host NQN of the node. A controller can be disconnected from there, for
example after its portal was removed from the storage. The node
refuses that for the last usable path of a namespace in use.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/SANUtils.js | 5 ++
www/manager6/Utils.js | 1 +
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 115 +++++++++++++++++++++++++
5 files changed, 130 insertions(+), 1 deletion(-)
create mode 100644 www/manager6/node/NVMeOFControllers.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index ab4b85d0c..83fa225b7 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -252,6 +252,7 @@ JSSRC= \
node/ISCSITargets.js \
node/LVM.js \
node/LVMThin.js \
+ node/NVMeOFControllers.js \
node/SANLuns.js \
node/StatusView.js \
node/Subscription.js \
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index d61c74df4..8c3ddb8a2 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -78,6 +78,11 @@ Ext.define('PVE.SANUtils', {
'logged-in': ['check-circle good', gettext('Connected')],
recovering: ['exclamation-circle warning', gettext('Reconnecting')],
'not-connected': ['times-circle faded', gettext('Not connected')],
+ live: ['check-circle good', gettext('Connected')],
+ connecting: ['exclamation-circle warning', gettext('Reconnecting')],
+ resetting: ['exclamation-circle warning', gettext('Reconnecting')],
+ deleting: ['times-circle faded', gettext('Disconnecting')],
+ 'deleting (no IO)': ['times-circle faded', gettext('Disconnecting')],
}[value];
let [icon, label] = display ?? ['question-circle faded', value];
return `<i class="fa fa-fw fa-${icon}"></i> ${Ext.htmlEncode(label)}`;
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 4a97358ac..55d5806d5 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -2251,6 +2251,7 @@ Ext.define('PVE.Utils', {
lvmthinremove: ['Thinpool', gettext('Remove')],
migrateall: ['', gettext('Bulk migrate VMs and Containers')],
move_volume: ['CT', gettext('Move Volume')],
+ nvmedisconnect: ['NVMe-oF', gettext('Disconnect')],
'pbs-download': ['VM/CT', gettext('File Restore Download')],
pull_file: ['CT', gettext('Pull file')],
push_file: ['CT', gettext('Push file')],
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index d4a292d68..f3db4acba 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -360,7 +360,7 @@ Ext.define('PVE.node.Config', {
);
}
- // the san-luns and iscsi reads accept either privilege
+ // the san-luns, iscsi and nvmeof reads accept either privilege
if (caps.nodes['Sys.Audit'] || caps.storage['Datastore.Allocate']) {
me.items.push(
{
@@ -376,6 +376,13 @@ Ext.define('PVE.node.Config', {
iconCls: 'fa fa-bullseye',
groups: ['san'],
},
+ {
+ xtype: 'pveNVMeOFControllerList',
+ title: 'NVMe over Fabrics',
+ itemId: 'san-nvmeof',
+ iconCls: 'fa fa-plug',
+ groups: ['san'],
+ },
);
}
diff --git a/www/manager6/node/NVMeOFControllers.js b/www/manager6/node/NVMeOFControllers.js
new file mode 100644
index 000000000..93955442d
--- /dev/null
+++ b/www/manager6/node/NVMeOFControllers.js
@@ -0,0 +1,115 @@
+Ext.define('PVE.node.NVMeOFControllerList', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'pveNVMeOFControllerList',
+ onlineHelp: 'storage_nvmeof',
+ emptyText: gettext('No NVMe over Fabrics controllers found'),
+ viewConfig: { enableTextSelection: true },
+ store: {
+ fields: ['controller', 'subsysnqn', 'portal', 'state', 'namespaces', 'used-by-storage'],
+ sorters: ['subsysnqn', 'portal'],
+ },
+ columns: [
+ { text: gettext('Controller'), dataIndex: 'controller', width: 100 },
+ {
+ text: gettext('Subsystem'),
+ dataIndex: 'subsysnqn',
+ flex: 5,
+ renderer: Ext.htmlEncode,
+ },
+ { text: gettext('Portal'), dataIndex: 'portal', width: 180, renderer: Ext.htmlEncode },
+ {
+ text: gettext('State'),
+ dataIndex: 'state',
+ width: 150,
+ renderer: PVE.SANUtils.renderState,
+ },
+ { text: gettext('Namespaces'), dataIndex: 'namespaces', width: 110 },
+ {
+ text: gettext('Storage'),
+ dataIndex: 'used-by-storage',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+
+ reload: function () {
+ let me = this;
+ let load = (path, success) =>
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${me.nodename}/nvmeof/${path}`,
+ method: 'GET',
+ waitMsgTarget: me.getView(),
+ failure: (response) =>
+ Proxmox.Utils.setErrorMask(me.getView(), response.htmlStatus),
+ success: (response) => !me.destroyed && success(response.result.data),
+ });
+ load('status', function (status) {
+ me.down('#hostnqn').setValue(status['host-nqn'] || '');
+ let error = status.supported
+ ? status.error
+ : gettext('nvme-cli is not installed on this node.');
+ if (error) {
+ Proxmox.Utils.setErrorMask(me.getView(), Ext.htmlEncode(error));
+ return;
+ }
+ load('controller', function (controllers) {
+ Proxmox.Utils.setErrorMask(me.getView(), false);
+ me.getStore().setData(controllers);
+ });
+ });
+ },
+
+ listeners: {
+ activate: function () {
+ this.reload();
+ },
+ },
+
+ initComponent: function () {
+ let me = this;
+ me.nodename = me.pveSelNode.data.node;
+ me.tbar = [
+ { text: gettext('Reload'), iconCls: 'fa fa-refresh', handler: () => me.reload() },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Disconnect'),
+ iconCls: 'fa fa-unlink',
+ disabled: true,
+ dangerous: true,
+ enableFn: () => !!Ext.state.Manager.get('GuiCap').dc['Sys.Modify'],
+ confirmMsg: (rec) =>
+ Ext.String.format(
+ gettext(
+ 'Disconnect controller {0}? A storage that still lists its portal connects to it again.',
+ ),
+ Ext.htmlEncode(rec.get('controller')),
+ ),
+ handler: (button, event, rec) =>
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${me.nodename}/nvmeof/controller/${rec.get('controller')}`,
+ method: 'DELETE',
+ waitMsgTarget: me,
+ failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+ success: (response) =>
+ Ext.create('Proxmox.window.TaskProgress', {
+ upid: response.result.data,
+ autoShow: true,
+ taskDone: () => !me.destroyed && me.reload(),
+ }),
+ }),
+ },
+ '->',
+ {
+ xtype: 'displayfield',
+ itemId: 'hostnqn',
+ fieldLabel: gettext('Host NQN'),
+ },
+ {
+ iconCls: 'fa fa-clipboard',
+ tooltip: gettext('Copy to Clipboard'),
+ handler: () => PVE.Utils.copyToClipboard(me.down('#hostnqn').getValue()),
+ },
+ ];
+ me.callParent();
+ },
+});
^ permalink raw reply related [relevance 12%]
* [PATCH storage 08/17] multipath: report the NVMe host NQN of each node
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (6 preceding siblings ...)
2026-11-13 3:04 14% ` [PATCH storage 07/17] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
@ 2026-11-13 3:04 10% ` Thomas Lamprecht
2026-11-13 3:04 15% ` [PATCH storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
` (8 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
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/Multipath.pm | 2 +-
src/PVE/Multipath/Status.pm | 6 +++++-
src/test/run_multipath_api_tests.pl | 12 +++++++++++-
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/PVE/API2/Multipath.pm b/src/PVE/API2/Multipath.pm
index d5d2df9d..1d7f5707 100644
--- a/src/PVE/API2/Multipath.pm
+++ b/src/PVE/API2/Multipath.pm
@@ -86,7 +86,7 @@ my $node_schema = {
state => { type => 'string', enum => ['ok', 'unavailable', 'no-report'] },
time => { type => 'integer', optional => 1 },
map { $_ => { type => 'string', optional => 1 } }
- qw(error apply-error iscsi-initiator-name),
+ qw(error apply-error iscsi-initiator-name nvme-host-nqn),
},
};
diff --git a/src/PVE/Multipath/Status.pm b/src/PVE/Multipath/Status.pm
index 58d11f5d..9dc8e2cf 100644
--- a/src/PVE/Multipath/Status.pm
+++ b/src/PVE/Multipath/Status.pm
@@ -48,6 +48,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\n" if !PVE::Multipath::is_running();
@@ -134,7 +137,8 @@ sub cluster_status() {
|| !defined($report->{time})
|| time() - $report->{time} > 180;
$entry->{$_} = $report->{$_}
- for grep { defined($report->{$_}) } qw(error apply-error iscsi-initiator-name);
+ for grep { defined($report->{$_}) }
+ qw(error apply-error iscsi-initiator-name nvme-host-nqn);
$entry->{state} = defined($report->{error}) ? 'unavailable' : 'ok';
next if $entry->{state} ne 'ok';
diff --git a/src/test/run_multipath_api_tests.pl b/src/test/run_multipath_api_tests.pl
index 77ee3b9f..9bf44733 100755
--- a/src/test/run_multipath_api_tests.pl
+++ b/src/test/run_multipath_api_tests.pl
@@ -14,6 +14,7 @@ use Test::More;
use Test::MockModule;
use PVE::API2::Multipath;
use PVE::Multipath::Generator;
+use PVE::NVMeOF;
use PVE::Storage;
subtest 'explicit entries are ordinary configuration writes' => sub {
@@ -156,9 +157,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();
@@ -215,15 +219,20 @@ 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)], 'single call owns ordering');
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();
is($report->{error}, 'multipathd is not running', '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();
@@ -278,7 +287,7 @@ subtest 'API returns final node and LUN states' => sub {
},
],
}),
- n2 => encode_json({ time => $NOW, luns => [] }),
+ n2 => encode_json({ time => $NOW, luns => [], 'nvme-host-nqn' => 'nqn.test:n2' }),
n3 => encode_json({ time => $NOW - 181, luns => [] }),
n4 => encode_json({ time => $NOW, luns => [] }),
n5 => encode_json({ time => $NOW, error => 'multipath-tools is not installed' }),
@@ -307,6 +316,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');
^ permalink raw reply related [relevance 10%]
* [PATCH storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (4 preceding siblings ...)
2026-11-13 3:04 8% ` [PATCH storage 05/17] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
@ 2026-11-13 3:04 21% ` Thomas Lamprecht
2026-11-13 3:04 14% ` [PATCH storage 07/17] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
` (10 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
The SAN LUN inventory lists NVMe namespaces without relation to an
NVMe over Fabrics storage. Report the subsystem NQN and the namespace
ID of a namespace, and expect one path per portal of the storage that
connects its subsystem, so that a namespace with fewer paths shows as
degraded.
A namespace counts as used by the LVM storage that has it as base
volume, else by the storage of its subsystem if that one serves the
namespaces as images.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 10 +++++++++
src/PVE/Storage/SAN.pm | 25 ++++++++++++++++++----
src/test/run_san_lun_scan_tests.pl | 33 +++++++++++++++++++++++++++++-
3 files changed, 63 insertions(+), 5 deletions(-)
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index a9d05f79..35c1c71f 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -596,6 +596,16 @@ __PACKAGE__->register_method({
type => 'string',
optional => 1,
},
+ 'nvme-subsystem' => {
+ description => 'The NVMe subsystem NQN.',
+ type => 'string',
+ optional => 1,
+ },
+ 'nvme-nsid' => {
+ description => 'The namespace ID within the NVMe subsystem.',
+ type => 'integer',
+ optional => 1,
+ },
'iscsi-target' => {
description => "The IQN of the iSCSI target the LUN is attached through.",
type => 'string',
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
index f3682106..b281177b 100644
--- a/src/PVE/Storage/SAN.pm
+++ b/src/PVE/Storage/SAN.pm
@@ -15,6 +15,7 @@ use PVE::Multipath;
use PVE::Multipath::Generator;
use PVE::Multipath::Config;
use PVE::Multipath::Identity;
+use PVE::NVMeOF;
use PVE::Storage;
use PVE::Storage::LVMPlugin;
use PVE::Tools qw(file_read_firstline dir_glob_foreach run_command);
@@ -34,7 +35,7 @@ sub scan_luns($cfg) {
PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
- my (%storage, %expected, %vg_owner, %target_owner, %base_owner);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner, %nvme_owner);
for my $sid (sort keys %$derived) {
for my $wwid (keys $derived->{$sid}->{wwids}->%*) {
@@ -52,7 +53,9 @@ sub scan_luns($cfg) {
$vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
$target_owner{ $scfg->{target} } //= $sid
if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
- $base_owner{$1} //= $sid if ($scfg->{base} // '') =~ m/(?:^|\.)dm-uuid-mpath-(.+)$/;
+ $base_owner{$1} //= $sid
+ if ($scfg->{base} // '') =~ m/(?:^|[.:])(?:dm-uuid-mpath|nvme)-(.+)$/;
+ $nvme_owner{ $scfg->{subsysnqn} } //= $sid if $scfg->{type} eq 'nvmeof';
}
my %rows;
@@ -96,7 +99,19 @@ sub scan_luns($cfg) {
: $storage{$wwid} ? 'storage'
: 'unmanaged';
}
- $row->{multipath} = 'native' if $name =~ /^nvme\d+n\d+$/;
+ if ($name =~ /^nvme\d+n\d+$/) {
+ $row->{multipath} = 'native';
+ my $nqn = PVE::Diskmanage::read_subsysnqn("/sys/block/$name/device/subsysnqn");
+ if (defined($nqn)) {
+ $row->{'nvme-subsystem'} = $nqn;
+ my $nsid = file_read_firstline("/sys/block/$name/nsid");
+ $row->{'nvme-nsid'} = int($nsid) if defined($nsid) && $nsid =~ /^\d+$/;
+ if (my $sid = $nvme_owner{$nqn}) {
+ $row->{'paths-expected'} =
+ scalar(PVE::NVMeOF::storage_paths($cfg->{ids}->{$sid})->@*);
+ }
+ }
+ }
for my $key (qw(transport vendor model serial)) {
my $value = $disk->{$key};
$row->{$key} //= $value if defined($value) && $value ne 'unknown';
@@ -150,8 +165,10 @@ sub scan_luns($cfg) {
$row->{'paths-expected'},
);
}
+ my $nvme = $nvme_owner{ $row->{'nvme-subsystem'} // '' };
+ undef $nvme if $nvme && !PVE::Storage::san_storage_serves_images($cfg->{ids}->{$nvme});
my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' }
- // $target_owner{ $row->{'iscsi-target'} // '' };
+ // $target_owner{ $row->{'iscsi-target'} // '' } // $nvme;
$row->{'used-by-storage'} = $owner if defined($owner);
}
return [map { $rows{$_} } sort keys %rows];
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
index 94df0d5c..3578a3af 100755
--- a/src/test/run_san_lun_scan_tests.pl
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -165,7 +165,14 @@ is($rows->[0]->{'by-id'}, '/dev/disk/by-id/scsi-3600plain', 'by-id link of the s
is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id link resolves to');
$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
-$scan->mock(file_read_firstline => sub { 'eui.0123456789abcdef' });
+$scan->mock(file_read_firstline => sub { $_[0] =~ m{/nsid$} ? 1 : 'eui.0123456789abcdef' });
+$disk->mock(read_subsysnqn => sub { 'nqn.test' });
+$cfg->{ids}->{fabric} = {
+ type => 'nvmeof',
+ subsysnqn => 'nqn.test',
+ 'nvme-portals' => '192.0.2.1,192.0.2.2',
+ content => { images => 1 },
+};
$scan->unmock('stable_path');
$scan->mock(abs_path => sub { '/dev/nvme0n1' });
$rows = PVE::Storage::SAN::scan_luns($cfg);
@@ -173,6 +180,30 @@ is($rows->[0]->{multipath}, 'native', 'NVMe uses kernel-native multipath');
is($rows->[0]->{'by-id'}, '/dev/disk/by-id/nvme-eui.0123456789abcdef', 'NVMe stable name');
eval { PVE::JSONSchema::validate($rows, $schema) };
is($@, '', 'native row matches the API schema');
+is($rows->[0]->{'nvme-subsystem'}, 'nqn.test', 'subsystem NQN exposed');
+is($rows->[0]->{'nvme-nsid'}, 1, 'namespace ID exposed');
+is($rows->[0]->{'used-by-storage'}, 'fabric', 'a storage serving the namespaces uses them');
+is($rows->[0]->{'paths-expected'}, 2, 'one expected path per configured portal');
+
+for my $count (1, 3) {
+ $config->mock(
+ read_config => sub { {
+ ids => { 'eui.0123456789abcdef' => { type => 'wwid', 'paths-expected' => $count } },
+ } },
+ );
+ my $entry = PVE::Storage::SAN::scan_luns($cfg);
+ is($entry->[0]->{'paths-expected'}, 2, "a multipath entry does not change it ($count)");
+}
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+{
+ local $cfg->{ids}->{fabric}->{content} = { none => 1 };
+ my $plain = PVE::Storage::SAN::scan_luns($cfg);
+ is($plain->[0]->{'used-by-storage'}, undef, 'a connection storage does not');
+ is($plain->[0]->{'paths-expected'}, 2, 'but still tells the expected paths');
+}
+$cfg->{ids}->{data}->{base} = 'fabric:nvme-eui.0123456789abcdef';
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{'used-by-storage'}, 'data', 'LVM base consumer takes precedence');
$disk->mock(is_partition => sub { 1 });
ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
^ permalink raw reply related [relevance 21%]
* [PATCH manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (11 preceding siblings ...)
2026-11-13 3:04 16% ` [PATCH manager 12/17] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-13 3:04 18% ` Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
` (3 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
A namespace of an NVMe over Fabrics storage can hold the volume group
of an LVM storage like an iSCSI LUN, so list such storages in the base
storage selector as well and name the type of each.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/storage/LVMEdit.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 9c4df2609..7ac366f35 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -70,10 +70,13 @@ Ext.define('PVE.storage.BaseStorageSelector', {
let store = Ext.create('Ext.data.Store', {
autoLoad: {
addRecords: true,
- params: {
- type: 'iscsi',
- },
},
+ filters: [
+ {
+ filterFn: (rec) =>
+ !rec.get('storage') || ['iscsi', 'nvmeof'].includes(rec.get('type')),
+ },
+ ],
fields: [
'storage',
'type',
@@ -82,7 +85,8 @@ Ext.define('PVE.storage.BaseStorageSelector', {
name: 'text',
convert: function (value, record) {
if (record.data.storage) {
- return record.data.storage + ' (iSCSI)';
+ let type = PVE.Utils.format_storage_type(record.data.type);
+ return `${record.data.storage} (${type})`;
} else {
return me.existingGroupsText;
}
^ permalink raw reply related [relevance 18%]
* [PATCH manager 17/17] ui: dc: san: show that a namespace uses native multipath
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (14 preceding siblings ...)
2026-11-13 3:04 12% ` [PATCH manager 15/17] ui: node: san: list NVMe over Fabrics controllers Thomas Lamprecht
@ 2026-11-13 3:04 9% ` Thomas Lamprecht
2026-11-18 20:44 6% ` superseded: [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
The cluster-wide status lists the namespaces of NVMe over Fabrics
storages as well. They use the native multipath of the kernel, with
neither an entry nor a storage that requests a map, so the Multipath
column would call them unmanaged. Show "Native" for them, as the LUN
list of a node does.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/dc/SAN.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js
index 98aad36ab..083bc8c21 100644
--- a/www/manager6/dc/SAN.js
+++ b/www/manager6/dc/SAN.js
@@ -14,6 +14,7 @@ Ext.define('pve-san-status', {
'name',
'explicit',
'multipath-storage',
+ 'native',
'nodes',
'size',
'used-by-storage',
@@ -312,7 +313,14 @@ Ext.define('PVE.dc.SANView', {
width: 170,
renderer: (value, md, rec) => {
let storage = rec.get('multipath-storage');
- let kind = value ? 'manual' : storage ? 'storage' : 'unmanaged';
+ // a namespace uses the native multipath of the kernel
+ let kind = rec.get('native')
+ ? 'native'
+ : value
+ ? 'manual'
+ : storage
+ ? 'storage'
+ : 'unmanaged';
return Ext.htmlEncode(PVE.SANUtils.multipathText(kind, storage));
},
},
^ permalink raw reply related [relevance 9%]
* [PATCH storage 05/17] pvesm: add a scan command for NVMe over Fabrics
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (3 preceding siblings ...)
2026-11-13 3:04 18% ` [PATCH storage 04/17] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
@ 2026-11-13 3:04 8% ` Thomas Lamprecht
2026-11-13 3:04 21% ` [PATCH storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage Thomas Lamprecht
` (11 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
Add 'pvesm scan nvmeof <portal>', which prints the subsystems a
portal offers to the node with their portals, like the iSCSI scan
prints targets. That gives the values for a new storage on the
command line, with the usual output formats for scripts.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/CLI/pvesm.pm | 13 +++++++++++++
src/test/run_nvmeof_tests.pl | 12 ++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 347fbffa..aa3c587e 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -736,6 +736,19 @@ our $cmddef = {
$print_api_result,
$PVE::RESTHandler::standard_output_options,
],
+ nvmeof => [
+ "PVE::API2::Storage::Scan",
+ 'nvmeofscan',
+ ['portal'],
+ { node => $nodename },
+ sub {
+ my ($data, $schema, $options) = @_;
+ PVE::CLIFormatter::print_api_result(
+ $data, $schema, [qw(subsysnqn portals)], $options,
+ );
+ },
+ $PVE::RESTHandler::standard_output_options,
+ ],
'san-luns' => [
"PVE::API2::Storage::Scan",
'sanlunscan',
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index ead8d03c..ef15d17a 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -292,6 +292,18 @@ subtest 'TCP discovery, fallback and API result' => sub {
@ports = ();
PVE::NVMeOF::discover('[2001:db8::1]:4421');
is_deeply(\@ports, [4421], 'explicit port does not fall back');
+ require PVE::CLI::pvesm;
+ my $formatter = Test::MockModule->new('PVE::CLIFormatter');
+ my $schema = PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns};
+ $formatter->mock(
+ print_api_result => sub {
+ is($_[0], $rows, 'CLI forwards complete discovery rows');
+ is($_[1], $schema, 'CLI forwards discovery schema');
+ is($_[3]->{'output-format'}, 'json', 'CLI supports structured output');
+ },
+ );
+ $PVE::CLI::pvesm::cmddef->{scan}->{nvmeof}->[4]
+ ->($rows, $schema, { 'output-format' => 'json' });
};
done_testing();
^ permalink raw reply related [relevance 8%]
* [PATCH manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (9 preceding siblings ...)
2026-11-13 3:04 21% ` [PATCH docs 10/17] storage: document NVMe over Fabrics storages Thomas Lamprecht
@ 2026-11-13 3:04 6% ` Thomas Lamprecht
2026-11-13 3:04 16% ` [PATCH manager 12/17] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
` (5 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
Make the node status, the controller list and the disconnect call of
pve-storage reachable at /nodes/{node}/nvmeof for the web UI.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
PVE/API2/Nodes.pm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 2a7ab4133..3495c3e17 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -53,6 +53,7 @@ use PVE::API2::Hardware;
use PVE::API2::ISCSI;
use PVE::API2::LXC::Status;
use PVE::API2::LXC;
+use PVE::API2::NVMeOF;
use PVE::API2::Network;
use PVE::API2::Network::SDN::Nodes::Status;
use PVE::API2::NodeConfig;
@@ -166,6 +167,11 @@ __PACKAGE__->register_method({
path => 'iscsi',
});
+__PACKAGE__->register_method({
+ subclass => "PVE::API2::NVMeOF",
+ path => 'nvmeof',
+});
+
__PACKAGE__->register_method({
subclass => "PVE::API2::Capabilities",
path => 'capabilities',
@@ -252,6 +258,7 @@ __PACKAGE__->register_method({
{ name => 'migrateall' },
{ name => 'netstat' },
{ name => 'network' },
+ { name => 'nvmeof' },
{ name => 'qemu' },
{ name => 'query-oci-repo-tags' },
{ name => 'query-url-metadata' },
^ permalink raw reply related [relevance 6%]
* [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage
@ 2026-11-13 3:04 12% Thomas Lamprecht
2026-11-13 3:04 8% ` [PATCH storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
` (16 more replies)
0 siblings, 17 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
A storage type for NVMe subsystems reached over TCP, on top of v4 of the
SAN series [0]: namespaces as base volumes of shared LVM, or directly
as disk images, with the kernel's native multipath.
This is a deliberately small first version: TCP only, without
authentication or TLS, so access rests on the host NQN list of the
target and a separate storage network. It relies on the kernel to
reconnect lost paths and on the SAN series for the LUN inventory, the
guided setup and the checks before a namespace is written. The plugin
connects what is missing and removes nothing, also not when a portal or
the storage is removed: disconnecting a controller is an explicit
action per node.
Two prerequisites from the chapter: nodes cloned from one image need
distinct host NQNs before they connect. And as with every new storage
type, all nodes need the upgrade before the first such storage is
added, as a node that does not know the type drops its definitions when
it writes storage.cfg. I ran into that in the lab.
What it adds:
- storage type 'nvmeof' with a subsystem NQN and a list of TCP
portals. Each node connects the portals it has no controller for and
leaves existing controllers as they are. New controllers get
ctrl_loss_tmo=-1, so the kernel keeps reconnecting, and fail I/O on
a lost path after 120 seconds unless configured otherwise. Volumes
are named nvme-<wwid>.
- LVM accepts such a volume as base, with the reference check and the
per-LUN lock of the SAN series.
- discovery: /nodes/{node}/scan/nvmeof and 'pvesm scan nvmeof'.
- /nodes/{node}/nvmeof: host identity, controller list, and removal
of one controller. That is refused if a namespace that is mounted,
has a holder or is referenced by a storage would lose its last
usable path. A storage that still lists the portal connects again.
- the node report and with it the cluster-wide status of the SAN
series include the namespaces of nvmeof storages, with their state
on each node of the storage. They do not need multipathd.
- web UI: the Add Storage menu of the SAN panel gets a third entry for
shared LVM on a namespace, which ends with the state of the namespace
on every node like the other two; Datacenter > Storage > Add gets the
dialog of the storage type, with subsystem discovery and the note
pointing to the SAN panel; Node > SAN lists the controllers; the SAN
panel shows the host NQN of each node.
- nvme-cli becomes a Recommends of libpve-storage-perl.
Namespaces already show up in the LUN list of Node > SAN through the
SAN series, with their paths.
Patches:
- storage 01-09: SMART skip for fabrics namespaces, the plugin,
LVM base, discovery, namespace attribution in the LUN inventory, the
node API, the host NQN and the namespaces in the node report
- docs 10: the storage chapter
- manager 11-17: API mount, storage type and its dialog, LVM base
selector, guided setup, controller list, host NQN column, native
multipath in the LUN list of the SAN panel
I tested this on a six-node nested cluster against a Linux nvmet target
and a NetApp AFF A20, each with two portals: the guided setup with a new
and with a reused connection storage and with a node that has no access
at first, one path down on both targets, a NetApp path cut and a stopped
multipathd as the cluster-wide status shows them, the plain dialogs on
the nvmet target, a guest disk on a NetApp namespace through snapshot,
rollback, live migration and a path cut under I/O, wiping a namespace
and its refusals on the NetApp, and connecting after a node reboot on
both.
[0]: https://lore.proxmox.com/pve-devel/20261113030146.1559030-1-t.lamprecht@proxmox.com/
pve-storage:
Thomas Lamprecht (9):
diskmanage: skip SMART queries for NVMe fabric namespaces
nvmeof: add a storage for NVMe over Fabrics subsystems
lvm: allow a volume group on an NVMe over Fabrics namespace
api: scan: add NVMe over Fabrics discovery
pvesm: add a scan command for NVMe over Fabrics
api: scan: san-luns: attribute NVMe namespaces to storage
api: add node-level NVMe over Fabrics status and controller removal
multipath: report the NVMe host NQN of each node
multipath: report NVMe over Fabrics namespaces in the cluster status
debian/control | 1 +
src/PVE/API2/Makefile | 1 +
src/PVE/API2/Multipath.pm | 8 +-
src/PVE/API2/NVMeOF.pm | 182 ++++++++++++++
src/PVE/API2/Storage/Scan.pm | 59 +++++
src/PVE/CLI/pvesm.pm | 13 +
src/PVE/Diskmanage.pm | 30 ++-
src/PVE/Makefile | 1 +
src/PVE/Multipath/Status.pm | 64 ++++-
src/PVE/NVMeOF.pm | 352 ++++++++++++++++++++++++++++
src/PVE/Storage.pm | 2 +
src/PVE/Storage/LVMPlugin.pm | 3 +-
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/NVMeOFPlugin.pm | 204 ++++++++++++++++
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SAN.pm | 38 ++-
src/test/Makefile | 7 +-
src/test/disklist_test.pm | 14 ++
src/test/run_multipath_api_tests.pl | 103 +++++++-
src/test/run_nvmeof_api_tests.pl | 151 ++++++++++++
src/test/run_nvmeof_taint_tests.pl | 65 +++++
src/test/run_nvmeof_tests.pl | 309 ++++++++++++++++++++++++
src/test/run_san_lun_scan_tests.pl | 33 ++-
src/test/run_san_nvme_tests.pl | 30 +++
24 files changed, 1642 insertions(+), 31 deletions(-)
pve-docs:
Thomas Lamprecht (1):
storage: document NVMe over Fabrics storages
pve-storage-multipath.adoc | 4 +-
pve-storage-nvmeof.adoc | 161 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 20 +++--
3 files changed, 177 insertions(+), 8 deletions(-)
pve-manager:
Thomas Lamprecht (7):
api: nodes: mount the NVMe over Fabrics endpoints
ui: storage: add NVMe over Fabrics storage
ui: lvm: offer NVMe over Fabrics storages as base storage
ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics
ui: node: san: list NVMe over Fabrics controllers
ui: dc: san: show the NVMe host NQN of each node
ui: dc: san: show that a namespace uses native multipath
PVE/API2/Nodes.pm | 7 +
www/manager6/Makefile | 4 +-
www/manager6/SANUtils.js | 7 +
www/manager6/Utils.js | 7 +
www/manager6/dc/SAN.js | 41 ++++--
www/manager6/dc/StorageView.js | 5 +-
www/manager6/node/Config.js | 9 +-
www/manager6/node/NVMeOFControllers.js | 115 ++++++++++++++++
www/manager6/storage/IScsiEdit.js | 5 +-
www/manager6/storage/LVMEdit.js | 12 +-
www/manager6/storage/NVMeOFEdit.js | 130 ++++++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 29 +++-
www/manager6/storage/wizard/NodeIdentities.js | 45 +++---
.../storage/wizard/{IScsi.js => Target.js} | 129 +++++++++++------
www/manager6/storage/wizard/Wizard.js | 43 +++---
www/manager6/window/SANLunState.js | 23 +++-
16 files changed, 499 insertions(+), 112 deletions(-)
^ permalink raw reply [relevance 12%]
* [PATCH storage 04/17] api: scan: add NVMe over Fabrics discovery
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-13 3:04 17% ` [PATCH storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
@ 2026-11-13 3:04 18% ` Thomas Lamprecht
2026-11-13 3:04 8% ` [PATCH storage 05/17] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
` (12 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
Setting up an NVMe over Fabrics storage needs the NQN of the
subsystem and its portals. Add /nodes/{node}/scan/nvmeof, which asks
the discovery service at a portal for the NVMe/TCP subsystems it
offers to the node and lists them with their portals.
Without a port, it tries the discovery port 8009 and then the I/O
port 4420, where Linux targets answer discovery too. The scan needs
Datastore.Allocate on /storage, like the iSCSI scan.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 49 +++++++++++++++++++++++
src/PVE/NVMeOF.pm | 62 ++++++++++++++++++++++++++++++
src/test/run_nvmeof_taint_tests.pl | 5 +++
src/test/run_nvmeof_tests.pl | 54 ++++++++++++++++++++++++++
4 files changed, 170 insertions(+)
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index 96e1bd34..a9d05f79 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -6,6 +6,7 @@ use warnings;
# NOTE: This API endpoints are mounted by pve-manager's API2::Node module and pvesm CLI
use PVE::JSONSchema qw(get_standard_option);
+use PVE::NVMeOF;
use PVE::RESTHandler;
use PVE::SafeSyslog;
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'iscsi' },
{ method => 'lvm' },
{ method => 'nfs' },
+ { method => 'nvmeof' },
{ method => 'pbs' },
{ method => 'san-luns' },
{ method => 'zfs' },
@@ -299,6 +301,53 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'nvmeofscan',
+ path => 'nvmeof',
+ method => 'GET',
+ description =>
+ 'List the NVMe over TCP subsystems offered to this node by a discovery controller.',
+ protected => 1,
+ proxyto => 'node',
+ permissions => { check => ['perm', '/storage', ['Datastore.Allocate']] },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ portal => {
+ description => 'IPv4 or bracketed IPv6 discovery address with an optional port.'
+ . ' Without a port, try 8009 then 4420.',
+ type => 'string',
+ format => 'pve-storage-nvme-portal',
+ },
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ additionalProperties => 0,
+ properties => {
+ subsysnqn => { type => 'string', description => 'The subsystem NQN.' },
+ portals => {
+ type => 'string',
+ description => 'The discovered TCP portals, comma separated.',
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+ my $res = PVE::NVMeOF::discover($param->{portal});
+ return [
+ map { {
+ subsysnqn => $_,
+ portals => join(',', map { PVE::NVMeOF::format_path($_) } $res->{$_}->@*),
+ } } sort keys %$res
+ ];
+ },
+});
+
__PACKAGE__->register_method({
name => 'lvmscan',
path => 'lvm',
diff --git a/src/PVE/NVMeOF.pm b/src/PVE/NVMeOF.pm
index 7a3140cb..d1dfe15b 100644
--- a/src/PVE/NVMeOF.pm
+++ b/src/PVE/NVMeOF.pm
@@ -5,10 +5,12 @@ use v5.36;
use Digest::SHA qw(sha1_hex);
use Fcntl qw(:flock F_GETFD F_SETFD FD_CLOEXEC);
use File::Path qw(make_path);
+use JSON qw(decode_json);
use Socket qw(AF_INET AF_INET6 inet_ntop inet_pton);
use PVE::Diskmanage;
use PVE::JSONSchema;
+use PVE::Network;
use PVE::Tools qw(dir_glob_foreach file_read_firstline file_set_contents run_command);
our $NVME = '/usr/sbin/nvme';
@@ -246,4 +248,64 @@ sub connect_path($scfg, $path) {
});
}
+sub parse_discovery_log($raw) {
+ my $log = decode_json($raw);
+ die "invalid NVMe discovery log\n"
+ if ref($log) ne 'HASH' || ref($log->{records}) ne 'ARRAY';
+ my (%seen, %res);
+ for my $record ($log->{records}->@*) {
+ next
+ if ($record->{subtype} // '') ne 'nvme subsystem' || ($record->{trtype} // '') ne 'tcp';
+ my $nqn = $record->{subnqn} // next;
+ next
+ if $nqn !~ /^$NQN_PATTERN$/
+ || length($nqn) > 223
+ || $nqn eq 'nqn.2014-08.org.nvmexpress.discovery';
+ my $addr = $record->{traddr} // '';
+ my $port = $record->{trsvcid} // '';
+ my $path = parse_portal(($addr =~ /:/ ? "[$addr]" : $addr) . ":$port") // next;
+ next if $seen{$nqn}->{ format_path($path) }++;
+ push $res{$nqn}->@*, $path;
+ }
+ return \%res;
+}
+
+sub discover($portal) {
+ my $path = parse_portal($portal) // die "invalid portal '$portal'\n";
+ my @ports = $portal =~ /:\d+$/ ? ($path->{trsvcid}) : (8009, 4420);
+ my $error;
+ for my $port (@ports) {
+ my $result = eval {
+ die "no answer from portal\n" if !PVE::Network::tcp_ping($path->{traddr}, $port, 2);
+ with_lock(sub {
+ assert_support();
+ my $host = host_identity();
+ my $out = '';
+ run_command(
+ [
+ $NVME,
+ 'discover',
+ '--transport=tcp',
+ '--traddr',
+ $path->{traddr},
+ '--trsvcid',
+ $port,
+ '--hostnqn',
+ $host->{nqn},
+ '--hostid',
+ $host->{id},
+ '--output-format=json',
+ ],
+ timeout => 30,
+ outfunc => sub($line) { $out .= "$line\n" },
+ );
+ return parse_discovery_log($out);
+ });
+ };
+ $error = $@;
+ return $result if !$error;
+ }
+ die "discovery at portal '$portal' failed - $error";
+}
+
1;
diff --git a/src/test/run_nvmeof_taint_tests.pl b/src/test/run_nvmeof_taint_tests.pl
index 3c19f8cc..d136c4f1 100755
--- a/src/test/run_nvmeof_taint_tests.pl
+++ b/src/test/run_nvmeof_taint_tests.pl
@@ -38,6 +38,7 @@ $nvme->mock(
'all connect operands are validated and untainted',
);
PVE::Tools::run_command(['/usr/bin/true', @$cmd], timeout => 5);
+ $opts{outfunc}->('{"records":[]}') if $opts{outfunc};
},
);
my $path = PVE::NVMeOF::parse_portal($portal);
@@ -53,6 +54,10 @@ for my $bad ('nqn.bad,nqn=other', "nqn.test\n", 'nqn.2014-08.org.nvmexpress.disc
eval { PVE::NVMeOF::connect_path({ subsysnqn => $bad }, $path) };
like($@, qr/invalid subsystem/, 'invalid connect subsystem refused');
}
+my $net = Test::MockModule->new('PVE::Network');
+$net->mock(tcp_ping => sub { 1 });
+eval { PVE::NVMeOF::discover($portal) };
+is($@, '', 'discovery can execute with file-backed host identity in taint mode');
file_set_contents($PVE::NVMeOF::HOSTID_FILE, "00000000-0000-0000-0000-000000000000\n");
eval { PVE::NVMeOF::host_identity() };
like($@, qr/nonzero UUID/, 'zero host ID refused');
diff --git a/src/test/run_nvmeof_tests.pl b/src/test/run_nvmeof_tests.pl
index 5ff96833..ead8d03c 100755
--- a/src/test/run_nvmeof_tests.pl
+++ b/src/test/run_nvmeof_tests.pl
@@ -9,6 +9,8 @@ use Test::More;
use Test::MockModule;
use PVE::NVMeOF;
use PVE::Storage;
+use PVE::API2::Storage::Scan;
+use JSON qw(encode_json);
use PVE::Tools qw(file_set_contents);
my $dir = tempdir('nvmeof-test-XXXX', DIR => '.', CLEANUP => 1);
@@ -240,4 +242,56 @@ subtest 'local disk setup rejects fabric namespaces by transport' => sub {
}
};
+subtest 'TCP discovery, fallback and API result' => sub {
+ my $record = {
+ subtype => 'nvme subsystem',
+ trtype => 'tcp',
+ subnqn => 'nqn.test',
+ traddr => '192.0.2.1',
+ trsvcid => '4420',
+ };
+ my $raw = encode_json({
+ records =>
+ [$record, $record, { %$record, trtype => 'rdma' }, { %$record, trsvcid => 70000 }],
+ });
+ is_deeply(
+ PVE::NVMeOF::parse_discovery_log($raw),
+ { 'nqn.test' => [{ traddr => '192.0.2.1', trsvcid => 4420 }] },
+ 'TCP only, unique valid portals',
+ );
+ for my $bad ('garbage', '{}', '[]') {
+ eval { PVE::NVMeOF::parse_discovery_log($bad) };
+ ok($@, 'malformed discovery is not an empty success');
+ }
+ my $nvme = Test::MockModule->new('PVE::NVMeOF');
+ my $net = Test::MockModule->new('PVE::Network');
+ my (@ports, @commands);
+ our $locked;
+ $nvme->mock(with_lock => sub { local $locked = 1; $_[0]->() });
+ $nvme->mock(assert_support => sub { });
+ $nvme->mock(host_identity => sub { { nqn => 'nqn.host', id => 'id' } });
+ $net->mock(tcp_ping => sub { push @ports, $_[1]; $_[1] != 8009 });
+ $nvme->mock(
+ run_command => sub($cmd, %opts) {
+ ok($locked, 'discovery holds the NVMe lock');
+ is($opts{timeout}, 30, 'discovery command timeout');
+ push @commands, $cmd;
+ $opts{outfunc}->($raw);
+ },
+ );
+ my $rows = PVE::API2::Storage::Scan->nvmeofscan({ node => 'n1', portal => '192.0.2.1' });
+ is_deeply(\@ports, [8009, 4420], 'unspecified port tries discovery then I/O port');
+ is_deeply($rows, [{ subsysnqn => 'nqn.test', portals => '192.0.2.1:4420' }], 'API shape');
+ eval {
+ PVE::JSONSchema::validate(
+ $rows,
+ PVE::API2::Storage::Scan->map_method_by_name('nvmeofscan')->{returns},
+ );
+ };
+ is($@, '', 'API schema accepts result');
+ @ports = ();
+ PVE::NVMeOF::discover('[2001:db8::1]:4421');
+ is_deeply(\@ports, [4421], 'explicit port does not fall back');
+};
+
done_testing();
^ permalink raw reply related [relevance 18%]
* [PATCH storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
@ 2026-11-13 3:04 8% ` Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
` (15 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
The disk list queries the SMART health of every disk. For an NVMe
namespace attached over TCP or RDMA, the query goes to the target and
can stall the listing while a path recovers.
Skip the query for these transports. It depends on the transport of
the namespace only, so namespaces connected by hand are covered too.
Their health shows as unknown, local NVMe drives are queried as
before.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 4 +++-
src/test/disklist_test.pm | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index d6340d32..1fec9ec5 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -644,7 +644,9 @@ sub get_disks {
}
my ($health, $wearout) = ('UNKNOWN', 'N/A');
- if (!$nosmart) {
+ # SMART queries over fabrics can stall while a path recovers.
+ my $remote_nvme = defined($nvme_transport) && $nvme_transport =~ /^(?:tcp|rdma)$/;
+ if (!$nosmart && !$remote_nvme) {
eval {
my $smartdata = get_smart_data($devpath, !is_ssdlike($type));
$health = $smartdata->{health} if $smartdata->{health};
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 2f22fae8..c32ee09a 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -266,6 +266,20 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if ($testcasedir eq 'nvme_smart') {
+ my $smart_calls;
+ $diskmanage_module->mock(get_smart_data => sub { $smart_calls++; return {} });
+ for my $transport (qw(tcp rdma pcie)) {
+ $smart_calls = 0;
+ $diskmanage_module->mock(get_nvme_transport => sub { $transport });
+ PVE::Diskmanage::get_disks();
+ $testcount++;
+ is($smart_calls, $transport eq 'pcie' ? 1 : 0, "SMART queries for $transport");
+ }
+ $diskmanage_module->unmock('get_smart_data');
+ $diskmanage_module->unmock('get_nvme_transport');
+ }
+
if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
my $status = PVE::Multipath::path_status_by_wwid();
my $expected_status =
^ permalink raw reply related [relevance 8%]
* [PATCH storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-13 3:04 8% ` [PATCH storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
@ 2026-11-13 3:04 17% ` Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH storage 04/17] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
` (13 subsequent siblings)
16 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:04 UTC (permalink / raw)
To: pve-devel
An LVM storage only accepts an iSCSI LUN as base volume. Accept a
namespace of an NVMe over Fabrics storage too. Adding such an LVM
storage connects the subsystem, waits for the namespace and creates
the volume group on it, and activating it on another node connects
that node first.
The creation treats the namespace like any SAN LUN: it takes the
cluster-wide lock of the LUN and refuses a namespace that another
storage references.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 3 +--
src/test/run_san_nvme_tests.pl | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 4e885429..e7fb83d1 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -1158,9 +1158,8 @@ sub on_add_hook {
my $basecfg = PVE::Storage::storage_config($cfg, $baseid, 1);
die "base storage ID '$baseid' does not exist\n" if !$basecfg;
- # we only support iscsi for now
die "unsupported base type '$basecfg->{type}'"
- if $basecfg->{type} ne 'iscsi';
+ if $basecfg->{type} ne 'iscsi' && $basecfg->{type} ne 'nvmeof';
# Managed multipath requires the coalesced map, never a transient single-path PV.
die "base volume '$volname' is no multipath volume of storage '$baseid'\n"
diff --git a/src/test/run_san_nvme_tests.pl b/src/test/run_san_nvme_tests.pl
index b1a39629..43b1219e 100755
--- a/src/test/run_san_nvme_tests.pl
+++ b/src/test/run_san_nvme_tests.pl
@@ -117,4 +117,21 @@ is_deeply(
);
is_deeply(\@opens, [$link], 'VG creation holds the native by-id device');
+$cfg->{ids} = { fabric => { type => 'nvmeof', subsysnqn => 'nqn.test' } };
+my @activation;
+$storage->mock(path => sub { $link });
+$storage->mock(activate_storage => sub { push @activation, 'storage' });
+$storage->mock(activate_volumes => sub { push @activation, 'volume' });
+$lvm->mock(
+ lvm_create_volume_group => sub {
+ is($_[0], $link, 'add hook passes native base');
+ is($_[3]->{exempt}, 'data', 'add hook exempts new storage');
+ },
+);
+PVE::Storage::LVMPlugin->on_add_hook(
+ 'data',
+ { base => 'fabric:nvme-eui.0123456789abcdef', vgname => 'data', shared => 1 },
+);
+is_deeply(\@activation, ['storage', 'volume'], 'LVM activates the NVMe base before creation');
+
done_testing();
^ permalink raw reply related [relevance 17%]
* [PATCH v4 storage 16/36] api: scan: add a SAN LUN inventory
2026-11-13 3:00 5% [PATCH v4 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-13 3:00 13% ` [PATCH v4 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
2026-11-13 3:00 13% ` [PATCH v4 storage 05/36] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
@ 2026-11-13 3:00 9% ` Thomas Lamprecht
2026-11-13 3:00 9% ` [PATCH v4 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:00 UTC (permalink / raw)
To: pve-devel
Add /nodes/{node}/scan/san-luns, which lists the LUNs a node sees
over iSCSI, Fibre Channel or NVMe over Fabrics, one row per WWID with
the paths folded into their multipath map. The node disk list has
neither the maps nor a relation to volume groups and storages.
A row has the device to use, its size and transport, how multipath
handles the LUN, the health and state of its paths, and the known
usage with the volume group and storage. The usage comes from cached
data only, as probing a LUN whose paths are down can block.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Storage/Scan.pm | 197 ++++++++++++++++++
src/PVE/Diskmanage.pm | 7 +
src/PVE/Multipath.pm | 24 +++
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 189 +++++++++++++++++
src/test/Makefile | 8 +-
src/test/disk_tests/multipath/multipathd | 124 +++++++++++
.../multipath/multipathd_status_expected.json | 40 ++++
src/test/disklist_test.pm | 15 ++
src/test/run_san_api_tests.pl | 24 +++
src/test/run_san_lun_scan_tests.pl | 180 ++++++++++++++++
11 files changed, 809 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/Storage/SAN.pm
create mode 100644 src/test/disk_tests/multipath/multipathd
create mode 100644 src/test/disk_tests/multipath/multipathd_status_expected.json
create mode 100755 src/test/run_san_api_tests.pl
create mode 100755 src/test/run_san_lun_scan_tests.pl
diff --git a/src/PVE/API2/Storage/Scan.pm b/src/PVE/API2/Storage/Scan.pm
index a58bdd80..96e1bd34 100644
--- a/src/PVE/API2/Storage/Scan.pm
+++ b/src/PVE/API2/Storage/Scan.pm
@@ -12,6 +12,7 @@ use PVE::SafeSyslog;
use PVE::Storage::LVMPlugin;
use PVE::Storage::LvmThinPlugin;
use PVE::Storage::PBSPlugin;
+use PVE::Storage::SAN;
use PVE::Storage;
use base qw(PVE::RESTHandler);
@@ -49,6 +50,7 @@ __PACKAGE__->register_method({
{ method => 'lvm' },
{ method => 'nfs' },
{ method => 'pbs' },
+ { method => 'san-luns' },
{ method => 'zfs' },
];
@@ -373,6 +375,201 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'sanlunscan',
+ path => 'san-luns',
+ method => 'GET',
+ description => "List SAN LUNs with their paths and cached usage.",
+ protected => 1,
+ proxyto => "node",
+ permissions => {
+ check => [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ devpath => {
+ description => "The device path.",
+ type => 'string',
+ },
+ size => {
+ description => "The device size in bytes.",
+ type => 'integer',
+ renderer => 'bytes',
+ optional => 1,
+ },
+ transport => {
+ description =>
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'iscsi', 'nvme', 'nvme-fc', or 'nvme-tcp'.",
+ type => 'string',
+ optional => 1,
+ },
+ vendor => { type => 'string', optional => 1 },
+ model => { type => 'string', optional => 1 },
+ serial => { type => 'string', optional => 1 },
+ state => {
+ description =>
+ 'The health of the multipath LUN when path status is available.',
+ type => 'string',
+ enum => ['optimal', 'degraded', 'failed'],
+ optional => 1,
+ },
+ 'paths-total' => {
+ description => "The number of paths of a multipath mapped device or of"
+ . " an NVMe namespace attached through multiple controllers.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-active' => {
+ description =>
+ "The number of active paths whose checker state is ready, ghost,"
+ . " or not reported. Native NVMe paths count when their controller is live"
+ . " and their ANA state is optimized, non-optimized, or not reported.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'paths-expected' => {
+ description => "The number of paths the LUN should have according to the"
+ . " storage configuration, one per portal for iSCSI; absent when it is"
+ . " not known.",
+ type => 'integer',
+ optional => 1,
+ },
+ 'path-list' => {
+ description => "The member paths of the device with their state.",
+ type => 'array',
+ optional => 1,
+ items => {
+ type => 'object',
+ properties => {
+ device => {
+ description => "The path block device, or the NVMe"
+ . " controller device the path uses.",
+ type => 'string',
+ },
+ state => {
+ description => "The device mapper state of the path (for"
+ . " example active or failed) or the state of the NVMe"
+ . " controller (for example live or connecting).",
+ type => 'string',
+ },
+ 'checker-state' => {
+ description => "The state reported by the multipathd path"
+ . " checker, for example ready, ghost or faulty.",
+ type => 'string',
+ optional => 1,
+ },
+ 'ana-state' => {
+ description => "The Asymmetric Namespace Access state of"
+ . " the namespace on this path, for example optimized"
+ . " or inaccessible.",
+ type => 'string',
+ optional => 1,
+ },
+ 'host-wwpn' => {
+ description => "The WWPN of the host (initiator) port of"
+ . " Fibre Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ 'target-wwpn' => {
+ description => "The WWPN of the target port of Fibre"
+ . " Channel attached paths.",
+ type => 'string',
+ optional => 1,
+ },
+ address => {
+ description => "The address of the NVMe controller the"
+ . " path uses.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ usage => {
+ description => "The usage indicated by cached device metadata.",
+ type => 'string',
+ enum => ['unused', 'lvm', 'other'],
+ },
+ vgname => {
+ description => "The name of the LVM volume group the device belongs to.",
+ type => 'string',
+ optional => 1,
+ },
+ 'by-id' => {
+ description =>
+ "A path under /dev/disk/by-id that encodes the device's identity"
+ . " and has been verified to resolve to this device. Absent when no such"
+ . " link could be verified.",
+ type => 'string',
+ optional => 1,
+ },
+ 'used-by-storage' => {
+ description => "The storage that uses the LUN: through the volume group"
+ . " on it, or as an iSCSI storage that serves the LUNs of its target as"
+ . " images.",
+ type => 'string',
+ optional => 1,
+ },
+ wwid => {
+ description => "The LUN WWID.",
+ type => 'string',
+ },
+ name => {
+ description => 'The map alias, when different from its WWID.',
+ type => 'string',
+ optional => 1,
+ },
+ multipath => {
+ description => "How the node manages multipath for the LUN. NVMe namespaces"
+ . " use kernel-native multipath.",
+ type => 'string',
+ enum => ['none', 'pending', 'storage', 'manual', 'unmanaged', 'native'],
+ },
+ 'multipath-storage' => {
+ description =>
+ "The multipath-enabled storage the LUN belongs to, whether or"
+ . " not it also has an explicit multipath entry.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-target' => {
+ description => "The IQN of the iSCSI target the LUN is attached through.",
+ type => 'string',
+ optional => 1,
+ },
+ 'iscsi-lun' => {
+ description => "The number of the LUN on its iSCSI target.",
+ type => 'integer',
+ optional => 1,
+ },
+ detail => {
+ description => "The cached signature or usage when usage is 'other'.",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ },
+ code => sub {
+ return PVE::Storage::SAN::scan_luns(PVE::Storage::config());
+ },
+});
+
__PACKAGE__->register_method({
name => 'zfsscan',
path => 'zfs',
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 5c021d6d..bef401af 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -523,6 +523,13 @@ sub get_nvme_transport {
return $transport;
}
+# SAS does not distinguish local from remote attachments, so it is not classified as remote.
+sub is_remote_transport {
+ my ($transport) = @_;
+
+ return ($transport // '') =~ m/^(?:fc|fcoe|iscsi|nvme-(?:fc|tcp|rdma))$/;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
diff --git a/src/PVE/Multipath.pm b/src/PVE/Multipath.pm
index 6f61a3fe..0d41d963 100644
--- a/src/PVE/Multipath.pm
+++ b/src/PVE/Multipath.pm
@@ -2,6 +2,8 @@ package PVE::Multipath;
use v5.36;
+use Cwd qw(abs_path);
+use File::Basename qw(basename);
use Encode qw(decode encode);
use JSON qw(decode_json);
use PVE::Diskmanage;
@@ -17,6 +19,12 @@ sub parse_dm_uuid($uuid) {
return { wwid => $wwid, defined($part) ? (partition => int($part)) : () };
}
+sub device_map($device) {
+ my $name = basename(abs_path($device) // $device);
+ return undef if $name !~ /^dm-\d+$/;
+ return parse_dm_uuid(file_read_firstline("/sys/block/$name/dm/uuid"));
+}
+
sub map_info() {
my $maps = {};
dir_glob_foreach(
@@ -157,6 +165,22 @@ sub get_maps() {
return $maps;
}
+sub path_status_by_wwid() {
+ my $res = {};
+ for my $map (get_maps()->@*) {
+ my $wwid = $map->{wwid} // next;
+ my @paths;
+ for my $path ($map->{paths}->@*) {
+ my $row = { device => "/dev/$path->{dev}", state => $path->{'dm-state'} // 'undef' };
+ $row->{'checker-state'} = $path->{'check-state'} if defined($path->{'check-state'});
+ $row->{$_} = $path->{$_} for grep { defined($path->{$_}) } qw(host-wwpn target-wwpn);
+ push @paths, $row;
+ }
+ $res->{$wwid} = { active => $map->{'paths-active'}, paths => \@paths };
+ }
+ return $res;
+}
+
sub wait_for_map($wwid, $timeout = 10) {
my $link = "/dev/disk/by-id/dm-uuid-mpath-$wwid";
my $deadline = time() + ($timeout // 10);
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a67dc25f..a2df83c0 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -14,7 +14,8 @@ SOURCES= \
PBSPlugin.pm \
BTRFSPlugin.pm \
LvmThinPlugin.pm \
- ESXiPlugin.pm
+ ESXiPlugin.pm \
+ SAN.pm
.PHONY: install
install:
diff --git a/src/PVE/Storage/SAN.pm b/src/PVE/Storage/SAN.pm
new file mode 100644
index 00000000..f13d9633
--- /dev/null
+++ b/src/PVE/Storage/SAN.pm
@@ -0,0 +1,189 @@
+package PVE::Storage::SAN;
+
+use v5.36;
+
+use Cwd qw(abs_path);
+use File::Basename qw(basename);
+
+use PVE::INotify;
+
+use PVE::Diskmanage;
+use PVE::ISCSI::Topology;
+use PVE::Multipath;
+use PVE::Multipath::Generator;
+use PVE::Multipath::Config;
+use PVE::Multipath::Identity;
+use PVE::Storage;
+use PVE::Storage::LVMPlugin;
+use PVE::Tools qw(file_read_firstline);
+
+sub scan_luns($cfg) {
+ my $ids = PVE::Multipath::Identity::collect(all => 1);
+ my $disks = PVE::Diskmanage::get_disks(undef, 1, 0, 1);
+ my $map_info = PVE::Multipath::map_info();
+ my $members = PVE::Multipath::member_map($map_info);
+ my $maps = PVE::Diskmanage::get_multipath_disks($map_info);
+ my $sessions = PVE::ISCSI::Topology::device_map();
+ my $status = eval { PVE::Multipath::path_status_by_wwid() } // {};
+ my $nvme = PVE::Diskmanage::get_nvme_path_status();
+ my $pv_vgs = PVE::Storage::LVMPlugin::cached_pv_volume_groups();
+ my $mpcfg = PVE::Multipath::Config::read_config();
+ my %explicit = map { $_ => 1 }
+ PVE::Multipath::Config::wwids_for_node($mpcfg, PVE::INotify::nodename())->@*;
+ my %listed = map { $_ => 1 } PVE::Multipath::list_etc_multipath_wwids()->@*;
+ my $derived = PVE::Multipath::Generator::derived_wwids($cfg, $ids);
+ my (%storage, %expected, %vg_owner, %target_owner, %base_owner);
+
+ for my $sid (sort keys %$derived) {
+ for my $wwid (keys $derived->{$sid}->{wwids}->%*) {
+ $storage{$wwid} //= $sid;
+ my $count = $derived->{$sid}->{wwids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ }
+ for my $wwid (keys %explicit) {
+ my $count = $mpcfg->{ids}->{$wwid}->{'paths-expected'};
+ $expected{$wwid} = $count if defined($count) && $count > ($expected{$wwid} // 0);
+ }
+ for my $sid (sort keys $cfg->{ids}->%*) {
+ my $scfg = $cfg->{ids}->{$sid};
+ $vg_owner{ $scfg->{vgname} } //= $sid if defined($scfg->{vgname});
+ $target_owner{ $scfg->{target} } //= $sid
+ if defined($scfg->{target}) && PVE::Storage::san_storage_serves_images($scfg);
+ $base_owner{$1} //= $sid if ($scfg->{base} // '') =~ m/(?:^|\.)dm-uuid-mpath-(.+)$/;
+ }
+
+ my %rows;
+ my $add = sub($disk, $map = 0) {
+ my $name = basename(abs_path($disk->{devpath}) // $disk->{devpath});
+ return
+ if !is_san_device(
+ $disk->{devpath},
+ {
+ map => $map,
+ transport => $disk->{transport},
+ session => $sessions->{$name},
+ },
+ );
+ my $wwid = $map ? $disk->{wwn} : PVE::Multipath::Identity::path_wwid($ids, $name);
+ $wwid //= file_read_firstline("/sys/class/block/$name/wwid") if $name =~ /^nvme/;
+ return if !defined($wwid) || !length($wwid);
+
+ my $row = $rows{$wwid} //= {
+ wwid => $wwid,
+ devpath => $disk->{devpath},
+ size => $disk->{size},
+ usage => 'unused',
+ multipath => $listed{$wwid}
+ || $explicit{$wwid}
+ || $storage{$wwid} ? 'pending' : 'none',
+ };
+ my $link = stable_path($disk->{devpath}, $wwid, $map);
+ # The device and its by-id name come from one disk. A map replaces a single path.
+ if ($map || (defined($link) && !$row->{'by-id'})) {
+ delete $row->{'by-id'};
+ $row->{devpath} = $disk->{devpath};
+ $row->{size} = $disk->{size};
+ $row->{'by-id'} = $link if defined($link);
+ }
+ if ($map) {
+ my $alias = basename($disk->{devpath});
+ $row->{name} = $alias if $alias ne $wwid;
+ $row->{multipath} =
+ $explicit{$wwid} ? 'manual'
+ : $storage{$wwid} ? 'storage'
+ : 'unmanaged';
+ }
+ $row->{multipath} = 'native' if $name =~ /^nvme\d+n\d+$/;
+ for my $key (qw(transport vendor model serial)) {
+ my $value = $disk->{$key};
+ $row->{$key} //= $value if defined($value) && $value ne 'unknown';
+ }
+ for my $member (map { basename($_) } ($disk->{slaves} // [$disk->{devpath}])->@*) {
+ my $session = $sessions->{$member} // next;
+ $row->{'iscsi-target'} //= $session->{target};
+ $row->{'iscsi-lun'} //= $session->{lun};
+ $row->{transport} = 'iscsi';
+ }
+ my $used = $disk->{used};
+ if (defined($used)) {
+ if ($used eq 'LVM' || $used eq 'LVM2_member') {
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ } elsif ($row->{usage} ne 'lvm') {
+ $row->{usage} = 'other';
+ $row->{detail} = $used;
+ }
+ }
+ my $vg = $pv_vgs->{ abs_path($disk->{devpath}) // $disk->{devpath} };
+ if (defined($vg)) {
+ $row->{vgname} //= $vg;
+ $row->{usage} = 'lvm';
+ delete $row->{detail};
+ }
+ my $paths = $map ? $status->{$wwid} : $nvme->{$name};
+ if ($paths) {
+ $row->{'path-list'} = $paths->{paths};
+ $row->{'paths-total'} = scalar($paths->{paths}->@*);
+ $row->{'paths-active'} = $paths->{active};
+ } elsif ($map) {
+ $row->{'paths-total'} = $disk->{paths};
+ }
+ $row->{'multipath-storage'} = $storage{$wwid} if defined($storage{$wwid});
+ # multipath entries and iSCSI portals are for maps, not for native NVMe multipath
+ $row->{'paths-expected'} = $expected{$wwid}
+ if defined($expected{$wwid}) && $row->{multipath} ne 'native';
+ };
+ for my $name (sort keys %$disks) {
+ my $disk = $disks->{$name};
+ next if $members->{$name};
+ $add->($disk);
+ }
+ $add->($maps->{$_}, 1) for sort keys %$maps;
+ for my $row (values %rows) {
+ if (defined($row->{'paths-active'})) {
+ $row->{state} = PVE::Multipath::derive_health(
+ $row->{'paths-active'},
+ $row->{'paths-total'},
+ $row->{'paths-expected'},
+ );
+ }
+ my $owner = $base_owner{ $row->{wwid} } // $vg_owner{ $row->{vgname} // '' }
+ // $target_owner{ $row->{'iscsi-target'} // '' };
+ $row->{'used-by-storage'} = $owner if defined($owner);
+ }
+ return [map { $rows{$_} } sort keys %rows];
+}
+
+sub stable_path($device, $wwid, $map = 0) {
+ my $prefix = $map ? 'dm-uuid-mpath' : basename($device) =~ /^nvme/ ? 'nvme' : 'scsi';
+ my ($link) = "/dev/disk/by-id/$prefix-$wwid" =~ m{\A(/dev/disk/by-id/[A-Za-z0-9_.:+-]+)\z};
+ return undef if !defined($link);
+ return $link if (abs_path($link) // '') eq (abs_path($device) // $device);
+ return undef;
+}
+
+sub is_san_device($device, $info = undef) {
+ if (!$info) {
+ my $path = abs_path($device) // $device;
+ return 0 if PVE::Diskmanage::is_partition($path);
+ my $name = basename($path);
+ my $transport;
+ if ($name =~ /^nvme/) {
+ $transport = 'nvme-' . (PVE::Diskmanage::get_nvme_transport("/sys/block/$name") // '');
+ } elsif ((readlink("/sys/block/$name") // '') =~ m{/rport-\d+}) {
+ $transport = 'fc';
+ }
+ $info = {
+ map => PVE::Multipath::device_map($path),
+ transport => $transport,
+ session => PVE::Diskmanage::is_iscsi_device($name),
+ };
+ }
+ return
+ $info->{map}
+ || $info->{session}
+ || PVE::Diskmanage::is_remote_transport($info->{transport}) ? 1 : 0;
+}
+
+1;
diff --git a/src/test/Makefile b/src/test/Makefile
index a758e593..6348c61e 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_create test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access test_remote_command test_multipath test_san_libraries test_lun_identity test_lvm_base_activation test_multipath_api test_san_taint test_san_lun_scan test_san_api
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -65,3 +65,9 @@ test_multipath_api: run_multipath_api_tests.pl
test_san_taint: run_san_taint_tests.pl
perl -T ./run_san_taint_tests.pl
+
+test_san_lun_scan: run_san_lun_scan_tests.pl
+ ./run_san_lun_scan_tests.pl
+
+test_san_api: run_san_api_tests.pl
+ ./run_san_api_tests.pl
diff --git a/src/test/disk_tests/multipath/multipathd b/src/test/disk_tests/multipath/multipathd
new file mode 100644
index 00000000..40243f91
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd
@@ -0,0 +1,124 @@
+{
+ "major_version": 0,
+ "minor_version": 1,
+ "maps": [{
+ "name" : "mpatha",
+ "uuid" : "3600140500000000000000000000000001",
+ "sysfs" : "dm-0",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 0,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sda",
+ "dev_t" : "8:0",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdb",
+ "dev_t" : "8:16",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0001000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ },
+ {
+ "name" : "mpathb",
+ "uuid" : "3600140500000000000000000000000002",
+ "sysfs" : "dm-1",
+ "failback" : "immediate",
+ "queueing" : "5 chk",
+ "paths" : 2,
+ "write_prot" : "rw",
+ "dm_st" : "active",
+ "features" : "1 queue_if_no_path",
+ "hwhandler" : "1 alua",
+ "action" : "",
+ "path_faults" : 3,
+ "vend" : "SANVEND ",
+ "prod" : "SANMODEL",
+ "rev" : "4.1",
+ "switch_grp" : 0,
+ "map_loads" : 1,
+ "total_q_time" : 0,
+ "q_timeouts" : 0,
+ "path_groups": [{
+ "selector" : "service-time 0",
+ "pri" : 50,
+ "dm_st" : "active",
+ "marginal_st" : "normal",
+ "group" : 1,
+ "paths": [{
+ "dev" : "sdc",
+ "dev_t" : "8:32",
+ "dm_st" : "active",
+ "dev_st" : "running",
+ "chk_st" : "ready",
+ "checker" : "tur",
+ "pri" : 50,
+ "host_wwnn" : "0x20000024ff7d6a1c",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1c",
+ "target_wwpn" : "0x2100d039ea28bf00",
+ "host_adapter" : "0000:41:00.0",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ },
+ {
+ "dev" : "sdd",
+ "dev_t" : "8:48",
+ "dm_st" : "failed",
+ "dev_st" : "running",
+ "chk_st" : "faulty",
+ "checker" : "tur",
+ "pri" : 0,
+ "host_wwnn" : "0x20000024ff7d6a1d",
+ "target_wwnn" : "0x2000d039ea28bf00",
+ "host_wwpn" : "0x21000024ff7d6a1d",
+ "target_wwpn" : "0x2200d039ea28bf00",
+ "host_adapter" : "0000:41:00.1",
+ "lun_hex" : "0x0002000000000000",
+ "marginal_st" : "normal"
+ }]
+ }]
+ }]
+}
diff --git a/src/test/disk_tests/multipath/multipathd_status_expected.json b/src/test/disk_tests/multipath/multipathd_status_expected.json
new file mode 100644
index 00000000..df5a24da
--- /dev/null
+++ b/src/test/disk_tests/multipath/multipathd_status_expected.json
@@ -0,0 +1,40 @@
+{
+ "3600140500000000000000000000000001": {
+ "active": 2,
+ "paths": [
+ {
+ "device": "/dev/sda",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdb",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ },
+ "3600140500000000000000000000000002": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/sdc",
+ "state": "active",
+ "checker-state": "ready",
+ "host-wwpn": "0x21000024ff7d6a1c",
+ "target-wwpn": "0x2100d039ea28bf00"
+ },
+ {
+ "device": "/dev/sdd",
+ "state": "failed",
+ "checker-state": "faulty",
+ "host-wwpn": "0x21000024ff7d6a1d",
+ "target-wwpn": "0x2200d039ea28bf00"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index caa60e79..2f22fae8 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -70,6 +70,8 @@ sub mocked_run_command {
$content = '{}';
}
@$outputlines = split(/\n/, $content);
+ } elsif ($cmd->[0] =~ m/multipathd/i) {
+ @$outputlines = split(/\n/, read_test_file('multipathd'));
} else {
die "unexpected run_command call: '@$cmd', aborting\n";
}
@@ -264,6 +266,16 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/multipathd_status_expected.json") {
+ my $status = PVE::Multipath::path_status_by_wwid();
+ my $expected_status =
+ decode_json(read_test_file('multipathd_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'multipath status should be the same');
+ }
+
if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
my $status = PVE::Diskmanage::get_nvme_path_status();
my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
@@ -296,8 +308,11 @@ print("\tMocked get_sysdir_size\n");
$diskmanage_module->mock('assert_blockdev' => sub { return 1; });
print("\tMocked assert_blockdev\n");
$multipath_module = Test::MockModule->new('PVE::Multipath', no_auto => 1);
+$multipath_module->mock('run_command' => \&mocked_run_command);
+$multipath_module->mock('is_supported' => sub { return 1; });
$multipath_module->mock('dir_glob_foreach' => \&mocked_dir_glob_foreach);
$multipath_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked PVE::Multipath run_command and is_supported\n");
$diskmanage_module->mock(
'dir_is_empty' => sub {
my $val = shift;
diff --git a/src/test/run_san_api_tests.pl b/src/test/run_san_api_tests.pl
new file mode 100755
index 00000000..4bd7d2d7
--- /dev/null
+++ b/src/test/run_san_api_tests.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw(. ..);
+use PVE::API2::Storage::Scan;
+
+for my $case (['PVE::API2::Storage::Scan', 'sanlunscan']) {
+ my ($class, @names) = @$case;
+ for my $name (@names) {
+ is_deeply(
+ $class->map_method_by_name($name)->{permissions}->{check},
+ [
+ 'or',
+ ['perm', '/nodes/{node}', ['Sys.Audit']],
+ ['perm', '/storage', ['Datastore.Allocate']],
+ ],
+ "$class $name read permission",
+ );
+ }
+}
+
+done_testing();
diff --git a/src/test/run_san_lun_scan_tests.pl b/src/test/run_san_lun_scan_tests.pl
new file mode 100755
index 00000000..94df0d5c
--- /dev/null
+++ b/src/test/run_san_lun_scan_tests.pl
@@ -0,0 +1,180 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(..);
+use Test::More;
+use Test::MockModule;
+
+use PVE::Storage::SAN;
+use PVE::API2::Storage::Scan;
+
+my $disk = Test::MockModule->new('PVE::Diskmanage');
+my $mp = Test::MockModule->new('PVE::Multipath');
+my $id = Test::MockModule->new('PVE::Multipath::Identity');
+my $config = Test::MockModule->new('PVE::Multipath::Config');
+my $storage = Test::MockModule->new('PVE::Storage');
+my $iscsi = Test::MockModule->new('PVE::ISCSI::Topology');
+my $scan = Test::MockModule->new('PVE::Storage::SAN');
+my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+my $hints;
+$lvm->mock(file_get_contents => sub { $hints // die "No such file\n" });
+$lvm->mock(abs_path => sub { $_[0] });
+$lvm->mock(run_command => sub { die "unexpected LVM device probe\n" });
+
+my $disks = {
+ sda => { devpath => '/dev/sda', size => 100, transport => 'sata' },
+ sdb => { devpath => '/dev/sdb', size => 200, transport => 'iscsi' },
+ sdc => { devpath => '/dev/sdc', size => 200, transport => 'iscsi', used => 'LVM2_member' },
+ sdd =>
+ { devpath => '/dev/sdd', size => 300, transport => 'fc', multipath => '/dev/mapper/lun' },
+ sde => { devpath => '/dev/sde', size => 400, transport => 'fc' },
+};
+my $maps = {
+ 'dm-0' => {
+ devpath => '/dev/mapper/lun',
+ size => 300,
+ wwn => '3600map',
+ paths => 2,
+ slaves => ['/dev/sdd', '/dev/sdf'],
+ transport => 'fc',
+ },
+};
+$id->mock(collect => sub { {} });
+$id->mock(path_wwid => sub { $_[1] =~ /^(sdb|sdc)$/ ? '3600plain' : undef });
+$config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+my $generator = Test::MockModule->new('PVE::Multipath::Generator');
+$generator->mock(derived_wwids => sub { {} });
+$iscsi->mock(
+ device_map => sub {
+ return { map { $_ => { target => 'iqn.test', lun => 1 } } qw(sdb sdc) };
+ },
+);
+$disk->mock(
+ get_disks => sub { ok($_[3], 'SAN inventory opts into iSCSI'); $disks },
+ get_multipath_disks => sub { $maps },
+ get_nvme_path_status => sub { {} },
+ run_command => sub { die 'unexpected device probe' },
+);
+$mp->mock(list_etc_multipath_wwids => sub { [] });
+$mp->mock(
+ map_info => sub {
+ return {
+ map {
+ $_ => {
+ wwid => $maps->{$_}->{wwn},
+ slaves => [map { s{^/dev/}{}r } $maps->{$_}->{slaves}->@*],
+ }
+ } keys %$maps
+ };
+ },
+);
+$mp->mock(
+ path_status_by_wwid => sub {
+ return {
+ '3600map' => {
+ active => 1,
+ paths => [
+ { device => '/dev/sdd', state => 'active', 'checker-state' => 'ghost' },
+ { device => '/dev/sdf', state => 'failed', 'checker-state' => 'faulty' },
+ ],
+ },
+ };
+ },
+);
+$scan->mock(abs_path => sub { $_[0] });
+$scan->mock(stable_path => sub { '/dev/disk/by-id/scsi-' . $_[1] });
+my $cfg =
+ { ids => { direct => { type => 'iscsi', target => 'iqn.test', content => { images => 1 } } } };
+my $rows = PVE::Storage::SAN::scan_luns($cfg);
+is(scalar(@$rows), 2, 'only identified SAN LUNs, one row per identity');
+my %row = map { $_->{wwid} => $_ } @$rows;
+is($row{'3600plain'}->{usage}, 'lvm', 'positive usage from any path survives folding');
+is($row{'3600plain'}->{'used-by-storage'}, 'direct', 'a storage serving the LUNs uses them');
+{
+ local $cfg->{ids}->{direct}->{content} = { none => 1 };
+ my %plain = map { $_->{wwid} => $_ } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($plain{'3600plain'}->{'used-by-storage'}, undef, 'a connection storage does not');
+}
+ok(!exists($row{'3600plain'}->{state}), 'single path devices have no multipath health');
+is($row{'3600map'}->{state}, 'degraded', 'final state counts usable paths');
+is($row{'3600map'}->{multipath}, 'manual', 'explicit map');
+is($row{'3600map'}->{devpath}, '/dev/mapper/lun', 'map is the selected device');
+my $schema = PVE::API2::Storage::Scan->map_method_by_name('sanlunscan')->{returns};
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'rows match the public schema');
+is($row{'3600map'}->{name}, 'lun', 'map alias is exposed');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/3600map';
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unnamed) = grep { $_->{wwid} eq '3600map' } @$rows;
+ok(!exists($unnamed->{name}), 'WWID is not repeated as an alias');
+$maps->{'dm-0'}->{devpath} = '/dev/mapper/lun';
+
+{
+ my $healthy = {
+ '3600map' => {
+ active => 2,
+ paths => [map { { device => $_, state => 'active' } } qw(/dev/sdd /dev/sdf)],
+ },
+ };
+ $mp->mock(path_status_by_wwid => sub { $healthy });
+ my ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{state}, 'optimal', 'all paths usable without an expected count');
+ $config->mock(
+ read_config =>
+ sub { { ids => { '3600map' => { type => 'wwid', 'paths-expected' => 3 } } } },
+ );
+ ($map) = grep { $_->{wwid} eq '3600map' } PVE::Storage::SAN::scan_luns($cfg)->@*;
+ is($map->{'paths-expected'}, 3, 'expected count of the entry');
+ is($map->{state}, 'degraded', 'fewer paths than the entry expects');
+ $config->mock(read_config => sub { { ids => { '3600map' => { type => 'wwid' } } } });
+}
+
+$mp->mock(path_status_by_wwid => sub { {} });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($unobserved) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($unobserved->{'paths-total'}, 2, 'map membership supplies total without daemon status');
+ok(!exists($unobserved->{'paths-active'}), 'no invented active count');
+ok(!exists($unobserved->{state}), 'no false failed state');
+
+$cfg->{ids}->{data} = { type => 'lvm', vgname => 'data' };
+$hints = "scan:/dev/mapper/lun pvid:abc devn:253:0 vg:data\n";
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+my ($cached) = grep { $_->{wwid} eq '3600map' } @$rows;
+is($cached->{vgname}, 'data', 'hints supply the display VG');
+is($cached->{usage}, 'lvm', 'hints also supply cached usage evidence');
+is($cached->{'used-by-storage'}, 'data', 'VG allows storage attribution');
+for my $contents (undef, '', "scan=/dev/mapper/lun vg=data\n") {
+ $hints = $contents;
+ $rows = PVE::Storage::SAN::scan_luns($cfg);
+ is(scalar(@$rows), 2, 'missing or unrecognized hints do not lose LUNs');
+ my ($uncached) = grep { $_->{wwid} eq '3600map' } @$rows;
+ ok(!exists($uncached->{vgname}), 'VG name is absent without a hint');
+ ok(!exists($uncached->{'used-by-storage'}), 'VG-derived attribution is also absent');
+ is($uncached->{usage}, 'unused', 'usage falls back to other cached evidence');
+}
+
+$disks->{sdc}->{used} = 'ext4';
+$maps = {};
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{usage}, 'other', 'foreign data from a sibling path is retained');
+is($rows->[0]->{detail}, 'ext4', 'signature detail');
+$scan->mock(stable_path => sub { $_[0] eq '/dev/sdc' ? '/dev/disk/by-id/scsi-3600plain' : undef });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/scsi-3600plain', 'by-id link of the second path');
+is($rows->[0]->{devpath}, '/dev/sdc', 'the row names the path that its by-id link resolves to');
+
+$disks = { nvme0n1 => { devpath => '/dev/nvme0n1', size => 100, transport => 'nvme-fc' } };
+$scan->mock(file_read_firstline => sub { 'eui.0123456789abcdef' });
+$scan->unmock('stable_path');
+$scan->mock(abs_path => sub { '/dev/nvme0n1' });
+$rows = PVE::Storage::SAN::scan_luns($cfg);
+is($rows->[0]->{multipath}, 'native', 'NVMe uses kernel-native multipath');
+is($rows->[0]->{'by-id'}, '/dev/disk/by-id/nvme-eui.0123456789abcdef', 'NVMe stable name');
+eval { PVE::JSONSchema::validate($rows, $schema) };
+is($@, '', 'native row matches the API schema');
+
+$disk->mock(is_partition => sub { 1 });
+ok(!PVE::Storage::SAN::is_san_device('/dev/sdb1'), 'a partition is never a LUN');
+
+done_testing();
^ permalink raw reply related [relevance 9%]
* [PATCH v4 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view
2026-11-13 3:00 5% [PATCH v4 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-13 3:00 9% ` [PATCH v4 storage 16/36] api: scan: add a SAN LUN inventory Thomas Lamprecht
@ 2026-11-13 3:00 9% ` Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:00 UTC (permalink / raw)
To: pve-devel
Admins new to Proxmox VE look for adding their SAN under Datacenter >
Storage > Add. There, the iSCSI dialog connects a target without a
volume group on top and, by default, without multipath, so they end up
with neither a storage that can allocate guest disks nor path
redundancy. The guided setups that do both are in the SAN view, which
nothing in these dialogs mentions.
Add a note to the add dialogs of iSCSI and LVM that names the SAN view.
Its link closes the dialog and opens the view. The dialogs stay as they
are for attaching existing targets and volume groups. The storage panel
base shows the note for panels that set one, so the NVMe over Fabrics
dialog can use it as well.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/SANUtils.js | 38 +++++++++++++++++++++++++++++++
www/manager6/storage/Base.js | 5 ++++
www/manager6/storage/IScsiEdit.js | 3 +++
www/manager6/storage/LVMEdit.js | 3 +++
4 files changed, 49 insertions(+)
diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js
index 8947d83e5..c08ac2a1a 100644
--- a/www/manager6/SANUtils.js
+++ b/www/manager6/SANUtils.js
@@ -103,6 +103,44 @@ Ext.define('PVE.SANUtils', {
return Ext.htmlEncode(PVE.SANUtils.usageText(rec.data));
},
+ // Selects Datacenter > Storage > SAN, as the TFA entry of the user menu does for its panel.
+ showSANView: function () {
+ Ext.state.Manager.getProvider().set('dctab', { value: 'san' }, true);
+ Ext.ComponentQuery.query('pveStdWorkspace')[0]?.selectById('root');
+ },
+
+ // A note for the add dialogs of storages on a SAN, which points to the guided setups of the
+ // SAN view. Its link closes the dialog and opens the view.
+ sanViewNote: function (text) {
+ let path = `${gettext('Datacenter')} > ${gettext('Storage')} > SAN`;
+ let link = `<a href="#" style="white-space: nowrap;">${Ext.htmlEncode(path)}</a>`;
+ return {
+ xtype: 'component',
+ margin: '5 0 0 0',
+ html:
+ `<span class="pmx-hint">${Ext.htmlEncode(gettext('Note:'))}</span> ` +
+ Ext.String.format(Ext.htmlEncode(text), link),
+ listeners: {
+ afterrender: function (cmp) {
+ let follow = function (event) {
+ event.stopEvent();
+ cmp.up('window')?.close();
+ PVE.SANUtils.showSANView();
+ };
+ cmp.mon(cmp.getEl(), 'click', follow, null, { delegate: 'a' });
+ // an edit window handles Enter for its default button, so no click follows it
+ cmp.mon(
+ cmp.getEl(),
+ 'keydown',
+ (event) => event.getKey() === event.ENTER && follow(event),
+ null,
+ { delegate: 'a' },
+ );
+ },
+ },
+ };
+ },
+
renderSanTransport: function (value) {
return Ext.htmlEncode(
{
diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index 04f5f706f..58e77c05c 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -131,6 +131,11 @@ Ext.define('PVE.panel.StorageBase', {
me.advancedColumnB.unshift(volumeChain.hint);
}
+ // the add dialog of a SAN storage points to the guided setups of the SAN view
+ if (me.isCreate && me.sanNote) {
+ me.columnB = [...(me.columnB ?? []), PVE.SANUtils.sanViewNote(me.sanNote)];
+ }
+
me.callParent();
},
});
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index 0725edad0..f11995585 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -75,6 +75,9 @@ Ext.define('PVE.storage.IScsiInputPanel', {
onlineHelp: 'storage_open_iscsi',
+ // TRANSLATORS: "Add Storage" is a button of the SAN view, {0} the menu path of that view.
+ sanNote: gettext('To set up shared LVM with multipath on a LUN, use Add Storage in {0}.'),
+
// Loading sets the value before its original value, so use the dirty state.
updateMultipathActivation: function () {
let me = this;
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 0c56455df..9c4df2609 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -148,6 +148,9 @@ Ext.define('PVE.storage.LVMInputPanel', {
onlineHelp: 'storage_lvm',
+ // TRANSLATORS: "Add Storage" is a button of the SAN view, {0} the menu path of that view.
+ sanNote: gettext('To set up shared LVM on a SAN LUN, use Add Storage in {0}.'),
+
column1: [
{
xtype: 'pveBaseStorageSelector',
^ permalink raw reply related [relevance 9%]
* [PATCH v4 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM
@ 2026-11-13 3:00 5% Thomas Lamprecht
2026-11-13 3:00 13% ` [PATCH v4 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
` (3 more replies)
0 siblings, 4 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:00 UTC (permalink / raw)
To: pve-devel
This is v4 of the combined and reduced series of the cluster-wide
multipath work [0][1] and Dietmar's RFC for guided remote storage setup
and SAN visibility [2].
v3 [3] had 76 patches in six repositories. I tried to trim v4 down by
reducing both the scope, minimally, and the implementation. This narrows
the series to shared LVM on iSCSI and Fibre Channel LUNs: 36 patches in
four repositories, about 7700 added lines instead of 26300. It basically
trades automatic cleanup and broad usage checks for a smaller
implementation and documented procedures for the admin. "The rework"
below gives some reasoning, "Changes since v3" the details.
Overview of what an admin gets with this:
- Datacenter > Storage > SAN, a new entry below Storage, shows the
multipath state of every node and of the LUNs that multipath
handles, and edits the multipath entries and array-specific
overrides. I explicitly chose this over the client/plugin side of
Storage, as we do not have e.g. Ceph or ZFS/LVM/... creation in
there either. We might want to rethink and consolidate our storage
interface vs. management story in the future, but IMO a partial
switch now is not worth it, that would add even more potential for
confusion than the new SAN view.
- Its Add Storage menu guides through shared LVM on a LUN: for iSCSI
it connects or reuses a target, with the initiator names of all
nodes at hand, for Fibre Channel it takes a LUN the nodes already
see. Both set up multipath for the LUN and end with its state on
every node of the new storage.
- Datacenter > Storage > Add keeps its dialogs. The iSCSI one gets a
Multipath option and the LVM one enables Shared for a base storage,
so the same works there in two steps. Both name the SAN view in a
note whose link opens it, as admins coming from other platforms look
for their SAN there first.
- Node > SAN lists the LUNs of a node with their paths and usage, can
wipe a LUN that no storage uses, and shows the iSCSI sessions.
The rework:
The series is for a cluster that reaches the LUNs of an array over
iSCSI or Fibre Channel on two or more paths and puts shared LVM on
them. v3 went further: it cleaned up after the admin, tried to find
every user of a LUN before a write, and added iSCSI operations of its
own. Each of these brought a ton of state and failure handling that has
to be maintained and tested. v4 drops them for the time being to get
this into a shippable state, and tries to follow a few rules instead:
- Add, never remove. A node adds the WWIDs it needs to the multipath
allow-list, but never removes one and never flushes a map. v3 did,
which took a record of who added what and probes for maps still in
use. Removing a LUN is rare and hurts when it goes wrong, so I made
it a documented procedure.
- Check a write where it happens. Creating a volume group or wiping a
LUN checks that no storage references it and looks at the device on
that node for mounts, holders and, for a volume group, existing
data. v3 also scanned for other local users, let the web UI ask the
other nodes and verified the device again between the writes of a
wipe. Stopping the users on other nodes and hosts before a wipe is
up to the admin now.
- Lists do not probe. The LUN inventory uses what udev, multipathd and
LVM's hint file already know, it no longer reads signatures or runs
LVM commands. The price is that usage can lag behind, for example on
the other nodes after a wipe, and that LVM keeps no hints while it
sees duplicate PVs, for example a LUN with an old PV that has two
paths and no map yet. Until that is resolved, the node shows no
volume group names and no storage for a Fibre Channel LUN, which has
no base volume to go by. A write asks LVM itself and is not
affected.
- Use what is there. The output of multipathd is parsed in Perl. v3
had a new crate in proxmox and its binding in proxmox-perl-rs for
that (patches 01 and 02), both repositories are out of the series.
Bounding the LVM status commands got reworked on top of the existing
run_fork_with_timeout() and sent separately [4].
- No new iSCSI operations. Session logout, record removal, rescan and
session parameters are gone from the API and from pvenode. The iSCSI
view is read-only and iscsiadm remains for the rest, so removing an
iSCSI storage leaves its sessions and node records behind, as on
master.
- The guided setup makes the API calls an admin would make by hand,
for iSCSI and Fibre Channel only. It no longer tracks and resumes
partial setups, always enables multipath, and no storage plugin gets
a setup method for it. It looks at the LUN on the node serving the
web UI only and does not ask the other nodes before it writes.
Instead it ends with the state of the LUN on each node of the
storage, from the cluster-wide status, so that a node without access
shows up right there.
- Multipath management is turned on by the admin. The API no longer
checks that every node supports it before the option is set, or
that nothing needs the option or an entry before it is removed. The
docs say to upgrade all nodes first and how to remove a LUN.
Again, we might reintroduce _some_ of this in a fitting form later, but
scope creep weighed v3 (and the revisions before it) down way too much
for it to ever get into a sane, shippable state where we do not get a
ton of maintenance issues. This here is certainly not perfect, but it
is at least still manageable and should get us the most relevant
convenience features.
Two things an admin will likely miss: there is no notification when a
LUN loses path redundancy, the state only shows on the SAN pages and in
the API. A node with fewer paths than its iSCSI portals or the expected
paths of the LUN's entry at least shows as degraded there, and a LUN
that only has one path reads "OK (1 path)" instead of optimal. And Fibre
Channel starts at a LUN the nodes already see, the web UI neither lists
the WWPNs of the nodes nor rescans their HBAs; the chapter gives the
commands for both, and the setup points to the rescan.
How it works:
- /etc/pve/multipath.cfg holds explicit entries per WWID (nodes, alias,
no-path-retry, expected paths), /etc/pve/multipath-overrides.conf
array settings in multipath.conf syntax; patch 01 registers
both. An iSCSI storage with the new 'multipath' option supplies its
LUNs without entries, Fibre Channel LUNs get an explicit entry.
- pvestatd calls one function of pve-storage per pass. It adds the
WWIDs the node needs to /etc/multipath/wwids, writes the drop-ins
/etc/multipath/conf.d/pve-*.conf (entries, overrides and one
generated default, auto_resize grow_only) and reloads multipathd
when something changed. The same call publishes the node's maps and
their state through the node key-value store (key 'multipath').
- /cluster/multipath/status aggregates these reports, derives
'missing' from the configuration and names the storage that requests
each map; /cluster/multipath/{wwid,overrides} edit the two files.
- The volumes of an iSCSI storage with the option end in
dm-uuid-mpath-<wwid> instead of the name of one path, so an LVM
storage uses them through the existing 'base' mechanism.
- /nodes/{node}/scan/san-luns and 'pvesm scan san-luns' return one row
per LUN with a WWID, /nodes/{node}/iscsi/{status,target} the
read-only session view.
- Volume group creation and wipe run under a cluster lock per LUN
(cfs_lock_domain) and do not hold the storage configuration lock
while they write. Adding an LVM storage with a new base volume still
does, as before.
- multipath-tools becomes a Recommends of libpve-storage-perl. Nodes
without it report that; plain iSCSI and LVM are unaffected.
Patches:
- cluster 01: register the two configuration files
- storage 02-22: helpers for the disk and iSCSI session inventory
(mostly Dietmar's), the multipath library and configuration, the
iSCSI option, the per-node apply and status with their API, the LUN
inventory, the read-only iSCSI status, volume groups on LUNs and the
wipe, in that order
- docs 23: the multipath chapter, rewritten around tasks
- manager 24-36: the pvestatd call, report and API mounts, then
the views, the two dialog changes, the two guided setups and the
note in the add dialogs
Changes since v3 [3] (numbers are v3 patches):
- applied meanwhile: the independent fixes 05 and 07 to 11, the
documentation note 43 and the scan picker fixes 47 and 48
- sent separately [4]: the bound for LVM status commands (04, 06, 46),
now one pve-storage patch without a pvestatd part or plugin API
change. Unlike v3 it leaves thin pool activation unbounded.
Whichever of the two is applied second has to pass the status cache
to the two lvm_vgs() calls of the base volume activation
- removed: everything "The rework" names, and with it the NFS,
SMB/CIFS and ZFS over iSCSI types, the wipe step, the node selector
and the multipath checkbox of the guided setup; the structured
'defaults' section of multipath.cfg and the per-LUN path settings
except no-path-retry (the generated defaults no longer set
find_multipaths, user_friendly_names and polling_interval); the
duplicate PV flag, the rows for devices without a WWID and the
'incomplete' marking in the LUN lists; the include-remote option of
the disk list; identity-based names for plain iSCSI volumes (40);
the JavaScript unit tests
- changed:
- get_disks() lists iSCSI devices only on request, so Ceph OSD
creation needs no change (45) and no Breaks
- one SAN panel below Datacenter > Storage instead of a SAN and a
Multipath view, with one state per node and per LUN. The state
of a LUN names the nodes it applies to, a single path is shown
as such instead of optimal, and the LUN list says how the
multipath of each LUN is managed instead of a yes or no for an
entry
- the guided setup starts from the Add Storage menu of that panel
instead of Datacenter > Storage > Add, offers snapshots as volume
chain, the Fibre Channel one adds its storage itself, and both
show the state of the LUN on each node at the end instead of
asking the other nodes before
- the node disk API adds the storage of a volume group on a LUN as
shared and for all nodes, and only under a new storage ID
- the chapter went from 527 to 260 lines
- new: destroying the volume group of a shared storage through the node
disk API is refused, and the LVM dialog enables Shared when a base
storage is selected; explicit multipath entries can set the expected
number of paths, which the Fibre Channel setup fills in
When applying, versioned dependencies have to be set: pve-manager on
libpve-storage-perl, and libpve-storage-perl (also as build dependency)
on the libpve-cluster-perl with patch 01, as PVE::Storage
registers the two files when it is loaded.
The per-node target and portal series [5][6] are independent of this
one. It takes the LUNs of an iSCSI storage from the sessions of its one
target, so if a storage can have several targets per node, whichever is
applied second has to cover that.
I tested this on a six-node nested cluster attached to a NetApp AFF A20
with three iSCSI portals and to Linux LIO targets with two: the guided
iSCSI setup with a new and with a reused connection storage, the same
through the plain dialogs and from the CLI as documented, a LUN that one
node is not allowed to see and gets access later, the Fibre Channel flow
through the web UI, also as an administrator other than root@pam, a
guest on the resulting storages (snapshot, rollback, online resize, live
migration, one path cut under I/O), growing a LUN, wipe and its
refusals, one path and all paths down with queued I/O, a stopped
multipathd, a node reboot and the documented LUN removal. The lab has no
FC hardware, so I emulated it with software FCoE in VN2VN mode and an
LIO tcm_fc target on two fabrics: the nodes get real FC host and remote
port objects, and the documented WWPN listing, rescan and LUN growth
work there as written. The guided Fibre Channel setup ran on such a LUN,
with one node on one fabric only and one node that saw the LUN only
after the rescan. The setup records the paths it sees in the LUN's
entry, so the node on one fabric shows as degraded, and a fabric cut
stays degraded also after the kernel removed the lost paths (66 seconds
dev_loss_tmo of the LIO profile). Real HBA drivers were not tested. Most
of that ran with the NVMe over Fabrics series on top and with the LVM
status patch [4] applied, the series alone ran on one node of that
cluster for the guided setups, the CLI procedure and the views. Without
[4] a stuck LVM command blocks pvestatd as on master.
[0]: https://lore.proxmox.com/pve-devel/20260626121000.2095591-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20260703124707.1172980-2-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20260731102156.3947857-1-dietmar@proxmox.com/
[3]: https://lore.proxmox.com/pve-devel/20261105233336.2178064-1-t.lamprecht@proxmox.com/
[4]: https://lore.proxmox.com/pve-devel/20261111015217.941220-1-t.lamprecht@proxmox.com/
[5]: https://lore.proxmox.com/pve-devel/20260430173220.441001-1-m.limbeck@proxmox.com/
[6]: https://lore.proxmox.com/pve-devel/20260804090819.2136483-1-dietmar@proxmox.com/
pve-cluster:
Thomas Lamprecht (1):
cfs: observe the multipath configuration files
src/PVE/Cluster.pm | 2 ++
src/pmxcfs/status.c | 2 ++
2 files changed, 4 insertions(+)
pve-storage:
Dietmar Maurer (8):
diskmanage: collect disk transport type from lsblk
diskmanage: qualify NVMe over fabrics transport
diskmanage: optionally include iSCSI session devices in disk enumeration
diskmanage: collect native NVMe multipath path state
iscsi: factor out session device map from device list
diskmanage: add helper to list multipath devices
pvesm: expose the SAN LUN inventory
api: add node-level iSCSI status
Thomas Lamprecht (13):
multipath: add a library around multipathd
multipath: add a cluster-wide configuration
iscsi: add an option to manage storage LUNs with multipath
lvm: activate a missing base volume before using the volume group
multipath: apply the configuration on every node
multipath: publish per-node status
api: add endpoints for the cluster-wide multipath configuration
api: multipath: add the cluster-wide health status
api: scan: add a SAN LUN inventory
disks: lvm: drop unused imports
disks: lvm: allow volume groups on SAN LUNs and multipath maps
disks: lvm: refuse to destroy the volume group of a shared storage
disks: allow wiping a SAN LUN that no storage uses
debian/control | 3 +-
src/PVE/API2/Disks.pm | 36 +-
src/PVE/API2/Disks/LVM.pm | 64 ++-
src/PVE/API2/ISCSI.pm | 165 +++++++
src/PVE/API2/Makefile | 2 +
src/PVE/API2/Multipath.pm | 446 ++++++++++++++++++
src/PVE/API2/Storage/Scan.pm | 197 ++++++++
src/PVE/CLI/pvesm.pm | 14 +
src/PVE/Diskmanage.pm | 212 ++++++++-
src/PVE/ISCSI/Topology.pm | 95 ++++
src/PVE/Makefile | 6 +
src/PVE/Multipath.pm | 211 +++++++++
src/PVE/Multipath/Config.pm | 204 ++++++++
src/PVE/Multipath/Generator.pm | 112 +++++
src/PVE/Multipath/Identity.pm | 43 ++
src/PVE/Multipath/Status.pm | 184 ++++++++
src/PVE/Storage/ISCSIPlugin.pm | 211 +++++----
src/PVE/Storage/LVMPlugin.pm | 128 ++++-
src/PVE/Storage/Makefile | 3 +-
src/PVE/Storage/SAN.pm | 328 +++++++++++++
src/test/Makefile | 34 +-
src/test/disk_api_test.pm | 256 ++++++++++
src/test/disk_tests/iscsi/disklist | 1 +
.../disk_tests/iscsi/disklist_expected.json | 19 +
src/test/disk_tests/iscsi/lsblk | 5 +
src/test/disk_tests/iscsi/sda/device/model | 1 +
src/test/disk_tests/iscsi/sda/device/vendor | 1 +
.../disk_tests/iscsi/sda/queue/rotational | 1 +
src/test/disk_tests/iscsi/sda/size | 1 +
src/test/disk_tests/iscsi/sda_udevadm | 21 +
src/test/disk_tests/multipath/disklist | 11 +
.../multipath/disklist_expected.json | 107 +++++
src/test/disk_tests/multipath/dm-0/dm/name | 1 +
src/test/disk_tests/multipath/dm-0/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-0/size | 1 +
src/test/disk_tests/multipath/dm-0_slaves | 4 +
src/test/disk_tests/multipath/dm-1/dm/name | 1 +
src/test/disk_tests/multipath/dm-1/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-1/size | 1 +
src/test/disk_tests/multipath/dm-1_slaves | 4 +
src/test/disk_tests/multipath/dm-2/dm/name | 1 +
src/test/disk_tests/multipath/dm-2/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-2/size | 1 +
src/test/disk_tests/multipath/dm-2_slaves | 0
src/test/disk_tests/multipath/dm-3/dm/name | 1 +
src/test/disk_tests/multipath/dm-3/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-3/size | 1 +
src/test/disk_tests/multipath/dm-3_slaves | 0
src/test/disk_tests/multipath/dm-4/dm/name | 1 +
src/test/disk_tests/multipath/dm-4/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-4/size | 1 +
src/test/disk_tests/multipath/dm-4_slaves | 0
src/test/disk_tests/multipath/lsblk | 77 +++
src/test/disk_tests/multipath/lvs | 0
src/test/disk_tests/multipath/mounts | 1 +
.../multipath/multipath_expected.json | 59 +++
src/test/disk_tests/multipath/multipathd | 124 +++++
.../multipath/multipathd_status_expected.json | 40 ++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 +
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +
.../multipath/nvme_path_status_expected.json | 19 +
src/test/disk_tests/multipath/partlist | 0
src/test/disk_tests/multipath/pvs | 1 +
.../disk_tests/multipath/sda/device/model | 1 +
.../disk_tests/multipath/sda/device/vendor | 1 +
.../disk_tests/multipath/sda/holders/holder | 1 +
.../disk_tests/multipath/sda/queue/rotational | 1 +
src/test/disk_tests/multipath/sda/size | 1 +
src/test/disk_tests/multipath/sda_udevadm | 18 +
.../disk_tests/multipath/sdb/device/model | 1 +
.../disk_tests/multipath/sdb/device/vendor | 1 +
.../disk_tests/multipath/sdb/holders/holder | 1 +
.../disk_tests/multipath/sdb/queue/rotational | 1 +
src/test/disk_tests/multipath/sdb/size | 1 +
src/test/disk_tests/multipath/sdb_udevadm | 18 +
.../disk_tests/multipath/sdc/device/model | 1 +
.../disk_tests/multipath/sdc/device/vendor | 1 +
.../disk_tests/multipath/sdc/holders/holder | 1 +
.../disk_tests/multipath/sdc/queue/rotational | 1 +
src/test/disk_tests/multipath/sdc/size | 1 +
src/test/disk_tests/multipath/sdc_udevadm | 18 +
.../disk_tests/multipath/sdd/device/model | 1 +
.../disk_tests/multipath/sdd/device/vendor | 1 +
.../disk_tests/multipath/sdd/holders/holder | 1 +
.../disk_tests/multipath/sdd/queue/rotational | 1 +
src/test/disk_tests/multipath/sdd/size | 1 +
src/test/disk_tests/multipath/sdd_udevadm | 18 +
src/test/disk_tests/multipath/zpool | 1 +
.../disk_tests/sas/disklist_expected.json | 1 +
src/test/disk_tests/sas/lsblk | 5 +
src/test/disklist_test.pm | 107 ++++-
src/test/multipath-three-states.json | 52 ++
src/test/run_disk_api_tests.pl | 11 +
src/test/run_iscsi_activation_tests.pl | 86 ++++
src/test/run_lun_identity_tests.pl | 48 ++
src/test/run_multipath_api_tests.pl | 352 ++++++++++++++
src/test/run_multipath_tests.pl | 169 +++++++
src/test/run_san_api_tests.pl | 94 ++++
src/test/run_san_library_tests.pl | 84 ++++
src/test/run_san_lun_scan_tests.pl | 180 +++++++
src/test/run_san_nvme_tests.pl | 107 +++++
src/test/run_san_taint_tests.pl | 60 +++
src/test/run_san_wipe_tests.pl | 137 ++++++
src/test/run_test_lvm_base_activation.pl | 117 +++++
src/test/run_test_lvm_base_conflicts.pl | 232 ++++++---
src/test/run_test_lvm_create.pl | 14 +
123 files changed, 5244 insertions(+), 214 deletions(-)
pve-docs:
Thomas Lamprecht (1):
storage: document the cluster-wide multipath management
pmxcfs.adoc | 2 +
pve-storage-iscsi.adoc | 11 ++
pve-storage-iscsidirect.adoc | 2 +-
pve-storage-lvm.adoc | 3 +
pve-storage-multipath.adoc | 260 +++++++++++++++++++++++++++++++++++
pvesm.adoc | 18 ++-
6 files changed, 290 insertions(+), 6 deletions(-)
pve-manager:
Dietmar Maurer (2):
api: nodes: expose the iSCSI status
ui: node: san: show iSCSI targets and sessions
Thomas Lamprecht (11):
pvestatd: apply the multipath configuration and report the node status
report: add the managed multipath configuration
api: cluster: add the multipath endpoints
ui: dc: add a SAN view
ui: storage: iscsi: add the multipath option
ui: lvm: enable shared when a base storage is selected
ui: node: add SAN LUNs panel
ui: node: san: wipe a LUN that no storage uses
ui: dc: san: add a guided setup for shared LVM on iSCSI
ui: dc: san: add a guided setup for shared LVM on Fibre Channel
ui: storage: point the iSCSI and LVM add dialogs to the SAN view
PVE/API2/Cluster.pm | 7 +
PVE/API2/Nodes.pm | 7 +
PVE/Report.pm | 3 +
PVE/Service/pvestatd.pm | 7 +
www/manager6/Makefile | 12 +
www/manager6/SANUtils.js | 161 +++++++++
www/manager6/Utils.js | 14 +
www/manager6/dc/Config.js | 23 +-
www/manager6/dc/MultipathWwidEdit.js | 81 +++++
www/manager6/dc/SAN.js | 331 ++++++++++++++++++
www/manager6/node/Config.js | 24 ++
www/manager6/node/ISCSITargets.js | 122 +++++++
www/manager6/node/SANLuns.js | 184 ++++++++++
www/manager6/storage/Base.js | 5 +
www/manager6/storage/IScsiEdit.js | 46 +++
www/manager6/storage/LVMEdit.js | 6 +
www/manager6/storage/wizard/FibreChannel.js | 162 +++++++++
www/manager6/storage/wizard/IScsi.js | 272 ++++++++++++++
www/manager6/storage/wizard/LunSelect.js | 181 ++++++++++
www/manager6/storage/wizard/NodeIdentities.js | 83 +++++
www/manager6/storage/wizard/Wizard.js | 254 ++++++++++++++
www/manager6/window/SANLunState.js | 115 ++++++
www/manager6/window/SANLunWipe.js | 53 +++
23 files changed, 2147 insertions(+), 6 deletions(-)
^ permalink raw reply [relevance 5%]
* [PATCH v4 storage 05/36] diskmanage: collect native NVMe multipath path state
2026-11-13 3:00 5% [PATCH v4 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-13 3:00 13% ` [PATCH v4 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
@ 2026-11-13 3:00 13% ` Thomas Lamprecht
2026-11-13 3:00 9% ` [PATCH v4 storage 16/36] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-13 3:00 9% ` [PATCH v4 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view Thomas Lamprecht
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:00 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
NVMe over Fabrics usually uses native multipath, whose paths
multipathd does not know. Collect the controller state and address
and the ANA state of each path from sysfs, grouped by namespace, so
the SAN LUN inventory can report path health for both multipath
stacks. Devices with a single local controller have no per-path
entries and are left out.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: drop redundant comments]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 60 +++++++++++++++++++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../multipath/nvme_path_status_expected.json | 19 ++++++
src/test/disklist_test.pm | 16 +++++
11 files changed, 103 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
create mode 100644 src/test/disk_tests/multipath/nvme_path_status_expected.json
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 5043a83d..d5251095 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -816,6 +816,66 @@ sub get_disks {
return $disklist;
}
+# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
+# single-controller devices lack these children and are omitted.
+sub get_nvme_path_status {
+ my $res = {};
+
+ dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ 'nvme-subsys\d+',
+ sub {
+ my ($subsys) = @_;
+ my $subsysdir = "/sys/class/nvme-subsystem/$subsys";
+
+ dir_glob_foreach(
+ $subsysdir,
+ 'nvme\d+',
+ sub {
+ my ($ctrl) = @_;
+ my $ctrldir = "$subsysdir/$ctrl";
+ my $state = file_read_firstline("$ctrldir/state") // return;
+ my $address = file_read_firstline("$ctrldir/address");
+
+ dir_glob_foreach(
+ $ctrldir,
+ 'nvme\d+c\d+n\d+',
+ sub {
+ my ($pathdev) = @_;
+ return if $pathdev !~ m/^nvme(\d+)c\d+n(\d+)$/;
+ my $head = "nvme$1n$2";
+
+ my $entry = { device => "/dev/$ctrl", state => $state };
+ $entry->{address} = $address
+ if defined($address) && $address ne '';
+ my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
+ $entry->{'ana-state'} = $ana if defined($ana);
+
+ # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
+ # cannot serve IO even on a live controller
+ my $usable = $state eq 'live'
+ && (!defined($ana)
+ || $ana eq 'optimized'
+ || $ana eq 'non-optimized');
+
+ my $status = $res->{$head} //= { active => 0, paths => [] };
+ $status->{active}++ if $usable;
+ push @{ $status->{paths} }, $entry;
+ },
+ );
+ },
+ );
+ },
+ );
+
+ for my $status (values %$res) {
+ @{ $status->{paths} } =
+ sort { $a->{device} cmp $b->{device} } @{ $status->{paths} };
+ }
+
+ return $res;
+}
+
sub get_partnum {
my ($part_path) = @_;
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
new file mode 100644
index 00000000..803fab3e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
@@ -0,0 +1 @@
+traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
new file mode 100644
index 00000000..e48c58f5
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
@@ -0,0 +1 @@
+optimized
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
new file mode 100644
index 00000000..36618744
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
@@ -0,0 +1 @@
+traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
new file mode 100644
index 00000000..436c48ee
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
@@ -0,0 +1 @@
+inaccessible
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
new file mode 100644
index 00000000..f99fcb14
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
@@ -0,0 +1 @@
+0000:02:00.0
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme_path_status_expected.json b/src/test/disk_tests/multipath/nvme_path_status_expected.json
new file mode 100644
index 00000000..62611b3f
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme_path_status_expected.json
@@ -0,0 +1,19 @@
+{
+ "nvme2n1": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/nvme3",
+ "state": "live",
+ "address": "traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "optimized"
+ },
+ {
+ "device": "/dev/nvme4",
+ "state": "live",
+ "address": "traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "inaccessible"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index bd70dc33..0d34c0db 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -103,6 +103,7 @@ sub mocked_file_read_firstline {
my $originalsub = $diskmanage_module->original('file_read_firstline');
$path =~ s|^/sys/block|disk_tests/$testcasedir|;
+ $path =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|;
return &$originalsub($path);
}
@@ -112,6 +113,12 @@ sub mocked_dir_glob_foreach {
my $lines = [];
+ # nvme subsystem trees are provided as directories, glob them like production code
+ if ($dir =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|) {
+ my $originalsub = $diskmanage_module->original('dir_glob_foreach');
+ return &$originalsub($dir, $regex, $sub);
+ }
+
# read lines in from file
if ($dir =~ m{^/sys/block$}) {
@$lines = split(/\n/, read_test_file('disklist'));
@@ -230,6 +237,15 @@ sub test_disk_list {
ok($san_disks->{sda}, 'SAN inventory opts into iSCSI');
}
+ if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'nvme path status should be the same');
+ }
+
done_testing($testcount);
};
}
^ permalink raw reply related [relevance 13%]
* [PATCH v4 storage 03/36] diskmanage: qualify NVMe over fabrics transport
2026-11-13 3:00 5% [PATCH v4 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
@ 2026-11-13 3:00 13% ` Thomas Lamprecht
2026-11-13 3:00 13% ` [PATCH v4 storage 05/36] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
` (2 subsequent siblings)
3 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-13 3:00 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
lsblk reports 'nvme' for namespaces attached over a fabric too, so
they cannot be told from local PCIe drives. Read the transport from
the controller, or from a controller of the subsystem with native
multipath, and report nvme-fc, nvme-tcp, nvme-rdma or nvme-loop for
such namespaces.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: add the test case with the two namespaces only, the multipath
devices it was part of follow later; mention the new values in the
transport description]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Disks.pm | 3 +-
src/PVE/Diskmanage.pm | 27 ++++++++++++++
src/test/disk_tests/multipath/disklist | 2 ++
.../multipath/disklist_expected.json | 35 +++++++++++++++++++
src/test/disk_tests/multipath/lsblk | 18 ++++++++++
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 ++++++++
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +++++++
src/test/disklist_test.pm | 12 +++++++
17 files changed, 131 insertions(+), 1 deletion(-)
create mode 100644 src/test/disk_tests/multipath/disklist
create mode 100644 src/test/disk_tests/multipath/disklist_expected.json
create mode 100644 src/test/disk_tests/multipath/lsblk
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme8n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme8n1/size
create mode 100644 src/test/disk_tests/multipath/nvme8n1_udevadm
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/vendor
create mode 100644 src/test/disk_tests/multipath/nvme9n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme9n1/size
create mode 100644 src/test/disk_tests/multipath/nvme9n1_udevadm
diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index 1abab820..980ba7ff 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -138,7 +138,8 @@ __PACKAGE__->register_method({
transport => {
type => 'string',
description =>
- "The device transport, for example 'sata', 'sas', 'usb', 'fc', or 'nvme'.",
+ "The device transport, for example 'sata', 'sas', 'usb', 'fc',"
+ . " 'nvme', 'nvme-fc', or 'nvme-tcp'.",
optional => 1,
},
parent => {
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 4d66902b..7862bcd4 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -505,6 +505,26 @@ sub is_iscsi {
return 0;
}
+# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
+# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+sub get_nvme_transport {
+ my ($sysdir) = @_;
+
+ my $transport = file_read_firstline("$sysdir/device/transport");
+ return $transport if defined($transport);
+
+ dir_glob_foreach(
+ "$sysdir/device",
+ 'nvme\d+',
+ sub {
+ my ($controller) = @_;
+ $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ },
+ );
+
+ return $transport;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
@@ -597,6 +617,9 @@ sub get_disks {
# we do not want iscsi devices
return if is_iscsi($sysdir);
+ my $nvme_transport;
+ $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
+
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
@@ -648,7 +671,11 @@ sub get_disks {
wearout => $wearout,
};
+ # lsblk reports plain 'nvme' for fabrics attached namespaces
my $transport = $lsblk_info->{$devpath}->{tran};
+ if (defined($nvme_transport) && $nvme_transport ne 'pcie') {
+ $transport = "nvme-$nvme_transport";
+ }
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
diff --git a/src/test/disk_tests/multipath/disklist b/src/test/disk_tests/multipath/disklist
new file mode 100644
index 00000000..b5e636a5
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist
@@ -0,0 +1,2 @@
+nvme8n1
+nvme9n1
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
new file mode 100644
index 00000000..908c2b56
--- /dev/null
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -0,0 +1,35 @@
+{
+ "nvme8n1": {
+ "devpath": "/dev/nvme8n1",
+ "size": 10737418240,
+ "vendor": "unknown",
+ "model": "FCMODEL",
+ "serial": "FCNVME1",
+ "wwn": "uuid.20000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
+ "transport": "nvme-fc"
+ },
+ "nvme9n1": {
+ "devpath": "/dev/nvme9n1",
+ "size": 10737418240,
+ "vendor": "FABVEND",
+ "model": "FABRICS CTRL",
+ "serial": "FAB1",
+ "wwn": "uuid.10000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "transport": "nvme-tcp"
+ }
+}
diff --git a/src/test/disk_tests/multipath/lsblk b/src/test/disk_tests/multipath/lsblk
new file mode 100644
index 00000000..597adf94
--- /dev/null
+++ b/src/test/disk_tests/multipath/lsblk
@@ -0,0 +1,18 @@
+{
+ "blockdevices": [
+ {
+ "path": "/dev/nvme8n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ },
+ {
+ "path": "/dev/nvme9n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ }
+ ]
+}
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/model b/src/test/disk_tests/multipath/nvme8n1/device/model
new file mode 100644
index 00000000..1aac689e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/model
@@ -0,0 +1 @@
+FCMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/transport b/src/test/disk_tests/multipath/nvme8n1/device/transport
new file mode 100644
index 00000000..8b517d01
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/transport
@@ -0,0 +1 @@
+fc
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/queue/rotational b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/size b/src/test/disk_tests/multipath/nvme8n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1_udevadm b/src/test/disk_tests/multipath/nvme8n1_udevadm
new file mode 100644
index 00000000..d0cd5ea9
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1_udevadm
@@ -0,0 +1,14 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+N: nvme8n1
+S: disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVLINKS=/dev/disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVNAME=/dev/nvme8n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+E: DEVTYPE=disk
+E: ID_MODEL=FCMODEL
+E: ID_SERIAL=FCNVME_1
+E: ID_SERIAL_SHORT=FCNVME1
+E: ID_WWN=uuid.20000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=1
+E: SUBSYSTEM=block
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/model b/src/test/disk_tests/multipath/nvme9n1/device/model
new file mode 100644
index 00000000..aa0287c7
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/model
@@ -0,0 +1 @@
+FABMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/transport
new file mode 100644
index 00000000..f5483dbf
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/transport
@@ -0,0 +1 @@
+tcp
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/vendor b/src/test/disk_tests/multipath/nvme9n1/device/vendor
new file mode 100644
index 00000000..cdc6ddfa
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/vendor
@@ -0,0 +1 @@
+FABVEND
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/queue/rotational b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/size b/src/test/disk_tests/multipath/nvme9n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1_udevadm b/src/test/disk_tests/multipath/nvme9n1_udevadm
new file mode 100644
index 00000000..b6d13ccb
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1_udevadm
@@ -0,0 +1,12 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+N: nvme9n1
+E: DEVNAME=/dev/nvme9n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+E: DEVTYPE=disk
+E: ID_MODEL=FABRICS CTRL
+E: ID_SERIAL=FABRICS_1
+E: ID_SERIAL_SHORT=FAB1
+E: ID_WWN=uuid.10000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=0
+E: SUBSYSTEM=block
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index a0dc01f6..51b20c53 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -101,6 +101,16 @@ sub mocked_is_iscsi {
return 0;
}
+sub mocked_file_read_firstline {
+ my ($path) = @_;
+
+ my $originalsub = $diskmanage_module->original('file_read_firstline');
+
+ $path =~ s|^/sys/block|disk_tests/$testcasedir|;
+
+ return &$originalsub($path);
+}
+
sub mocked_dir_glob_foreach {
my ($dir, $regex, $sub) = @_;
@@ -248,6 +258,8 @@ $diskmanage_module->mock(
},
);
print("\tMocked dir_is_empty\n");
+$diskmanage_module->mock('file_read_firstline' => \&mocked_file_read_firstline);
+print("\tMocked file_read_firstline\n");
$diskmanage_module->mock('check_bin' => sub { return 1; });
print("\tMocked check_bin\n");
my $tools_module = Test::MockModule->new('PVE::ProcFSTools', no_auto => 1);
^ permalink raw reply related [relevance 13%]
* [PATCH v3 docs 44/76] storage: document the cluster-wide multipath management
2026-11-05 23:30 5% [PATCH v3 proxmox,proxmox-perl-rs,cluster,storage,docs,manager 00/76] SAN: cluster-wide multipath, SAN views and a guided storage setup Thomas Lamprecht
` (3 preceding siblings ...)
2026-11-05 23:30 13% ` [PATCH v3 storage 23/76] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
@ 2026-11-05 23:31 8% ` Thomas Lamprecht
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-05 23:31 UTC (permalink / raw)
To: pve-devel
Document managed multipath setup, health states, and upgrade
requirements so administrators can distinguish incomplete configuration
from unusable paths.
Cover shared LVM setup and recovery in the Remote Storage wizard,
including device checks, unanswered requests, task completion, and
readiness before guest use. Explain safe connection-storage removal,
growing LUNs, and presenting them again without queued I/O blocking
the operation.
Require content none in the iSCSI guidance for LVM, rather than merely
recommending it: initialization is refused while a storage uses the
target for disk images.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
pve-storage-iscsi.adoc | 13 +-
pve-storage-multipath.adoc | 527 +++++++++++++++++++++++++++++++++++++
pvesm.adoc | 13 +-
3 files changed, 545 insertions(+), 8 deletions(-)
create mode 100644 pve-storage-multipath.adoc
diff --git a/pve-storage-iscsi.adoc b/pve-storage-iscsi.adoc
index aea26d2..67055f1 100644
--- a/pve-storage-iscsi.adoc
+++ b/pve-storage-iscsi.adoc
@@ -38,6 +38,13 @@ target::
iSCSI target.
+multipath::
+
+Combine the paths to each LUN of the target into one `dm-multipath` map on every
+node the storage is enabled on, and monitor the maps cluster-wide. A shared LVM
+storage on a target with several portals needs this option. See
+xref:storage_multipath[Multipath].
+
.Configuration Example (`/etc/pve/storage.cfg`)
----
@@ -47,9 +54,9 @@ iscsi: mynas
content none
----
-TIP: If you want to use LVM on top of iSCSI, it make sense to set
-`content none`. That way it is not possible to create VMs using iSCSI
-LUNs directly.
+NOTE: To use LVM on top of iSCSI, set `content none`. When you add an LVM
+storage with a LUN as its base volume, {pve} refuses the operation if any
+configured storage also uses that target for disk images.
File naming conventions
diff --git a/pve-storage-multipath.adoc b/pve-storage-multipath.adoc
new file mode 100644
index 0000000..6f6dc1a
--- /dev/null
+++ b/pve-storage-multipath.adoc
@@ -0,0 +1,527 @@
+[[storage_multipath]]
+Multipath
+---------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: Multipath
+endif::wiki[]
+
+A storage area network (SAN) usually exports each logical unit (LUN) over
+several paths, for example over two iSCSI portals or two Fibre Channel ports.
+Linux sees every path as a separate block device. Device-mapper multipath
+(`dm-multipath`) combines the paths of a LUN into one device, called a
+multipath map, keeps I/O flowing while a path is down, and spreads the load over
+the paths.
+
+{pve} manages `dm-multipath` cluster-wide: it decides which LUNs get a map,
+sets the name and options of each map, and monitors every path on every node. A
+LUN is identified by its World Wide Identifier (WWID), which is the same on
+every node. The configuration is stored in the cluster file system, every node
+generates its local `multipath-tools` configuration from it, and
+*Datacenter -> SAN -> Multipath* shows the health of the maps across the
+cluster.
+
+NOTE: NVMe over Fabrics namespaces use native NVMe multipath in the kernel
+instead of `dm-multipath`. They need no multipath configuration and do not
+appear under *Datacenter -> SAN -> Multipath*. They show up under
+*Node -> SAN*.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+Install `multipath-tools` on every node that accesses the SAN:
+
+----
+# apt install multipath-tools
+----
+
+A node without the package does not take part. *Datacenter -> SAN* shows it as
+*Not installed*, which counts as a problem once a LUN is expected on the node.
+
+Upgrade every node of the cluster before you enable the multipath option of a
+storage. A node with an older version does not know the option and removes it
+from every iSCSI storage the next time it writes the storage configuration,
+even for an unrelated change. The other nodes then stop managing the LUNs of
+those storages. {pve} therefore refuses to enable the option until every
+cluster node has reported multipath support, which a node does while it is
+online. It also refuses while `multipath-tools` is not installed on a node the
+storage is available on, as the volumes of the storage cannot be activated
+there without their maps. Upgrade a node before it joins a cluster that uses the
+option, as the check covers only the nodes that are members when you enable it.
+
+Managing LUNs
+~~~~~~~~~~~~~
+
+{pve} assembles maps only for the LUNs on its allow-list, so unrelated disks,
+the boot disk, and LUNs that other software uses directly stay untouched. A LUN
+gets onto the allow-list in one of two ways, and the *Source* column under
+*Datacenter -> SAN -> Multipath* shows which one applies:
+
+iSCSI storages::
+
+Enable *Multipath* in the edit dialog of the iSCSI storage or in the
+*Remote Storage* wizard, see
+xref:storage_multipath_setup[Setting Up Shared LVM]. Every node the storage is
+enabled on then assembles one map per LUN over the paths through the portals of
+the target. The storage lists its LUNs as multipath maps afterwards, and an LVM
+storage created on top of it uses the map as its base volume, see
+xref:storage_lvm[LVM].
++
+Without the option, {pve} logs in to every portal of the target as well, and
+each LUN shows up once per portal as a separate device. LVM ignores a volume
+group that it finds on several devices, so a shared LVM storage on a target with
+several portals needs the option. The option cannot be disabled while an LVM
+storage uses one of the maps as its base volume.
++
+You do not need to remove and add an existing LVM storage again when you enable
+the option: it can keep its base volume. LVM finds the physical volume by its
+metadata, not by the device name. Keep `multipath_component_detection` enabled
+in the LVM configuration (the default), so that LVM ignores the path devices of
+the LUN and uses the map. Logical volumes that are already active on a single
+path device stay there when you enable the option; before you rely on path
+redundancy, run `lsblk` on each node to see which device they use. Deactivating
+and activating a logical volume again moves it to the map, for example by
+migrating its guest to another node and back.
++
+The same can happen when a node logs in to the target for the first time, for
+example after it joined the cluster, or when the target presents a new LUN: the
+node adds a LUN to its allow-list only after it found it, and until then LVM can
+activate logical volumes with autoactivation enabled on a path device. {pve} 9
+creates new logical volumes for guests with autoactivation disabled. For older
+guest volumes, run
+`/usr/share/pve-manager/migrations/pve-lvm-disable-autoactivation`; for other
+logical volumes, run `lvchange --setautoactivation n <vg>/<lv>`.
++
+If the volume group is not visible yet, for example right after a node booted,
+activating a volume of the LVM storage also activates the base volume and waits
+briefly for the map. For a base volume that is still named by the SCSI
+identifier of the LUN, a timeout only logs a warning and activation continues;
+activation can still fail if the volume group remains unavailable.
+
+Other LUNs::
+
+LUNs attached over Fibre Channel or SAS, and LUNs of an iSCSI target without an
+iSCSI storage, need an explicit entry in the cluster-wide multipath
+configuration, shown as *Explicit entry* in the *Source* column. For Fibre
+Channel, the *Remote Storage* wizard can add the entry together with the volume
+group and the LVM storage, see
+xref:storage_multipath_setup[Setting Up Shared LVM]. To add an entry by hand:
++
+. Under *Node -> SAN*, select the LUN and choose *Enable Multipath*.
+. Review *Nodes*. For a new entry, the dialog preselects this node, the nodes
+ that see the LUN, and the nodes it could not check. Adjust the selection to
+ the nodes that should use the LUN. Optionally set an *Alias*, which becomes
+ the map name on every selected node.
+. Wait for the map to assemble, which takes up to about ten seconds, as every
+ node applies the configuration periodically.
+. Create the volume group on the map with `pvesh create
+ /nodes/<node>/disks/lvm --name <vg> --device
+ /dev/disk/by-id/dm-uuid-mpath-<wwid>` and check its output for errors. Then
+ add the shared LVM storage with
+ `pvesm add lvm <storage> --vgname <vg> --shared 1`.
+
+A map that {pve} does not manage, for example one from a hand-made
+configuration that predates the upgrade, shows up as *Unmanaged* under
+*Node -> SAN*. Select it and choose *Manage* to add it to the cluster-wide
+configuration.
+
+A node keeps a LUN on its allow-list while an explicit entry or an enabled
+storage requires it there. Once neither does, the node removes the LUN from its
+allow-list and `multipathd` releases the map, unless the LUN was added to the
+allow-list outside of {pve}. However, the node keeps the LUN on its allow-list
+while something on the node still uses the map, for example a volume group, a
+file system, or a partition table, as the users would otherwise fall back to a
+single path after the next reboot. The datacenter view and the SAN
+view of the node show such a LUN as *Kept while in use* until the node can
+confirm that the map is unused, including that no data signatures remain. To
+keep the LUN on the allow-list after it is no longer in use, choose *Manage* in
+the SAN view of the node, which adds an explicit entry for it.
+
+{pve} refuses to remove an explicit entry, or to restrict it to fewer nodes,
+while an LVM storage uses the map as its base volume on a node that would then
+drop the LUN from its allow-list. Remove or change that storage first. An LVM
+storage without a base volume, as used for Fibre Channel, is not linked to the
+LUN in the configuration. It is protected only because every node keeps the LUN
+on its allow-list while the volume group is on the map, as described above.
+
+[[storage_multipath_setup]]
+Setting Up Shared LVM
+~~~~~~~~~~~~~~~~~~~~~
+
+The *Remote Storage* wizard under *Datacenter -> Storage -> Add* sets up shared
+LVM storage on a LUN. For iSCSI, it creates the volume group from the node that
+the web interface is connected to. That node must reach the target and be
+included in any node restriction. For Fibre Channel, it uses the selected scan
+node and can enable multipath for the selected LUN, create a volume group or use
+an existing one, and add the LVM storage.
+
+For iSCSI, the wizard first adds or reuses a connection storage: an iSCSI
+storage with `content none` that connects the nodes to the target without
+offering its LUNs as disk images. *Connect and Select LUN* adds the connection
+storage and lists its LUNs. If a connection storage for the target already
+exists, the button is *Select LUN* and lists the LUNs of that storage. Select a
+LUN, then choose *Create Volume Group*. The LVM storage gets the LUN as its
+base volume, so that a node connects to the target before it activates the
+volume group, for example for guests that start at boot. Keep the base volume
+when you add such a storage by hand.
+
+The wizard offers only LUNs that no configured storage uses for data, that are
+neither mounted nor used by another device on the node, and on which the node
+finds no partitions, file system, LVM, or other signature. The node checks the
+device and its users again right before it creates the volume group. If no
+configured storage uses a device for data and nothing on the node uses it,
+`root@pam` can wipe it for reuse: in the wizard after selecting *Allow wiping
+LUNs with data*, or under *Node -> SAN*.
+
+Before you put guests on a new shared storage, check under
+*Datacenter -> SAN -> Multipath* that every node of the storage sees the LUN
+with all its paths.
+
+If a step fails after the wizard has created something, you can no longer
+change the settings in the wizard. *Retry Setup* runs the remaining steps again.
+If creating the LVM storage on iSCSI fails, retries use the same LUN and do not
+return to device selection, as the attempt may have written to it. If the wizard
+could not confirm that it created a storage, *Check and Retry* checks whether
+the storage exists with the expected settings and creates it only if it is
+missing. Closing the wizard does not remove the storages it already created.
+
+If the wizard cannot tell whether a wipe finished, it blocks the device until
+the outcome is known. *Check Task Status* waits for the same wipe task again; it
+does not start another wipe. If the wizard does not know the task ID, check the
+*Task History* of the node before you choose *Dismiss* or use the device.
+
+If the node does not answer while the Fibre Channel wizard creates the volume
+group, the wizard stops, as the task may still be running. Check the
+*Task History* of the node to see whether the task created the volume group.
+Once the task has finished, run the wizard again. If the volume group exists,
+the wizard offers it; select it to complete the setup.
+
+NOTE: When you use the API, a returned task ID only means that the node
+accepted the task, not that the task succeeded. Wait for the task to finish and
+check its exit status before you use the device. `pvesh` runs the task in the
+foreground; check its output for errors.
+
+Health
+~~~~~~
+
+*Datacenter -> SAN* shows one row per node with the state of its multipath
+service, the number of its managed LUNs in each state, and its iSCSI initiator
+name, which the targets of its iSCSI storages have to allow. A node that has not
+reported shows *No report*. A missing `multipath-tools` package or a stopped
+`multipathd` counts as a problem only on a node that should see a LUN.
+
+*Datacenter -> SAN -> Multipath* lists every managed LUN with its state on each
+node:
+
+*Optimal*:: Every path is active and no expected path is missing.
+*Degraded*:: Some paths are down, or fewer paths are present than the storage
+configuration expects.
+*Failed*:: No active path remains.
+*Missing*:: The node should see the LUN but has not assembled its map.
+*Unknown*:: The node has no current report. The view also shows why: the node
+is offline, its report is stale, `multipath-tools` is not installed,
+`multipathd` is not running or did not answer, or the node has too many LUNs to
+list them. A node that runs an older version, or has not reported since its
+cluster file system started, has no report at all.
+
+If the status updates of a node stall, for example while a status query waits
+for I/O to a LUN that lost every path, the view keeps a *Degraded*, *Missing*,
+or *Failed* state from the last report of the node, but shows *Unknown* instead
+of *Optimal*, as that report may be long outdated.
+
+A LUN of an iSCSI storage that no node finds on the target anymore, and that no
+node has a map of, shows *Not currently observed* instead of *Missing*. This
+usually means that the LUN was unmapped on the storage system, on purpose or by
+mistake, so check which one it was. The storage keeps the LUN on the allow-list,
+see xref:storage_multipath_remove[Removing a LUN]. A LUN stays *Missing* if it
+has an explicit entry or an LVM storage uses it. It also stays *Missing* while
+one of its nodes cannot tell whether the LUN is gone: the node runs an older
+version, could not apply the configuration, has no current report or stalled
+status updates, has not completed login and the initial LUN scan on every
+portal of the target, or cannot identify every LUN of the target.
+
+The *Cluster Health* of a LUN is the worst state among the nodes that should see
+it. Nodes without a current report do not count, so *Optimal* means that every
+node with a current report is fine, not that every node has reported. While the
+state on one of these nodes is unknown, the view shows *Optimal (incomplete)*. A
+node that should see the LUN but cannot manage multipath, because
+`multipath-tools` is not installed or `multipathd` is not running or does not
+answer, makes the LUN *Degraded*. An explicit entry without a node restriction
+expects the LUN on every node of the cluster.
+
+Nodes report the state of their LUNs through the cluster file system, which
+limits the size of a report. A node with more than about 200 LUNs reports only
+the number of its LUNs in each state, and the datacenter view refers to the SAN
+view of that node for details.
+
+For an iSCSI storage, {pve} knows how many paths a LUN should have: one per
+portal of the target. If several storages provide the same LUN, the LUN is
+expected on the nodes of all of them, with the highest path count among them.
+For Fibre Channel, {pve} only knows the paths that are currently present. If the
+transport has already removed a failed path, the map shows as *Optimal* with
+fewer paths, so compare the path count with what the SAN should provide.
+
+A node learns the portals of an iSCSI target when it first logs in to it. A
+portal that is added to the target later is neither used nor expected until the
+node discovers the target again. To start using a new portal, run the discovery
+on every node, against any portal of the target:
+
+----
+# iscsiadm --mode discovery --type sendtargets --portal <portal>
+----
+
+The next activation of the storage then also logs in to the new portal.
+
+Above the list, *Datacenter -> SAN -> Multipath* shows the nodes that could not
+apply the configuration, so a node that drifts from the configured state does
+not go unnoticed. It also shows nodes that cannot identify some LUNs of their
+iSCSI storages, because the identifiers of their paths are not available or
+could not be verified, for example while `multipathd` starts. Such a LUN is left
+out until the node can identify it.
+
+*Node -> SAN* lists each LUN of the node with its users and the state of its
+paths, and shows the problems of the node above the list. There, `root@pam` can
+also wipe a LUN that no configured storage uses for data, for example before
+reusing it. The wipe dialog first asks the other nodes what uses the LUN and
+refuses while one of them reports a user. *Node -> SAN -> iSCSI* shows the iSCSI
+targets and sessions of the node and its initiator name.
+
+Permissions
+~~~~~~~~~~~
+
+The multipath views and changes need these privileges:
+
+* Viewing the multipath status: `Sys.Audit` on `/` or `Datastore.Allocate` on
+ `/storage`.
+* Viewing the SAN views of a node: `Sys.Audit` on `/nodes/<node>` or
+ `Datastore.Allocate` on `/storage`.
+* Changing the cluster-wide multipath configuration through the API:
+ `Sys.Modify` on `/`.
+* Using *Enable Multipath*, *Manage*, or *Edit* in the multipath views:
+ `Sys.Modify` and `Sys.Audit` on `/`. The editors read the configuration before
+ changing it.
+* Changing the multipath option of a storage: `Datastore.Allocate` on
+ `/storage`.
+
+[[storage_multipath_grow]]
+Growing a LUN
+~~~~~~~~~~~~~
+
+{pve} lets a map grow with its LUN once every path of the map reports the new
+size, see `auto-resize` under xref:storage_multipath_config[Configuration]. To
+grow a LUN that carries a shared LVM volume group:
+
+. Grow the LUN on the storage system. Never shrink a LUN that is in use.
+. Make every path on every node report the new size. For iSCSI, {pve} rescans
+ the sessions of an active storage about every ten seconds, so this happens on
+ its own; a path of a session that is down follows once the session recovers.
+ For Fibre Channel, rescan each path on every node with
+ `echo 1 > /sys/block/<path>/device/rescan`, where `<path>` is a path device
+ of the map, such as `sdc`. NVMe over Fabrics targets notify the hosts
+ themselves.
+. Check the size of the map on every node, under *Node -> SAN* or with
+ `multipath -ll <wwid>`. If the map of a node did not follow, run
+ `multipathd resize map <wwid>` on that node.
+. Only then, on one node, grow the physical volume with
+ `pvresize /dev/disk/by-id/dm-uuid-mpath-<wwid>`. A node whose map is still
+ smaller cannot activate logical volumes in the added space.
+
+[[storage_multipath_remove]]
+Removing a LUN
+~~~~~~~~~~~~~~
+
+The device profiles of many storage systems make `dm-multipath` queue I/O while
+a map has no path, some of them without a time limit, so that a controller
+failover causes no I/O errors. If such a LUN is unmapped on the storage system,
+every process that reads its map blocks until a path returns or the retries run
+out. This includes LVM commands, which scan every device. The map cannot be
+removed while processes wait for it. The LVM status commands share a 15-second
+time limit. If they fail or time out, {pve} shows the affected LVM storages as
+not active on that node. The rest of the status update can take longer. Guests,
+backups, and other LVM commands can still hang. Therefore, turn off queueing
+before you unmap a LUN:
+
+. Stop the guests that use volumes on the LUN or move their disks to another
+ storage, and remove the LVM storage. Removing the storage entry does not stop
+ its users and keeps the volume group with its data.
+. Deactivate the volume group on every node with `vgchange -an <vg>`. Do not
+ remove the volume group or the physical volume unless you want to destroy the
+ data; removing them is not part of this procedure.
+. Make the map fail I/O instead of queueing it. If the LUN has an explicit
+ entry, note its `no-path-retry` setting and set it to `fail`, for example with
+ `pvesh set /cluster/multipath/wwid/<wwid> --no-path-retry fail`. Otherwise,
+ create a temporary entry for the nodes that see the LUN:
++
+----
+# pvesh create /cluster/multipath/wwid --wwid <wwid> --nodes <nodes> \
+ --no-path-retry fail
+----
+
+. On every node that sees the LUN, check in the output of `multipath -ll <wwid>`
+ that the `features` of the map no longer list `queue_if_no_path`. If a node is
+ offline, wait until it is back and check it as well before you continue.
+. On every node, note the path devices of the map that `multipath -ll <wwid>`
+ lists, and for each of them the identifier in `/sys/block/<path>/device/wwid`.
+ Then unmap the LUN on the storage system.
+. On every node:
+.. Remove the map with `multipath -f <wwid>`. If the map is still in use, do not
+ force the removal: find out what uses it, and retry after you have deleted
+ the path devices.
+.. For each noted path device, check that `/sys/block/<path>/device/wwid` still
+ shows the noted identifier, then delete the device with
+ `echo 1 > /sys/block/<path>/device/delete`. Skip a path device that is gone.
+ If one shows another identifier, stop: its name now belongs to another LUN.
+.. Check that `dmsetup ls` no longer lists the map.
+. Remove the temporary entry with `pvesh delete /cluster/multipath/wwid/<wwid>`,
+ or set `no-path-retry` of the explicit entry back to its previous value. If it
+ was not set before, unset it with
+ `pvesh set /cluster/multipath/wwid/<wwid> --delete no-path-retry`.
+
+If the LUN was already unmapped while its map queued I/O, processes that read
+the map hang, and changing the entry does not stop the queueing while they hold
+the map open. Run `multipathd disablequeueing map <wwid>` on every node that has
+the map to fail the queued I/O, then continue with noting the path devices and
+removing the map.
+
+An iSCSI storage keeps every LUN it has found on the allow-list for as long as
+the storage exists, as it cannot tell a LUN that was withdrawn on purpose from
+one that is only temporarily not visible. The datacenter view therefore keeps
+showing an unmapped LUN as *Not currently observed*. The allow-list entry is
+harmless, and if the LUN is presented again, it is managed again right away.
+Once you remove the storage or disable its multipath option, each node removes
+the allow-list entries that {pve} added, as soon as no other storage or
+explicit entry needs them and the map is unused. Allow-list entries that {pve}
+did not add stay in place.
+
+If the nodes lost a LUN, for example because it was unmapped by mistake, its
+paths report a size of zero after it is presented again, until they are
+rescanned. For iSCSI, the periodic session rescan of {pve} repairs the paths
+that still exist, and `iscsiadm --mode session --rescan` finds the LUNs whose
+paths were deleted. For Fibre Channel, rescan the remaining paths as described
+in xref:storage_multipath_grow[Growing a LUN], and rescan the host adapters to
+find the deleted paths, for example with `rescan-scsi-bus.sh` from the
+`sg3-utils` package.
+
+[[storage_multipath_disconnect]]
+Removing a Connection Storage
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Removing an iSCSI storage leaves its sessions connected and does not erase any
+data. To remove such a connection storage and disconnect the nodes safely:
+
+. Find out what uses each LUN of the target, not only the one that an LVM
+ storage uses. Stop these users or move their data to another storage.
+. Remove the LVM storages on the connection storage, and deactivate their
+ volume groups on every node with `vgchange -an <vg>`. Removing a storage does
+ not deactivate its volumes or remove its data.
+. Remove the connection storage. Make sure that no other enabled storage uses
+ the same target, as it would connect again.
+. On every node, choose *Logout* for the sessions under *Node -> SAN -> iSCSI*.
+ Once the iSCSI sessions are gone, *Remove* deletes the saved target records.
+ A logout is refused if it would take away the last usable path of a LUN that
+ is in use; stop what uses it instead of forcing the removal.
+
+Snapshot Clones
+~~~~~~~~~~~~~~~
+
+Do not present a snapshot clone of a LUN that carries an LVM physical volume to
+the nodes that use the original LUN. LVM then sees the same physical volume
+twice and refuses to activate logical volumes of the volume group or to change
+it, so guests on that storage cannot start or migrate. The SAN view of a node
+flags such LUNs as *duplicate PV*, but that check relies on the information udev
+recorded and can miss a duplicate. To access the data of a clone, present it to
+another host, or give it a new identity with `vgimportclone` on a host that
+sees only the clone before presenting it to the nodes.
+
+[[storage_multipath_config]]
+Configuration
+~~~~~~~~~~~~~
+
+The cluster-wide configuration is stored in `/etc/pve/multipath.cfg`. It has an
+optional `defaults` section for global `multipathd` settings and one `wwid`
+section for each explicit entry. From it, every node generates drop-in files
+with the prefix `pve-` under `/etc/multipath/conf.d/`, and maintains its
+allow-list in `/etc/multipath/wwids` with the LUNs of its multipath-enabled
+storages and the explicit entries that apply to the node. A hand-made
+`/etc/multipath.conf` and allow-list entries that {pve} did not add stay in
+place.
+
+.Example (`/etc/pve/multipath.cfg`)
+----
+defaults: defaults
+ no-path-retry queue
+
+wwid: 3600140558631413f06d4840826b34782
+ alias san1-lun0
+ nodes pve1,pve2
+ path-selector service-time 0
+----
+
+The `defaults` section takes `find-multipaths`, `user-friendly-names`,
+`polling-interval`, `auto-resize`, `no-path-retry`, `path-grouping-policy`,
+`failback`, and `path-selector`. Keep `find-multipaths` at `strict`, so that
+`multipathd` assembles maps only for LUNs on the allow-list, and
+`user-friendly-names` at `no`, so that maps without an explicit alias use their
+WWIDs as names, consistently across nodes and without a node-local bindings
+file. `auto-resize` defaults to `grow_only`, so a map grows with its LUN, see
+xref:storage_multipath_grow[Growing a LUN]; `grow_shrink` also shrinks it, and
+`never` leaves resizing to you.
+
+The built-in device profiles of `multipath-tools` set `no-path-retry` and the
+path settings for many storage systems, and these profiles take precedence over
+a `defaults` section. {pve} therefore writes `no-path-retry`,
+`path-grouping-policy`, `failback`, and `path-selector` from its `defaults`
+section into an `overrides` section, which takes precedence over the device
+profiles. Leave these settings unset to keep the values from the profile of your
+storage system.
+
+A `wwid` section takes `alias`, `nodes`, and the per-LUN settings
+`no-path-retry`, `path-grouping-policy`, `failback`, `path-selector`,
+`rr-min-io-rq`, and `rr-weight`, which take precedence over the defaults and
+the device profiles. See the `multipath.conf` manual page for the meaning of
+each setting.
+
+NOTE: For storage systems with Asymmetric Logical Unit Access (ALUA), whose
+paths all use the `alua` or `sysfs` prioritizer, `multipathd` detects the path
+grouping policy by itself and ignores a configured `path-grouping-policy`, even
+that of a `wwid` section. Setting `path-grouping-policy` in the `defaults`
+section turns this detection off. For a policy that only a `wwid` section sets,
+turn the detection off with `detect_pgpolicy no` in an `overrides` section of
+`/etc/pve/multipath-overrides.conf`.
+
+NOTE: A LUN is identified by the WWID that `multipathd` computes for its paths.
+If you change how `multipathd` computes it, for example with `uid_attrs`, the
+WWIDs of the affected LUNs can change once `multipathd` restarts. The entries of
+their old WWIDs then stay on the allow-list until their storage is removed or
+its multipath option is disabled, see
+xref:storage_multipath_remove[Removing a LUN].
+
+Hardware-specific settings, that is, the `devices`, `overrides`, and
+`blacklist` sections of `multipath.conf`, belong in
+`/etc/pve/multipath-overrides.conf`, written as in `multipath.conf`. Edit them
+with *Edit Overrides* under *Datacenter -> SAN -> Multipath*; every node applies
+them like the rest of the configuration. An `overrides` section in this file
+takes precedence over the managed defaults, but a `devices` section does not
+take precedence over the settings that {pve} writes as overrides.
+
+The API under `/cluster/multipath` manages the configuration and reports the
+health, for example:
+
+----
+# pvesh create /cluster/multipath/wwid --nodes pve1,pve2 \
+ --wwid 3600140558631413f06d4840826b34782
+# pvesh get /cluster/multipath/status
+----
+
+ifdef::wiki[]
+
+See Also
+~~~~~~~~
+
+* link:/wiki/Storage[Storage]
+
+* link:/wiki/Storage:_iSCSI[Storage: iSCSI]
+
+* link:/wiki/Storage:_LVM[Storage: LVM]
+
+endif::wiki[]
diff --git a/pvesm.adoc b/pvesm.adoc
index 5bd24b2..6f4e776 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -96,11 +96,10 @@ TiB sized), these operations may take several minutes, or in extreme cases, even
hours. If your setup is affected, create and remove snapshots while the VM is
shut down, expecting a long task duration.
-^3^: With iSCSI, FibreChannel (FC), or SAS block storage as shared storage in a
-cluster, LVM is used to split the LUN into virtual disks. The
-https://pve.proxmox.com/wiki/Multipath[Multipath Guide] explains how to
-configure it in a cluster, including multipathing which is usually a
-requirement in these scenarios.
+^3^: With iSCSI, Fibre Channel (FC), or SAS block storage as shared storage in
+a cluster, LVM is used to split the LUN into virtual disks. A LUN is usually
+reachable over several paths; xref:storage_multipath[Multipath] describes how
+{pve} manages them in a cluster.
^4^: Since {pve} 9, snapshots as a volume chain have been available for VMs.
These snapshots use separate volumes for the snapshot data and layer them. For
@@ -421,6 +420,8 @@ See Also
* link:/wiki/Storage:_iSCSI[Storage: iSCSI]
+* link:/wiki/Storage:_Multipath[Storage: Multipath]
+
* link:/wiki/Storage:_LVM[Storage: LVM]
* link:/wiki/Storage:_LVM_Thin[Storage: LVM Thin]
@@ -463,6 +464,8 @@ include::pve-storage-iscsi.adoc[]
include::pve-storage-iscsidirect.adoc[]
+include::pve-storage-multipath.adoc[]
+
include::pve-storage-rbd.adoc[]
include::pve-storage-cephfs.adoc[]
--
2.47.3
^ permalink raw reply related [relevance 8%]
* [PATCH v3 storage 21/76] disks: lvm: allow volume groups on SAN LUNs and multipath maps
2026-11-05 23:30 5% [PATCH v3 proxmox,proxmox-perl-rs,cluster,storage,docs,manager 00/76] SAN: cluster-wide multipath, SAN views and a guided storage setup Thomas Lamprecht
2026-11-05 23:30 6% ` [PATCH v3 storage 05/76] lvm: find a shared volume group created by another node Thomas Lamprecht
2026-11-05 23:30 14% ` [PATCH v3 storage 14/76] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
@ 2026-11-05 23:30 9% ` Thomas Lamprecht
2026-11-05 23:30 13% ` [PATCH v3 storage 23/76] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
2026-11-05 23:31 8% ` [PATCH v3 docs 44/76] storage: document the cluster-wide multipath management Thomas Lamprecht
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-05 23:30 UTC (permalink / raw)
To: pve-devel
The node disk API only accepts local disks for volume-group creation,
rejecting multipath maps and iSCSI LUNs. Allow this operation to opt in
to iSCSI, Fibre Channel, NVMe over Fabrics, and multipath devices so it
can set up shared LVM. Other local disk operations remain unchanged.
Check and initialize SAN LUNs under the cluster storage configuration
lock, also held by storage-add when initializing a base volume. This
prevents two nodes from both finding a LUN unused and initializing it.
Resolve the submitted device reference again under the locks. Refuse a
local device that has become a SAN device while the task waited, since
it would otherwise bypass the cluster lock. Local devices still need
no quorum.
Co-authored-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/API2/Disks/LVM.pm | 62 ++++++++++++++++-----
src/PVE/Diskmanage.pm | 53 ++++++++++++++++--
src/PVE/Storage/LVMPlugin.pm | 30 ++++++++--
src/test/disk_api_test.pm | 105 +++++++++++++++++++++++++++++++++++
src/test/disklist_test.pm | 23 ++++++++
5 files changed, 250 insertions(+), 23 deletions(-)
diff --git a/src/PVE/API2/Disks/LVM.pm b/src/PVE/API2/Disks/LVM.pm
index 9f8f9516..feab0a3b 100644
--- a/src/PVE/API2/Disks/LVM.pm
+++ b/src/PVE/API2/Disks/LVM.pm
@@ -3,6 +3,7 @@ package PVE::API2::Disks::LVM;
use strict;
use warnings;
+use PVE::Storage;
use PVE::Storage::LVMPlugin;
use PVE::Diskmanage;
use PVE::JSONSchema qw(get_standard_option);
@@ -131,7 +132,8 @@ __PACKAGE__->register_method({
name => get_standard_option('pve-storage-id'),
device => {
type => 'string',
- description => 'The block device you want to create the volume group on',
+ description => 'The block device you want to create the volume group on.'
+ . ' Multipath mapped devices are supported.',
},
add_storage => {
description => "Configure storage using the Volume Group",
@@ -149,11 +151,17 @@ __PACKAGE__->register_method({
my $user = $rpcenv->get_user();
my $name = $param->{name};
- my $dev = $param->{device};
+ my $reference = $param->{device};
my $node = $param->{node};
+ my $dev = PVE::Diskmanage::verify_blockdev_path($reference);
+ my $is_san = sub {
+ my ($device) = @_;
+ return PVE::Diskmanage::is_multipath_device($device)
+ || PVE::Diskmanage::is_san_device($device);
+ };
+ my $san = $is_san->($dev);
- $dev = PVE::Diskmanage::verify_blockdev_path($dev);
- PVE::Diskmanage::assert_disk_unused($dev);
+ PVE::Diskmanage::assert_disk_unused($dev, 1);
my $storage_params = {
type => 'lvm',
@@ -176,19 +184,45 @@ __PACKAGE__->register_method({
my $worker = sub {
PVE::Diskmanage::locked_disk_action(sub {
- PVE::Diskmanage::assert_disk_unused($dev);
- die "volume group with name '${name}' already exists on node '${node}'\n"
- if PVE::Storage::LVMPlugin::lvm_vgs()->{$name};
+ my $create = sub {
+ if ($san) {
+ $dev = PVE::Diskmanage::verify_blockdev_path($reference);
+ }
+ die "cannot use '$dev' - device topology changed\n"
+ if !$san && $is_san->($dev);
+ PVE::Diskmanage::assert_disk_unused($dev, 1);
+ die "volume group with name '${name}' already exists on node '${node}'\n"
+ if PVE::Storage::LVMPlugin::lvm_vgs()->{$name};
- if (PVE::Diskmanage::is_partition($dev)) {
- eval { PVE::Diskmanage::change_parttype($dev, '8E00'); };
- warn $@ if $@;
+ if (!$san && PVE::Diskmanage::is_partition($dev)) {
+ eval { PVE::Diskmanage::change_parttype($dev, '8E00'); };
+ warn $@ if $@;
+ }
+
+ my $guard = {
+ reference => $san ? $reference : $dev,
+ san => $san,
+ };
+ PVE::Storage::LVMPlugin::lvm_create_volume_group(
+ $guard->{reference},
+ $name,
+ undef,
+ $guard,
+ );
+
+ PVE::Diskmanage::udevadm_trigger($dev);
+ };
+
+ # Serialize with the storage API so two nodes cannot initialize the same LUN.
+ if ($san) {
+ PVE::Storage::lock_storage_config(
+ $create,
+ "creating volume group '$name' failed",
+ );
+ } else {
+ $create->();
}
- PVE::Storage::LVMPlugin::lvm_create_volume_group($dev, $name);
-
- PVE::Diskmanage::udevadm_trigger($dev);
-
if ($param->{add_storage}) {
PVE::API2::Storage::Config->create_or_update(
$name, $node, $storage_params, $verify_params,
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 807ef0ca..caad0fee 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -112,16 +112,23 @@ sub assert_local_device {
}
sub disk_is_used {
- my ($disk) = @_;
+ my ($disk, $allow_san) = @_;
my $dev = $disk;
$dev =~ s|^/dev/||;
my $disklist = get_disks($dev, 1, 1);
- die "'$disk' is not a valid local disk\n" if !defined($disklist->{$dev});
+ if (!defined($disklist->{$dev})) {
+ if ($allow_san) {
+ my $multipath = lookup_multipath_map($disk);
+ return defined($multipath->{used}) ? 1 : 0 if defined($multipath);
+ }
- assert_local_device($disk, $disklist);
+ die "'$disk' is not a valid local disk\n";
+ }
+
+ assert_local_device($disk, $disklist) if !$allow_san;
return $disklist->{$dev}->{used} ? 1 : 0;
}
@@ -941,6 +948,42 @@ sub get_multipath_disks {
return $disklist;
}
+sub is_san_device {
+ my ($devpath) = @_;
+
+ my $dev = strip_dev(abs_path($devpath) // $devpath);
+ $dev = strip_dev(get_blockdev("/dev/$dev")) if is_partition("/dev/$dev");
+ if ($dev =~ m/^nvme\d+n\d+$/) {
+ my $transport = get_nvme_transport("/sys/block/$dev") // '';
+ return $transport =~ m/^(?:tcp|rdma|fc)$/ ? 1 : 0;
+ }
+ my $link = readlink("/sys/block/$dev") // return 0;
+ return $link =~ m{/session\d+/|/rport-\d+} ? 1 : 0;
+}
+
+# An unreadable dm UUID counts as multipath so callers fail closed.
+sub is_multipath_device {
+ my ($devpath) = @_;
+
+ my $path = abs_path($devpath) // $devpath;
+ my $dev = strip_dev($path);
+ return 0 if $dev !~ m/^dm-\d+$/;
+
+ my $uuid = file_read_firstline("/sys/block/$dev/dm/uuid");
+ return 1 if !defined($uuid);
+ return $uuid =~ m/^(?:part\d+-)?mpath-/ ? 1 : 0;
+}
+
+sub lookup_multipath_map {
+ my ($devpath) = @_;
+
+ my $path = abs_path($devpath) // $devpath;
+ my $dev = strip_dev($path);
+ return undef if $dev !~ m/^dm-\d+$/;
+
+ return get_multipath_disks()->{$dev};
+}
+
sub get_partnum {
my ($part_path) = @_;
@@ -995,8 +1038,8 @@ sub locked_disk_action {
}
sub assert_disk_unused {
- my ($dev) = @_;
- die "device '$dev' is already in use\n" if disk_is_used($dev);
+ my ($dev, $allow_san) = @_;
+ die "device '$dev' is already in use\n" if disk_is_used($dev, $allow_san);
return;
}
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index d718d8f8..916f1b8f 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -147,10 +147,26 @@ sub clear_first_sector {
}
sub lvm_create_volume_group {
- my ($device, $vgname, $shared) = @_;
+ my ($device, $vgname, $shared, $guard) = @_;
+ $guard = {%$guard} if $guard;
- my $requested_device = $device;
- $device = PVE::Diskmanage::verify_blockdev_path($device);
+ my $requested_device = $guard ? $guard->{reference} : $device;
+ $device = PVE::Diskmanage::verify_blockdev_path($requested_device);
+ my $san = $guard && $guard->{san};
+ if ($guard) {
+ if (!$san) {
+ $guard->{verify} = sub {
+ die "cannot use '$device' - device topology changed\n"
+ if PVE::Diskmanage::is_multipath_device($device)
+ || PVE::Diskmanage::is_san_device($device);
+ };
+ $guard->{verify}->();
+ }
+ }
+ my $check_instance = sub { $guard->{verify}->() if $guard && $guard->{verify} };
+ my $check_safe = sub {
+ $check_instance->();
+ };
my $refuse_data = sub {
my (@types) = @_;
die "device '$device' contains data ("
@@ -208,6 +224,7 @@ sub lvm_create_volume_group {
}
my %signatures = map { $_->{type} => 1 } $probe->@*;
my $res = lvm_pv_info($device, $signatures{LVM2_member});
+ $check_instance->();
# A PV without metadata copies can belong to a VG whose other devices are not visible. The
# sentinel is not a VG name or orphan proof, even if the use flag contradicts it.
@@ -223,17 +240,20 @@ sub lvm_create_volume_group {
delete $signatures{LVM2_member} if $res && !$res->{vgname};
$refuse_data->(keys %signatures) if %signatures;
- clear_first_sector($device); # else pvcreate fails
+ $check_safe->();
+ clear_first_sector($device);
# we use --metadatasize 250k, which reseults in "pe_start = 512"
# so pe_start is aligned on a 128k boundary (advantage for SSDs)
my $cmd = ['/sbin/pvcreate', '--metadatasize', '250k', $device];
+ $check_safe->();
run_command($cmd, errmsg => "pvcreate '$device' error");
$cmd = ['/sbin/vgcreate', $vgname, $device];
# push @$cmd, '-c', 'y' if $shared; # we do not use this yet
+ $check_safe->();
run_command(
$cmd,
errmsg => "vgcreate $vgname $device error",
@@ -1067,6 +1087,8 @@ sub on_add_hook {
assert_device_discard_supported($path)
if discard_on_remove_requested($scfg->{'on-volume-remove'});
+ # The storage API runs this hook under the cluster-wide storage configuration lock, which
+ # the disk API also takes for shared devices, so two nodes cannot initialize the same LUN.
lvm_create_volume_group($path, $scfg->{vgname}, $scfg->{shared});
}
diff --git a/src/test/disk_api_test.pm b/src/test/disk_api_test.pm
index c7735c0f..893b4e04 100644
--- a/src/test/disk_api_test.pm
+++ b/src/test/disk_api_test.pm
@@ -6,7 +6,10 @@ use warnings;
use lib qw(..);
use PVE::API2::Disks;
+use PVE::API2::Disks::LVM;
use PVE::Diskmanage;
+use PVE::Storage;
+use PVE::Storage::LVMPlugin;
use Test::MockModule;
use Test::More;
@@ -110,4 +113,106 @@ is_deeply(
'partitions inherit the visibility of their parent disk',
);
+subtest 'a volume group on a map is created under the storage configuration lock' => sub {
+ my $storage = Test::MockModule->new('PVE::Storage');
+ my $disk = $diskmanage_module;
+ my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+ my $rpc = Test::MockModule->new('PVE::RPCEnvironment');
+ my (@stack, @created);
+ my $lock = sub {
+ my ($name, $code) = @_;
+ push @stack, $name;
+ my $res = eval { $code->() };
+ my $err = $@;
+ pop @stack;
+ die $err if $err;
+ return $res;
+ };
+ $storage->mock(lock_storage_config => sub { $lock->('storage.cfg', $_[0]) });
+ $disk->mock(locked_disk_action => sub { $lock->('disk', $_[0]) });
+ $disk->mock(verify_blockdev_path => sub { $_[0] });
+ $disk->mock(assert_disk_unused => sub { });
+ $disk->mock(is_partition => sub { 0 });
+ $disk->mock(udevadm_trigger => sub { });
+ $lvm->mock(lvm_vgs => sub { {} });
+ $lvm->mock(lvm_create_volume_group => sub { push @created, [$_[0], join('>', @stack)] });
+ {
+
+ package MultipathTestRPC;
+ sub get_user { 'root@pam' }
+ sub check { 1 }
+ sub fork_worker { $_[4]->(); return 'test-upid' }
+ }
+ $rpc->mock(get => sub { bless {}, 'MultipathTestRPC' });
+
+ my ($is_map, $is_san) = (1, 0);
+ $disk->mock(is_multipath_device => sub { $is_map });
+ $disk->mock(is_san_device => sub { $is_san });
+ PVE::API2::Disks::LVM->create({ node => 'n1', name => 'vg1', device => '/dev/dm-3' });
+ ($is_map, $is_san) = (0, 1);
+ PVE::API2::Disks::LVM->create({ node => 'n1', name => 'vg2', device => '/dev/sdc' });
+ ($is_map, $is_san) = (0, 0);
+ PVE::API2::Disks::LVM->create({ node => 'n1', name => 'vg3', device => '/dev/sdb' });
+ is_deeply(
+ \@created,
+ [
+ ['/dev/dm-3', 'disk>storage.cfg'],
+ ['/dev/sdc', 'disk>storage.cfg'],
+ ['/dev/sdb', 'disk'],
+ ],
+ 'a map or SAN LUN is initialized under the cluster-wide lock, a local disk is not',
+ );
+ @created = ();
+ $disk->mock(assert_disk_unused => sub { die "device is already in use\n" });
+ eval {
+ PVE::API2::Disks::LVM->create({
+ node => 'n1',
+ name => 'vg',
+ device => '/dev/sdc',
+ });
+ };
+ like($@, qr/already in use/, 'disk API rejects a used inventory entry');
+ is_deeply(\@created, [], 'used inventory prevents initialization');
+ $disk->mock(assert_disk_unused => sub { });
+ $lvm->mock(lvm_vgs => sub { { vg => {} } });
+ eval {
+ PVE::API2::Disks::LVM->create({
+ node => 'n1',
+ name => 'vg',
+ device => '/dev/sdc',
+ });
+ };
+ like(
+ $@,
+ qr/volume group with name 'vg' already exists/,
+ 'stale inventory does not permit an existing VG',
+ );
+ is_deeply(\@created, [], 'existing VG prevents initialization');
+ $disk->unmock($_)
+ for qw(
+ locked_disk_action verify_blockdev_path assert_disk_unused is_partition
+ udevadm_trigger is_multipath_device is_san_device
+ );
+};
+
+subtest 'only multipath maps count as shared devices' => sub {
+ my $disk = $diskmanage_module;
+ my $uuid;
+ $disk->mock(abs_path => sub { $_[0] =~ m!^/dev/(?:mapper|disk)/! ? '/dev/dm-900' : $_[0] });
+ $disk->mock(file_read_firstline => sub { $uuid });
+ $uuid = 'mpath-3600abc';
+ ok(PVE::Diskmanage::is_multipath_device('/dev/disk/by-id/dm-name-lun'), 'a map alias');
+ $uuid = 'part1-mpath-3600abc';
+ ok(PVE::Diskmanage::is_multipath_device('/dev/mapper/lunp1'), 'a partition of a map');
+ $uuid = 'LVM-abcdef';
+ ok(!PVE::Diskmanage::is_multipath_device('/dev/mapper/vg-lv'), 'not a logical volume');
+ $uuid = undef;
+ ok(
+ PVE::Diskmanage::is_multipath_device('/dev/mapper/x'),
+ 'an unreadable identity is shared',
+ );
+ ok(!PVE::Diskmanage::is_multipath_device('/dev/sdb'), 'a plain disk is not');
+ $disk->unmock($_) for qw(abs_path file_read_firstline);
+};
+
done_testing();
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index dd4e4d73..21823daa 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -236,12 +236,35 @@ sub test_disk_list {
print Dumper($multipath) if $print;
$testcount++;
is_deeply($multipath, $expected_multipath, 'multipath list should be the same');
+
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/dm-0'); };
+ $testcount++;
+ like($@, qr/not a valid local disk/,
+ 'multipath devices require an explicit opt-in');
+
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/mapper/mpatha', 1); };
+ $testcount++;
+ is($@, '', 'unused multipath alias should pass');
+
+ for my $dev (qw(dm-1 dm-2 dm-3 dm-4)) {
+ eval { PVE::Diskmanage::assert_disk_unused("/dev/$dev", 1); };
+ $testcount++;
+ like($@, qr/already in use/, "used multipath device $dev should fail");
+ }
+
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/dm-99', 1); };
+ $testcount++;
+ like($@, qr/not a valid local disk/, 'unknown device mapper device should fail');
}
if ($testcasedir eq 'iscsi') {
eval { PVE::Diskmanage::assert_disk_unused('/dev/sda'); };
$testcount++;
like($@, qr/attached over iSCSI/, 'local disk operations reject an iSCSI LUN');
+
+ eval { PVE::Diskmanage::assert_disk_unused('/dev/sda', 1); };
+ $testcount++;
+ is($@, '', 'the SAN opt-in accepts an unused iSCSI LUN');
}
done_testing($testcount);
--
2.47.3
^ permalink raw reply related [relevance 9%]
* [PATCH v3 storage 23/76] diskmanage: collect native NVMe multipath path state
2026-11-05 23:30 5% [PATCH v3 proxmox,proxmox-perl-rs,cluster,storage,docs,manager 00/76] SAN: cluster-wide multipath, SAN views and a guided storage setup Thomas Lamprecht
` (2 preceding siblings ...)
2026-11-05 23:30 9% ` [PATCH v3 storage 21/76] disks: lvm: allow volume groups on SAN LUNs and multipath maps Thomas Lamprecht
@ 2026-11-05 23:30 13% ` Thomas Lamprecht
2026-11-05 23:31 8% ` [PATCH v3 docs 44/76] storage: document the cluster-wide multipath management Thomas Lamprecht
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-05 23:30 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
NVMe over Fabrics usually uses native multipath, whose paths are
unknown to multipathd. Collect controller state and address, plus
per-path namespace ANA state, from sysfs and group them by head
namespace. This allows uniform health reporting for both multipath
stacks. Local single-controller devices have no per-path entries and
are omitted.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[TL: drop redundant comments]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 60 +++++++++++++++++++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../multipath/nvme_path_status_expected.json | 19 ++++++
src/test/disklist_test.pm | 16 +++++
11 files changed, 103 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
create mode 100644 src/test/disk_tests/multipath/nvme_path_status_expected.json
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index caad0fee..a7eb2b21 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -974,6 +974,66 @@ sub is_multipath_device {
return $uuid =~ m/^(?:part\d+-)?mpath-/ ? 1 : 0;
}
+# Native multipath creates per-path namespace children nvmeXcYnZ below controllers. Local
+# single-controller devices lack these children and are omitted.
+sub get_nvme_path_status {
+ my $res = {};
+
+ dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ 'nvme-subsys\d+',
+ sub {
+ my ($subsys) = @_;
+ my $subsysdir = "/sys/class/nvme-subsystem/$subsys";
+
+ dir_glob_foreach(
+ $subsysdir,
+ 'nvme\d+',
+ sub {
+ my ($ctrl) = @_;
+ my $ctrldir = "$subsysdir/$ctrl";
+ my $state = file_read_firstline("$ctrldir/state") // return;
+ my $address = file_read_firstline("$ctrldir/address");
+
+ dir_glob_foreach(
+ $ctrldir,
+ 'nvme\d+c\d+n\d+',
+ sub {
+ my ($pathdev) = @_;
+ return if $pathdev !~ m/^nvme(\d+)c\d+n(\d+)$/;
+ my $head = "nvme$1n$2";
+
+ my $entry = { device => "/dev/$ctrl", state => $state };
+ $entry->{address} = $address
+ if defined($address) && $address ne '';
+ my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
+ $entry->{'ana-state'} = $ana if defined($ana);
+
+ # 'change' is transient; paths in 'inaccessible' or 'persistent-loss'
+ # cannot serve IO even on a live controller
+ my $usable = $state eq 'live'
+ && (!defined($ana)
+ || $ana eq 'optimized'
+ || $ana eq 'non-optimized');
+
+ my $status = $res->{$head} //= { active => 0, paths => [] };
+ $status->{active}++ if $usable;
+ push @{ $status->{paths} }, $entry;
+ },
+ );
+ },
+ );
+ },
+ );
+
+ for my $status (values %$res) {
+ @{ $status->{paths} } =
+ sort { $a->{device} cmp $b->{device} } @{ $status->{paths} };
+ }
+
+ return $res;
+}
+
sub lookup_multipath_map {
my ($devpath) = @_;
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
new file mode 100644
index 00000000..803fab3e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
@@ -0,0 +1 @@
+traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
new file mode 100644
index 00000000..e48c58f5
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
@@ -0,0 +1 @@
+optimized
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
new file mode 100644
index 00000000..36618744
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
@@ -0,0 +1 @@
+traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
new file mode 100644
index 00000000..436c48ee
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
@@ -0,0 +1 @@
+inaccessible
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
new file mode 100644
index 00000000..f99fcb14
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
@@ -0,0 +1 @@
+0000:02:00.0
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
new file mode 100644
index 00000000..e23fe645
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme_path_status_expected.json b/src/test/disk_tests/multipath/nvme_path_status_expected.json
new file mode 100644
index 00000000..62611b3f
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme_path_status_expected.json
@@ -0,0 +1,19 @@
+{
+ "nvme2n1": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/nvme3",
+ "state": "live",
+ "address": "traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "optimized"
+ },
+ {
+ "device": "/dev/nvme4",
+ "state": "live",
+ "address": "traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "inaccessible"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 21823daa..c6fb620c 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -111,6 +111,7 @@ sub mocked_file_read_firstline {
my $originalsub = $diskmanage_module->original('file_read_firstline');
$path =~ s|^/sys/block|disk_tests/$testcasedir|;
+ $path =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|;
return &$originalsub($path);
}
@@ -120,6 +121,12 @@ sub mocked_dir_glob_foreach {
my $lines = [];
+ # nvme subsystem trees are provided as directories, glob them like production code
+ if ($dir =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|) {
+ my $originalsub = $diskmanage_module->original('dir_glob_foreach');
+ return &$originalsub($dir, $regex, $sub);
+ }
+
# read lines in from file
if ($dir =~ m{^/sys/block$}) {
@$lines = split(/\n/, read_test_file('disklist'));
@@ -267,6 +274,15 @@ sub test_disk_list {
is($@, '', 'the SAN opt-in accepts an unused iSCSI LUN');
}
+ if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'nvme path status should be the same');
+ }
+
done_testing($testcount);
};
}
--
2.47.3
^ permalink raw reply related [relevance 13%]
* [PATCH v3 proxmox,proxmox-perl-rs,cluster,storage,docs,manager 00/76] SAN: cluster-wide multipath, SAN views and a guided storage setup
@ 2026-11-05 23:30 5% Thomas Lamprecht
2026-11-05 23:30 6% ` [PATCH v3 storage 05/76] lvm: find a shared volume group created by another node Thomas Lamprecht
` (4 more replies)
0 siblings, 5 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-05 23:30 UTC (permalink / raw)
To: pve-devel
This v3 combines the cluster-wide multipath series [0][1] with
Dietmar's RFC for guided remote storage setup and SAN visibility [2].
What it adds:
- cluster-wide dm-multipath management through /etc/pve/multipath.cfg:
iSCSI storages with the new 'multipath' option supply their LUNs;
explicit entries cover individual LUNs, for example Fibre Channel.
pvestatd applies the configuration on each node without removing
allow-list entries added by hand or for boot from SAN. Array-specific
settings go in /etc/pve/multipath-overrides.conf.
- SAN views: Datacenter > SAN shows node status and initiator names
for target access rules. Its Multipath view groups path health per
LUN, including expected paths, report age, and unresolved identities.
Node > SAN lists LUNs, paths, usage, and iSCSI targets and sessions,
with actions to enable multipath or wipe a LUN as root@pam.
- guided setup for NFS, SMB/CIFS, iSCSI, Fibre Channel, and ZFS over
iSCSI. For shared LVM over iSCSI, it creates or reuses the connection
storage, waits for LUN discovery, and creates a volume group on the
selected LUN, using its map when multipath is enabled. Partial setups
retain their settings and retry only missing steps; unanswered
requests are checked before retrying.
- guards for destructive actions: SAN wipes and volume-group creation
check cluster storage references, local users, and device identities.
Before a wipe, the web UI also asks the other nodes for users of the
LUN. Wipes keep the checked device references and recheck identities
between writes. Inconclusive checks refuse the operation. Session
logout is refused if it would remove the last usable path of a LUN in
use. Cluster locks do not cover hosts outside the cluster.
Patches 04-11 are independent fixes and could go in first, with their
documentation and pvestatd parts in patches 43 and 46: status-only
activation and bounded LVM queries, shared VGs missed by LVM hints,
per-target rescans, LUNs listed per iSCSI session, validation before
volume-group creation, and a target check that refuses composite
devices. The smaller fixes for SCSI padding, iSCSI discovery errors,
iSER and offload sessions, LVM base volumes and the iSCSI edit dialog
are already applied.
Changes since v2:
- combined with Dietmar's RFC; multipath is an iSCSI storage option
rather than a separate per-LUN storage type
- Node > SAN offers Enable Multipath; the datacenter view uses one
row per LUN with expandable node details, not a column per node
(Dominik)
- addressed Dominik's API and code remarks: add_wwid accepts alias and
settings, alias changes use the update endpoint, config helpers are
renamed, group_by_tpg is available, and the overrides example is
fixed
- preserved existing allow-list entries, addressing Maximiliano's
migration concern without a warning on first use
- added expected path counts, stalled-node detection, withdrawn LUN
status, unresolved identities, and duplicate-PV hints for clones
- added LVM and wipe guards, bounded status commands, the node iSCSI
API, and pvenode commands
- added an admin guide chapter, including removal, growth, and clone
procedures tested on real hardware
- moved the parsing of multipathd map status and the health derivation
to a new proxmox-multipath crate, used through pve-rs bindings
Testing used a five-node nested cluster attached to a NetApp AFF A20
through two independent paths over iSCSI and NVMe/TCP, plus host-side
Linux LIO and nvmet targets. Scenarios covered path, LIF, and
whole-array outages with guests running; LUN unmapping with queued I/O;
revoked node access; online growth; snapshot clones; reboot; and adding
30 LUNs at once. Wizard and wipe tests covered lost responses, stuck
tasks, denied logins, and LVM metadata written by other nodes. The
screens were also reviewed from four user perspectives. The bounded
status commands and the wizard's LUN identity check also have focused
regression tests. Fibre Channel and offload iSCSI initiators, which can
run several sessions on one SCSI host, were not tested on hardware.
Open points:
- path-redundancy loss is visible in the web UI and API but sends no
notification (can be more easily done once Lukas' notification
matcher rework has landed)
- an optimal LUN is marked incomplete while its state on an expected
node is unknown, but there is no count of the current reports per LUN
- LUN removal is documented, not guided - can be added later.
- if thin_check takes longer than the shared status-command budget,
that status pass reports no LVM or LVM-thin status. Later passes
retry the activation; starting a guest activates the pool without
this budget
- pvcreate and vgcreate receive a checked, identity-bearing by-id name,
but resolve it themselves, leaving a short race after the final check
- integration with the per-node target and portal mapping work [3][4]
Apply in patch order. The pve-rs bindings need the proxmox-multipath
crate packaged first. pve-storage needs pve-cluster with the multipath
configuration files registered and libpve-rs-perl with the bindings.
pve-manager needs the matching pve-storage APIs and status-command
helper, plus the pve-docs and pve-doc-generator changes.
Feature-specific dependency bumps are deferred until the providing
package versions are known and must be added before shipping. This
includes a Breaks of libpve-storage-perl on older pve-manager, whose
Ceph OSD creation would accept the iSCSI LUNs that the disk list now
includes (patch 45).
[0]: https://lore.proxmox.com/pve-devel/20260626121000.2095591-1-t.lamprecht@proxmox.com/
[1]: https://lore.proxmox.com/pve-devel/20260703124707.1172980-2-t.lamprecht@proxmox.com/
[2]: https://lore.proxmox.com/pve-devel/20260731102156.3947857-1-dietmar@proxmox.com/
[3]: https://lore.proxmox.com/pve-devel/20260430173220.441001-1-m.limbeck@proxmox.com/
[4]: https://lore.proxmox.com/pve-devel/20260804090819.2136483-1-dietmar@proxmox.com/
proxmox:
Thomas Lamprecht (1):
add proxmox-multipath crate
Cargo.toml | 2 +
proxmox-multipath/Cargo.toml | 17 ++
proxmox-multipath/debian/changelog | 7 +
proxmox-multipath/debian/control | 38 +++
proxmox-multipath/debian/copyright | 18 ++
proxmox-multipath/debian/debcargo.toml | 7 +
proxmox-multipath/src/lib.rs | 531 +++++++++++++++++++++++++++++++++
7 files changed, 620 insertions(+)
proxmox-perl-rs:
Thomas Lamprecht (1):
pve-rs: add PVE::RS::Multipath bindings for multipathd status parsing
pve-rs/Cargo.toml | 1 +
pve-rs/Makefile | 2 ++
pve-rs/debian/control | 1 +
pve-rs/src/bindings/mod.rs | 3 ++
pve-rs/src/bindings/multipath.rs | 40 ++++++++++++++++++++++
pve-rs/test/Makefile | 1 +
pve-rs/test/multipath.pl | 74 ++++++++++++++++++++++++++++++++++++++++
7 files changed, 122 insertions(+)
pve-cluster:
Thomas Lamprecht (1):
cfs: observe the multipath configuration files
src/PVE/Cluster.pm | 2 ++
src/pmxcfs/status.c | 2 ++
2 files changed, 4 insertions(+)
pve-storage:
Dietmar Maurer (12):
diskmanage: collect disk transport type from lsblk
diskmanage: add helper to list multipath devices
diskmanage: qualify NVMe over fabrics transport
disks: list: add include-remote parameter
diskmanage: include iSCSI session devices in disk enumeration
diskmanage: link multipath member disks to their map device
iscsi: factor out session device map from device list
api: scan: add a SAN LUN inventory
pvesm: expose the SAN LUN inventory
diskmanage: collect native NVMe multipath path state
api: scan: san-luns: report path state
api: add node-level iSCSI status and maintenance
Thomas Lamprecht (27):
storage: distinguish status-only activation in plugins
lvm: find a shared volume group created by another node
storage: bound LVM status commands
iscsi: rate-limit session rescans per target
iscsi: list the LUNs of each session, not of its SCSI host
lvm: refuse to create a volume group on a device that holds data
lvm: refuse a base volume of a target that serves disk images
iscsi: refuse virtual devices other than multipath maps as volumes
disks: lvm: allow volume groups on SAN LUNs and multipath maps
multipath: add a library around multipathd
diskmanage: collect local block device users
api: iscsi: add session logout with last-path protection
multipath: add a cluster-wide configuration
iscsi: add an option to manage storage LUNs with multipath
lvm: activate a missing base volume before using the volume group
multipath: apply the configuration on every node
iscsi: share the initiator identity reader
multipath: publish per-node status
api: add endpoints for the cluster-wide multipath configuration
api: multipath: add the cluster-wide health status
multipath: collect identities of non-iSCSI SCSI paths
api: scan: san-luns: report the multipath state of each LUN
api: scan: flag duplicate physical volumes on distinct LUNs
api: disks: recheck local users and retain wipe device references
iscsi: name plain LUNs after their identity link
api: disks: guard SAN wipes with stable identities and storage checks
api: scan: refresh SAN usage with bounded probes
ApiChangeLog | 24 +
debian/control | 2 +
src/PVE/API2/Disks.pm | 76 +-
src/PVE/API2/Disks/LVM.pm | 74 +-
src/PVE/API2/ISCSI.pm | 423 +++++++
src/PVE/API2/Makefile | 2 +
src/PVE/API2/Multipath.pm | 689 +++++++++++
src/PVE/API2/Storage/Scan.pm | 247 ++++
src/PVE/CLI/pvesm.pm | 13 +
src/PVE/Diskmanage.pm | 1007 +++++++++++++++-
src/PVE/Makefile | 6 +
src/PVE/Multipath.pm | 375 ++++++
src/PVE/Multipath/ClusterConfig.pm | 64 +
src/PVE/Multipath/Config.pm | 451 +++++++
src/PVE/Multipath/Generator.pm | 314 +++++
src/PVE/Multipath/Identity.pm | 402 +++++++
src/PVE/Multipath/Status.pm | 486 ++++++++
src/PVE/Storage.pm | 272 ++++-
src/PVE/Storage/ISCSIPlugin.pm | 695 +++++++++--
src/PVE/Storage/LVMPlugin.pm | 323 ++++-
src/PVE/Storage/LvmThinPlugin.pm | 39 +-
src/PVE/Storage/Makefile | 4 +-
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/SANScan.pm | 429 +++++++
src/PVE/Storage/StatusCommand.pm | 241 ++++
src/test/Makefile | 61 +-
src/test/disk_api_test.pm | 194 +++
src/test/disk_tests/iscsi/disklist | 1 +
src/test/disk_tests/iscsi/disklist_expected.json | 19 +
src/test/disk_tests/iscsi/lsblk | 5 +
src/test/disk_tests/iscsi/sda/device/model | 1 +
src/test/disk_tests/iscsi/sda/device/vendor | 1 +
src/test/disk_tests/iscsi/sda/queue/rotational | 1 +
src/test/disk_tests/iscsi/sda/size | 1 +
src/test/disk_tests/iscsi/sda_udevadm | 21 +
src/test/disk_tests/multipath/disklist | 11 +
.../disk_tests/multipath/disklist_expected.json | 111 ++
src/test/disk_tests/multipath/dm-0/dm/name | 1 +
src/test/disk_tests/multipath/dm-0/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-0/size | 1 +
src/test/disk_tests/multipath/dm-0_slaves | 4 +
src/test/disk_tests/multipath/dm-1/dm/name | 1 +
src/test/disk_tests/multipath/dm-1/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-1/size | 1 +
src/test/disk_tests/multipath/dm-1_slaves | 4 +
src/test/disk_tests/multipath/dm-2/dm/name | 1 +
src/test/disk_tests/multipath/dm-2/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-2/size | 1 +
src/test/disk_tests/multipath/dm-2_slaves | 1 +
src/test/disk_tests/multipath/dm-3/dm/name | 1 +
src/test/disk_tests/multipath/dm-3/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-3/size | 1 +
src/test/disk_tests/multipath/dm-3_slaves | 1 +
src/test/disk_tests/multipath/dm-4/dm/name | 1 +
src/test/disk_tests/multipath/dm-4/dm/uuid | 1 +
src/test/disk_tests/multipath/dm-4/size | 1 +
src/test/disk_tests/multipath/dm-4_slaves | 1 +
src/test/disk_tests/multipath/lsblk | 77 ++
src/test/disk_tests/multipath/lvs | 0
src/test/disk_tests/multipath/mounts | 1 +
.../disk_tests/multipath/multipath_expected.json | 59 +
src/test/disk_tests/multipath/multipathd | 124 ++
.../multipath/multipathd_status_expected.json | 42 +
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
src/test/disk_tests/multipath/nvme8n1/device/model | 1 +
.../disk_tests/multipath/nvme8n1/device/transport | 1 +
.../disk_tests/multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 +
src/test/disk_tests/multipath/nvme9n1/device/model | 1 +
.../disk_tests/multipath/nvme9n1/device/transport | 1 +
.../disk_tests/multipath/nvme9n1/device/vendor | 1 +
.../disk_tests/multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +
.../multipath/nvme_path_status_expected.json | 19 +
src/test/disk_tests/multipath/partlist | 0
src/test/disk_tests/multipath/pvs | 1 +
src/test/disk_tests/multipath/sda/device/model | 1 +
src/test/disk_tests/multipath/sda/device/vendor | 1 +
src/test/disk_tests/multipath/sda/holders/holder | 1 +
src/test/disk_tests/multipath/sda/queue/rotational | 1 +
src/test/disk_tests/multipath/sda/size | 1 +
src/test/disk_tests/multipath/sda_udevadm | 18 +
src/test/disk_tests/multipath/sdb/device/model | 1 +
src/test/disk_tests/multipath/sdb/device/vendor | 1 +
src/test/disk_tests/multipath/sdb/holders/holder | 1 +
src/test/disk_tests/multipath/sdb/queue/rotational | 1 +
src/test/disk_tests/multipath/sdb/size | 1 +
src/test/disk_tests/multipath/sdb_udevadm | 18 +
src/test/disk_tests/multipath/sdc/device/model | 1 +
src/test/disk_tests/multipath/sdc/device/vendor | 1 +
src/test/disk_tests/multipath/sdc/holders/holder | 1 +
src/test/disk_tests/multipath/sdc/queue/rotational | 1 +
src/test/disk_tests/multipath/sdc/size | 1 +
src/test/disk_tests/multipath/sdc_udevadm | 18 +
src/test/disk_tests/multipath/sdd/device/model | 1 +
src/test/disk_tests/multipath/sdd/device/vendor | 1 +
src/test/disk_tests/multipath/sdd/holders/holder | 1 +
src/test/disk_tests/multipath/sdd/queue/rotational | 1 +
src/test/disk_tests/multipath/sdd/size | 1 +
src/test/disk_tests/multipath/sdd_udevadm | 18 +
src/test/disk_tests/multipath/zpool | 1 +
src/test/disk_tests/sas/disklist_expected.json | 1 +
src/test/disk_tests/sas/lsblk | 5 +
src/test/disklist_test.pm | 117 +-
src/test/lvm-fixtures/README.md | 20 +
.../lvm-fixtures/lab1-nomda-orphan-derived.colon | 2 +
src/test/lvm-fixtures/lab1-nomda-orphan.txt | 23 +
src/test/run_block_device_users_tests.pl | 172 +++
src/test/run_disk_api_tests.pl | 11 +
src/test/run_iscsi_activation_tests.pl | 171 +++
src/test/run_iscsi_device_list_tests.pl | 78 ++
src/test/run_iscsi_logout_tests.pl | 271 +++++
src/test/run_iscsi_rescan_tests.pl | 109 ++
src/test/run_iscsi_session_tests.pl | 15 +-
src/test/run_iscsi_volume_tests.pl | 81 +-
src/test/run_lun_identity_tests.pl | 1262 ++++++++++++++++++++
src/test/run_multipath_api_tests.pl | 693 +++++++++++
src/test/run_multipath_tests.pl | 1240 +++++++++++++++++++
src/test/run_san_api_tests.pl | 180 +++
src/test/run_san_library_tests.pl | 77 ++
src/test/run_san_lun_scan_tests.pl | 945 +++++++++++++++
src/test/run_san_lvm_create_tests.pl | 611 ++++++++++
src/test/run_san_taint_tests.pl | 80 ++
src/test/run_san_wipe_tests.pl | 673 +++++++++++
src/test/run_status_command_contention_tests.pl | 520 ++++++++
src/test/run_status_command_tests.pl | 189 +++
src/test/run_test_lvm_base_activation.pl | 130 ++
src/test/run_test_lvm_base_conflicts.pl | 62 +
src/test/run_test_lvm_base_volume.pl | 8 +-
src/test/run_test_lvm_create.pl | 243 ++++
src/test/run_test_lvm_hints.pl | 110 ++
src/test/run_test_lvm_status.pl | 220 ++++
src/test/run_wipe_partition_tests.pl | 387 ++++++
src/test/run_wipe_readiness_tests.pl | 138 +++
src/test/run_wipe_reference_tests.pl | 243 ++++
src/test/run_wipedisk_tests.pl | 110 ++
145 files changed, 16554 insertions(+), 215 deletions(-)
pve-docs:
Thomas Lamprecht (2):
storage: lvm: note the rescan after extending a shared volume group
storage: document the cluster-wide multipath management
pve-storage-iscsi.adoc | 13 +-
pve-storage-lvm.adoc | 9 +
pve-storage-multipath.adoc | 527 +++++++++++++++++++++++++++++++++++++++++++++
pvesm.adoc | 13 +-
4 files changed, 554 insertions(+), 8 deletions(-)
pve-manager:
Dietmar Maurer (10):
ui: storage: allow changing the node for NFS/CIFS scans
ui: storage: add guided remote storage wizard with NFS support
ui: storage wizard: add SMB/CIFS support
ui: storage wizard: add ZFS over iSCSI support
ui: dc: storage: add remote storage wizard entry to the add menu
ui: node: add SAN LUNs panel
ui: san luns: show multipath path state
api: nodes: expose iSCSI status and maintenance
pvenode: add iscsi commands
ui: node: san: add iSCSI target and session management
Thomas Lamprecht (22):
api: ceph: osd: keep iSCSI LUNs out of OSD creation
pvestatd: track pending storage status commands across re-exec
ui: storage: factor out the scan picker error mask
ui: storage: nfs: show scan errors and empty results
ui: storage wizard: preserve settings after partial setup
ui: storage wizard: add Fibre Channel shared LVM setup
ui: storage wizard: reconcile unanswered storage creation
pvestatd: apply the multipath configuration and report the node status
api: cluster: add the multipath endpoints
ui: dc: add a cluster-wide multipath view
ui: storage: iscsi: add the multipath option
ui: san luns: show multipath state and manage LUN entries
ui: storage wizard: add iSCSI support
ui: storage wizard: iscsi: show cluster initiator names
ui: storage wizard: iscsi: enable multipath for shared LVM
ui: node: san: wipe a LUN that no storage uses
ui: storage wizard: iscsi: reuse existing target connections
ui: storage wizard: fibre channel: enable multipath for a LUN
ui: storage wizard: let root@pam wipe a LUN with data
ui: storage wizard: do not offer LUNs in use for a new volume group
ui: san: show the local users of a LUN in its usage tooltip
ui: san: check the other nodes for users before wiping a LUN
PVE/API2/Ceph/OSD.pm | 3 +
PVE/API2/Cluster.pm | 7 +
PVE/API2/Nodes.pm | 7 +
PVE/CLI/pvenode.pm | 48 ++
PVE/Service/pvestatd.pm | 34 +
debian/control | 1 +
test/Makefile | 10 +
test/SANUtils_test.js | 204 +++++
test/StorageWizard_test.js | 128 +++
www/manager6/Makefile | 21 +
www/manager6/SANUtils.js | 579 +++++++++++++
www/manager6/Utils.js | 47 ++
www/manager6/dc/Config.js | 28 +-
www/manager6/dc/Multipath.js | 535 ++++++++++++
www/manager6/dc/MultipathWwidEdit.js | 233 ++++++
www/manager6/dc/SAN.js | 326 ++++++++
www/manager6/dc/StorageView.js | 13 +-
www/manager6/node/Config.js | 24 +
www/manager6/node/ISCSITargets.js | 615 ++++++++++++++
www/manager6/node/SANLuns.js | 771 ++++++++++++++++++
www/manager6/panel/SANNotice.js | 26 +
www/manager6/storage/CIFSEdit.js | 29 +-
www/manager6/storage/IScsiEdit.js | 38 +
www/manager6/storage/NFSEdit.js | 13 +
www/manager6/storage/wizard/CIFS.js | 118 +++
www/manager6/storage/wizard/CommonSettings.js | 75 ++
www/manager6/storage/wizard/FCRecovery.js | 242 ++++++
www/manager6/storage/wizard/FibreChannel.js | 1083 +++++++++++++++++++++++++
www/manager6/storage/wizard/IScsi.js | 707 ++++++++++++++++
www/manager6/storage/wizard/LunPicker.js | 101 +++
www/manager6/storage/wizard/LunSelect.js | 485 +++++++++++
www/manager6/storage/wizard/NFS.js | 89 ++
www/manager6/storage/wizard/NodeIdentities.js | 123 +++
www/manager6/storage/wizard/SanLvm.js | 179 ++++
www/manager6/storage/wizard/WipeStatus.js | 34 +
www/manager6/storage/wizard/Wizard.js | 970 ++++++++++++++++++++++
www/manager6/storage/wizard/ZFSOverISCSI.js | 180 ++++
www/manager6/window/SANLunWipe.js | 331 ++++++++
38 files changed, 8432 insertions(+), 25 deletions(-)
^ permalink raw reply [relevance 5%]
* [PATCH v3 storage 14/76] diskmanage: qualify NVMe over fabrics transport
2026-11-05 23:30 5% [PATCH v3 proxmox,proxmox-perl-rs,cluster,storage,docs,manager 00/76] SAN: cluster-wide multipath, SAN views and a guided storage setup Thomas Lamprecht
2026-11-05 23:30 6% ` [PATCH v3 storage 05/76] lvm: find a shared volume group created by another node Thomas Lamprecht
@ 2026-11-05 23:30 14% ` Thomas Lamprecht
2026-11-05 23:30 9% ` [PATCH v3 storage 21/76] disks: lvm: allow volume groups on SAN LUNs and multipath maps Thomas Lamprecht
` (2 subsequent siblings)
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-05 23:30 UTC (permalink / raw)
To: pve-devel
From: Dietmar Maurer <dietmar@proxmox.com>
lsblk reports 'nvme' for fabrics-attached namespaces, preventing clients
from distinguishing them from local PCIe drives. Read the transport from
the controller, or a subsystem controller for native multipath, and
report nvme-fc, nvme-tcp, nvme-rdma, or nvme-loop instead.
This lets SAN scans and local storage dialogs select suitable devices
without hiding fabrics-attached namespaces server-side.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Diskmanage.pm | 27 +++++++++++++++
src/test/disk_tests/multipath/disklist | 2 ++
.../multipath/disklist_expected.json | 33 +++++++++++++++++++
src/test/disk_tests/multipath/lsblk | 14 ++++++++
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 ++++++++
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +++++++
15 files changed, 111 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme8n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme8n1/size
create mode 100644 src/test/disk_tests/multipath/nvme8n1_udevadm
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/vendor
create mode 100644 src/test/disk_tests/multipath/nvme9n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme9n1/size
create mode 100644 src/test/disk_tests/multipath/nvme9n1_udevadm
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index e950b6dd..bc81e854 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -503,6 +503,26 @@ sub is_iscsi {
return 0;
}
+# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
+# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+sub get_nvme_transport {
+ my ($sysdir) = @_;
+
+ my $transport = file_read_firstline("$sysdir/device/transport");
+ return $transport if defined($transport);
+
+ dir_glob_foreach(
+ "$sysdir/device",
+ 'nvme\d+',
+ sub {
+ my ($controller) = @_;
+ $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ },
+ );
+
+ return $transport;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
@@ -595,6 +615,9 @@ sub get_disks {
# we do not want iscsi devices
return if is_iscsi($sysdir);
+ my $nvme_transport;
+ $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
+
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
@@ -646,7 +669,11 @@ sub get_disks {
wearout => $wearout,
};
+ # lsblk reports plain 'nvme' for fabrics attached namespaces
my $transport = $lsblk_info->{$devpath}->{tran};
+ if (defined($nvme_transport) && $nvme_transport ne 'pcie') {
+ $transport = "nvme-$nvme_transport";
+ }
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
diff --git a/src/test/disk_tests/multipath/disklist b/src/test/disk_tests/multipath/disklist
index 92935894..f759ba9e 100644
--- a/src/test/disk_tests/multipath/disklist
+++ b/src/test/disk_tests/multipath/disklist
@@ -7,3 +7,5 @@ dm-1
dm-2
dm-3
dm-4
+nvme8n1
+nvme9n1
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
index a8e74fa1..ec442969 100644
--- a/src/test/disk_tests/multipath/disklist_expected.json
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -70,5 +70,38 @@
"by_id_link": "/dev/disk/by-id/scsi-36001405000000000000000000000000d",
"transport": "fc",
"used": "Device Mapper"
+ },
+ "nvme8n1": {
+ "devpath": "/dev/nvme8n1",
+ "size": 10737418240,
+ "vendor": "unknown",
+ "model": "FCMODEL",
+ "serial": "FCNVME1",
+ "wwn": "uuid.20000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
+ "transport": "nvme-fc"
+ },
+ "nvme9n1": {
+ "devpath": "/dev/nvme9n1",
+ "size": 10737418240,
+ "vendor": "FABVEND",
+ "model": "FABRICS CTRL",
+ "serial": "FAB1",
+ "wwn": "uuid.10000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "transport": "nvme-tcp"
}
}
diff --git a/src/test/disk_tests/multipath/lsblk b/src/test/disk_tests/multipath/lsblk
index 91f74574..dfc1ae1a 100644
--- a/src/test/disk_tests/multipath/lsblk
+++ b/src/test/disk_tests/multipath/lsblk
@@ -58,6 +58,20 @@
"fstype": null,
"tran": null,
"pttype": null
+ },
+ {
+ "path": "/dev/nvme8n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ },
+ {
+ "path": "/dev/nvme9n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
}
]
}
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/model b/src/test/disk_tests/multipath/nvme8n1/device/model
new file mode 100644
index 00000000..1aac689e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/model
@@ -0,0 +1 @@
+FCMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/transport b/src/test/disk_tests/multipath/nvme8n1/device/transport
new file mode 100644
index 00000000..8b517d01
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/transport
@@ -0,0 +1 @@
+fc
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/queue/rotational b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/size b/src/test/disk_tests/multipath/nvme8n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1_udevadm b/src/test/disk_tests/multipath/nvme8n1_udevadm
new file mode 100644
index 00000000..d0cd5ea9
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1_udevadm
@@ -0,0 +1,14 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+N: nvme8n1
+S: disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVLINKS=/dev/disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVNAME=/dev/nvme8n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+E: DEVTYPE=disk
+E: ID_MODEL=FCMODEL
+E: ID_SERIAL=FCNVME_1
+E: ID_SERIAL_SHORT=FCNVME1
+E: ID_WWN=uuid.20000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=1
+E: SUBSYSTEM=block
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/model b/src/test/disk_tests/multipath/nvme9n1/device/model
new file mode 100644
index 00000000..aa0287c7
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/model
@@ -0,0 +1 @@
+FABMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/transport
new file mode 100644
index 00000000..f5483dbf
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/transport
@@ -0,0 +1 @@
+tcp
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/vendor b/src/test/disk_tests/multipath/nvme9n1/device/vendor
new file mode 100644
index 00000000..cdc6ddfa
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/vendor
@@ -0,0 +1 @@
+FABVEND
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/queue/rotational b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
new file mode 100644
index 00000000..c2270834
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/size b/src/test/disk_tests/multipath/nvme9n1/size
new file mode 100644
index 00000000..8280959b
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1_udevadm b/src/test/disk_tests/multipath/nvme9n1_udevadm
new file mode 100644
index 00000000..b6d13ccb
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1_udevadm
@@ -0,0 +1,12 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+N: nvme9n1
+E: DEVNAME=/dev/nvme9n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+E: DEVTYPE=disk
+E: ID_MODEL=FABRICS CTRL
+E: ID_SERIAL=FABRICS_1
+E: ID_SERIAL_SHORT=FAB1
+E: ID_WWN=uuid.10000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=0
+E: SUBSYSTEM=block
--
2.47.3
^ permalink raw reply related [relevance 14%]
* [PATCH v3 storage 05/76] lvm: find a shared volume group created by another node
2026-11-05 23:30 5% [PATCH v3 proxmox,proxmox-perl-rs,cluster,storage,docs,manager 00/76] SAN: cluster-wide multipath, SAN views and a guided storage setup Thomas Lamprecht
@ 2026-11-05 23:30 6% ` Thomas Lamprecht
2026-11-05 23:30 14% ` [PATCH v3 storage 14/76] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
` (3 subsequent siblings)
4 siblings, 0 replies; 143+ results
From: Thomas Lamprecht @ 2026-11-05 23:30 UTC (permalink / raw)
To: pve-devel
LVM hints restrict scans to devices that previously held PVs. A shared
volume group created by another node on an already attached device can
remain invisible until the hints are invalidated, leaving the storage
inactive and blocking guest startup and migration to that node. The
fallback vgscan finds the group but updates neither the hints nor the
cached volume-group list.
Retry the listing without hints. If it finds additional groups, rebuild
the hints with 'pvscan --cache', update the cached groups, and
invalidate the logical-volume list used by thin pool activation. Rebuild
only when needed: pvscan also resets LVM autoactivation records and must
not run on every status pass merely because a group remains absent.
This was observed on a five-node cluster with shared groups created on
iSCSI multipath LUNs and NVMe over Fabrics namespaces already attached
to the other nodes.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 43 ++++++++-----
src/test/Makefile | 5 +-
src/test/run_test_lvm_hints.pl | 109 +++++++++++++++++++++++++++++++++
3 files changed, 140 insertions(+), 17 deletions(-)
create mode 100755 src/test/run_test_lvm_hints.pl
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index a6a5eb70..3ed5bc78 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -161,7 +161,7 @@ sub lvm_destroy_volume_group {
}
sub lvm_vgs {
- my ($includepvs) = @_;
+ my ($includepvs, $nohints) = @_;
my $cmd = [
'/sbin/vgs',
@@ -172,8 +172,9 @@ sub lvm_vgs {
'b',
'--unbuffered',
'--nosuffix',
- '--options',
];
+ push @$cmd, '--nohints' if $nohints;
+ push @$cmd, '--options';
my $cols = [qw(vg_name vg_size vg_free lv_count)];
@@ -1420,25 +1421,35 @@ sub volume_snapshot_info {
return $info;
}
+# LVM hints can miss PVs written by another node onto previously empty devices. Probe without
+# hints once per activation cache; rebuild only when new VGs appear, since rebuilding also resets
+# LVM autoactivation records.
+my sub find_unhinted_vgs {
+ my ($cache) = @_;
+
+ $cache->{vgscaned} = 1;
+
+ my $vgs = lvm_vgs(0, 1);
+ my @unhinted = grep { !$cache->{vgs}->{$_} } sort keys %$vgs;
+ return if !@unhinted;
+
+ eval {
+ run_command(['/sbin/pvscan', '--cache'], outfunc => sub { });
+ };
+ warn "rebuilding the LVM device hints failed - $@" if $@;
+
+ # add, never replace: an incomplete listing must not hide volume groups found before
+ $cache->{vgs}->{$_} = $vgs->{$_} for @unhinted;
+ # the cached logical volume list lacks the volumes of these volume groups
+ delete $cache->{lvs};
+}
+
sub activate_storage {
my ($class, $storeid, $scfg, $cache) = @_;
$cache->{vgs} = lvm_vgs() if !$cache->{vgs};
- # In LVM2, vgscans take place automatically;
- # this is just to be sure
- if (
- $cache->{vgs}
- && !$cache->{vgscaned}
- && !$cache->{vgs}->{ $scfg->{vgname} }
- ) {
- $cache->{vgscaned} = 1;
- my $cmd = ['/sbin/vgscan', '--ignorelockingfailure', '--mknodes'];
- eval {
- run_command($cmd, outfunc => sub { });
- };
- warn $@ if $@;
- }
+ find_unhinted_vgs($cache) if !$cache->{vgscaned} && !$cache->{vgs}->{ $scfg->{vgname} };
# we do not acticate any volumes here ('vgchange -aly')
# instead, volumes are activate individually later
diff --git a/src/test/Makefile b/src/test/Makefile
index 1fe50885..02d833e8 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
all: test
-test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_lock_retry test_lvm_base_volume test_disklist test_bwlimit test_plugin test_ovf test_volume_access
+test: test_iscsi test_zfspoolplugin test_lvmplugin test_lvm_lock_retry test_lvm_base_volume test_lvm_hints test_disklist test_bwlimit test_plugin test_ovf test_volume_access
test_zfspoolplugin: run_test_zfspoolplugin.pl
./run_test_zfspoolplugin.pl
@@ -15,6 +15,9 @@ test_lvm_lock_retry: run_test_lvm_lock_retry.pl
test_lvm_base_volume: run_test_lvm_base_volume.pl
./run_test_lvm_base_volume.pl
+test_lvm_hints: run_test_lvm_hints.pl
+ ./run_test_lvm_hints.pl
+
test_disklist: run_disk_tests.pl
./run_disk_tests.pl
diff --git a/src/test/run_test_lvm_hints.pl b/src/test/run_test_lvm_hints.pl
new file mode 100755
index 00000000..fc2ffff7
--- /dev/null
+++ b/src/test/run_test_lvm_hints.pl
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+
+# Unit test for the activation of an LVM storage whose volume group is missing from the volume
+# groups LVM lists through its device hints, as after another node created it on a device this node
+# already had: a listing without the hints finds it, and only then the hints are rebuilt. vgs and
+# pvscan are mocked, so the test needs neither root nor a real LVM setup.
+
+use strict;
+use warnings;
+
+use lib '..';
+use Test::More;
+use Test::MockModule;
+
+use PVE::Storage::LVMPlugin;
+use PVE::Storage::LvmThinPlugin;
+
+my $CLASS = 'PVE::Storage::LVMPlugin';
+
+# the volume groups vgs lists with and without the hints, and the commands run
+my ($hinted, $all, $vgs_fails, $pvscan_fails, @calls);
+
+my $lvm = Test::MockModule->new('PVE::Storage::LVMPlugin');
+$lvm->mock(
+ run_command => sub {
+ my ($cmd, %param) = @_;
+ if ($cmd->[0] eq '/sbin/vgs') {
+ my $nohints = grep { $_ eq '--nohints' } @$cmd;
+ push @calls, $nohints ? 'vgs --nohints' : 'vgs';
+ die "vgs failed\n" if $nohints && $vgs_fails;
+ $param{outfunc}->("$_:1024:512:0") for ($nohints ? $all : $hinted)->@*;
+ } elsif ($cmd->[0] eq '/sbin/pvscan') {
+ push @calls, 'pvscan --cache';
+ die "pvscan failed\n" if $pvscan_fails;
+ } else {
+ push @calls, join(' ', @$cmd);
+ }
+ },
+);
+
+my sub activate {
+ my ($vgname, $cache) = @_;
+
+ @calls = ();
+ my @warnings;
+ local $SIG{__WARN__} = sub { push @warnings, $_[0] };
+ $CLASS->activate_storage('lvm', { vgname => $vgname }, $cache);
+ return (join(', ', @calls), \@warnings);
+}
+
+($hinted, $all) = (['vg1'], ['vg1']);
+my ($calls) = activate('vg1', {});
+is($calls, 'vgs', 'listed volume group: no listing without the hints');
+
+($hinted, $all) = (['vg1'], ['vg1', 'vg2']);
+my $cache = { lvs => { vg1 => {} } };
+($calls) = activate('vg2', $cache);
+is($calls, 'vgs, vgs --nohints, pvscan --cache', 'unhinted volume group: hints rebuilt');
+ok($cache->{vgs}->{vg2} && $cache->{vgs}->{vg1}, 'and added to the volume groups of the cache');
+ok(!exists($cache->{lvs}), 'and the logical volume list of the cache is dropped');
+is_deeply(
+ [$CLASS->status('lvm', { vgname => 'vg2' }, $cache)],
+ [1024, 512, 512, 1],
+ 'the status of the same cache sees the volume group',
+);
+
+($calls) = activate('vg3', $cache);
+is($calls, '', 'once per cache: no second listing for the next missing volume group');
+
+($hinted, $all) = (['vg1'], ['vg1']);
+($calls) = activate('vg2', {});
+is($calls, 'vgs, vgs --nohints', 'volume group missing everywhere: hints left alone');
+
+($hinted, $all, $vgs_fails) = (['vg1'], [], 1);
+$cache = {};
+my $warnings;
+($calls, $warnings) = activate('vg2', $cache);
+is($calls, 'vgs, vgs --nohints', 'failed listing without the hints: hints left alone');
+ok($cache->{vgs}->{vg1}, 'and the volume groups found before stay');
+like($warnings->[0] // '', qr/vgs failed/, 'and it warns');
+$vgs_fails = 0;
+
+($hinted, $all, $pvscan_fails) = (['vg1'], ['vg1', 'vg2'], 1);
+$cache = {};
+($calls, $warnings) = activate('vg2', $cache);
+ok($cache->{vgs}->{vg2}, 'failed rebuild of the hints: the volume group still counts');
+like(
+ $warnings->[0] // '',
+ qr/^rebuilding the LVM device hints failed - pvscan failed/,
+ 'and it warns about the rebuild',
+);
+$pvscan_fails = 0;
+
+# a thin pool storage activates through the LVM activation and reads the logical volume list
+my $listed;
+$lvm->mock(
+ lvm_list_volumes => sub {
+ $listed++;
+ return { vg2 => { data => { lv_type => 't', lv_state => 'a' } } };
+ },
+);
+($hinted, $all) = (['vg1'], ['vg1', 'vg2']);
+$cache = { lvs => { vg1 => {} } };
+PVE::Storage::LvmThinPlugin->activate_storage(
+ 'thin', { vgname => 'vg2', thinpool => 'data' }, $cache,
+);
+ok($listed, 'thin pool: the logical volumes are listed again after the volume group was found');
+
+done_testing();
--
2.47.3
^ permalink raw reply related [relevance 6%]
* [PATCH storage v3 1/4] zfsnvme: add ZFS over NVMe/TCP storage plugin
2026-10-05 0:26 8% [PATCH storage v3 0/4] add ZFS over NVMe/TCP storage plugin Joaquin Varela
@ 2026-10-05 0:26 9% ` Joaquin Varela
2026-10-05 0:26 5% ` [PATCH storage v3 2/4] test: add zfsnvme plugin tests Joaquin Varela
2026-10-05 0:26 14% ` [PATCH docs v3] storage: document ZFS over NVMe/TCP Joaquin Varela
2 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-10-05 0:26 UTC (permalink / raw)
To: pve-devel
Add the shared storage type 'zfsnvme': ZFS zvols on a remote Linux
target, exported with the kernel NVMe target (nvmet, configured through
configfs) over NVMe/TCP, and consumed by the cluster nodes with native
NVMe multipath and DH-HMAC-CHAP authentication.
The ZFS dataset is the source of truth for a namespace: the subsystem
NQN, NSID and UUID of every volume are stored in the ZFS user properties
'proxmox:nvme-subsys', 'proxmox:nvme-nsid' and 'proxmox:nvme-uuid', and
the pool keeps the highest NSID handed out in 'proxmox:nvme-last-nsid'.
The nodes find a namespace by its UUID. Everything else on the target
(nvmet_tcp module, configfs mount, subsystem, namespaces, ports, host
ACLs) is derived state that an activation rebuilds after a target
restart.
All parsing, validation and planning happen locally. The target state
is read with one 'zfs get' and one 'find' over configfs; other reads
are 'zfs get' and 'zfs list', 'test -b' while a new zvol appears, and
'cat /proc/mounts' to decide whether configfs needs to be mounted. The
target runs quoted simple commands over SSH, joined with '&&' where a
step depends on the previous one: an export starts with 'test -b' on
its zvol, and each publish link repeats two read-only checks right
before it links the subsystem to a port. There are no scripts, loops
or variables on the target. As with ZFS over iSCSI, the SSH key is
/etc/pve/priv/zfs/<server>_id_rsa. Target changes are serialized
cluster-wide by a pmxcfs domain lock per target server, and an
operation whose SSH connection broke is reported as unknown and
repaired by the next activation rather than compensated from a read
that could overtake it.
Each storage needs its own NVMe/TCP listener (address family, address
and port) on the target. nvmet answers a connect to a listener that
does not publish the subsystem yet with DNR, and the host then deletes
the controller whatever its loss timeout, so after a target restart the
storage published second on a shared listener would lose its paths.
Adding, updating and activating a storage therefore refuse a portal
whose listener another zfsnvme storage uses, disabled ones included,
and a target address that another storage reaches through a different
'server' value, since that value names the target lock. A data address
thus identifies one target for all zfsnvme storages of the cluster.
The DH-HMAC-CHAP key is a sensitive property, stored like the other
storage secrets in /etc/pve/priv/storage/<storeid>.nvme-dhchap. It
reaches the target through stdin, and the plugin restricts the
dhchap_key and dhchap_ctrl_key attributes there to 0600 whenever it
writes the key. On the nodes, controllers are created with exactly one
write to /dev/nvme-fabrics in a bounded child (run_fork_with_timeout),
so the key never appears on a command line, and the secret attributes of
a new controller are restricted before the child returns. Rescans and
disconnects are sysfs writes; nvme-cli is not run.
Keep-alive, reconnect delay, controller loss and optional fast I/O
failure timeouts are configurable, with defaults that prefer waiting for
the target over failing guest I/O (ctrl_loss_tmo 600, fast_io_fail_tmo
unset).
Outside the plugin: register the type in PVE::Storage and the Makefile,
add it to @SHARED_STORAGE in PVE::Storage::Plugin, let 'pvesm add' and
'pvesm set' read --dhchap-key from a file, and depend on nvme-cli, which
creates /etc/nvme/hostnqn and /etc/nvme/hostid and remains the
administration tool, like the client packages of the other shared types.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
debian/control | 1 +
src/PVE/CLI/pvesm.pm | 21 +-
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/ZFSNVMePlugin.pm | 3177 ++++++++++++++++++++++++++++++
6 files changed, 3201 insertions(+), 3 deletions(-)
create mode 100644 src/PVE/Storage/ZFSNVMePlugin.pm
diff --git a/debian/control b/debian/control
index 850cd57c..ab46e6b6 100644
--- a/debian/control
+++ b/debian/control
@@ -43,6 +43,7 @@ Depends: bzip2,
lvm2,
lzop,
nfs-common,
+ nvme-cli,
proxmox-backup-client (>= 2.1.10~),
proxmox-backup-file-restore,
pve-cluster (>= 5.0-32),
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 1aaa9f3c..3c68ffb5 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -78,12 +78,29 @@ sub param_mapping {
},
};
+ my $dhchap_key_map = {
+ name => 'dhchap-key',
+ desc => 'a file containing the NVMe DH-HMAC-CHAP key',
+ func => sub {
+ my ($value) = @_;
+ # never repeat a key passed in place of the file name
+ die "dhchap-key expects the path of a file containing the key\n"
+ if $value =~ /^DHHC-1:/i || -d $value;
+ my ($key) = split(/\n/, PVE::Tools::file_get_contents($value), 2);
+ $key = PVE::Tools::trim($key // '');
+ die "DH-HMAC-CHAP key file '$value' is empty\n" if $key eq '';
+ return $key;
+ },
+ };
+
my $mapping = {
'cifsscan' => [$password_map],
'cifs' => [$password_map],
'pbs' => [$password_map],
- 'create' => [$password_map, $enc_key_map, $master_key_map, $keyring_map],
- 'update' => [$password_map, $enc_key_map, $master_key_map, $keyring_map],
+ 'create' =>
+ [$password_map, $enc_key_map, $master_key_map, $keyring_map, $dhchap_key_map],
+ 'update' =>
+ [$password_map, $enc_key_map, $master_key_map, $keyring_map, $dhchap_key_map],
};
return $mapping->{$name};
}
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index fc3db812..2e5a8031 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -36,6 +36,7 @@ use PVE::Storage::CephFSPlugin;
use PVE::Storage::ISCSIDirectPlugin;
use PVE::Storage::ZFSPoolPlugin;
use PVE::Storage::ZFSPlugin;
+use PVE::Storage::ZFSNVMePlugin;
use PVE::Storage::PBSPlugin;
use PVE::Storage::BTRFSPlugin;
use PVE::Storage::ESXiPlugin;
@@ -61,6 +62,7 @@ PVE::Storage::CephFSPlugin->register();
PVE::Storage::ISCSIDirectPlugin->register();
PVE::Storage::ZFSPoolPlugin->register();
PVE::Storage::ZFSPlugin->register();
+PVE::Storage::ZFSNVMePlugin->register();
PVE::Storage::PBSPlugin->register();
PVE::Storage::BTRFSPlugin->register();
PVE::Storage::ESXiPlugin->register();
diff --git a/src/PVE/Storage/Makefile b/src/PVE/Storage/Makefile
index a67dc25f..d1cbfe29 100644
--- a/src/PVE/Storage/Makefile
+++ b/src/PVE/Storage/Makefile
@@ -11,6 +11,7 @@ SOURCES= \
ISCSIDirectPlugin.pm \
ZFSPoolPlugin.pm \
ZFSPlugin.pm \
+ ZFSNVMePlugin.pm \
PBSPlugin.pm \
BTRFSPlugin.pm \
LvmThinPlugin.pm \
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index a9e17513..a5aedc2b 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -35,7 +35,7 @@ our @COMMON_TAR_FLAGS = qw(
);
our @SHARED_STORAGE = (
- 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'drbd', 'pbs',
+ 'iscsi', 'nfs', 'cifs', 'rbd', 'cephfs', 'iscsidirect', 'zfs', 'zfsnvme', 'drbd', 'pbs',
);
our $QCOW2_PREALLOCATION = {
diff --git a/src/PVE/Storage/ZFSNVMePlugin.pm b/src/PVE/Storage/ZFSNVMePlugin.pm
new file mode 100644
index 00000000..127680fb
--- /dev/null
+++ b/src/PVE/Storage/ZFSNVMePlugin.pm
@@ -0,0 +1,3177 @@
+package PVE::Storage::ZFSNVMePlugin;
+
+use v5.36;
+
+use Compress::Zlib qw(crc32);
+use Digest::SHA qw(sha256_hex);
+use Errno qw(ENOENT);
+use Fcntl qw(O_NOFOLLOW O_RDONLY O_RDWR S_ISCHR);
+use File::Path qw(make_path);
+use List::Util qw(max);
+use MIME::Base64 qw(decode_base64);
+use POSIX qw(SIG_BLOCK SIG_SETMASK SIGHUP SIGINT SIGQUIT SIGTERM sigprocmask);
+use Socket qw(AF_INET6 inet_ntop inet_pton);
+use Time::HiRes;
+
+use PVE::Cluster;
+use PVE::File;
+use PVE::JSONSchema;
+use PVE::Network;
+use PVE::RESTEnvironment qw(log_warn);
+use PVE::RPCEnvironment;
+use PVE::SysFSTools;
+use PVE::Tools qw(file_read_firstline file_set_contents run_command trim);
+
+use base qw(PVE::Storage::Plugin);
+
+# ZFS zvols on a remote Linux target, exported through the kernel NVMe target
+# (nvmet, configured through configfs) over NVMe/TCP and consumed with native
+# NVMe multipath.
+#
+# The ZFS dataset is the source of truth for a namespace: its owner NQN, NSID
+# and UUID are ZFS user properties. Everything else on the target is derived
+# state that the plugin rebuilds after a target restart.
+#
+# Storage parsing, validation and planning happen locally. SSH carries quoted
+# commands, sometimes joined with `&&`, to read or change ZFS/configfs state.
+# A pmxcfs domain lock per target serializes the changes within the cluster,
+# held like the storage lock of the other shared storage types.
+
+# ---------------------------------------------------------------------------
+# Constants and regular expressions
+# ---------------------------------------------------------------------------
+
+# LogLevel=ERROR keeps a login banner out of the first stderr line, which is
+# the error text of a failed call.
+my @ssh_cmd = (
+ '/usr/bin/ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=10', '-o', 'LogLevel=ERROR',
+);
+my $id_rsa_path = '/etc/pve/priv/zfs';
+my $secret_dir = '/etc/pve/priv/storage';
+my $max_paths = 16;
+my $max_hosts = 64;
+my $slow_path_backoff = 60;
+
+my $nvmet_root = '/sys/kernel/config/nvmet';
+my $nvmet_model = 'Proxmox ZFS NVMe';
+my $nvmet_marker = 'ZFSNVME-CONFIGFS';
+my $nvmet_max_nsid = 0xfffffffe;
+my $nvmet_max_command = 65536;
+# Seconds to wait for the target lock while another node changes the target;
+# a destroy or rollback can hold it for several seconds.
+my $nvmet_lock_wait = 30;
+# On the pool dataset: the highest NSID handed out for a volume of the pool.
+my $nvmet_last_nsid = 'proxmox:nvme-last-nsid';
+
+my @nvmet_zfs_props =
+ ('type', 'proxmox:nvme-subsys', 'proxmox:nvme-nsid', 'proxmox:nvme-uuid', $nvmet_last_nsid);
+my %nvmet_zfs_keys = (
+ type => 'type',
+ 'proxmox:nvme-subsys' => 'nqn',
+ 'proxmox:nvme-nsid' => 'nsid',
+ 'proxmox:nvme-uuid' => 'uuid',
+ $nvmet_last_nsid => 'last_nsid',
+);
+my @nvmet_cfs_attrs = qw(
+ enable device_path device_uuid buffered_io
+ attr_model attr_serial attr_allow_any_host
+ addr_trtype addr_adrfam addr_traddr addr_trsvcid
+);
+# Every command the plugin runs on the target, besides the `dd | tee` pipe of
+# a key write. The configfs read runs find through env to set its locale.
+my %nvmet_commands = map { $_ => 1 } qw(
+ cat chmod env grep ln mkdir modprobe mount printf rm rmdir test zfs
+);
+
+my $RE_NQN = qr{
+ \A
+ nqn \.
+ [A-Za-z0-9] [A-Za-z0-9.-]*
+ :
+ [A-Za-z0-9] [A-Za-z0-9._:-]*
+ \z
+}nxx;
+my $RE_IPV4_PORTAL = qr{
+ \A
+ (?<address> [^:]+)
+ (?: : (?<port> [0-9]+))?
+ \z
+}nxx;
+my $RE_IPV6_PORTAL = qr{
+ \A
+ \[ (?<address> [^\]]+) \]
+ (?: : (?<port> [0-9]+))?
+ \z
+}nxx;
+# A canonical IPv4-mapped IPv6 address.
+my $RE_IPV4_MAPPED = qr{\A ::ffff: (?<address> [0-9.]+) \z}nxx;
+my $RE_HOST_IFACE = qr{\A [A-Za-z0-9_.-]+ \z}nxx;
+my $RE_DHCHAP_KEY = qr{
+ \A DHHC-1 : (?<hash> 0[0-3]) : (?<secret> [A-Za-z0-9+/]+ ={0,2}) : \z
+}nxx;
+# A stopped PVE task: the worker's signal handler dies with the first text,
+# run_command adds the command context, and run_fork_with_timeout reports
+# the signal in its own words.
+my $RE_TASK_INTERRUPT = qr{
+ \A (?: (?: command \x20 ' .* ' \x20 failed: \x20 )? received \x20 interrupt
+ | interrupted \x20 by \x20 unexpected \x20 signal ) \n \z
+}nsxx;
+my $RE_COMMAND_TIMEOUT = qr{
+ \A (?: command \x20 ' .* ' \x20 failed: \x20 )? got \x20 timeout \n \z
+}nsxx;
+my $RE_COMMAND_EXIT =
+ qr{\A command \x20 ' .* ' \x20 failed: \x20 exit \x20 code \x20 (?<code> [0-9]+) \n \z}nsxx;
+my $RE_FABRICS_VALUE = qr{\A [^\s,\x00]+ \z}nxx;
+my $RE_FABRICS_RESULT = qr{\A instance=(?<instance> [0-9]+) ,cntlid= [0-9]+ \n \z}nxx;
+my $RE_ZERO_UUID = qr{\A 0{8} (?: -0{4}){3} -0{12} \z}nxx;
+my $RE_CONFIG_INT = qr{\A -?[0-9]+ \z}nxx;
+my $RE_NVME_CONTROLLER = qr{\A nvme [0-9]+ \z}nxx;
+my $RE_NVME_SUBSYSTEM = qr{\A nvme-subsys [0-9]+ \z}nxx;
+my $RE_NVME_NAMESPACE = qr{\A nvme [0-9]+ n [0-9]+ \z}nxx;
+my $RE_NVME_PARTITION = qr{\A nvme [0-9]+ n [0-9]+ p [0-9]+ \z}nxx;
+my $RE_TRADDR = qr{(?: \A | ,) traddr=(?<value>[^,]+)}nxx;
+my $RE_TRSVCID = qr{(?: \A | ,) trsvcid=(?<value>[^,]+)}nxx;
+my $RE_HOST_IFACE_ADDRESS = qr{(?: \A | ,) host_iface=(?<value>[^,]+)}nxx;
+my $RE_ZVOL_OWNER = qr{^ (?:vm|base|subvol|basevol)- (?<owner>\d+) - \S+ $}nxx;
+my $RE_VOLNAME = qr{
+ ^
+ (?: (?<base> (?:base|basevol)- (?<base_vmid>\d+) - \S+) /)?
+ (?<name> (?<type>base|basevol|vm|subvol)- (?<vmid>\d+) - \S+)
+ $
+}nxx;
+my $RE_BASE_SNAPSHOT = qr{^ (?<base>\S+) \@__base__ $}nxx;
+my $RE_UNSIGNED_INTEGER = qr{^ (?<value>\d+) $}nxx;
+
+my $RE_NVMET_UUID = qr{\A [0-9a-fA-F]{8} (?: - [0-9a-fA-F]{4}){3} - [0-9a-fA-F]{12} \z}nxx;
+my $RE_NVMET_NSID = qr{\A [1-9] [0-9]* \z}nxx;
+my $RE_NVMET_POOL = qr{\A [A-Za-z0-9] [A-Za-z0-9_.:/-]* \z}nxx;
+my $RE_NVMET_DATASET_NAME = qr{\A [A-Za-z0-9] [A-Za-z0-9_.:-]* \z}nxx;
+my $RE_NVMET_SNAPSHOT = qr{\A [A-Za-z0-9_.:-]+ \z}nxx;
+my $RE_NVMET_TEMPLATE_ZVOL = qr{/ (?<type> vm | base) - (?<suffix> [^/]+) \z}nxx;
+my $RE_NVMET_INHERITED = qr{\A inherited \x20 from \x20 (?<source> .+) \z}nxx;
+# Errors after which the target state is not known: an interrupted task, or a
+# change whose command may still be running on the target.
+my $RE_NVMET_ABANDONED = qr{
+ (?: \A received \x20 interrupt | ; \x20 the \x20 target \x20 state \x20 is \x20 unknown) \n \z
+}nxx;
+
+# Lines of the configfs read (nvmet_configfs_step below): `D <dir>`,
+# `L <link>`, `<file>:<value>` from grep, and `<sha256> <file>` from
+# sha256sum. Attribute names anchor the split, so an NQN containing ':' is
+# never ambiguous.
+my $cfs_root = quotemeta($nvmet_root);
+my $RE_CFS_TOP = qr{\A D \x20 $cfs_root (?: / (?<top> hosts | ports | subsystems))? \z}nxx;
+my $RE_CFS_SUBSYS_DIR = qr{\A D \x20 $cfs_root /subsystems/ (?<nqn> [^/]+) \z}nxx;
+my $RE_CFS_SUBSYS_GROUP = qr{
+ \A D \x20 $cfs_root /subsystems/ [^/]+ / (?: namespaces | allowed_hosts) \z
+}nxx;
+my $RE_CFS_NS_DIR = qr{
+ \A D \x20 $cfs_root /subsystems/ (?<nqn> [^/]+) /namespaces/ (?<nsid> [0-9]+) \z
+}nxx;
+my $RE_CFS_PORT_DIR = qr{\A D \x20 $cfs_root /ports/ (?<port> [0-9]+) \z}nxx;
+my $RE_CFS_PORT_GROUP = qr{\A D \x20 $cfs_root /ports/ [0-9]+ /subsystems \z}nxx;
+my $RE_CFS_HOST_DIR = qr{\A D \x20 $cfs_root /hosts/ (?<host> [^/]+) \z}nxx;
+my $RE_CFS_PORT_LINK = qr{
+ \A L \x20 $cfs_root /ports/ (?<port> [0-9]+) /subsystems/ (?<nqn> [^/]+) \z
+}nxx;
+my $RE_CFS_ACL_LINK = qr{
+ \A L \x20 $cfs_root /subsystems/ (?<nqn> [^/]+) /allowed_hosts/ (?<host> [^/]+) \z
+}nxx;
+my $RE_CFS_OTHER_ENTRY = qr{\A [DL] \x20 $cfs_root /}nxx;
+my $RE_CFS_NS_ATTR = qr{
+ \A $cfs_root /subsystems/ (?<nqn> [^/]+) /namespaces/ (?<nsid> [0-9]+)
+ / (?<attr> enable | device_path | device_uuid | buffered_io) : (?<value> .*) \z
+}nxx;
+my $RE_CFS_SUBSYS_ATTR = qr{
+ \A $cfs_root /subsystems/ (?<nqn> [^/]+)
+ / (?<attr> attr_model | attr_serial | attr_allow_any_host) : (?<value> .*) \z
+}nxx;
+my $RE_CFS_PORT_ATTR = qr{
+ \A $cfs_root /ports/ (?<port> [0-9]+)
+ / (?<attr> addr_trtype | addr_adrfam | addr_traddr | addr_trsvcid) : (?<value> .*) \z
+}nxx;
+my $RE_CFS_KEY_DIGEST = qr{
+ \A (?<sha> [0-9a-f]{64}) \x20 [\x20*] $cfs_root /hosts/ (?<host> [^/]+) /dhchap_key \z
+}nxx;
+my $RE_CFS_OTHER_ATTR = qr{\A $cfs_root /}nxx;
+
+# ---------------------------------------------------------------------------
+# Target addressing and validated names
+# ---------------------------------------------------------------------------
+
+my sub nvmet_server($scfg) {
+ return $scfg->{server};
+}
+
+my sub nvmet_ssh_key($scfg) {
+ return "$id_rsa_path/" . nvmet_server($scfg) . '_id_rsa';
+}
+
+my sub nvmet_lock_id($scfg) {
+ my $server = nvmet_server($scfg) // '';
+ return 'zfsnvme-' . ($server =~ s/[^A-Za-z0-9.-]/_/gr);
+}
+
+my sub secret_path($storeid) {
+ return "$secret_dir/$storeid.nvme-dhchap";
+}
+
+my sub nvmet_nqn($scfg) {
+ my $nqn = $scfg->{subsysnqn};
+ die "invalid NVMe subsystem NQN\n" if !defined($nqn) || !verify_nvme_nqn($nqn, 1);
+ return $nqn;
+}
+
+my sub nvmet_pool($scfg) {
+ my $pool = $scfg->{pool};
+ die "invalid ZFS pool name\n" if !defined($pool) || $pool !~ $RE_NVMET_POOL;
+ return $pool;
+}
+
+my sub nvmet_dataset($scfg, $name) {
+ die "invalid ZFS volume name\n" if !defined($name) || $name !~ $RE_NVMET_DATASET_NAME;
+ return nvmet_pool($scfg) . "/$name";
+}
+
+# zfs destroy reads '%' and ',' in a snapshot name as a range and a list.
+my sub nvmet_snapshot($scfg, $name, $snap) {
+ die "invalid snapshot name\n" if !defined($snap) || $snap !~ $RE_NVMET_SNAPSHOT;
+ return nvmet_dataset($scfg, $name) . "\@$snap";
+}
+
+my sub nvmet_valid_nsid($value) {
+ return defined($value) && $value =~ $RE_NVMET_NSID && $value <= $nvmet_max_nsid;
+}
+
+# IPv6 addresses have many spellings; compare and store only the canonical one.
+my sub nvmet_canonical_address($address) {
+ return $address if !defined($address) || index($address, ':') < 0;
+ my $packed = inet_pton(AF_INET6, $address) // return $address;
+ return inet_ntop(AF_INET6, $packed);
+}
+
+# The address family and address that a portal of parse_nvme_portals reaches:
+# an IPv4-mapped IPv6 address reaches the IPv4 address.
+my sub nvmet_listener_address($portal) {
+ return ('ipv4', $+{address})
+ if $portal->{family} eq 'ipv6' && $portal->{address} =~ $RE_IPV4_MAPPED;
+ return $portal->@{qw(family address)};
+}
+
+# Target-provided names only appear in messages when they are well-formed.
+my sub nvmet_label($name) {
+ return $name =~ $RE_NQN ? " '$name'" : '';
+}
+
+# The other name of a zvol that a template conversion renames: vm-* and base-*.
+my sub nvmet_template_twin($name) {
+ return '' if $name !~ $RE_NVMET_TEMPLATE_ZVOL;
+ my $twin = ($+{type} eq 'vm' ? 'base' : 'vm') . "-$+{suffix}";
+ return substr($name, 0, $-[0]) . "/$twin";
+}
+
+# The timeout of a call that changes ZFS: ZFS waits for transaction groups,
+# which a busy pool can take minutes to sync.
+my sub nvmet_long_timeout() {
+ return PVE::RPCEnvironment->is_worker() ? 60 * 60 : 60;
+}
+
+# ---------------------------------------------------------------------------
+# Remote steps
+#
+# A step is an argv array, a write `{ write => $path, value => $value }` or a
+# key write `{ key => [$path, ...] }` fed from stdin. A unit is a list of steps
+# that must stay in one call.
+# ---------------------------------------------------------------------------
+
+my sub nvmet_subsys_path($nqn) {
+ return "$nvmet_root/subsystems/$nqn";
+}
+
+my sub nvmet_ns_path($nqn, $nsid) {
+ return "$nvmet_root/subsystems/$nqn/namespaces/$nsid";
+}
+
+my sub nvmet_port_path($id) {
+ return "$nvmet_root/ports/$id";
+}
+
+my sub nvmet_host_path($hostnqn) {
+ return "$nvmet_root/hosts/$hostnqn";
+}
+
+my sub nvmet_write($path, $value) {
+ return { write => $path, value => $value };
+}
+
+# Parts of a parsed configfs state; missing parts read as empty.
+my sub nvmet_namespaces($cfs, $nqn) {
+ my $subsys = $cfs->{subsystems}->{$nqn};
+ return ($subsys ? $subsys->{namespaces} : undef) // {};
+}
+
+my sub nvmet_port_linked($cfs, $id, $nqn) {
+ my $port = $cfs->{ports}->{$id};
+ return $port && ($port->{links} // {})->{$nqn};
+}
+
+my sub nvmet_linked_hosts($cfs) {
+ my %linked;
+ for my $subsys (values $cfs->{subsystems}->%*) {
+ $linked{$_} = 1 for keys(($subsys->{acl} // {})->%*);
+ }
+ return \%linked;
+}
+
+# A subsystem whose creation by this plugin stopped after its model was
+# written, before its serial: nobody else writes our model, and it exports,
+# allows and publishes nothing, so completing it takes nothing from anybody.
+# A subsystem with the kernel's default model may belong to another tool.
+my sub nvmet_unfinished_subsystem($cfs, $nqn) {
+ my $subsys = $cfs->{subsystems}->{$nqn};
+ return 0 if !$subsys;
+ return
+ $subsys->{attr_model} eq $nvmet_model
+ && !($subsys->{namespaces} // {})->%*
+ && !($subsys->{acl} // {})->%*
+ && !grep { nvmet_port_linked($cfs, $_, $nqn) } keys $cfs->{ports}->%*;
+}
+
+# Same write order as the kernel requires: the device before enabling it.
+my sub nvmet_build_unit($nqn, $nsid, $uuid, $dev) {
+ my $ns = nvmet_ns_path($nqn, $nsid);
+ return [
+ ['test', '-b', $dev],
+ ['mkdir', $ns],
+ nvmet_write("$ns/device_path", $dev),
+ nvmet_write("$ns/device_uuid", $uuid),
+ nvmet_write("$ns/buffered_io", 0),
+ nvmet_write("$ns/enable", 1),
+ ];
+}
+
+my sub nvmet_enable_unit($nqn, $nsid, $dev) {
+ return [['test', '-b', $dev], nvmet_write(nvmet_ns_path($nqn, $nsid) . '/enable', 1)];
+}
+
+my sub nvmet_unexport_unit($nqn, $nsid, $enabled) {
+ my $ns = nvmet_ns_path($nqn, $nsid);
+ return [($enabled ? (nvmet_write("$ns/enable", 0)) : ()), ['rmdir', $ns]];
+}
+
+my sub nvmet_identity($nqn, $nsid, $uuid) {
+ return ("proxmox:nvme-subsys=$nqn", "proxmox:nvme-nsid=$nsid", "proxmox:nvme-uuid=$uuid");
+}
+
+# The pool and its direct children with their identity properties.
+my sub nvmet_zfs_inventory_step($pool) {
+ return [
+ 'zfs',
+ 'get',
+ '-H',
+ '-p',
+ '-d',
+ '1',
+ '-t',
+ 'filesystem,volume',
+ '-o',
+ 'name,property,value,source',
+ join(',', @nvmet_zfs_props),
+ $pool,
+ ];
+}
+
+# Every configfs object the plugin uses, in one traversal. Keys are never
+# read back; with host NQNs, only their sha256 digests are returned. Only the
+# kernel's own groups of objects the plugin does not use are skipped, so an
+# object of another tool with one of their names is still listed.
+my sub nvmet_configfs_step($hostnqns) {
+ my @names = map { ('-o', '-name', $_) } @nvmet_cfs_attrs;
+ shift @names;
+ my @keys = map { ('-o', '-path', nvmet_host_path($_) . '/dhchap_key') } $hostnqns->@*;
+ shift @keys;
+ return [
+ 'env',
+ 'LC_ALL=C',
+ 'find',
+ $nvmet_root,
+ '(',
+ '-path',
+ "$nvmet_root/subsystems/*/passthru",
+ '-o',
+ '-path',
+ "$nvmet_root/ports/*/ana_groups",
+ '-o',
+ '-path',
+ "$nvmet_root/ports/*/referrals",
+ ')',
+ '-type',
+ 'd',
+ '-prune',
+ '-o',
+ '-type',
+ 'd',
+ '-exec',
+ 'printf',
+ 'D %s\n',
+ '{}',
+ '+',
+ '-o',
+ '-type',
+ 'l',
+ '-exec',
+ 'printf',
+ 'L %s\n',
+ '{}',
+ '+',
+ '-o',
+ '-type',
+ 'f',
+ '(',
+ @names,
+ ')',
+ '-exec',
+ 'grep',
+ '',
+ '/dev/null',
+ '{}',
+ '+',
+ (@keys ? ('-o', '-type', 'f', '(', @keys, ')', '-exec', 'sha256sum', '{}', '+') : ()),
+ ];
+}
+
+# The whole target state: the ZFS inventory, a marker and configfs. Only a
+# locked read loads nvmet first (modprobe).
+my sub nvmet_state_steps($pool, $hostnqns, $modprobe) {
+ return [
+ ($modprobe ? (['modprobe', 'nvmet_tcp']) : ()),
+ nvmet_zfs_inventory_step($pool),
+ ['printf', '%s\n', $nvmet_marker],
+ nvmet_configfs_step($hostnqns),
+ ];
+}
+
+# ---------------------------------------------------------------------------
+# Renderer and runner
+# ---------------------------------------------------------------------------
+
+my sub nvmet_valid_word($word) {
+ return defined($word) && !ref($word) && $word !~ /[\0\r\n]/;
+}
+
+my sub nvmet_valid_path($path) {
+ return nvmet_valid_word($path) && $path =~ m{\A/};
+}
+
+my sub nvmet_quote($word) {
+ return PVE::Tools::shellquote($word);
+}
+
+# Renders steps into one POSIX shell command line: simple commands joined with
+# `&&`, plus `>` for configfs writes and one `dd | tee` pipe for a key read from
+# stdin. There are no loops, variables, conditionals or substitutions. Every
+# word is quoted; all operands are built from validated configuration.
+sub _nvmet_render($steps) {
+ my $invalid = "internal error: invalid NVMe target step\n";
+ die $invalid if ref($steps) ne 'ARRAY' || !$steps->@*;
+
+ my $keys = 0;
+ my @commands;
+ for my $step ($steps->@*) {
+ if (ref($step) eq 'ARRAY') {
+ die $invalid if !$step->@* || grep { !nvmet_valid_word($_) } $step->@*;
+ die $invalid if !$nvmet_commands{ $step->[0] };
+ push @commands, join(' ', map { nvmet_quote($_) } $step->@*);
+ } elsif (ref($step) eq 'HASH' && exists($step->{write})) {
+ die $invalid
+ if keys($step->%*) != 2
+ || !nvmet_valid_path($step->{write})
+ || !nvmet_valid_word($step->{value});
+ push @commands,
+ q{printf '%s\n' }
+ . nvmet_quote($step->{value}) . ' > '
+ . nvmet_quote($step->{write});
+ } elsif (ref($step) eq 'HASH' && exists($step->{key})) {
+ my $paths = $step->{key};
+ die $invalid
+ if keys($step->%*) != 1
+ || ref($paths) ne 'ARRAY'
+ || !$paths->@*
+ || grep { !nvmet_valid_path($_) } $paths->@*;
+ $keys++;
+ die $invalid if $keys > 1;
+ # configfs needs the whole key in one write(2). dd collects its
+ # input into one output block: GNU dd without bs=, busybox dd only
+ # when ibs and obs differ. tee writes it to every host object.
+ push @commands,
+ 'dd ibs=4096 obs=8192 2>/dev/null | tee '
+ . join(' ', map { nvmet_quote($_) } $paths->@*)
+ . ' >/dev/null';
+ } else {
+ die $invalid;
+ }
+ }
+ return join(' && ', @commands);
+}
+
+# Packs whole units into calls of at most $max bytes of rendered command, the
+# single argument sshd runs, below its limit. A rendered command is ASCII
+# (every operand is validated), so its length is its size in bytes.
+sub _nvmet_chunk($units, $max = $nvmet_max_command) {
+ my (@chunks, @current);
+ for my $unit ($units->@*) {
+ my @next = (@current, $unit->@*);
+ if (length(_nvmet_render(\@next)) > $max) {
+ die "internal error: NVMe target command too long\n"
+ if !@current || length(_nvmet_render($unit)) > $max;
+ push @chunks, [@current];
+ @next = $unit->@*;
+ }
+ @current = @next;
+ }
+ push @chunks, [@current] if @current;
+ return \@chunks;
+}
+
+# Never propagate the context run_command adds to the task marker: it quotes
+# the command line.
+my sub rethrow_task_interrupt($error) {
+ die "received interrupt\n" if $error =~ $RE_TASK_INTERRUPT;
+}
+
+# The only code that runs anything on the target. Returns
+# { rc => exit code, or -1 when ssh did not run to its end, out => [lines],
+# err => text } and never dies on a failing command; a stopped task dies with
+# the task marker. %opts: op (label, required), timeout and input (stdin,
+# used for keys).
+sub _nvmet_run($scfg, $steps, %opts) {
+ die "internal error: NVMe target call without label\n" if !defined($opts{op});
+ my $command = _nvmet_render($steps);
+ die "internal error: NVMe target command too long\n" if length($command) > $nvmet_max_command;
+ my $cmd = [@ssh_cmd, '-i', nvmet_ssh_key($scfg), 'root@' . nvmet_server($scfg), $command];
+ my (@out, $err);
+ my $rc = 0;
+ # Not noerr: run_command would then also swallow the interrupt of a stopped
+ # task, which must end the call. The exit code is taken from the exception.
+ eval {
+ run_command(
+ $cmd,
+ timeout => $opts{timeout} // 15,
+ outfunc => sub($line) { push @out, $line },
+ errfunc => sub($line) { $err = $line if !defined($err) && $line ne '' },
+ (defined($opts{input}) ? (input => $opts{input}) : ()),
+ );
+ };
+ if (my $error = $@) {
+ rethrow_task_interrupt($error);
+ return { rc => -1, out => [], err => 'timeout' } if $error =~ $RE_COMMAND_TIMEOUT;
+ return { rc => -1, out => [], err => 'ssh failed' } if $error !~ $RE_COMMAND_EXIT;
+ $rc = $+{code};
+ }
+ return { rc => $rc, out => \@out, err => $err // ($rc ? "exit code $rc" : '') };
+}
+
+# Monotonic clock for the activation backoff and local waits (a test seam).
+sub _now() {
+ return Time::HiRes::clock_gettime(Time::HiRes::CLOCK_MONOTONIC());
+}
+
+# Every local wait of the plugin (a test seam).
+sub _sleep($seconds) {
+ Time::HiRes::sleep($seconds);
+ return;
+}
+
+# ---------------------------------------------------------------------------
+# Parsers (pure)
+# ---------------------------------------------------------------------------
+
+sub _nvmet_split_state($text) {
+ my @parts = split /^\Q$nvmet_marker\E\n/m, $text, -1;
+ die "malformed NVMe target state\n" if @parts != 2;
+ return @parts;
+}
+
+sub _nvmet_property_value($value, $source) {
+ die "malformed ZFS property value\n"
+ if !defined($value)
+ || !defined($source)
+ || $value eq ''
+ || $source eq ''
+ || $value =~ /[\r\n\t]/
+ || $source =~ /[\r\n\t]/;
+ return $value if $source eq 'local' || $source eq 'received';
+ return '-' if $value eq '-' && $source eq '-';
+ if ($source =~ $RE_NVMET_INHERITED) {
+ die "invalid ZFS pool name\n" if $+{source} !~ $RE_NVMET_POOL;
+ return '-';
+ }
+ die "invalid ZFS property source\n";
+}
+
+# Parses the ZFS inventory into { types => { dataset => type }, volumes =>
+# { dataset => { nqn, nsid, uuid } }, last_nsid => highest NSID handed out }.
+# The inventory must be complete: the pool rows and all rows of every
+# dataset, or the read fails. Children whose names PVE never uses (for
+# example with a space) are kept as datasets but never count as owned.
+sub _nvmet_parse_zfs_inventory($text, $pool) {
+ die "invalid ZFS pool name\n" if $pool !~ $RE_NVMET_POOL;
+
+ my (%rows, %foreign);
+ for my $line (split /\n/, $text) {
+ my @fields = split /\t/, $line, -1;
+ die "malformed ZFS inventory row\n" if @fields != 4 || $line =~ /\r/;
+ my ($dataset, $property, $value, $source) = @fields;
+ if ($dataset ne $pool) {
+ die "ZFS dataset is outside configured pool\n" if index($dataset, "$pool/") != 0;
+ my $child = substr($dataset, length($pool) + 1);
+ die "ZFS dataset is outside configured pool\n"
+ if $child eq '' || index($child, '/') >= 0;
+ $foreign{$dataset} = 1 if $child !~ $RE_NVMET_DATASET_NAME;
+ }
+ my $on = $foreign{$dataset} ? '' : " on '$dataset'";
+ my $key = $nvmet_zfs_keys{$property} // die "unexpected ZFS property$on\n";
+ die "duplicate ZFS property '$property'$on\n" if exists($rows{$dataset}->{$key});
+ if ($key eq 'type') {
+ die "invalid ZFS dataset type$on\n"
+ if ($value ne 'filesystem' && $value ne 'volume') || $source ne '-';
+ $rows{$dataset}->{type} = $value;
+ } else {
+ $rows{$dataset}->{$key} = _nvmet_property_value($value, $source);
+ }
+ }
+ die "ZFS dataset inventory is missing the configured pool\n" if !$rows{$pool};
+
+ my (%types, %volumes);
+ for my $dataset (keys %rows) {
+ my $row = $rows{$dataset};
+ die "incomplete ZFS properties" . ($foreign{$dataset} ? '' : " on '$dataset'") . "\n"
+ if keys($row->%*) != scalar(@nvmet_zfs_props);
+ $types{$dataset} = $row->{type};
+ next if $row->{type} ne 'volume';
+ # nvmet shows device_uuid and udev names the by-id link in lower case,
+ # so identities are compared in lower case.
+ $volumes{$dataset} =
+ $foreign{$dataset}
+ ? { nqn => '-', nsid => '-', uuid => '-' }
+ : { nqn => $row->{nqn}, nsid => $row->{nsid}, uuid => lc($row->{uuid}) };
+ }
+ my $last_nsid = $rows{$pool}->{last_nsid};
+ return {
+ types => \%types,
+ volumes => \%volumes,
+ last_nsid => nvmet_valid_nsid($last_nsid) ? $last_nsid : 0,
+ };
+}
+
+# Parses the configfs read into
+# { subsystems => { nqn => { attr_model, attr_serial, attr_allow_any_host,
+# acl => { hostnqn => 1 }, namespaces => { nsid => { enable, device_path,
+# device_uuid, buffered_io } } } },
+# ports => { id => { addr_trtype, addr_adrfam, addr_traddr, addr_trsvcid,
+# links => { nqn => 1 } } },
+# hosts => { hostnqn => { key_sha256 => hex or undef } } }
+# Every object must be complete; unknown objects of newer kernels are ignored.
+sub _nvmet_parse_configfs($text) {
+ my $state = { subsystems => {}, ports => {}, hosts => {} };
+ my (%top, %dir);
+
+ my $subsystem = sub($nqn) {
+ return $state->{subsystems}->{$nqn} //= { acl => {}, namespaces => {} };
+ };
+ my $namespace = sub($nqn, $nsid) {
+ return $subsystem->($nqn)->{namespaces}->{$nsid} //= {};
+ };
+ my $port = sub($id) { return $state->{ports}->{$id} //= { links => {} } };
+ my $host = sub($hostnqn) { return $state->{hosts}->{$hostnqn} //= { key_sha256 => undef } };
+ my $set = sub($object, $attr, $value) {
+ die "duplicate NVMe target configfs attribute\n" if exists($object->{$attr});
+ $object->{$attr} = $value;
+ };
+
+ for my $line (split /\n/, $text) {
+ if ($line =~ $RE_CFS_TOP) {
+ $top{ $+{top} // 'root' } = 1;
+ } elsif ($line =~ $RE_CFS_SUBSYS_DIR) {
+ my $nqn = $+{nqn};
+ $subsystem->($nqn);
+ $dir{"subsystem $nqn"} = 1;
+ } elsif ($line =~ $RE_CFS_SUBSYS_GROUP || $line =~ $RE_CFS_PORT_GROUP) {
+ # default groups, always present with their parent
+ } elsif ($line =~ $RE_CFS_NS_DIR) {
+ my ($nqn, $nsid) = @+{qw(nqn nsid)};
+ $namespace->($nqn, $nsid);
+ $dir{"namespace $nqn/$nsid"} = 1;
+ } elsif ($line =~ $RE_CFS_PORT_DIR) {
+ my $id = $+{port};
+ $port->($id);
+ $dir{"port $id"} = 1;
+ } elsif ($line =~ $RE_CFS_HOST_DIR) {
+ my $hostnqn = $+{host};
+ $host->($hostnqn);
+ $dir{"host $hostnqn"} = 1;
+ } elsif ($line =~ $RE_CFS_PORT_LINK) {
+ my ($id, $nqn) = @+{qw(port nqn)};
+ $port->($id)->{links}->{$nqn} = 1;
+ } elsif ($line =~ $RE_CFS_ACL_LINK) {
+ my ($nqn, $hostnqn) = @+{qw(nqn host)};
+ $subsystem->($nqn)->{acl}->{$hostnqn} = 1;
+ } elsif ($line =~ $RE_CFS_OTHER_ENTRY) {
+ # objects of a shape the plugin does not use
+ } elsif ($line =~ $RE_CFS_NS_ATTR) {
+ my ($nqn, $nsid, $attr, $value) = @+{qw(nqn nsid attr value)};
+ $set->($namespace->($nqn, $nsid), $attr, $value);
+ } elsif ($line =~ $RE_CFS_SUBSYS_ATTR) {
+ my ($nqn, $attr, $value) = @+{qw(nqn attr value)};
+ $set->($subsystem->($nqn), $attr, $value);
+ } elsif ($line =~ $RE_CFS_PORT_ATTR) {
+ my ($id, $attr, $value) = @+{qw(port attr value)};
+ $set->($port->($id), $attr, $value);
+ } elsif ($line =~ $RE_CFS_KEY_DIGEST) {
+ my ($sha, $hostnqn) = @+{qw(sha host)};
+ my $object = $host->($hostnqn);
+ die "duplicate DH-HMAC-CHAP key digest" . nvmet_label($hostnqn) . "\n"
+ if defined($object->{key_sha256});
+ $object->{key_sha256} = $sha;
+ } elsif ($line =~ $RE_CFS_OTHER_ATTR) {
+ # attribute of an object shape the plugin does not use
+ } else {
+ die "unexpected NVMe target configfs line\n";
+ }
+ }
+
+ for my $name (qw(root hosts ports subsystems)) {
+ die "NVMe target configfs is unavailable\n" if !$top{$name};
+ }
+ for my $nqn (keys $state->{subsystems}->%*) {
+ my $subsys = $state->{subsystems}->{$nqn};
+ die "incomplete NVMe subsystem" . nvmet_label($nqn) . "\n"
+ if !$dir{"subsystem $nqn"}
+ || grep { !defined($subsys->{$_}) } qw(attr_model attr_serial attr_allow_any_host);
+ for my $nsid (keys $subsys->{namespaces}->%*) {
+ my $ns = $subsys->{namespaces}->{$nsid};
+ die "incomplete NVMe namespace '$nsid' of subsystem" . nvmet_label($nqn) . "\n"
+ if !$dir{"namespace $nqn/$nsid"}
+ || grep { !defined($ns->{$_}) } qw(enable device_path device_uuid buffered_io);
+ }
+ }
+ for my $id (keys $state->{ports}->%*) {
+ my $object = $state->{ports}->{$id};
+ my @attrs = qw(addr_trtype addr_adrfam addr_traddr addr_trsvcid);
+ die "incomplete NVMe port '$id'\n"
+ if !$dir{"port $id"} || grep { !defined($object->{$_}) } @attrs;
+ }
+ for my $hostnqn (keys $state->{hosts}->%*) {
+ die "DH-HMAC-CHAP key digest for unknown NVMe host" . nvmet_label($hostnqn) . "\n"
+ if !$dir{"host $hostnqn"};
+ }
+ return $state;
+}
+
+sub _nvmet_parse_mounts($text) {
+ for my $line (split /\n/, $text) {
+ my (undef, $mountpoint, $type) = split / /, $line;
+ return 1 if ($mountpoint // '') eq '/sys/kernel/config' && ($type // '') eq 'configfs';
+ }
+ return 0;
+}
+
+# ---------------------------------------------------------------------------
+# Planners (pure)
+# ---------------------------------------------------------------------------
+
+sub _nvmet_serial($nqn) {
+ return 'PVEZFS' . substr(sha256_hex($nqn), 0, 14);
+}
+
+sub _nvmet_template_name($dataset) {
+ die "only VM zvols can become templates\n"
+ if $dataset !~ $RE_NVMET_TEMPLATE_ZVOL || $+{type} ne 'vm';
+ return nvmet_template_twin($dataset);
+}
+
+# The durable identity (NSID, UUID) of a volume owned by $nqn. Refuses a
+# volume that another owned volume duplicates anywhere in the pool.
+sub _nvmet_owned_identity($inv, $nqn, $dataset) {
+ my $type = $inv->{types}->{$dataset} // die "ZFS volume '$dataset' does not exist\n";
+ die "'$dataset' is not a ZFS volume\n" if $type ne 'volume';
+ my $row = $inv->{volumes}->{$dataset};
+ die "ZFS volume '$dataset' is not owned by NVMe subsystem '$nqn'\n" if $row->{nqn} ne $nqn;
+ die "invalid NSID on '$dataset'\n" if !nvmet_valid_nsid($row->{nsid});
+ die "invalid namespace UUID on '$dataset'\n" if $row->{uuid} !~ $RE_NVMET_UUID;
+ for my $other (keys $inv->{volumes}->%*) {
+ next if $other eq $dataset;
+ my $identity = $inv->{volumes}->{$other};
+ next if $identity->{nqn} ne $nqn;
+ die "duplicate NVMe identity on '$dataset'\n"
+ if $identity->{nsid} eq $row->{nsid} || $identity->{uuid} eq $row->{uuid};
+ }
+ return ($row->{nsid}, $row->{uuid});
+}
+
+# { nsid => [uuid, device] } for every volume owned by $nqn, after validating
+# all of them, so a bad identity refuses the whole plan before any change.
+sub _nvmet_desired_namespaces($inv, $nqn) {
+ my (%desired, %uuids);
+ for my $dataset (sort keys $inv->{volumes}->%*) {
+ my $row = $inv->{volumes}->{$dataset};
+ next if $row->{nqn} ne $nqn;
+ die "invalid NSID on '$dataset'\n" if !nvmet_valid_nsid($row->{nsid});
+ die "invalid namespace UUID on '$dataset'\n" if $row->{uuid} !~ $RE_NVMET_UUID;
+ die "duplicate NSID '$row->{nsid}'\n" if $desired{ $row->{nsid} };
+ die "duplicate namespace UUID '$row->{uuid}'\n" if $uuids{ lc($row->{uuid}) }++;
+ $desired{ $row->{nsid} } = [$row->{uuid}, "/dev/zvol/$dataset"];
+ }
+ return \%desired;
+}
+
+# NSIDs grow monotonically, also past the last NSID handed out in the pool,
+# so a host that missed a namespace removal never sees a new volume at an old
+# NSID. Only after the last NSID is used does the allocation fall back to the
+# lowest free one.
+sub _nvmet_allocate_nsid($inv, $cfs, $nqn) {
+ my %used;
+ for my $row (values $inv->{volumes}->%*) {
+ $used{ $row->{nsid} } = 1 if $row->{nqn} eq $nqn && nvmet_valid_nsid($row->{nsid});
+ }
+ $used{$_} = 1 for keys nvmet_namespaces($cfs, $nqn)->%*;
+
+ my $highest = max(0, $inv->{last_nsid} // 0, keys %used);
+ return $highest + 1 if $highest < $nvmet_max_nsid;
+ my $nsid = 1;
+ $nsid++ while $used{$nsid};
+ die "no free namespace ID\n" if $nsid > $nvmet_max_nsid;
+ return $nsid;
+}
+
+# Export state of (NSID, UUID, device) in the subsystem: present, disabled,
+# absent, incomplete (a disabled namespace with another identity, for example
+# one being built), stale (enabled on the other template name of the zvol) or
+# nosubsys. Dies on a conflict.
+sub _nvmet_export_state($cfs, $nqn, $nsid, $uuid, $dev) {
+ return 'nosubsys' if !$cfs->{subsystems}->{$nqn};
+ my $namespaces = nvmet_namespaces($cfs, $nqn);
+ for my $id (keys $namespaces->%*) {
+ next if $id eq $nsid;
+ die "namespace UUID '$uuid' is already in use\n"
+ if $namespaces->{$id}->{device_uuid} eq $uuid;
+ }
+ my $ns = $namespaces->{$nsid} // return 'absent';
+ if ($ns->{device_uuid} eq $uuid && $ns->{device_path} eq $dev) {
+ return $ns->{enable} eq '1' ? 'present' : 'disabled';
+ }
+ # A template conversion or its undo that ssh gave up on can rename the
+ # zvol on the target after an activation exported it under its old name.
+ my $twin = nvmet_template_twin($dev);
+ return 'stale'
+ if $ns->{enable} eq '1'
+ && $ns->{device_uuid} eq $uuid
+ && $twin ne ''
+ && $ns->{device_path} eq $twin;
+ die "NVMe namespace ID '$nsid' has a different identity; refusing to replace it\n"
+ if $ns->{enable} ne '0';
+ return 'incomplete';
+}
+
+# Units that export (NSID, UUID, device) and the state they start from:
+# absent, present, disabled, reclaim or stale. A disabled namespace with
+# another identity, or a stale one, is rebuilt, which is only correct under
+# the target lock. A stale namespace belongs to a template, or to a volume
+# whose template conversion failed, so no guest uses it.
+sub _nvmet_plan_export($cfs, $nqn, $nsid, $uuid, $dev) {
+ die "NVMe subsystem does not exist\n" if !$cfs->{subsystems}->{$nqn};
+ my $state = _nvmet_export_state($cfs, $nqn, $nsid, $uuid, $dev);
+ return ([nvmet_build_unit($nqn, $nsid, $uuid, $dev)], 'absent') if $state eq 'absent';
+ return ([], 'present') if $state eq 'present';
+ return ([nvmet_enable_unit($nqn, $nsid, $dev)], 'disabled') if $state eq 'disabled';
+ my $unexport = nvmet_unexport_unit($nqn, $nsid, $state eq 'stale');
+ my $build = nvmet_build_unit($nqn, $nsid, $uuid, $dev);
+ return ([[$unexport->@*, $build->@*]], $state eq 'stale' ? 'stale' : 'reclaim');
+}
+
+# Units that remove the namespace exporting $uuid, and its previous state.
+sub _nvmet_plan_unexport($cfs, $nqn, $uuid) {
+ my $namespaces = nvmet_namespaces($cfs, $nqn);
+ my @matches = grep { $namespaces->{$_}->{device_uuid} eq $uuid }
+ sort { $a <=> $b } keys $namespaces->%*;
+ die "duplicate namespace UUID '$uuid'\n" if @matches > 1;
+ return ([], undef) if !@matches;
+ my $enabled = $namespaces->{ $matches[0] }->{enable} eq '1';
+ return (
+ [nvmet_unexport_unit($nqn, $matches[0], $enabled)],
+ { nsid => $matches[0], enabled => $enabled },
+ );
+}
+
+# The port serving a portal ({ family, address, port } of parse_nvme_portals).
+# Among complete, matching ports, the one already linked to $nqn wins, then
+# the lowest id. Incomplete ports never match.
+sub _nvmet_find_port($cfs, $nqn, $portal) {
+ my $wanted = nvmet_canonical_address($portal->{address});
+ my @matches = grep {
+ my $port = $cfs->{ports}->{$_};
+ $port->{addr_trtype} eq 'tcp'
+ && $port->{addr_adrfam} eq $portal->{family}
+ && $port->{addr_traddr} ne ''
+ && $port->{addr_trsvcid} eq "$portal->{port}"
+ && nvmet_canonical_address($port->{addr_traddr}) eq $wanted
+ } sort {
+ $a <=> $b
+ } keys $cfs->{ports}->%*;
+ my @linked = grep { nvmet_port_linked($cfs, $_, $nqn) } @matches;
+ return $linked[0] // $matches[0];
+}
+
+# Units that bring the target to the configured state, except publishing:
+# objects (subsystem, ports, hosts), keys, ACLs, namespaces in NSID order,
+# then removal of undesired namespaces.
+# $conf: { nqn, portals (of parse_nvme_portals), hostnqns, keysha }
+sub _nvmet_plan_activation($inv, $cfs, $conf) {
+ my ($nqn, $keysha) = $conf->@{qw(nqn keysha)};
+ my $desired = _nvmet_desired_namespaces($inv, $nqn); # refuse before any unit
+ my $subsys_path = nvmet_subsys_path($nqn);
+ my $subsys = $cfs->{subsystems}->{$nqn};
+ my (@objects, @key_hosts, @acls, @namespaces, %port_ids);
+
+ if (!$subsys) {
+ push @objects,
+ [
+ ['mkdir', $subsys_path],
+ nvmet_write("$subsys_path/attr_model", $nvmet_model),
+ nvmet_write("$subsys_path/attr_serial", _nvmet_serial($nqn)),
+ nvmet_write("$subsys_path/attr_allow_any_host", 0),
+ ];
+ } else {
+ my $serial = _nvmet_serial($nqn);
+ my @attrs;
+ if ($subsys->{attr_model} ne $nvmet_model || $subsys->{attr_serial} ne $serial) {
+ die "refusing to take over existing NVMe subsystem '$nqn': it was not created by"
+ . " Proxmox VE; remove it on the target or use another NQN\n"
+ if !nvmet_unfinished_subsystem($cfs, $nqn);
+ push @attrs, nvmet_write("$subsys_path/attr_serial", $serial);
+ }
+ push @attrs, nvmet_write("$subsys_path/attr_allow_any_host", 0)
+ if $subsys->{attr_allow_any_host} ne '0';
+ push @objects, [@attrs] if @attrs;
+ }
+
+ my %taken = map { $_ => 1 } keys $cfs->{ports}->%*;
+ for my $portal ($conf->{portals}->@*) {
+ my $id = _nvmet_find_port($cfs, $nqn, $portal);
+ if (!defined($id)) {
+ $id = 1;
+ $id++ while $taken{$id};
+ $taken{$id} = 1;
+ my $port_path = nvmet_port_path($id);
+ push @objects,
+ [
+ ['mkdir', $port_path],
+ nvmet_write("$port_path/addr_trtype", 'tcp'),
+ nvmet_write("$port_path/addr_adrfam", $portal->{family}),
+ nvmet_write("$port_path/addr_traddr", $portal->{address}),
+ nvmet_write("$port_path/addr_trsvcid", $portal->{port}),
+ ];
+ }
+ $port_ids{$id} = 1;
+ }
+
+ # nvmet keeps the key on the global host object. A key that differs from
+ # ours is only replaced while no subsystem links the host.
+ my $linked = nvmet_linked_hosts($cfs);
+ for my $hostnqn ($conf->{hostnqns}->@*) {
+ my $host_path = nvmet_host_path($hostnqn);
+ if (my $host = $cfs->{hosts}->{$hostnqn}) {
+ my $sha = $host->{key_sha256}
+ // die "NVMe target does not expose a DH-HMAC-CHAP key for host '$hostnqn'\n";
+ if ($sha ne $keysha) {
+ die "refusing to replace an in-use DH-HMAC-CHAP key for '$hostnqn'\n"
+ if $linked->{$hostnqn};
+ push @key_hosts, $host_path;
+ }
+ } else {
+ push @objects, [['mkdir', $host_path]];
+ push @key_hosts, $host_path;
+ }
+ push @acls, [['ln', '-s', $host_path, "$subsys_path/allowed_hosts/$hostnqn"]]
+ if !$subsys || !($subsys->{acl} // {})->{$hostnqn};
+ }
+ # nvmet creates the key attributes world-readable. The chmod before the
+ # write keeps every later open from reading the key; a descriptor opened
+ # while an attribute was still world-readable is not affected by it.
+ my @keys;
+ if (@key_hosts) {
+ my @attrs = map { ("$_/dhchap_key", "$_/dhchap_ctrl_key") } @key_hosts;
+ @keys = ([['chmod', '0600', @attrs], { key => [map { "$_/dhchap_key" } @key_hosts] }]);
+ }
+
+ my $current = { subsystems => { $nqn => $subsys // { acl => {}, namespaces => {} } } };
+ for my $nsid (sort { $a <=> $b } keys $desired->%*) {
+ my ($units) = _nvmet_plan_export($current, $nqn, $nsid, $desired->{$nsid}->@*);
+ push @namespaces, $units->@*;
+ }
+ my $existing = nvmet_namespaces($cfs, $nqn);
+ for my $nsid (sort { $a <=> $b } keys $existing->%*) {
+ next if $desired->{$nsid};
+ push @namespaces, nvmet_unexport_unit($nqn, $nsid, $existing->{$nsid}->{enable} eq '1');
+ }
+
+ return {
+ prepublish => [@objects, @keys, @acls, @namespaces],
+ port_ids => [sort { $a <=> $b } keys %port_ids],
+ };
+}
+
+# One call per port: each link repeats the guards, so it only succeeds while
+# the subsystem denies unknown hosts and every configured host has its ACL.
+# Under the target lock, only a manager of the target outside this cluster
+# can change that after the verify read; the guards stop the publish then.
+# Links to ports that are no longer configured are removed.
+# Returns [{ port => $id, action => 'link' | 'unlink', steps => [...] }, ...].
+sub _nvmet_plan_publish($cfs, $nqn, $port_ids, $hostnqns) {
+ my $subsys_path = nvmet_subsys_path($nqn);
+ my %wanted = map { $_ => 1 } $port_ids->@*;
+ my @guards = (
+ ['grep', '-qx', '0', "$subsys_path/attr_allow_any_host"],
+ map { ['test', '-L', "$subsys_path/allowed_hosts/$_"] } $hostnqns->@*,
+ );
+
+ my @units;
+ for my $id ($port_ids->@*) {
+ next if nvmet_port_linked($cfs, $id, $nqn);
+ my $link = ['ln', '-s', $subsys_path, nvmet_port_path($id) . "/subsystems/$nqn"];
+ push @units, { port => $id, action => 'link', steps => [@guards, $link] };
+ }
+ for my $id (sort { $a <=> $b } keys $cfs->{ports}->%*) {
+ next if $wanted{$id} || !nvmet_port_linked($cfs, $id, $nqn);
+ my $unlink = ['rm', nvmet_port_path($id) . "/subsystems/$nqn"];
+ push @units, { port => $id, action => 'unlink', steps => [$unlink] };
+ }
+ return \@units;
+}
+
+# Teardown units for the subsystem and the hosts that may become orphans.
+sub _nvmet_plan_delete_target($inv, $cfs, $nqn, $hostnqns) {
+ for my $dataset (sort keys $inv->{volumes}->%*) {
+ die "refusing to delete NVMe subsystem '$nqn': owned ZFS volume '$dataset' exists\n"
+ if $inv->{volumes}->{$dataset}->{nqn} eq $nqn;
+ }
+ my $subsys = $cfs->{subsystems}->{$nqn} // return ([], [$hostnqns->@*]);
+ die "refusing to delete foreign NVMe subsystem '$nqn'\n"
+ if $subsys->{attr_model} ne $nvmet_model || $subsys->{attr_serial} ne _nvmet_serial($nqn);
+ die "refusing to delete NVMe subsystem '$nqn': namespaces remain\n"
+ if nvmet_namespaces($cfs, $nqn)->%*;
+
+ my $subsys_path = nvmet_subsys_path($nqn);
+ my @acl = sort keys(($subsys->{acl} // {})->%*);
+ die "refusing to delete NVMe subsystem '$nqn': it allows a malformed host name\n"
+ if grep { $_ !~ $RE_NQN } @acl;
+ my @links = (
+ (
+ map { nvmet_port_path($_) . "/subsystems/$nqn" }
+ grep { nvmet_port_linked($cfs, $_, $nqn) }
+ sort { $a <=> $b } keys $cfs->{ports}->%*
+ ),
+ (map { "$subsys_path/allowed_hosts/$_" } @acl),
+ );
+ # A retry after a teardown that failed at its rmdir finds no ACL left, so
+ # the configured hosts are candidates as well.
+ my %candidates = map { $_ => 1 } @acl, $hostnqns->@*;
+ return (
+ [[(@links ? (['rm', @links]) : ()), ['rmdir', $subsys_path]]], [sort keys %candidates],
+ );
+}
+
+# Candidate hosts that exist and that no subsystem links any more.
+sub _nvmet_plan_orphan_hosts($cfs, $candidates) {
+ my $linked = nvmet_linked_hosts($cfs);
+ my %seen;
+ my @orphans = map { nvmet_host_path($_) }
+ grep { !$seen{$_}++ && $_ =~ $RE_NQN && $cfs->{hosts}->{$_} && !$linked->{$_} }
+ sort $candidates->@*;
+ return @orphans ? [[['rmdir', @orphans]]] : [];
+}
+
+# ---------------------------------------------------------------------------
+# Target lock and remote execution
+# ---------------------------------------------------------------------------
+
+my %nvmet_lock_owner; # lock id => pid of the process holding the domain lock
+
+# Runs $code under the pmxcfs domain lock of the target. Like the pmxcfs
+# lock itself, it is not re-entrant, and a child forked inside is not the
+# owner.
+my sub nvmet_locked($scfg, $code) {
+ my $id = nvmet_lock_id($scfg);
+ die "cluster not quorate - refusing NVMe target changes\n"
+ if !PVE::Cluster::check_cfs_quorum(1);
+ my $res = PVE::Cluster::cfs_lock_domain(
+ $id,
+ $nvmet_lock_wait,
+ sub {
+ local $nvmet_lock_owner{$id} = $$;
+ return $code->();
+ },
+ );
+ die $@ if $@;
+ return $res;
+}
+
+# Runs steps on the target. %opts: op, timeout, input, change (the steps
+# change the target, which needs the lock).
+#
+# ssh does not stop a command on the target when it gives up on it: a change
+# whose connection broke (exit code 255), any call under the lock that ssh
+# did not run to its end (-1: its timeout, or ssh was killed), and a call
+# during which the task was stopped (it dies with the task marker) may still
+# be running there. Its outcome is unknown, so it is never compensated from a
+# read that could come before the rest of it. The next activation repairs
+# from the target state.
+my sub nvmet_exec($scfg, $steps, %opts) {
+ my $locked = ($nvmet_lock_owner{ nvmet_lock_id($scfg) } // 0) == $$;
+ die "internal error: NVMe target change without target lock\n"
+ if $opts{change} && !$locked;
+ my $res = _nvmet_run(
+ $scfg, $steps,
+ op => $opts{op},
+ timeout => $opts{timeout} // 15,
+ (defined($opts{input}) ? (input => $opts{input}) : ()),
+ );
+ die "NVMe target operation '$opts{op}' did not complete ($res->{err});"
+ . " the target state is unknown\n"
+ if ($locked && $res->{rc} == -1)
+ || ($opts{change} && $res->{rc} == 255);
+ return $res;
+}
+
+# An abandoned operation is passed on instead of being compensated.
+my sub nvmet_rethrow_abandoned($error) {
+ die $error if $error =~ $RE_NVMET_ABANDONED;
+}
+
+my sub nvmet_unreachable($res) {
+ return $res->{rc} == 255 || $res->{rc} == -1;
+}
+
+my sub nvmet_check($res, $op) {
+ die "NVMe target operation '$op' failed: $res->{err}\n" if $res->{rc};
+}
+
+my sub nvmet_read_failed($scfg, $res) {
+ die "NVMe target '" . nvmet_server($scfg) . "' is unreachable: $res->{err}\n"
+ if nvmet_unreachable($res);
+ die "cannot read NVMe target state: $res->{err}\n";
+}
+
+my sub nvmet_output($res) {
+ return join('', map { "$_\n" } $res->{out}->@*);
+}
+
+# A read, retried twice after 200 ms unless the target is unreachable: a read
+# without the lock can meet a configfs object that another node removes
+# while find lists it, which makes find fail once.
+my sub nvmet_read_call($scfg, $steps, %opts) {
+ my $res;
+ for my $attempt (0 .. 2) {
+ _sleep(0.2) if $attempt;
+ $res = nvmet_exec($scfg, $steps, %opts, timeout => 15);
+ last if !$res->{rc} || nvmet_unreachable($res);
+ }
+ return $res;
+}
+
+# Reads the target state and returns (ZFS inventory, configfs state).
+# keys => [hostnqns] adds the digests of their keys. modprobe => 1, for locked
+# reads only, loads nvmet first and mounts configfs if that is what failed.
+# With tolerant => 1, a failed or unparsable read returns an empty list,
+# unless the target is unreachable.
+my sub nvmet_read($scfg, %opts) {
+ my $pool = nvmet_pool($scfg);
+ my $hostnqns = $opts{keys} // [];
+ # loading a module that may still be loading is harmless
+ my @modprobe = $opts{modprobe} ? (change => 1) : ();
+ my $read = sub () {
+ return nvmet_read_call(
+ $scfg,
+ nvmet_state_steps($pool, $hostnqns, $opts{modprobe}),
+ op => 'read target state',
+ @modprobe,
+ );
+ };
+ my $res = $read->();
+ if ($res->{rc} && $opts{modprobe} && !nvmet_unreachable($res)) {
+ my $mounts = nvmet_exec($scfg, [['cat', '/proc/mounts']], op => 'read mounts');
+ nvmet_check($mounts, 'read mounts');
+ if (!_nvmet_parse_mounts(nvmet_output($mounts))) {
+ my $mount = ['mount', '-t', 'configfs', 'none', '/sys/kernel/config'];
+ my $mounted = nvmet_exec($scfg, [$mount], op => 'mount configfs', change => 1);
+ nvmet_check($mounted, 'mount configfs');
+ $res = $read->();
+ }
+ }
+ if ($res->{rc}) {
+ return () if $opts{tolerant} && !nvmet_unreachable($res);
+ nvmet_read_failed($scfg, $res);
+ }
+ my @state = eval {
+ my ($zfs, $configfs) = _nvmet_split_state(nvmet_output($res));
+ (_nvmet_parse_zfs_inventory($zfs, $pool), _nvmet_parse_configfs($configfs));
+ };
+ if (my $error = $@) {
+ return () if $opts{tolerant};
+ die $error;
+ }
+ return @state;
+}
+
+my sub nvmet_read_zfs($scfg) {
+ my $pool = nvmet_pool($scfg);
+ my $res = nvmet_read_call($scfg, [nvmet_zfs_inventory_step($pool)], op => 'read ZFS inventory');
+ nvmet_read_failed($scfg, $res) if $res->{rc};
+ return _nvmet_parse_zfs_inventory(nvmet_output($res), $pool);
+}
+
+# Applies units in as few calls as possible and stops at the first failing
+# call, whose result it returns. A chain only saves SSH round trips: every
+# decision was taken locally before, and `&&` only stops at the first
+# failing command. Only the call with the key step gets stdin. The default
+# timeout suits configfs chains; ZFS changes pass their own.
+my sub nvmet_apply($scfg, $units, %opts) {
+ my $input = delete $opts{input};
+ $opts{timeout} //= 30;
+ for my $chunk (_nvmet_chunk($units)->@*) {
+ my $with_key = grep { ref($_) eq 'HASH' && exists($_->{key}) } $chunk->@*;
+ my @input = $with_key ? (input => $input) : ();
+ my $res = nvmet_exec($scfg, $chunk, %opts, @input, change => 1);
+ return $res if $res->{rc};
+ }
+ return { rc => 0, out => [], err => '' };
+}
+
+my sub nvmet_change($scfg, $units, %opts) {
+ nvmet_check(nvmet_apply($scfg, $units, %opts), $opts{op});
+}
+
+my sub nvmet_wait_device($scfg, $dev) {
+ my $deadline = _now() + 10;
+ while (1) {
+ my $res = nvmet_exec($scfg, [['test', '-b', $dev]], op => 'wait for zvol');
+ return if !$res->{rc};
+ nvmet_read_failed($scfg, $res) if nvmet_unreachable($res);
+ last if _now() >= $deadline;
+ _sleep(0.25);
+ }
+ die "zvol '$dev' is not a block device after 10 seconds\n";
+}
+
+my sub nvmet_new_uuid($inv, $cfs) {
+ my %used = map { lc($_->{uuid}) => 1 } values $inv->{volumes}->%*;
+ for my $subsys (values $cfs->{subsystems}->%*) {
+ $used{ lc($_->{device_uuid}) } = 1 for values(($subsys->{namespaces} // {})->%*);
+ }
+ for (1 .. 10) {
+ my $uuid = lc(file_read_firstline('/proc/sys/kernel/random/uuid') // '');
+ return $uuid if $uuid =~ $RE_NVMET_UUID && !$used{$uuid};
+ }
+ die "cannot generate an unused namespace UUID\n";
+}
+
+my sub nvmet_has_identity($row, $nqn, $nsid, $uuid) {
+ return $row && $row->{nqn} eq $nqn && $row->{nsid} eq "$nsid" && $row->{uuid} eq $uuid;
+}
+
+# The configfs state after a successful unexport of namespace $pre->{nsid}.
+my sub nvmet_without_namespace($cfs, $nqn, $pre) {
+ return $cfs if !$pre;
+ my $subsys = $cfs->{subsystems}->{$nqn};
+ my %namespaces = $subsys->{namespaces}->%*;
+ delete $namespaces{ $pre->{nsid} };
+ my $changed = { $subsys->%*, namespaces => \%namespaces };
+ return { $cfs->%*, subsystems => { $cfs->{subsystems}->%*, $nqn => $changed } };
+}
+
+# Links the subsystem to each desired port separately. One port that cannot
+# be bound (for example, its address is missing on the target) only warns
+# while another desired port serves the subsystem.
+my sub nvmet_publish($scfg, $cfs, $nqn, $port_ids, $hostnqns) {
+ my @failed;
+ for my $unit (_nvmet_plan_publish($cfs, $nqn, $port_ids, $hostnqns)->@*) {
+ my $op = "$unit->{action} NVMe subsystem on port $unit->{port}";
+ my $res = nvmet_apply($scfg, [$unit->{steps}], op => $op);
+ push @failed, { $unit->%*, err => $res->{err} } if $res->{rc};
+ }
+ return if !@failed;
+
+ my (undef, $fresh) = eval { nvmet_read($scfg) };
+ nvmet_rethrow_abandoned($@) if $@;
+ my $published = $fresh && grep { nvmet_port_linked($fresh, $_, $nqn) } $port_ids->@*;
+ my ($first) = grep { $_->{action} eq 'link' } @failed;
+ $first //= $failed[0];
+ die "cannot publish NVMe subsystem '$nqn': $first->{err}\n" if !$published;
+ for my $failure (@failed) {
+ my $what = $failure->{action} eq 'link' ? 'publish' : 'unpublish';
+ log_warn("cannot $what NVMe subsystem '$nqn' on port $failure->{port}: $failure->{err}");
+ }
+}
+
+# ---------------------------------------------------------------------------
+# Target flows
+# ---------------------------------------------------------------------------
+
+# Brings the target to the configured state and publishes the subsystem.
+# A converged target costs one read and no lock. Otherwise, under the lock:
+# read, apply, verify with a fresh read, and publish only once the verify
+# read plans nothing more. $portals and $hostnqns are the parsed and validated
+# storage configuration.
+sub _nvmet_activate_target($storeid, $scfg, $portals, $hostnqns, $key) {
+ my $nqn = nvmet_nqn($scfg);
+ my $conf = {
+ nqn => $nqn,
+ portals => $portals,
+ hostnqns => $hostnqns,
+ keysha => sha256_hex("$key\n"),
+ };
+ my $converged = sub($inv, $cfs) {
+ my $plan = _nvmet_plan_activation($inv, $cfs, $conf);
+ return !$plan->{prepublish}->@*
+ && !_nvmet_plan_publish($cfs, $nqn, $plan->{port_ids}, $hostnqns)->@*;
+ };
+
+ # Without the lock, a refusal or failed read only means "take the lock".
+ my @state = nvmet_read($scfg, keys => $hostnqns, tolerant => 1);
+ return if @state && eval { $converged->(@state) };
+
+ nvmet_locked(
+ $scfg,
+ sub {
+ # Removing the storage deletes its key before it removes the target
+ # configuration, so an activation that waited for the lock meanwhile
+ # does not restore it.
+ die "storage '$storeid' is being removed or its key changed\n"
+ if (file_read_firstline(secret_path($storeid)) // '') ne $key;
+ my ($inv, $cfs) = nvmet_read($scfg, keys => $hostnqns, modprobe => 1);
+ my $plan = _nvmet_plan_activation($inv, $cfs, $conf);
+ my $error;
+ for my $round (1 .. 2) {
+ last if !$plan->{prepublish}->@*;
+ my $apply = nvmet_apply(
+ $scfg, $plan->{prepublish},
+ op => 'configure NVMe target',
+ input => "$key\n",
+ );
+ $error //= $apply->{err} if $apply->{rc};
+ ($inv, $cfs) = nvmet_read($scfg, keys => $hostnqns);
+ $plan = _nvmet_plan_activation($inv, $cfs, $conf);
+ }
+ die "NVMe target did not converge: " . ($error // 'state mismatch') . "\n"
+ if $plan->{prepublish}->@*;
+ nvmet_publish($scfg, $cfs, $nqn, $plan->{port_ids}, $hostnqns);
+ },
+ );
+ return;
+}
+
+# The namespace UUID of an owned volume, from one read-only ZFS query.
+sub _nvmet_volume_uuid($scfg, $name) {
+ my $dataset = nvmet_dataset($scfg, $name);
+ my $inv = nvmet_read_zfs($scfg);
+ my (undef, $uuid) = _nvmet_owned_identity($inv, nvmet_nqn($scfg), $dataset);
+ return $uuid;
+}
+
+# Creates (size => KiB) or clones (origin => pool/base@snap) a zvol with its
+# identity set at creation, then exports it. A failure removes only what this
+# call created, decided from a fresh read.
+my sub nvmet_create_volume($scfg, $name, %opts) {
+ my $nqn = nvmet_nqn($scfg);
+ my $dataset = nvmet_dataset($scfg, $name);
+ my $dev = "/dev/zvol/$dataset";
+ die "internal error: invalid zvol creation request\n"
+ if defined($opts{size}) == defined($opts{origin})
+ || (defined($opts{size}) && $opts{size} !~ $RE_UNSIGNED_INTEGER);
+
+ return nvmet_locked(
+ $scfg,
+ sub {
+ my ($inv, $cfs) = nvmet_read($scfg, modprobe => 1);
+ die "zvol '$dataset' already exists\n" if exists($inv->{types}->{$dataset});
+ die "NVMe subsystem does not exist; activate the storage first\n"
+ if !$cfs->{subsystems}->{$nqn};
+ my $nsid = _nvmet_allocate_nsid($inv, $cfs, $nqn);
+ my $uuid = nvmet_new_uuid($inv, $cfs);
+ my (undef, $state) = _nvmet_plan_export($cfs, $nqn, $nsid, $uuid, $dev);
+ die "internal error: namespace ID '$nsid' is in use\n" if $state ne 'absent';
+
+ # Record the NSID on the pool before the zvol exists: a creation that
+ # completes on the target only after this call gave up on it must
+ # never share its NSID with a later volume.
+ my $timeout = nvmet_long_timeout();
+ if ($nsid > $inv->{last_nsid}) {
+ my $reserve = ['zfs', 'set', "$nvmet_last_nsid=$nsid", nvmet_pool($scfg)];
+ nvmet_change(
+ $scfg, [[$reserve]],
+ op => 'reserve namespace ID',
+ timeout => $timeout,
+ );
+ }
+
+ my @identity = map { ('-o', $_) } nvmet_identity($nqn, $nsid, $uuid);
+ my @create_opts = (
+ ($scfg->{sparse} ? ('-s') : ()),
+ ($scfg->{blocksize} ? ('-b', $scfg->{blocksize}) : ()),
+ );
+ my $create =
+ defined($opts{origin})
+ ? ['zfs', 'clone', @identity, $opts{origin}, $dataset]
+ : ['zfs', 'create', @create_opts, @identity, '-V', "$opts{size}k", $dataset];
+ my $res = nvmet_apply(
+ $scfg, [[$create]],
+ op => 'create zvol',
+ timeout => $timeout,
+ );
+ if ($res->{rc}) {
+ # A definite command failure may still have created the zvol.
+ # Only a zvol with this call's identity counts. Ambiguous SSH
+ # outcomes have already aborted the transaction in nvmet_exec.
+ my $check = eval { nvmet_read_zfs($scfg) };
+ nvmet_rethrow_abandoned($@) if $@;
+ my $row = $check ? $check->{volumes}->{$dataset} : undef;
+ die "NVMe target operation 'create zvol' failed: $res->{err}\n"
+ if !nvmet_has_identity($row, $nqn, $nsid, $uuid);
+ }
+
+ my $verified;
+ eval {
+ nvmet_wait_device($scfg, $dev);
+ my $build_unit = nvmet_build_unit($nqn, $nsid, $uuid, $dev);
+ my $build = nvmet_apply($scfg, [$build_unit], op => 'export namespace');
+ $verified = [nvmet_read($scfg)];
+ my ($vinv, $vcfs) = $verified->@*;
+ my ($vnsid, $vuuid) = _nvmet_owned_identity($vinv, $nqn, $dataset);
+ die "NVMe identity of zvol '$dataset' changed\n"
+ if $vnsid ne $nsid || $vuuid ne $uuid;
+ if (_nvmet_export_state($vcfs, $nqn, $nsid, $uuid, $dev) ne 'present') {
+ nvmet_check($build, 'export namespace');
+ die "NVMe namespace '$nsid' was not exported\n";
+ }
+ };
+ my $error = $@ or return $uuid;
+ nvmet_rethrow_abandoned($error);
+
+ eval {
+ my ($cinv, $ccfs) = $verified ? $verified->@* : nvmet_read($scfg);
+ my $namespaces = nvmet_namespaces($ccfs, $nqn);
+ # The build writes the UUID before it enables the namespace, so an
+ # enabled namespace without our UUID was not built by this call.
+ my @unexport =
+ map { nvmet_unexport_unit($nqn, $_, $namespaces->{$_}->{enable} eq '1') }
+ grep {
+ my $ns = $namespaces->{$_};
+ $ns->{device_uuid} eq $uuid
+ || ($ns->{enable} ne '1' && $ns->{device_path} eq $dev)
+ } sort {
+ $a <=> $b
+ } keys $namespaces->%*;
+ nvmet_change($scfg, \@unexport, op => 'remove namespace') if @unexport;
+ # -o at creation proves that this call created the zvol
+ if (nvmet_has_identity($cinv->{volumes}->{$dataset}, $nqn, $nsid, $uuid)) {
+ my $destroy = ['zfs', 'destroy', '-r', $dataset];
+ nvmet_change(
+ $scfg, [[$destroy]],
+ op => 'destroy zvol',
+ timeout => $timeout,
+ );
+ }
+ };
+ log_warn("failed to clean up zvol '$name': $@") if $@;
+ die $error;
+ },
+ );
+}
+
+# Unexports and destroys an owned zvol. A missing zvol is already destroyed.
+my sub nvmet_destroy_volume($scfg, $name) {
+ my $nqn = nvmet_nqn($scfg);
+ my $dataset = nvmet_dataset($scfg, $name);
+ my $dev = "/dev/zvol/$dataset";
+ my $destroy = ['zfs', 'destroy', '-r', $dataset];
+ my $timeout = nvmet_long_timeout();
+
+ nvmet_locked(
+ $scfg,
+ sub {
+ my ($inv, $cfs) = nvmet_read($scfg, modprobe => 1);
+ return if !exists($inv->{types}->{$dataset});
+ my ($nsid, $uuid) = _nvmet_owned_identity($inv, $nqn, $dataset);
+ my ($unexport, $pre) = ([], undef);
+ if ($cfs->{subsystems}->{$nqn}) {
+ _nvmet_plan_export($cfs, $nqn, $nsid, $uuid, $dev); # refusals only
+ ($unexport, $pre) = _nvmet_plan_unexport($cfs, $nqn, $uuid);
+ }
+ my $units = [$unexport->@*, [$destroy]];
+ my $res = nvmet_apply($scfg, $units, op => 'destroy zvol', timeout => $timeout);
+ return if !$res->{rc};
+ my $error = $res->{err};
+
+ # Decide from a fresh read what the failed call changed.
+ my ($finv, $fcfs) = eval { nvmet_read($scfg) };
+ if (my $read_error = $@) {
+ nvmet_rethrow_abandoned($read_error);
+ die "failed to destroy '$dataset': $error\n";
+ }
+ return if !exists($finv->{types}->{$dataset});
+ my $namespaces = nvmet_namespaces($fcfs, $nqn);
+ my ($current) =
+ grep { $namespaces->{$_}->{device_uuid} eq $uuid } keys $namespaces->%*;
+ if (defined($current)) {
+ die "cannot disable namespace '$current': $error\n"
+ if $namespaces->{$current}->{enable} eq '1';
+ die "cannot remove namespace '$current': $error\n" if !$pre || !$pre->{enabled};
+ my $enable = [nvmet_enable_unit($nqn, $current, $dev)];
+ my $restore = nvmet_apply($scfg, $enable, op => 'enable namespace');
+ die "cannot remove namespace '$current': $error"
+ . ($restore->{rc} ? "; cannot restore namespace: $restore->{err}" : '') . "\n";
+ }
+
+ # The namespace is gone and the zvol is still there, typically busy.
+ for my $attempt (1 .. 5) {
+ _sleep(1);
+ my $retry =
+ nvmet_apply($scfg, [[$destroy]], op => 'destroy zvol', timeout => $timeout);
+ return if !$retry->{rc};
+ $error = $retry->{err};
+ }
+ die "failed to destroy '$dataset': $error\n" if !$pre;
+ eval {
+ my (undef, $rcfs) = nvmet_read($scfg);
+ my ($units) = _nvmet_plan_export($rcfs, $nqn, $nsid, $uuid, $dev);
+ nvmet_change($scfg, $units, op => 'restore namespace');
+ };
+ die "failed to destroy '$dataset': $error; namespace restoration also failed: $@"
+ if $@;
+ die "failed to destroy '$dataset': $error; namespace restored\n";
+ },
+ );
+ return;
+}
+
+# Rolls an owned zvol back and always exports it again with the same identity.
+my sub nvmet_rollback_volume($scfg, $name, $snap) {
+ my $snapshot = nvmet_snapshot($scfg, $name, $snap);
+ my $nqn = nvmet_nqn($scfg);
+ my $dataset = nvmet_dataset($scfg, $name);
+ my $dev = "/dev/zvol/$dataset";
+
+ my $timeout = nvmet_long_timeout();
+
+ nvmet_locked(
+ $scfg,
+ sub {
+ my ($inv, $cfs) = nvmet_read($scfg, modprobe => 1);
+ my ($nsid, $uuid) = _nvmet_owned_identity($inv, $nqn, $dataset);
+ die "NVMe subsystem does not exist\n" if !$cfs->{subsystems}->{$nqn};
+ _nvmet_plan_export($cfs, $nqn, $nsid, $uuid, $dev); # refusals only
+ my ($unexport, $pre) = _nvmet_plan_unexport($cfs, $nqn, $uuid);
+ my $set_identity = ['zfs', 'set', nvmet_identity($nqn, $nsid, $uuid), $dataset];
+ my $rollback = ['zfs', 'rollback', $snapshot];
+ my $res = nvmet_apply(
+ $scfg, [$unexport->@*, [$rollback], [$set_identity]],
+ op => 'rollback zvol',
+ timeout => $timeout,
+ );
+ my $error;
+ $error = "NVMe target operation 'rollback zvol' failed: $res->{err}" if $res->{rc};
+
+ # Always export the volume again, from a fresh read if anything failed.
+ eval {
+ my ($rinv, $rcfs) =
+ $error ? nvmet_read($scfg) : ($inv, nvmet_without_namespace($cfs, $nqn, $pre));
+ nvmet_wait_device($scfg, $dev);
+ my @units;
+ push @units, [$set_identity]
+ if !nvmet_has_identity($rinv->{volumes}->{$dataset}, $nqn, $nsid, $uuid);
+ my ($export) = _nvmet_plan_export($rcfs, $nqn, $nsid, $uuid, $dev);
+ push @units, $export->@*;
+ nvmet_change($scfg, \@units, op => 'restore namespace', timeout => $timeout);
+ };
+ chomp(my $restore_error = $@);
+
+ die "rollback failed: $error; namespace restoration failed: $restore_error\n"
+ if defined($error) && $restore_error;
+ die "namespace restoration failed after rollback: $restore_error\n"
+ if $restore_error;
+ die "$error\n" if defined($error);
+ },
+ );
+ return;
+}
+
+# Renames vm-* to base-*, exports it under the same identity and takes the
+# __base__ snapshot. A failed conversion is undone from a fresh read.
+my sub nvmet_template_volume($scfg, $name) {
+ my $nqn = nvmet_nqn($scfg);
+ my $old = nvmet_dataset($scfg, $name);
+ my $new = _nvmet_template_name($old);
+ my ($old_dev, $new_dev) = ("/dev/zvol/$old", "/dev/zvol/$new");
+ my $timeout = nvmet_long_timeout();
+
+ nvmet_locked(
+ $scfg,
+ sub {
+ my ($inv, $cfs) = nvmet_read($scfg, modprobe => 1);
+ my ($nsid, $uuid) = _nvmet_owned_identity($inv, $nqn, $old);
+ die "template zvol '$new' already exists\n" if exists($inv->{types}->{$new});
+ die "NVMe subsystem does not exist\n" if !$cfs->{subsystems}->{$nqn};
+ _nvmet_plan_export($cfs, $nqn, $nsid, $uuid, $old_dev); # refusals only
+ my ($unexport) = _nvmet_plan_unexport($cfs, $nqn, $uuid);
+
+ eval {
+ my $rename = [$unexport->@*, [['zfs', 'rename', $old, $new]]];
+ nvmet_change($scfg, $rename, op => 'rename zvol', timeout => $timeout);
+ nvmet_wait_device($scfg, $new_dev);
+ my $build = nvmet_build_unit($nqn, $nsid, $uuid, $new_dev);
+ my $template = [$build, [['zfs', 'snapshot', "$new\@__base__"]]];
+ nvmet_change($scfg, $template, op => 'create template', timeout => $timeout);
+ };
+ my $error = $@ or return;
+ nvmet_rethrow_abandoned($error);
+ chomp($error);
+
+ eval {
+ my ($rinv, $rcfs) = nvmet_read($scfg);
+ if (exists($rinv->{types}->{$new})) {
+ my ($units) = _nvmet_plan_unexport($rcfs, $nqn, $uuid);
+ my $back = [$units->@*, [['zfs', 'rename', $new, $old]]];
+ nvmet_change($scfg, $back, op => 'rename zvol back', timeout => $timeout);
+ (undef, $rcfs) = nvmet_read($scfg);
+ } elsif (!exists($rinv->{types}->{$old})) {
+ die "zvol '$old' does not exist\n";
+ }
+ nvmet_wait_device($scfg, $old_dev);
+ my ($units) = _nvmet_plan_export($rcfs, $nqn, $nsid, $uuid, $old_dev);
+ nvmet_change($scfg, $units, op => 'restore namespace');
+ };
+ die "template conversion failed: $error; restoration failed: $@" if $@;
+ die "template conversion failed: $error\n";
+ },
+ );
+ return;
+}
+
+# Grows an owned zvol and lets an exported namespace pick up the new size.
+my sub nvmet_resize_volume($scfg, $name, $size) {
+ my $nqn = nvmet_nqn($scfg);
+ my $dataset = nvmet_dataset($scfg, $name);
+ die "internal error: invalid zvol size\n" if $size !~ $RE_UNSIGNED_INTEGER;
+
+ # The volume is checked before it changes; under the lock, the namespace
+ # read here is still the one to revalidate after the resize. It is
+ # revalidated in the same call, so whenever the zvol grows, also after a
+ # lost reply, the hosts see the new size. A namespace that is not enabled
+ # reads the new size when it is enabled.
+ nvmet_locked(
+ $scfg,
+ sub {
+ my ($inv, $cfs) = nvmet_read($scfg, modprobe => 1);
+ my (undef, $uuid) = _nvmet_owned_identity($inv, $nqn, $dataset);
+ my $namespaces = nvmet_namespaces($cfs, $nqn);
+ my @matches =
+ grep { $namespaces->{$_}->{device_uuid} eq $uuid } keys $namespaces->%*;
+ die "duplicate namespace UUID '$uuid'\n" if @matches > 1;
+ my @resize = (['zfs', 'set', "volsize=${size}k", $dataset]);
+ push @resize, nvmet_write(nvmet_ns_path($nqn, $matches[0]) . '/revalidate_size', 1)
+ if @matches && $namespaces->{ $matches[0] }->{enable} eq '1';
+ nvmet_change(
+ $scfg, [\@resize],
+ op => 'resize zvol',
+ timeout => nvmet_long_timeout(),
+ );
+ },
+ );
+ return;
+}
+
+# Removes the subsystem once it has no volumes and namespaces, then the hosts
+# that no subsystem links any more. Ports are never removed.
+sub _nvmet_delete_target($scfg) {
+ my $nqn = nvmet_nqn($scfg);
+ my $hostnqns = parse_nvme_host_nqns($scfg->{'nvme-host-nqns'}, 1) // [];
+
+ nvmet_locked(
+ $scfg,
+ sub {
+ my ($inv, $cfs) = nvmet_read($scfg, modprobe => 1);
+ my ($units, $candidates) = _nvmet_plan_delete_target($inv, $cfs, $nqn, $hostnqns);
+ my $fresh = $cfs;
+ if ($units->@*) {
+ my $res = nvmet_apply($scfg, $units, op => 'remove NVMe subsystem');
+ (undef, $fresh) = eval { nvmet_read($scfg) };
+ my $read_error = $@;
+ nvmet_rethrow_abandoned($read_error) if $read_error;
+ die "cannot remove NVMe subsystem '$nqn': $res->{err}\n"
+ if $res->{rc} && (!$fresh || $fresh->{subsystems}->{$nqn});
+ die $read_error if !$fresh;
+ }
+ my $orphans = _nvmet_plan_orphan_hosts($fresh, $candidates);
+ return if !$orphans->@*;
+ my $res = nvmet_apply($scfg, $orphans, op => 'remove orphan NVMe hosts');
+ log_warn("could not remove orphan NVMe host(s): $res->{err}") if $res->{rc};
+ },
+ );
+ return;
+}
+
+# ---------------------------------------------------------------------------
+# Configuration
+# ---------------------------------------------------------------------------
+
+sub verify_nvme_nqn($value, $noerr = undef) {
+
+ if (
+ length($value) > 223
+ || $value !~ $RE_NQN
+ ) {
+ return undef if $noerr;
+ die "value is not a valid NVMe qualified name\n";
+ }
+
+ return $value;
+}
+
+sub parse_nvme_portals($value, $noerr = undef) {
+ my $result = [];
+ my $seen = {};
+
+ for my $entry (split(/,/, $value // '')) {
+ $entry = trim($entry);
+ my ($address, $port, $family);
+ if ($entry =~ $RE_IPV6_PORTAL) {
+ ($address, $port, $family) = ($+{address}, $+{port} // 4420, 'ipv6');
+ } elsif ($entry =~ $RE_IPV4_PORTAL) {
+ ($address, $port, $family) = ($+{address}, $+{port} // 4420, 'ipv4');
+ } else {
+ return undef if $noerr;
+ die "invalid NVMe/TCP portal '$entry'\n";
+ }
+
+ if (
+ !PVE::JSONSchema::pve_verify_ip($address, 1)
+ || ($family eq 'ipv4' && index($address, ':') >= 0)
+ || ($family eq 'ipv6' && index($address, ':') < 0)
+ || $port < 1
+ || $port > 65535
+ ) {
+ return undef if $noerr;
+ die "invalid NVMe/TCP portal '$entry'\n";
+ }
+ $address = nvmet_canonical_address($address) if $family eq 'ipv6';
+ # one listener: compare like _assert_unique_target
+ my $id = join(
+ "\0",
+ nvmet_listener_address({ family => $family, address => $address }),
+ int($port),
+ );
+ if ($seen->{$id}++) {
+ return undef if $noerr;
+ die "duplicate NVMe/TCP portal '$entry'\n";
+ }
+ push $result->@*,
+ {
+ address => $address,
+ port => int($port),
+ family => $family,
+ };
+ if (scalar($result->@*) > $max_paths) {
+ return undef if $noerr;
+ die "at most $max_paths NVMe/TCP portals are supported\n";
+ }
+ }
+
+ if (!$result->@*) {
+ return undef if $noerr;
+ die "at least one NVMe/TCP portal is required\n";
+ }
+
+ return $result;
+}
+
+my sub verify_nvme_portals($value, $noerr = undef) {
+ return undef if !parse_nvme_portals($value, $noerr);
+ return $value;
+}
+
+sub parse_nvme_host_ifaces($value, $noerr = undef) {
+ my $result = [];
+
+ for my $iface (split(/,/, $value // '')) {
+ $iface = trim($iface);
+ # the kernel never names an interface '.' or '..'
+ if (
+ length($iface) < 1
+ || length($iface) > 15
+ || $iface !~ $RE_HOST_IFACE
+ || $iface eq '.'
+ || $iface eq '..'
+ ) {
+ return undef if $noerr;
+ die "invalid NVMe/TCP host interface '$iface'\n";
+ }
+ push $result->@*, $iface;
+ }
+
+ if (!$result->@*) {
+ return undef if $noerr;
+ die "at least one NVMe/TCP host interface is required\n";
+ }
+
+ return $result;
+}
+
+sub parse_nvme_host_nqns($value, $noerr = undef) {
+ my $result = [];
+ my $seen = {};
+
+ for my $hostnqn (split(/,/, $value // '')) {
+ $hostnqn = trim($hostnqn);
+ if (!verify_nvme_nqn($hostnqn, 1) || $seen->{$hostnqn}++) {
+ return undef if $noerr;
+ die "invalid or duplicate NVMe host NQN '$hostnqn'\n";
+ }
+ push $result->@*, $hostnqn;
+ if (scalar($result->@*) > $max_hosts) {
+ return undef if $noerr;
+ die "at most $max_hosts NVMe host NQNs are supported\n";
+ }
+ }
+
+ if (!$result->@*) {
+ return undef if $noerr;
+ die "at least one NVMe host NQN is required\n";
+ }
+
+ return $result;
+}
+
+my sub verify_nvme_host_ifaces($value, $noerr = undef) {
+ return undef if !parse_nvme_host_ifaces($value, $noerr);
+ return $value;
+}
+
+my sub verify_nvme_host_nqns($value, $noerr = undef) {
+ return undef if !parse_nvme_host_nqns($value, $noerr);
+ return $value;
+}
+
+sub _configured_portals($scfg) {
+ my $portals = parse_nvme_portals($scfg->{'nvme-portals'});
+ my $ifaces = parse_nvme_host_ifaces($scfg->{'nvme-host-ifaces'});
+ die "nvme-host-ifaces must contain one interface for each nvme-portals entry\n"
+ if scalar($ifaces->@*) != scalar($portals->@*);
+
+ for (my $i = 0; $i < scalar($portals->@*); $i++) {
+ $portals->[$i]->{host_iface} = $ifaces->[$i];
+ }
+ return $portals;
+}
+
+sub _local_iface_exists($iface) {
+ return -d "/sys/class/net/$iface";
+}
+
+sub _validate_local_ifaces($portals) {
+ for my $portal ($portals->@*) {
+ my $iface = $portal->{host_iface};
+ die "NVMe/TCP host interface '$iface' does not exist on this node\n"
+ if !_local_iface_exists($iface);
+ }
+}
+
+PVE::JSONSchema::register_format('pve-storage-nvme-nqn', \&verify_nvme_nqn);
+PVE::JSONSchema::register_format('pve-storage-nvme-portals', \&verify_nvme_portals);
+PVE::JSONSchema::register_format('pve-storage-nvme-host-ifaces', \&verify_nvme_host_ifaces);
+PVE::JSONSchema::register_format('pve-storage-nvme-host-nqns', \&verify_nvme_host_nqns);
+
+sub type($class) {
+ return 'zfsnvme';
+}
+
+sub plugindata($class) {
+ return {
+ content => [{ images => 1 }, { images => 1 }],
+ 'sensitive-properties' => { 'dhchap-key' => 1 },
+ };
+}
+
+sub properties($class) {
+ return {
+ subsysnqn => {
+ description => "NVMe subsystem qualified name.",
+ type => 'string',
+ format => 'pve-storage-nvme-nqn',
+ },
+ 'nvme-portals' => {
+ description =>
+ "Comma-separated NVMe/TCP target IP addresses, at most 16. Put IPv6 addresses in"
+ . " brackets. The default TCP port is 4420.",
+ type => 'string',
+ format => 'pve-storage-nvme-portals',
+ maxLength => 2048,
+ },
+ 'nvme-host-ifaces' => {
+ description =>
+ "Comma-separated local interfaces, in portal order. Interface names must be"
+ . " identical on every cluster node.",
+ type => 'string',
+ format => 'pve-storage-nvme-host-ifaces',
+ maxLength => 512,
+ },
+ 'nvme-host-nqns' => {
+ description =>
+ "Comma-separated /etc/nvme/hostnqn values for every cluster node allowed to use"
+ . " this storage, at most 64. Host NQNs can only be added.",
+ type => 'string',
+ format => 'pve-storage-nvme-host-nqns',
+ maxLength => 8192,
+ },
+ 'dhchap-key' => {
+ description =>
+ "NVMe DH-HMAC-CHAP key in secret representation format (DHHC-1). Required when the"
+ . " storage is created; it cannot be changed.",
+ type => 'string',
+ maxLength => 256,
+ },
+ 'nvme-iopolicy' => {
+ description => "Native NVMe multipath I/O policy.",
+ type => 'string',
+ enum => ['numa', 'round-robin', 'queue-depth'],
+ default => 'round-robin',
+ },
+ 'nvme-keep-alive-tmo' => {
+ description => "NVMe keep-alive timeout in seconds.",
+ type => 'integer',
+ minimum => 1,
+ maximum => 120,
+ default => 5,
+ },
+ 'nvme-reconnect-delay' => {
+ description => "Delay between NVMe reconnect attempts in seconds.",
+ type => 'integer',
+ minimum => 1,
+ maximum => 120,
+ default => 2,
+ },
+ 'nvme-ctrl-loss-tmo' => {
+ description => "Time to keep retrying a lost NVMe controller in seconds.",
+ type => 'integer',
+ minimum => -1,
+ maximum => 86400,
+ default => 600,
+ },
+ 'nvme-fast-io-fail-tmo' => {
+ description =>
+ "Optional time before failing I/O on a reconnecting NVMe controller. Unset queues"
+ . " I/O until controller loss timeout.",
+ type => 'integer',
+ minimum => 0,
+ maximum => 86400,
+ optional => 1,
+ },
+ 'nvme-nr-io-queues' => {
+ description => "Number of NVMe/TCP I/O queues per controller.",
+ type => 'integer',
+ minimum => 1,
+ maximum => 1024,
+ optional => 1,
+ },
+ };
+}
+
+sub options($class) {
+ return {
+ server => { fixed => 1 },
+ subsysnqn => { fixed => 1 },
+ 'nvme-portals' => { fixed => 1 },
+ 'nvme-host-ifaces' => {},
+ 'nvme-host-nqns' => {},
+ pool => { fixed => 1 },
+ blocksize => { fixed => 1 },
+ sparse => { optional => 1 },
+ 'dhchap-key' => { optional => 1 },
+ 'nvme-iopolicy' => { optional => 1 },
+ 'nvme-keep-alive-tmo' => { optional => 1 },
+ 'nvme-reconnect-delay' => { optional => 1 },
+ 'nvme-ctrl-loss-tmo' => { optional => 1 },
+ 'nvme-fast-io-fail-tmo' => { optional => 1 },
+ 'nvme-nr-io-queues' => { optional => 1 },
+ nodes => { optional => 1 },
+ disable => { optional => 1 },
+ content => { optional => 1 },
+ bwlimit => { optional => 1 },
+ };
+}
+
+sub _validate_fail_fast_timeout($config, $default_ctrl_loss_tmo = undef) {
+ my $fast = $config->{'nvme-fast-io-fail-tmo'};
+ return if !defined($fast);
+
+ my $ctrl = $config->{'nvme-ctrl-loss-tmo'};
+ $ctrl = $default_ctrl_loss_tmo if !defined($ctrl);
+ return if !defined($ctrl) || $ctrl < 0;
+
+ die "nvme-fast-io-fail-tmo must not exceed nvme-ctrl-loss-tmo\n"
+ if $fast > $ctrl;
+}
+
+# Defaults are not injected here: this also runs when storage.cfg is parsed.
+# Every use site applies the schema default itself.
+sub check_config($class, $section_id, $config, $create, $skip_schema_check = undef) {
+ nvmet_pool($config) if defined($config->{pool});
+ verify_nvme_nqn($config->{subsysnqn}) if defined($config->{subsysnqn});
+ parse_nvme_portals($config->{'nvme-portals'}) if defined($config->{'nvme-portals'});
+ if (defined($config->{'nvme-host-ifaces'}) && defined($config->{'nvme-portals'})) {
+ _configured_portals($config);
+ } elsif (defined($config->{'nvme-host-ifaces'})) {
+ parse_nvme_host_ifaces($config->{'nvme-host-ifaces'});
+ }
+ parse_nvme_host_nqns($config->{'nvme-host-nqns'})
+ if defined($config->{'nvme-host-nqns'});
+ _validate_fail_fast_timeout($config, $create ? 600 : undef);
+ return $class->SUPER::check_config($section_id, $config, $create, $skip_schema_check);
+}
+
+# ---------------------------------------------------------------------------
+# ZFS helpers (same formats as the other ZFS plugins)
+# ---------------------------------------------------------------------------
+
+my sub zfs_request($scfg, $timeout, $method, @args) {
+ $timeout = PVE::RPCEnvironment->is_worker() ? 60 * 60 : 10 if !$timeout;
+ my $change = $method ne 'get' && $method ne 'list';
+ my $res = nvmet_exec(
+ $scfg, [['zfs', $method, @args]],
+ op => "zfs $method",
+ timeout => $timeout,
+ change => $change,
+ );
+ die "zfs error on '" . nvmet_server($scfg) . "': $res->{err}\n" if $res->{rc};
+ return nvmet_output($res);
+}
+
+# The direct children of the pool with PVE volume names. The plugin creates
+# and owns zvols only; a filesystem child holds its name.
+my sub zfs_parse_zvol_list($text, $pool) {
+ my $list = [];
+ for my $line (split /\n/, $text // '') {
+ my ($dataset, $size, $origin, $type) = split(/\s+/, $line);
+ next if !defined($type) || ($type ne 'volume' && $type ne 'filesystem');
+ my @parts = split /\//, $dataset;
+ next if @parts < 2;
+ my $name = pop @parts;
+ next if join('/', @parts) ne $pool;
+ next if $name !~ $RE_ZVOL_OWNER;
+ push $list->@*,
+ {
+ name => $name,
+ owner => $+{owner},
+ type => $type,
+ ($type eq 'volume' ? (size => $size + 0) : ()),
+ ($origin ne '-' ? (origin => $origin) : ()),
+ };
+ }
+ return $list;
+}
+
+# The pool's direct children with PVE volume names, so that a name is never
+# handed out twice; with $owned_only, the zvols owned by this storage's NVMe
+# subsystem.
+my sub zfs_list_zvol($scfg, $owned_only) {
+ my $pool = nvmet_pool($scfg);
+ my $text = zfs_request(
+ $scfg,
+ 10,
+ 'list',
+ '-o',
+ 'name,volsize,origin,type',
+ '-t',
+ 'volume,filesystem',
+ '-d1',
+ '-Hp',
+ $pool,
+ );
+ my $list = {};
+ my $prefix = "$pool/";
+ for my $zvol (zfs_parse_zvol_list($text, $pool)->@*) {
+ next if $owned_only && $zvol->{type} ne 'volume';
+ my $parent = $zvol->{origin};
+ # an origin in the pool is named relative to it, like the ZFS plugins do
+ $parent = substr($parent, length($prefix)) if $parent && index($parent, $prefix) == 0;
+ $list->{ $zvol->{name} } = {
+ name => $zvol->{name},
+ size => $zvol->{size},
+ parent => $parent,
+ format => 'raw',
+ vmid => $zvol->{owner},
+ };
+ }
+ return $list if !$owned_only;
+
+ my $properties = zfs_request(
+ $scfg,
+ 10,
+ 'get',
+ '-H',
+ '-d',
+ '1',
+ '-o',
+ 'name,value,source',
+ 'proxmox:nvme-subsys',
+ $pool,
+ );
+ my $owned = {};
+ for my $line (split(/\n/, $properties)) {
+ my ($dataset, $nqn, $source) = split(/\t/, $line, 3);
+ next if !defined($source) || ($source ne 'local' && $source ne 'received');
+ next if !defined($nqn) || $nqn ne $scfg->{subsysnqn};
+ next if index($dataset, $prefix) != 0;
+ $owned->{ substr($dataset, length($prefix)) } = 1;
+ }
+ for my $name (keys $list->%*) {
+ delete $list->{$name} if !$owned->{$name};
+ }
+ return $list;
+}
+
+my sub zfs_get_properties($scfg, $properties, $dataset, $timeout = undef) {
+ my $text = zfs_request($scfg, $timeout, 'get', '-o', 'value', '-Hp', $properties, $dataset);
+ my @values = split /\n/, $text;
+ return wantarray ? @values : $values[0];
+}
+
+my sub zfs_get_sorted_snapshot_list($scfg, $name, $sort_params) {
+ return [
+ map { s/^.*\@//r } split /\n/,
+ zfs_request(
+ $scfg,
+ undef,
+ 'list',
+ '-H',
+ '-r',
+ '-t',
+ 'snapshot',
+ '-o',
+ 'name',
+ $sort_params->@*,
+ nvmet_dataset($scfg, $name),
+ ),
+ ];
+}
+
+# ---------------------------------------------------------------------------
+# Storage API: volumes
+# ---------------------------------------------------------------------------
+
+sub parse_volname($class, $volname) {
+ if ($volname =~ $RE_VOLNAME) {
+ my $format = ($+{type} eq 'subvol' || $+{type} eq 'basevol') ? 'subvol' : 'raw';
+ my $is_base = $+{type} eq 'base' || $+{type} eq 'basevol';
+ return ('images', $+{name}, $+{vmid}, $+{base}, $+{base_vmid}, $is_base, $format);
+ }
+ die "unable to parse zfs volume name '$volname'\n";
+}
+
+sub list_images($class, $storeid, $scfg, $vmid = undef, $vollist = undef, $cache = undef) {
+ my $res = [];
+ for my $info (values zfs_list_zvol($scfg, 1)->%*) {
+ my $volname =
+ $info->{parent} && $info->{parent} =~ $RE_BASE_SNAPSHOT
+ ? "$storeid:$+{base}/$info->{name}"
+ : "$storeid:$info->{name}";
+ next
+ if $vollist
+ ? !grep { $_ eq $volname } $vollist->@*
+ : defined($vmid) && $info->{vmid} ne $vmid;
+ $info->{volid} = $volname;
+ push $res->@*, $info;
+ }
+ return $res;
+}
+
+# Names are allocated against every direct child of the pool, owned or not, so
+# a leftover zvol that list_images hides is never handed out again.
+sub find_free_diskname($class, $storeid, $scfg, $vmid, $fmt = undef, $add_fmt_suffix = undef) {
+ my $disk_list = [map { "$storeid:$_" } sort keys zfs_list_zvol($scfg, 0)->%*];
+ return PVE::Storage::Plugin::get_next_vm_diskname(
+ $disk_list, $storeid, $vmid, $fmt, $scfg, $add_fmt_suffix,
+ );
+}
+
+sub status($class, $storeid, $scfg, $cache = undef) {
+ my ($available, $used) =
+ eval { zfs_get_properties($scfg, 'available,used', nvmet_pool($scfg)) };
+ if (my $err = $@) {
+ warn "storage '$storeid': $err";
+ return (0, 0, 0, 0);
+ }
+ if (
+ !defined($available)
+ || !defined($used)
+ || $available !~ $RE_UNSIGNED_INTEGER
+ || $used !~ $RE_UNSIGNED_INTEGER
+ ) {
+ warn "unexpected ZFS pool usage for storage '$storeid'\n";
+ return (0, 0, 0, 0);
+ }
+ return ($available + $used, $available, $used, 1);
+}
+
+sub volume_size_info($class, $scfg, $storeid, $volname, $timeout = undef) {
+ my (undef, $name, undef, $parent, undef, undef, $format) = $class->parse_volname($volname);
+ die "volume_size_info requires a ZFS volume\n" if $format ne 'raw';
+ my ($size, $used) = zfs_get_properties(
+ $scfg, 'volsize,usedbydataset', nvmet_dataset($scfg, $name), $timeout,
+ );
+ die "Could not get zfs volume size\n" if !defined($size) || $size !~ $RE_UNSIGNED_INTEGER;
+ $used = defined($used) && $used =~ $RE_UNSIGNED_INTEGER ? $used + 0 : 0;
+ return wantarray ? ($size + 0, 'raw', $used, $parent) : $size + 0;
+}
+
+sub volume_snapshot($class, $scfg, $storeid, $volname, $snap) {
+ my (undef, $name, undef, undef, undef, undef, $format) = $class->parse_volname($volname);
+ die "volume_snapshot requires a ZFS volume\n" if $format ne 'raw';
+ my $snapshot = nvmet_snapshot($scfg, $name, $snap);
+ nvmet_locked($scfg, sub { zfs_request($scfg, undef, 'snapshot', $snapshot) });
+ return;
+}
+
+sub volume_snapshot_delete($class, $scfg, $storeid, $volname, $snap, $running = undef) {
+ my $name = ($class->parse_volname($volname))[1];
+ my $snapshot = nvmet_snapshot($scfg, $name, $snap);
+ nvmet_locked($scfg, sub { zfs_request($scfg, undef, 'destroy', $snapshot) });
+ return;
+}
+
+sub volume_rollback_is_possible($class, $scfg, $storeid, $volname, $snap, $blockers = undef) {
+ my $name = ($class->parse_volname($volname))[1];
+ nvmet_snapshot($scfg, $name, $snap); # validation only
+ my $found;
+ $blockers //= [];
+ for my $snapshot (zfs_get_sorted_snapshot_list($scfg, $name, ['-s', 'creation'])->@*) {
+ $found = 1 if $snapshot eq $snap;
+ push $blockers->@*, $snapshot if $found && $snapshot ne $snap;
+ }
+ die "can't rollback, snapshot '$snap' does not exist on '${storeid}:${volname}'\n" if !$found;
+ die "can't rollback, '$snap' is not most recent snapshot on '${storeid}:${volname}'\n"
+ if $blockers->@*;
+ return 1;
+}
+
+sub volume_snapshot_rollback($class, $scfg, $storeid, $volname, $snap) {
+ my (undef, $name, undef, undef, undef, undef, $format) = $class->parse_volname($volname);
+ die "snapshot rollback requires a ZFS volume\n" if $format ne 'raw';
+ nvmet_rollback_volume($scfg, $name, $snap);
+}
+
+sub volume_snapshot_info($class, $scfg, $storeid, $volname) {
+ my $name = ($class->parse_volname($volname))[1];
+ my $info = {};
+ my $text = zfs_request(
+ $scfg,
+ undef,
+ 'list',
+ '-Hp',
+ '-r',
+ '-t',
+ 'snapshot',
+ '-o',
+ 'name,guid,creation',
+ nvmet_dataset($scfg, $name),
+ );
+ for my $line (split /\n/, $text) {
+ my ($snapshot, $guid, $creation) = split /\s+/, $line;
+ $snapshot =~ s/^.*\@//;
+ $info->{$snapshot} = { id => $guid, timestamp => $creation };
+ }
+ return $info;
+}
+
+sub free_image($class, $storeid, $scfg, $volname, $is_base = undef, $format = undef) {
+ my (undef, $name, undef, undef, undef, undef, $volformat) = $class->parse_volname($volname);
+ die "free_image requires a ZFS volume\n" if $volformat ne 'raw';
+ nvmet_destroy_volume($scfg, $name);
+ return undef;
+}
+
+sub create_base($class, $storeid, $scfg, $volname) {
+ my (undef, $name, undef, $basename, undef, $is_base, $format) = $class->parse_volname($volname);
+ die "create_base not possible with base image\n" if $is_base;
+ die "create_base requires a ZFS volume\n" if $format ne 'raw';
+ my $newname = $name =~ s/^vm-/base-/r;
+ nvmet_template_volume($scfg, $name);
+ return $basename ? "$basename/$newname" : $newname;
+}
+
+sub clone_image($class, $scfg, $storeid, $volname, $vmid, $snap = undef) {
+ $snap ||= '__base__';
+ my (undef, $basename, undef, undef, undef, $is_base, $format) = $class->parse_volname($volname);
+ die "clone_image only works on base images\n" if !$is_base;
+ die "clone_image requires a ZFS volume\n" if $format ne 'raw';
+ my $origin = nvmet_snapshot($scfg, $basename, $snap);
+ my $name = $class->find_free_diskname($storeid, $scfg, $vmid, $format);
+ nvmet_create_volume($scfg, $name, origin => $origin);
+ return "$basename/$name";
+}
+
+sub alloc_image($class, $storeid, $scfg, $vmid, $fmt, $name, $size) {
+ die "unsupported format '$fmt'" if $fmt ne 'raw';
+ die "illegal name '$name' - should be 'vm-$vmid-*'\n"
+ if $name && index($name, "vm-$vmid-") != 0;
+ my $volname = $name || $class->find_free_diskname($storeid, $scfg, $vmid, $fmt);
+ $size += (1024 - $size % 1024) % 1024;
+ nvmet_create_volume($scfg, $volname, size => $size);
+ return $volname;
+}
+
+sub volume_resize($class, $scfg, $storeid, $volname, $size, $running = undef, $snapname = undef) {
+ # QEMU can resize a host_device once the device itself has grown, but the
+ # plugin cannot yet wait for the local NVMe namespace to report the new
+ # size. Until it can, refuse online resize before changing the zvol, so a
+ # running VM never sees a size different from its configuration.
+ die "online resize is not supported for NVMe/TCP block devices; stop the VM first\n"
+ if $running;
+ die "resizing a snapshot is not supported for $class\n" if $snapname;
+ my $new_size = int($size / 1024);
+ $new_size += (1024 - $new_size % 1024) % 1024;
+ my $name = ($class->parse_volname($volname))[1];
+ nvmet_resize_volume($scfg, $name, $new_size);
+ return $new_size;
+}
+
+sub volume_has_feature(
+ $class, $scfg, $feature, $storeid, $volname,
+ $snapname = undef,
+ $running = undef,
+ $opts = undef,
+) {
+ my $features = {
+ snapshot => { current => 1, snap => 1 },
+ clone => { base => 1 },
+ template => { current => 1 },
+ copy => { base => 1, current => 1 },
+ };
+ my $is_base = ($class->parse_volname($volname))[5];
+ my $key = $snapname ? 'snap' : $is_base ? 'base' : 'current';
+ return $features->{$feature}->{$key};
+}
+
+# No stream transfers or renames; the storage has no path, so the base class
+# offers no export or import format either.
+sub volume_export($class, @args) {
+ die "ZFS stream export is not supported for NVMe/TCP storage\n";
+}
+
+sub volume_import($class, @args) {
+ die "ZFS stream import is not supported for NVMe/TCP storage\n";
+}
+
+sub rename_volume($class, @args) {
+ die "renaming volumes is not supported for NVMe/TCP storage\n";
+}
+
+sub rename_snapshot($class, @args) {
+ die "rename_snapshot is not supported for $class";
+}
+
+# ---------------------------------------------------------------------------
+# Secrets and configuration hooks
+# ---------------------------------------------------------------------------
+
+# Each storage needs its own NVMe/TCP listener (address family, address and
+# port), and a disabled storage keeps its listener. nvmet answers a connect to
+# a listener that does not publish the subsystem yet with DNR, and the host
+# then deletes the controller whatever its loss timeout: after a target
+# restart, the storage published second would lose its paths. Storages that
+# reach the same data address must spell the server alike, as it names the
+# target lock.
+sub _assert_unique_target($storeid, $scfg, $cfg = undef) {
+ $cfg //= PVE::Storage::config();
+ my (%listeners, %addresses);
+ for my $portal (parse_nvme_portals($scfg->{'nvme-portals'})->@*) {
+ my $address = join("\0", nvmet_listener_address($portal));
+ $listeners{"$address\0$portal->{port}"} = 1;
+ $addresses{$address} = 1;
+ }
+ my $ids = $cfg->{ids} // {};
+ for my $other_id (sort keys $ids->%*) {
+ next if $other_id eq $storeid;
+ my $other = $ids->{$other_id};
+ next if ($other->{type} // '') ne 'zfsnvme';
+
+ die "NVMe subsystem NQN is already used by storage '$other_id'\n"
+ if ($other->{subsysnqn} // '') eq $scfg->{subsysnqn};
+ my $other_server = $other->{server} // '';
+ # a storage whose portals do not parse cannot be activated
+ for my $portal ((parse_nvme_portals($other->{'nvme-portals'}, 1) // [])->@*) {
+ my $address = join("\0", nvmet_listener_address($portal));
+ die "NVMe/TCP portal '$portal->{address}' port $portal->{port} is already used by"
+ . " storage '$other_id'; give each storage its own address or port\n"
+ if $listeners{"$address\0$portal->{port}"};
+ die "storage '$other_id' reaches target address '$portal->{address}' through server"
+ . " '$other_server'; use the same server value for both storages\n"
+ if $addresses{$address} && $other_server ne $scfg->{server};
+ }
+ next if $other_server ne $scfg->{server};
+ my ($pool, $other_pool) = ($scfg->{pool}, $other->{pool} // '');
+ die "ZFS pool '$pool' on '$scfg->{server}' is already used by storage '$other_id'\n"
+ if $other_pool eq $pool;
+ die "ZFS pool '$pool' on '$scfg->{server}' overlaps the pool of storage '$other_id'\n"
+ if index("$other_pool/", "$pool/") == 0 || index("$pool/", "$other_pool/") == 0;
+ }
+}
+
+# nvmet keeps one DH-HMAC-CHAP key per host NQN, so storages on the same target
+# whose host NQNs overlap must use the same key.
+sub _assert_shared_host_key($storeid, $scfg, $key, $cfg = undef) {
+ $cfg //= PVE::Storage::config();
+ my %hosts = map { $_ => 1 } (parse_nvme_host_nqns($scfg->{'nvme-host-nqns'}, 1) // [])->@*;
+ my $ids = $cfg->{ids} // {};
+ for my $other_id (sort keys $ids->%*) {
+ next if $other_id eq $storeid;
+ my $other = $ids->{$other_id};
+ next if ($other->{type} // '') ne 'zfsnvme';
+ next if ($other->{server} // '') ne ($scfg->{server} // '');
+ my $other_hosts = parse_nvme_host_nqns($other->{'nvme-host-nqns'}, 1) // [];
+ next if !grep { $hosts{$_} } $other_hosts->@*;
+ my $other_key = file_read_firstline(secret_path($other_id));
+ die "storage '$other_id' uses a different DH-HMAC-CHAP key for the same NVMe host NQNs"
+ . " on '$scfg->{server}'\n"
+ if defined($other_key) && $other_key ne $key;
+ }
+}
+
+# DHHC-1:<hash>:<base64 of key and its little-endian CRC-32>: as generated by
+# `nvme gen-dhchap-key`. Messages never contain the key.
+sub _validate_secret($key) {
+ die "missing NVMe DH-HMAC-CHAP key\n" if !defined($key) || $key eq '';
+ my $invalid = "invalid NVMe DH-HMAC-CHAP key representation\n";
+ die $invalid if $key !~ $RE_DHCHAP_KEY;
+ my ($hash, $encoded) = @+{qw(hash secret)};
+ die $invalid if length($encoded) % 4;
+ my $decoded = decode_base64($encoded);
+ my $length = length($decoded) - 4;
+ my %lengths = ('00' => [32, 48, 64], '01' => [32], '02' => [48], '03' => [64]);
+ die $invalid if !grep { $_ == $length } $lengths{$hash}->@*;
+ die $invalid if pack('V', crc32(substr($decoded, 0, $length))) ne substr($decoded, $length);
+ return $key;
+}
+
+my sub set_secret($storeid, $key) {
+ _validate_secret($key);
+ make_path($secret_dir, { mode => 0700 });
+ file_set_contents(secret_path($storeid), "$key\n", 0600);
+}
+
+my sub get_secret($storeid) {
+ my $key = file_read_firstline(secret_path($storeid));
+ return _validate_secret($key);
+}
+
+# Removes the key file of a storage (a test seam).
+sub _unlink_file($path) {
+ return unlink($path);
+}
+
+my sub delete_secret($storeid) {
+ _unlink_file(secret_path($storeid));
+}
+
+sub on_add_hook($class, $storeid, $scfg, %sensitive) {
+ _configured_portals($scfg);
+ parse_nvme_host_nqns($scfg->{'nvme-host-nqns'});
+ _assert_unique_target($storeid, $scfg);
+ my $key = _validate_secret($sensitive{'dhchap-key'});
+ _assert_shared_host_key($storeid, $scfg, $key);
+ set_secret($storeid, $key);
+ return;
+}
+
+sub on_update_hook_full($class, $storeid, $scfg, $update, $delete = undef, $sensitive = undef) {
+ $sensitive //= {};
+ my %prospective = ($scfg->%*, $update->%*);
+ delete @prospective{ $delete->@* } if $delete;
+ verify_nvme_nqn($prospective{subsysnqn});
+ _configured_portals(\%prospective);
+ my $new_hostnqns = parse_nvme_host_nqns($prospective{'nvme-host-nqns'});
+ my %new_hosts = map { $_ => 1 } $new_hostnqns->@*;
+ for my $old_hostnqn (parse_nvme_host_nqns($scfg->{'nvme-host-nqns'})->@*) {
+ die "removing NVMe host NQN '$old_hostnqn' is not supported; move every volume off"
+ . " the storage and recreate it with a new subsystem NQN and a new DH-HMAC-CHAP"
+ . " key\n"
+ if !$new_hosts{$old_hostnqn};
+ }
+ _validate_fail_fast_timeout(\%prospective, 600);
+ _assert_unique_target($storeid, \%prospective);
+
+ my $old_key = file_read_firstline(secret_path($storeid));
+ my $key = exists($sensitive->{'dhchap-key'}) ? $sensitive->{'dhchap-key'} : $old_key;
+ _validate_secret($key);
+
+ # nvmet stores authentication on the global Host NQN object, which can be
+ # shared by multiple subsystems. Replacing an active key in place can make
+ # unrelated storages unrecoverable on their next reconnect. Until PVE can
+ # coordinate a rolling rotation on every node, fail before mutating the
+ # cluster-wide secret.
+ die "NVMe DH-HMAC-CHAP key rotation is not supported; create a new storage with a new"
+ . " subsystem NQN\n"
+ if defined($old_key) && $key ne $old_key;
+ _assert_shared_host_key($storeid, \%prospective, $key);
+
+ set_secret($storeid, $key) if exists($sensitive->{'dhchap-key'});
+ return;
+}
+
+# ---------------------------------------------------------------------------
+# Local NVMe host side
+# ---------------------------------------------------------------------------
+
+my %slow_path_last; # storeid => time of the last slow-path activation
+
+# Probes of the local host (test seams).
+sub _block_device($path) {
+ return -b $path;
+}
+
+sub _link_target($path) {
+ return readlink($path);
+}
+
+sub _fabrics_device() {
+ return '/dev/nvme-fabrics';
+}
+
+# Runs $code in a child and gives up on it after $timeout seconds. Returns the
+# child's result; the child's errors pass through as exceptions, a timeout
+# becomes one. The bound is not hard: as with PVE::Tools::run_command, a
+# child stuck in the kernel (a write or delete in D state) is only reaped
+# once the kernel returns, and a timeout does not mean that the operation did
+# not happen.
+#
+# A stopped task (TERM, also HUP, INT and QUIT) stays pending in the parent
+# while the child runs, and the child inherits the mask: a connect that ends
+# before PVE escalates the stop to KILL, 5 seconds after the TERM, creates
+# the controller and restricts its secret attributes without interruption,
+# and run_fork_with_timeout, whose own handlers would consume the signal when
+# the child delivers a result, never sees it. Once the child is reaped and the
+# mask is restored, the handler of the worker dies with the task marker, also
+# over a result or an error of the child. ALRM, the timeout, is not blocked.
+# The KILL ends the parent and the child together; a controller that the
+# child had created but not restricted yet keeps its secret attributes
+# world-readable until the next activation restricts them.
+#
+# run_fork_with_timeout is called in list context on purpose: only there does
+# run_with_timeout report a timeout as its second return value; in scalar
+# context the timeout would be a warning and an undef result.
+my sub run_bounded($timeout, $what, $code) {
+ my $previous = POSIX::SigSet->new();
+ sigprocmask(SIG_BLOCK, POSIX::SigSet->new(SIGHUP, SIGINT, SIGQUIT, SIGTERM), $previous)
+ or die "cannot block signals: $!\n";
+ my $outer_warn = $SIG{__WARN__};
+ my ($res, $timed_out) = eval {
+ # Only a child that leaves no result makes run_fork_with_timeout warn
+ # in the parent; that case is an exception below. The child keeps the
+ # handler of the caller, so its own warnings reach the task log.
+ local $SIG{__WARN__} = sub($message) { };
+ PVE::Tools::run_fork_with_timeout(
+ $timeout,
+ sub {
+ local $SIG{__WARN__} = $outer_warn;
+ return $code->();
+ },
+ );
+ };
+ my $error = $@;
+ sigprocmask(SIG_SETMASK, $previous) or die "cannot restore signals: $!\n";
+ if ($error) {
+ rethrow_task_interrupt($error);
+ die $error;
+ }
+ die "$what did not complete within $timeout seconds\n" if $timed_out;
+ die "$what left no result\n" if !defined($res);
+ return $res;
+}
+
+# The connect options of one controller, as the fabrics device takes them,
+# and their names. The values are validated configuration and host identities
+# checked by the caller; the kernel reads each one up to the next ','.
+sub _fabrics_options($scfg, $portal, $hostnqn, $hostid, $key) {
+ my @options = (
+ [transport => 'tcp'],
+ [traddr => $portal->{address}],
+ [trsvcid => $portal->{port}],
+ [host_iface => $portal->{host_iface}],
+ [nqn => $scfg->{subsysnqn}],
+ [hostnqn => $hostnqn],
+ [hostid => $hostid],
+ [dhchap_secret => $key],
+ [keep_alive_tmo => $scfg->{'nvme-keep-alive-tmo'} // 5],
+ [reconnect_delay => $scfg->{'nvme-reconnect-delay'} // 2],
+ [ctrl_loss_tmo => $scfg->{'nvme-ctrl-loss-tmo'} // 600],
+ );
+ # unlike unset, which leaves fast I/O failure off, 0 is a real timeout
+ push @options, [fast_io_fail_tmo => $scfg->{'nvme-fast-io-fail-tmo'}]
+ if defined($scfg->{'nvme-fast-io-fail-tmo'});
+ push @options, [nr_io_queues => $scfg->{'nvme-nr-io-queues'}]
+ if defined($scfg->{'nvme-nr-io-queues'});
+ for my $option (@options) {
+ die "internal error: invalid NVMe connect option '$option->[0]'\n"
+ if !defined($option->[1]) || $option->[1] !~ $RE_FABRICS_VALUE;
+ }
+ return (join(',', map { "$_->[0]=$_->[1]" } @options), [map { $_->[0] } @options]);
+}
+
+# The child of a connect (a test seam): creates exactly one controller with
+# one write of $options to the fabrics device and returns its instance. The
+# write is never repeated, because the kernel may have created the controller
+# even when it reports an error. Errors carry the errno text of the failed
+# operation and never the options, which hold the key.
+sub _fabrics_connect($options, $names) {
+ my $device = _fabrics_device();
+ my $probe;
+ if (!sysopen($probe, $device, O_RDONLY | O_NOFOLLOW)) {
+ die "'$device' does not exist; load the nvme-tcp kernel module\n" if $! == ENOENT;
+ die "cannot open '$device': $!\n";
+ }
+ my @stat = stat($probe);
+ die "'$device' is not a character device\n" if !@stat || !S_ISCHR($stat[2]);
+ # without a controller, a read lists the supported options as patterns
+ my $supported = '';
+ sysread($probe, $supported, 4096) // die "cannot read '$device': $!\n";
+ close($probe);
+ my %supported = map { s/=.*//r => 1 } split(/,/, $supported =~ s/\n\z//r);
+ for my $name ($names->@*) {
+ die "the running kernel does not support the NVMe connect option '$name'\n"
+ if !$supported{$name};
+ }
+
+ # Not PVE::SysFSTools::file_write: the kernel returns the instance of the
+ # new controller on a read of the file descriptor that wrote the options.
+ sysopen(my $fh, $device, O_RDWR | O_NOFOLLOW) or die "cannot open '$device': $!\n";
+ my $written = _fabrics_write($fh, $options);
+ die "connect failed: $!\n" if !defined($written);
+ die "connect failed: short write\n" if $written != length($options);
+ my $result = '';
+ sysread($fh, $result, 128) // die "cannot read the connect result: $!\n";
+ die "unexpected connect result\n" if $result !~ $RE_FABRICS_RESULT;
+ my $instance = int($+{instance});
+ # The kernel creates the secret attributes of a controller world-readable;
+ # the caller keeps a stopped task from interrupting before this, short of
+ # a KILL.
+ _restrict_attr("/sys/class/nvme/nvme$instance/$_") for qw(dhchap_secret dhchap_ctrl_secret);
+ close($fh);
+ return $instance;
+}
+
+# The write that creates a controller (a test seam).
+sub _fabrics_write($fh, $options) {
+ return syswrite($fh, $options);
+}
+
+# Writes a sysfs attribute and returns the errno text of a failure, or undef.
+# PVE::SysFSTools::file_write returns undef without a warning when the open
+# fails, leaving its errno in $!, and 0 after warning "error writing ...:
+# <errno text>" when the write fails; that warning is not passed on. With
+# $missing_ok, an attribute that does not exist, because its controller went
+# away, is not a failure.
+my sub write_attribute($path, $value, $missing_ok = 0) {
+ my $warning;
+ my $written = do {
+ local $SIG{__WARN__} = sub($message) { $warning = $message };
+ PVE::SysFSTools::file_write($path, $value);
+ };
+ return if $written;
+ return if !defined($warning) && $missing_ok && $! == ENOENT;
+ return "$!" if !defined($warning);
+ return $warning =~ s/\A.*: //sr =~ s/\n\z//r;
+}
+
+# Deletes controllers (the body of a child, a test seam): the deletion can
+# block in the kernel. The error names the controller and the errno text; a
+# controller that is already gone counts as deleted.
+sub _delete_controllers($controllers) {
+ for my $controller ($controllers->@*) {
+ my $path = "/sys/class/nvme/$controller->{name}/delete_controller";
+ my $error = write_attribute($path, '1', 1) // next;
+ die "cannot delete NVMe controller '$controller->{name}': $error\n";
+ }
+ return scalar($controllers->@*);
+}
+
+# Every local controller of the subsystem.
+my sub nvme_controllers($nqn) {
+ my $controllers = [];
+ PVE::File::dir_glob_foreach(
+ '/sys/class/nvme',
+ $RE_NVME_CONTROLLER,
+ sub($entry) {
+ my $base = "/sys/class/nvme/$entry";
+ my $subsys = file_read_firstline("$base/subsysnqn");
+ return if !defined($subsys) || $subsys ne $nqn;
+ my $address = file_read_firstline("$base/address") // '';
+ my $traddr = $address =~ $RE_TRADDR ? $+{value} : undef;
+ my $trsvcid = $address =~ $RE_TRSVCID ? $+{value} : undef;
+ my $host_iface = $address =~ $RE_HOST_IFACE_ADDRESS ? $+{value} : undef;
+ push $controllers->@*,
+ {
+ name => $entry,
+ state => file_read_firstline("$base/state") // 'unknown',
+ traddr => nvmet_canonical_address($traddr),
+ trsvcid => $trsvcid,
+ host_iface => $host_iface,
+ };
+ },
+ );
+ return $controllers;
+}
+
+# Controllers by "address:port", with canonical IPv6 addresses. A portal has
+# more than one controller while its path moves to another interface.
+my sub controller_states($nqn) {
+ my $states = {};
+ for my $controller (nvme_controllers($nqn)->@*) {
+ next if !defined($controller->{traddr}) || !defined($controller->{trsvcid});
+ push $states->{"$controller->{traddr}:$controller->{trsvcid}"}->@*, $controller;
+ }
+ return $states;
+}
+
+# The multipath namespace devices of the subsystem and their partitions. One
+# dir_glob_foreach per directory level, because PVE::File::dir_glob_regex
+# returns only the first match.
+my sub namespace_devices($nqn) {
+ my $devices = {};
+
+ PVE::File::dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ $RE_NVME_SUBSYSTEM,
+ sub($entry) {
+ my $base = "/sys/class/nvme-subsystem/$entry";
+ my $subsys = file_read_firstline("$base/subsysnqn");
+ return if !defined($subsys) || $subsys ne $nqn;
+
+ PVE::File::dir_glob_foreach(
+ $base,
+ $RE_NVME_NAMESPACE,
+ sub($device) {
+ $devices->{"/dev/$device"} = $device if _block_device("/dev/$device");
+ PVE::File::dir_glob_foreach(
+ "/sys/class/block/$device",
+ $RE_NVME_PARTITION,
+ sub($partition) {
+ $devices->{"/dev/$partition"} = $partition
+ if _block_device("/dev/$partition");
+ },
+ );
+ },
+ );
+ },
+ );
+ return $devices;
+}
+
+sub _namespace_openers($nqn) {
+ my $devices = namespace_devices($nqn);
+ return [] if !$devices->%*;
+
+ my %openers;
+ PVE::File::dir_glob_foreach(
+ '/proc',
+ '[0-9]+',
+ sub($pid) {
+ PVE::File::dir_glob_foreach(
+ "/proc/$pid/fd",
+ '[0-9]+',
+ sub($fd) {
+ my $target = _link_target("/proc/$pid/fd/$fd");
+ return if !defined($target) || !exists($devices->{$target});
+ my $comm = eval { file_read_firstline("/proc/$pid/comm") } // 'unknown';
+ $openers{"$pid:$target"} = "$comm (PID $pid, $target)";
+ },
+ );
+ },
+ );
+
+ # Kernel consumers such as device-mapper do not necessarily keep a userspace
+ # file descriptor open, but expose their dependency in the holders directory.
+ for my $path (keys $devices->%*) {
+ my $device = $devices->{$path};
+ my $holders = "/sys/class/block/$device/holders";
+ PVE::File::dir_glob_foreach(
+ $holders,
+ '[^\\.].*',
+ sub($holder) {
+ $openers{"holder:$device:$holder"} = "$path held by $holder";
+ },
+ );
+ }
+
+ return [sort values %openers];
+}
+
+my sub portal_reachable($portal) {
+ return PVE::Network::tcp_ping($portal->{address}, $portal->{port}, 2) // 0;
+}
+
+# The number of portals with a live controller on their configured interface,
+# or, with $any_iface, on any interface: such a path carries I/O, even while
+# it waits to be moved to its configured interface.
+sub _live_portal_count($states, $portals, $any_iface = 0) {
+ my $live = 0;
+ for my $portal ($portals->@*) {
+ my $id = "$portal->{address}:$portal->{port}";
+ $live++ if grep {
+ $_->{state} eq 'live'
+ && ($any_iface || ($_->{host_iface} // '') eq $portal->{host_iface})
+ } ($states->{$id} // [])->@*;
+ }
+ return $live;
+}
+
+# Creates the controller of a portal in a child, giving up after 10 seconds.
+sub _connect_portal($scfg, $portal, $hostnqn, $hostid, $key) {
+ my ($options, $names) = _fabrics_options($scfg, $portal, $hostnqn, $hostid, $key);
+ return run_bounded(10, 'NVMe/TCP connect', sub { return _fabrics_connect($options, $names) });
+}
+
+my sub set_iopolicy($nqn, $policy) {
+ PVE::File::dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ $RE_NVME_SUBSYSTEM,
+ sub($entry) {
+ my $base = "/sys/class/nvme-subsystem/$entry";
+ my $subsys = file_read_firstline("$base/subsysnqn");
+ return if !defined($subsys) || $subsys ne $nqn;
+ my $error = write_attribute("$base/iopolicy", "$policy\n");
+ die "unable to set NVMe multipath policy: $error\n" if defined($error);
+ },
+ );
+}
+
+# Applies the reconnect timeouts to connected controllers, which otherwise
+# keep the values of their connect. sysfs shows "off" for -1, and shows the
+# loss timeout rounded up to a multiple of the reconnect delay.
+my sub set_tunables($scfg) {
+ my $delay = $scfg->{'nvme-reconnect-delay'} // 2;
+ my $loss = $scfg->{'nvme-ctrl-loss-tmo'} // 600;
+ my $fast = $scfg->{'nvme-fast-io-fail-tmo'};
+ my $shown_loss = $loss < 0 ? 'off' : int(($loss + $delay - 1) / $delay) * $delay;
+ my $shown_fast = defined($fast) && $fast >= 0 ? $fast : 'off';
+
+ for my $controller (nvme_controllers($scfg->{subsysnqn})->@*) {
+ my $base = "/sys/class/nvme/$controller->{name}";
+ my $current_delay = file_read_firstline("$base/reconnect_delay") // next;
+ my $write = sub($attr, $value) {
+ my $error = write_attribute("$base/$attr", "$value\n") // return;
+ log_warn("cannot set $attr of NVMe controller '$controller->{name}': $error");
+ };
+ my $delay_changed = $current_delay ne "$delay";
+ $write->('reconnect_delay', $delay) if $delay_changed;
+ # the loss timeout is stored as a number of reconnects of the delay
+ $write->('ctrl_loss_tmo', $loss < 0 ? -1 : $loss)
+ if $delay_changed
+ || (file_read_firstline("$base/ctrl_loss_tmo") // '') ne "$shown_loss";
+ $write->('fast_io_fail_tmo', $shown_fast eq 'off' ? -1 : $fast)
+ if (file_read_firstline("$base/fast_io_fail_tmo") // '') ne "$shown_fast";
+ }
+}
+
+# Attempts to make a controller attribute readable by root only (a test seam).
+sub _restrict_attr($path) {
+ my @stat = stat($path);
+ if (!@stat) {
+ log_warn("cannot stat NVMe controller attribute '$path': $!") if $! != ENOENT;
+ return;
+ }
+ return if !($stat[2] & 077);
+ chmod(0600, $path) or log_warn("cannot restrict permissions of '$path': $!");
+}
+
+# The kernel creates the DH-HMAC-CHAP secret attributes world-readable.
+my sub restrict_secret_attrs($nqn) {
+ for my $controller (nvme_controllers($nqn)->@*) {
+ _restrict_attr("/sys/class/nvme/$controller->{name}/$_")
+ for qw(dhchap_secret dhchap_ctrl_secret);
+ }
+}
+
+# Best effort: a controller that went away since it was listed needs no scan,
+# and one that cannot be rescanned is a warning.
+my sub rescan_namespaces($nqn) {
+ for my $controller (nvme_controllers($nqn)->@*) {
+ next if $controller->{state} ne 'live';
+ my $path = "/sys/class/nvme/$controller->{name}/rescan_controller";
+ my $error = write_attribute($path, "1\n", 1) // next;
+ log_warn("cannot rescan NVMe controller '$controller->{name}': $error");
+ }
+}
+
+# Deletes a controller that is dead or that moved to another interface. The
+# activation reconnects or keeps the path either way, so this only warns.
+my sub disconnect_controller($controller) {
+ my $name = $controller->{name};
+ eval {
+ run_bounded(
+ 5,
+ "deleting NVMe controller '$name'",
+ sub { return _delete_controllers([$controller]) },
+ );
+ };
+ if (my $error = $@) {
+ rethrow_task_interrupt($error);
+ log_warn($error);
+ }
+}
+
+# Waits up to 10 seconds for a live controller of the portal on its
+# configured interface.
+my sub wait_for_live_path($nqn, $portal) {
+ for (my $attempt = 0; $attempt < 40; $attempt++) {
+ return 1 if _live_portal_count(controller_states($nqn), [$portal]);
+ _sleep(0.25);
+ }
+ return 0;
+}
+
+# Connects every missing or dead path on its configured interface. A path
+# that is connected on another interface moves make-before-break: its old
+# controller is only disconnected once the new one is live, so changing an
+# interface mapping never takes away a path that carries I/O.
+my sub connect_portals($scfg, $portals, $hostnqn, $hostid, $key) {
+ my $nqn = $scfg->{subsysnqn};
+ for my $portal ($portals->@*) {
+ my $id = "$portal->{address}:$portal->{port}";
+ my $iface = $portal->{host_iface};
+ my @controllers = (controller_states($nqn)->{$id} // [])->@*;
+ my ($configured) = grep { ($_->{host_iface} // '') eq $iface } @controllers;
+ my @moved = grep { ($_->{host_iface} // '') ne $iface } @controllers;
+
+ if (!$configured || $configured->{state} eq 'dead') {
+ disconnect_controller($configured) if $configured;
+ if (!portal_reachable($portal)) {
+ log_warn("NVMe/TCP portal '$id' is unreachable");
+ next;
+ }
+ eval { _connect_portal($scfg, $portal, $hostnqn, $hostid, $key) };
+ my $connect_error = $@;
+ # A failed or timed-out connect can still have created a controller.
+ eval { restrict_secret_attrs($nqn); 1 };
+ if (my $error = $@) {
+ rethrow_task_interrupt($error);
+ log_warn("cannot restrict NVMe controller attributes for '$nqn'");
+ }
+ rethrow_task_interrupt($connect_error) if $connect_error;
+ if ($connect_error) {
+ log_warn("$id: $connect_error");
+ next;
+ }
+ }
+ next if !@moved;
+ if (!wait_for_live_path($nqn, $portal)) {
+ log_warn("NVMe/TCP portal '$id' is not live on '$iface' yet; keeping its path on"
+ . " another interface");
+ next;
+ }
+ disconnect_controller($_) for @moved;
+ }
+}
+
+sub activate_storage($class, $storeid, $scfg, $cache = undef) {
+ $cache //= {};
+ my $nqn = $scfg->{subsysnqn};
+ # First, whatever the rest of the activation does, also for controllers
+ # connected by hand. Also try after each connect attempt below, including
+ # failures that may have created a controller.
+ restrict_secret_attrs($nqn);
+
+ my $multipath = file_read_firstline('/sys/module/nvme_core/parameters/multipath')
+ // die "the NVMe kernel modules are not loaded; load the nvme-tcp kernel module\n";
+ die "native NVMe multipath is disabled in the running kernel\n" if $multipath ne 'Y';
+
+ my $portals = _configured_portals($scfg);
+ verify_nvme_nqn($nqn);
+ _validate_local_ifaces($portals);
+ _assert_unique_target($storeid, $scfg);
+ my $hostnqn = file_read_firstline('/etc/nvme/hostnqn')
+ // die "missing /etc/nvme/hostnqn; the nvme-cli package generates it\n";
+ verify_nvme_nqn($hostnqn);
+ my $hostnqns = parse_nvme_host_nqns($scfg->{'nvme-host-nqns'});
+ die "local NVMe host NQN '$hostnqn' is missing from nvme-host-nqns\n"
+ if !grep { $_ eq $hostnqn } $hostnqns->@*;
+ my $policy = $scfg->{'nvme-iopolicy'} // 'round-robin';
+ my $force_reconcile = delete($cache->{'zfsnvme-force-reconcile'}->{$storeid}) // 0;
+ my $states = controller_states($nqn);
+ my $healthy = _live_portal_count($states, $portals);
+ my $usable = _live_portal_count($states, $portals, 1);
+ my $last = $slow_path_last{$storeid};
+ my $recent = defined($last) && _now() - $last < $slow_path_backoff;
+
+ # This method is called by the periodic storage status loop. Once every
+ # configured path is live, lifecycle operations keep the target converged,
+ # so no remote call is needed. A degraded storage retries the target at
+ # most once a minute: in between, one with a live path (also one waiting
+ # to move to its configured interface) is usable, and one without fails
+ # at once instead of waiting for a path again. Missing namespaces
+ # explicitly force the slow path from activate_volume().
+ if (!$force_reconcile && ($healthy == scalar($portals->@*) || $recent)) {
+ die "no live NVMe/TCP path for storage '$storeid'\n" if !$usable;
+ die "missing NVMe DH-HMAC-CHAP key\n"
+ if (file_read_firstline(secret_path($storeid)) // '') eq '';
+ set_iopolicy($nqn, $policy);
+ set_tunables($scfg);
+ return 1;
+ }
+
+ $slow_path_last{$storeid} = _now();
+ my $hostid = file_read_firstline('/etc/nvme/hostid')
+ // die "missing /etc/nvme/hostid; the nvme-cli package generates it\n";
+ die "invalid NVMe host ID\n"
+ if $hostid !~ $RE_NVMET_UUID || $hostid =~ $RE_ZERO_UUID;
+ my $key = get_secret($storeid);
+ for my $name (qw(keep-alive-tmo reconnect-delay ctrl-loss-tmo fast-io-fail-tmo nr-io-queues)) {
+ my $value = $scfg->{"nvme-$name"};
+ die "invalid NVMe connection parameter '$name'\n"
+ if defined($value) && $value !~ $RE_CONFIG_INT;
+ }
+ _nvmet_activate_target($storeid, $scfg, $portals, $hostnqns, $key);
+ connect_portals($scfg, $portals, $hostnqn, $hostid, $key);
+
+ # Existing controllers can be in the middle of their kernel reconnect delay
+ # after a target restart. Do not create duplicates, but give that recovery
+ # cycle enough time to complete before declaring the storage unavailable.
+ for (my $attempt = 0; $attempt < 60; $attempt++) {
+ $states = controller_states($nqn);
+ last if _live_portal_count($states, $portals, 1);
+ _sleep(0.25);
+ }
+ die "no live NVMe/TCP path for storage '$storeid'\n"
+ if !_live_portal_count($states, $portals, 1);
+ $healthy = _live_portal_count($states, $portals);
+ log_warn("storage '$storeid' is degraded: $healthy/" . scalar($portals->@*) . " paths live")
+ if $healthy < scalar($portals->@*);
+
+ set_iopolicy($nqn, $policy);
+ set_tunables($scfg);
+ return 1;
+}
+
+sub deactivate_storage($class, $storeid, $scfg, $cache = undef) {
+ my $nqn = $scfg->{subsysnqn};
+ my $openers = _namespace_openers($nqn);
+ die "refusing to disconnect NVMe storage '$storeid': namespace in use by "
+ . join(', ', $openers->@*) . "\n"
+ if $openers->@*;
+
+ # One child deletes every controller, bounded by 15 seconds in all. When it
+ # gives up, the controllers that are left stay connected and the
+ # deactivation fails.
+ my $controllers = nvme_controllers($nqn);
+ run_bounded(
+ 15,
+ "disconnecting NVMe subsystem '$nqn'",
+ sub { return _delete_controllers($controllers) },
+ ) if $controllers->@*;
+ return 1;
+}
+
+# Removing a storage definition never destroys data and never depends on the
+# target, like for every other storage type. Target cleanup is best effort
+# and only happens once the storage owns no volume. Other nodes keep their
+# connections until they are disconnected there.
+sub on_delete_hook($class, $storeid, $scfg) {
+ # First: an activation elsewhere that waits for the target lock then
+ # refuses instead of restoring what is removed below.
+ delete_secret($storeid);
+ eval { $class->deactivate_storage($storeid, $scfg) };
+ if (my $err = $@) {
+ rethrow_task_interrupt($err);
+ chomp($err);
+ log_warn("not disconnecting NVMe storage '$storeid': $err");
+ }
+ eval { _nvmet_delete_target($scfg) };
+ if (my $err = $@) {
+ rethrow_task_interrupt($err);
+ chomp($err);
+ log_warn("keeping the NVMe target configuration of storage '$storeid': $err");
+ }
+ return;
+}
+
+sub path($class, $scfg, $volname, $storeid, $snapname = undef) {
+ die "direct access to snapshots not implemented\n" if defined($snapname);
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my $uuid = _nvmet_volume_uuid($scfg, $name);
+ my $path = "/dev/disk/by-id/nvme-uuid.$uuid";
+ return ($path, $vmid, $vtype);
+}
+
+sub qemu_blockdev_options(
+ $class, $scfg, $storeid, $volname,
+ $machine_version = undef,
+ $options = undef,
+) {
+ die "direct access to snapshots not implemented\n" if $options->{'snapshot-name'};
+ my ($path) = $class->path($scfg, $volname, $storeid);
+ return { driver => 'host_device', filename => $path };
+}
+
+# Whether the local device behind a namespace link is the namespace (NSID,
+# UUID) of this subsystem, so a UUID claimed by another subsystem is never
+# handed to a guest.
+sub _nvmet_local_namespace_ok($path, $nqn, $nsid, $uuid) {
+ my $link = _link_target($path) // return 0;
+ my $device = (split m{/}, $link)[-1];
+ return 0 if !defined($device) || $device !~ $RE_NVME_NAMESPACE;
+ my $sys = "/sys/block/$device";
+ return 0 if lc(file_read_firstline("$sys/uuid") // '') ne lc($uuid);
+ return 0 if (file_read_firstline("$sys/nsid") // '') ne "$nsid";
+ return 0 if (file_read_firstline("$sys/device/subsysnqn") // '') ne $nqn;
+ return 1;
+}
+
+sub activate_volume(
+ $class, $storeid, $scfg, $volname,
+ $snapname = undef,
+ $cache = undef,
+ $hints = undef,
+) {
+ die "unable to activate snapshot from remote zfs storage\n" if $snapname;
+ my (undef, $name) = $class->parse_volname($volname);
+ my $nqn = nvmet_nqn($scfg);
+ my $dataset = nvmet_dataset($scfg, $name);
+
+ my ($inv, $cfs) = nvmet_read($scfg);
+ my ($nsid, $uuid) = _nvmet_owned_identity($inv, $nqn, $dataset);
+ my $state = _nvmet_export_state($cfs, $nqn, $nsid, $uuid, "/dev/zvol/$dataset");
+ my $path = "/dev/disk/by-id/nvme-uuid.$uuid";
+ my $ok = sub {
+ return _block_device($path) && _nvmet_local_namespace_ok($path, $nqn, $nsid, $uuid);
+ };
+ return 1 if $state eq 'present' && $ok->();
+
+ $cache //= {};
+ $cache->{'zfsnvme-force-reconcile'}->{$storeid} = 1;
+ $class->activate_storage($storeid, $scfg, $cache);
+ for (my $attempt = 0; $attempt < 40 && !_block_device($path); $attempt++) {
+ # a host can miss the change notice; rescanning is harmless
+ rescan_namespaces($nqn) if $attempt % 8 == 0;
+ _sleep(0.25);
+ }
+ die "NVMe namespace for '$volname' did not appear\n" if !_block_device($path);
+ die "NVMe namespace for '$volname' has an unexpected identity\n" if !$ok->();
+ return 1;
+}
+
+sub deactivate_volume(
+ $class, $storeid, $scfg, $volname, $snapname = undef, $cache = undef,
+) {
+ die "unable to deactivate snapshot from remote zfs storage\n" if $snapname;
+ return 1;
+}
+
+1;
^ permalink raw reply related [relevance 9%]
* [PATCH storage v3 2/4] test: add zfsnvme plugin tests
2026-10-05 0:26 8% [PATCH storage v3 0/4] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-10-05 0:26 9% ` [PATCH storage v3 1/4] zfsnvme: " Joaquin Varela
@ 2026-10-05 0:26 5% ` Joaquin Varela
2026-10-05 0:26 14% ` [PATCH docs v3] storage: document ZFS over NVMe/TCP Joaquin Varela
2 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-10-05 0:26 UTC (permalink / raw)
To: pve-devel
Add two test files to the plugin test harness and register them in
run_plugin_tests.pl.
zfsnvme_test.pm covers the host side: option and portal parsing, the
schema and the config checks, the key handling (the add and update
hooks with /etc/pve/priv/storage, and the 'dhchap-key' file mapping of
'pvesm add' and 'pvesm set'), the SSH runner and its error
classification, the /dev/nvme-fabrics option builder and the connect
child (against a pseudoterminal that answers like the fabrics device;
skipped without /dev/ptmx), the sysfs-based rescan and controller
deletion, path selection and activation, vdisk_alloc under the core
storage lock, and the volume path and QEMU blockdev options. Nothing in
it opens a connection or touches a local NVMe device.
zfsnvme_target_test.pm covers the target side: the parsers and planners
on fixture reads of an nvmet target (Linux 6.8, ZFS 2.2; addresses and
NQNs replaced by documentation values), the command renderer and
chunking, and every target flow against an in-memory target
(FakeTarget) that interprets exactly the commands the plugin sends and
records anything else as a protocol violation. A fault sweep fails
every mutating call of every flow in each way an SSH call can fail
(before or after it ran, a connection cut or lost in the middle of a
chain, or a call the target runs to its end after ssh gave up on it)
and checks that identities stay unique, nothing of other storages
changes, every change ran under one domain lock, and the next
activation converges. The rendered chains also run with /bin/sh on a
configfs stand-in in a temporary directory, which checks the quoting
and the POSIX command shapes; these tests bail out unless /bin/sh,
find, grep, sha256sum, dd and tee are available.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
src/test/run_plugin_tests.pl | 2 +
.../zfsnvme_fixtures/configfs_snapshot.txt | 38 +
src/test/zfsnvme_fixtures/zfs_inventory.txt | 15 +
src/test/zfsnvme_target_test.pm | 4849 +++++++++++++++++
src/test/zfsnvme_test.pm | 2353 ++++++++
5 files changed, 7257 insertions(+)
create mode 100644 src/test/zfsnvme_fixtures/configfs_snapshot.txt
create mode 100644 src/test/zfsnvme_fixtures/zfs_inventory.txt
create mode 100644 src/test/zfsnvme_target_test.pm
create mode 100644 src/test/zfsnvme_test.pm
diff --git a/src/test/run_plugin_tests.pl b/src/test/run_plugin_tests.pl
index 8bce9d3b..d063a3d2 100755
--- a/src/test/run_plugin_tests.pl
+++ b/src/test/run_plugin_tests.pl
@@ -17,6 +17,8 @@ my $res = $harness->runtests(
"get_subdir_test.pm",
"filesystem_path_test.pm",
"prune_backups_test.pm",
+ "zfsnvme_test.pm",
+ "zfsnvme_target_test.pm",
);
exit -1 if !$res || $res->{failed} || $res->{parse_errors};
diff --git a/src/test/zfsnvme_fixtures/configfs_snapshot.txt b/src/test/zfsnvme_fixtures/configfs_snapshot.txt
new file mode 100644
index 00000000..1b7672a0
--- /dev/null
+++ b/src/test/zfsnvme_fixtures/configfs_snapshot.txt
@@ -0,0 +1,38 @@
+D /sys/kernel/config/nvmet
+D /sys/kernel/config/nvmet/hosts
+D /sys/kernel/config/nvmet/hosts/nqn.2014-08.org.nvmexpress:uuid:0a0a0a0a-0a0a-4a0a-8a0a-0a0a0a0a0a0a
+D /sys/kernel/config/nvmet/hosts/nqn.2014-08.org.nvmexpress:uuid:0b0b0b0b-0b0b-4b0b-8b0b-0b0b0b0b0b0b
+D /sys/kernel/config/nvmet/ports
+D /sys/kernel/config/nvmet/ports/2
+D /sys/kernel/config/nvmet/ports/2/subsystems
+D /sys/kernel/config/nvmet/ports/1
+D /sys/kernel/config/nvmet/ports/1/subsystems
+D /sys/kernel/config/nvmet/subsystems
+D /sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme
+D /sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/allowed_hosts
+D /sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces
+D /sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/6
+D /sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/5
+L /sys/kernel/config/nvmet/ports/2/subsystems/nqn.2026-01.com.example:zfsnvme
+L /sys/kernel/config/nvmet/ports/1/subsystems/nqn.2026-01.com.example:zfsnvme
+L /sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/allowed_hosts/nqn.2014-08.org.nvmexpress:uuid:0a0a0a0a-0a0a-4a0a-8a0a-0a0a0a0a0a0a
+L /sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/allowed_hosts/nqn.2014-08.org.nvmexpress:uuid:0b0b0b0b-0b0b-4b0b-8b0b-0b0b0b0b0b0b
+/sys/kernel/config/nvmet/ports/2/addr_trtype:tcp
+/sys/kernel/config/nvmet/ports/2/addr_trsvcid:4420
+/sys/kernel/config/nvmet/ports/2/addr_traddr:192.0.2.22
+/sys/kernel/config/nvmet/ports/2/addr_adrfam:ipv4
+/sys/kernel/config/nvmet/ports/1/addr_trtype:tcp
+/sys/kernel/config/nvmet/ports/1/addr_trsvcid:4420
+/sys/kernel/config/nvmet/ports/1/addr_traddr:192.0.2.21
+/sys/kernel/config/nvmet/ports/1/addr_adrfam:ipv4
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/6/buffered_io:0
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/6/enable:1
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/6/device_uuid:0d0d0d0d-0d0d-4d0d-8d0d-0d0d0d0d0d0d
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/6/device_path:/dev/zvol/tank/vm-100-cloudinit
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/5/buffered_io:0
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/5/enable:1
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/5/device_uuid:0c0c0c0c-0c0c-4c0c-8c0c-0c0c0c0c0c0c
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/namespaces/5/device_path:/dev/zvol/tank/vm-100-disk-0
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/attr_model:Proxmox ZFS NVMe
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/attr_serial:PVEZFS51b2c3c90ea254
+/sys/kernel/config/nvmet/subsystems/nqn.2026-01.com.example:zfsnvme/attr_allow_any_host:0
diff --git a/src/test/zfsnvme_fixtures/zfs_inventory.txt b/src/test/zfsnvme_fixtures/zfs_inventory.txt
new file mode 100644
index 00000000..69ba9238
--- /dev/null
+++ b/src/test/zfsnvme_fixtures/zfs_inventory.txt
@@ -0,0 +1,15 @@
+tank type filesystem -
+tank proxmox:nvme-subsys - -
+tank proxmox:nvme-nsid - -
+tank proxmox:nvme-uuid - -
+tank proxmox:nvme-last-nsid - -
+tank/vm-100-cloudinit type volume -
+tank/vm-100-cloudinit proxmox:nvme-subsys nqn.2026-01.com.example:zfsnvme local
+tank/vm-100-cloudinit proxmox:nvme-nsid 6 local
+tank/vm-100-cloudinit proxmox:nvme-uuid 0d0d0d0d-0d0d-4d0d-8d0d-0d0d0d0d0d0d local
+tank/vm-100-cloudinit proxmox:nvme-last-nsid - -
+tank/vm-100-disk-0 type volume -
+tank/vm-100-disk-0 proxmox:nvme-subsys nqn.2026-01.com.example:zfsnvme local
+tank/vm-100-disk-0 proxmox:nvme-nsid 5 local
+tank/vm-100-disk-0 proxmox:nvme-uuid 0c0c0c0c-0c0c-4c0c-8c0c-0c0c0c0c0c0c local
+tank/vm-100-disk-0 proxmox:nvme-last-nsid - -
diff --git a/src/test/zfsnvme_target_test.pm b/src/test/zfsnvme_target_test.pm
new file mode 100644
index 00000000..991d2084
--- /dev/null
+++ b/src/test/zfsnvme_target_test.pm
@@ -0,0 +1,4849 @@
+# Target side of the zfsnvme storage plugin: the parsers and planners on the
+# fixture reads, the command renderer, and every target flow against an
+# in-memory NVMe target (FakeTarget) that interprets exactly the commands the
+# plugin sends. Nothing here opens a connection or touches local NVMe devices.
+
+use v5.36;
+
+use lib qw(..);
+
+use Compress::Zlib qw(crc32);
+use Digest::SHA qw(sha256_hex);
+use File::Temp qw(tempdir);
+use FindBin;
+use IPC::Open3;
+use MIME::Base64 qw(encode_base64);
+use POSIX ();
+use Storable qw(dclone freeze);
+use Symbol qw(gensym);
+use Test::MockModule;
+use Test::More;
+
+use PVE::Cluster;
+use PVE::Storage;
+use PVE::Storage::ZFSNVMePlugin;
+
+my $PLUGIN = 'PVE::Storage::ZFSNVMePlugin';
+my $ROOT = '/sys/kernel/config/nvmet';
+my $MARKER = 'ZFSNVME-CONFIGFS';
+my $MODEL = 'Proxmox ZFS NVMe';
+my $FIXTURES = "$FindBin::Bin/zfsnvme_fixtures";
+my $UUID_RE = qr/\A[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\z/i;
+my $EMPTY_KEY_SHA = sha256_hex("\n");
+
+# The fixtures are the ZFS inventory and the configfs read of a target (Linux
+# 6.8 nvmet, ZFS 2.2) that serves one subsystem with two namespaces to two
+# cluster nodes, as the plugin reads them.
+my $FIXTURE_NQN = 'nqn.2026-01.com.example:zfsnvme';
+my @FIXTURE_HOSTS = (
+ 'nqn.2014-08.org.nvmexpress:uuid:0a0a0a0a-0a0a-4a0a-8a0a-0a0a0a0a0a0a',
+ 'nqn.2014-08.org.nvmexpress:uuid:0b0b0b0b-0b0b-4b0b-8b0b-0b0b0b0b0b0b',
+);
+my $FIXTURE_UUID5 = '0c0c0c0c-0c0c-4c0c-8c0c-0c0c0c0c0c0c';
+my $FIXTURE_UUID6 = '0d0d0d0d-0d0d-4d0d-8d0d-0d0d0d0d0d0d';
+
+my $NQN = 'nqn.2026-01.com.example:zfsnvme-test';
+my $FOREIGN_NQN = 'nqn.2026-01.com.example:foreign';
+my @HOSTS =
+ map { sprintf('nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-%012d', $_) } 1, 2;
+
+# A portal as parse_nvme_portals() returns it.
+sub portal($family, $address, $port) {
+ return { family => $family, address => $address, port => $port };
+}
+my $PORTALS = [portal('ipv4', '192.0.2.21', 4420), portal('ipv4', '192.0.2.22', 4420)];
+my %U = map {
+ my $d = $_;
+ ($d => join('-', $d x 8, $d x 4, '4' . $d x 3, '8' . $d x 3, $d x 12))
+} 1 .. 9;
+
+sub make_key($hash, $length, $seed = 1) {
+ my $raw = join('', map { chr(($_ * 131 + $seed * 17) % 256) } 1 .. $length);
+ return "DHHC-1:$hash:" . encode_base64($raw . pack('V', crc32($raw)), '') . ':';
+}
+my $KEY = make_key('00', 32);
+my $KEY_B = make_key('00', 32, 2);
+my $KEY_SHA = sha256_hex("$KEY\n");
+
+sub scfg(%override) {
+ return {
+ type => 'zfsnvme',
+ server => '192.0.2.10',
+ pool => 'tank',
+ subsysnqn => $NQN,
+ blocksize => '16k',
+ sparse => 1,
+ 'nvme-portals' => '192.0.2.21,192.0.2.22',
+ 'nvme-host-ifaces' => 'ens19,ens20',
+ 'nvme-host-nqns' => join(',', @HOSTS),
+ %override,
+ };
+}
+
+sub slurp($path) {
+ open(my $fh, '<', $path) or die "cannot open '$path': $!\n";
+ local $/;
+ return scalar(<$fh>);
+}
+
+# Calls a plugin package sub by name, so a mocked sub is the one called.
+sub nv($name, @args) {
+ my $code = $PLUGIN->can($name) // die "plugin has no sub '$name'\n";
+ return $code->(@args);
+}
+
+sub same($x, $y) {
+ local $Storable::canonical = 1;
+ return freeze([$x]) eq freeze([$y]);
+}
+
+# ---------------------------------------------------------------------------
+# Mocks: the only way to the target is _nvmet_run, and it reaches $FAKE.
+# The pmxcfs lock, quorum, clock, waits, UUID source, local files and local
+# devices are mocked. Waits advance $NOW.
+# ---------------------------------------------------------------------------
+
+our $FAKE;
+our $NOW = 1_000_000;
+our $SLEPT = 0;
+our $QUORATE = 1;
+our $LOCK_HOOK;
+our (%LOCK_HELD, @LOCKS, @NESTED_LOCKS, @QUORUM, @WARNINGS, @SYSFS_WRITES, %FILES, %CONFIG);
+our (%CORPUS, @VIOLATIONS, @WRITES, @UNLINKED, %BLOCK, @UUIDS);
+
+my $uuid_seq = 0;
+
+sub lock_id($scfg) {
+ return 'zfsnvme-' . ($scfg->{server} =~ s/[^A-Za-z0-9.-]/_/gr);
+}
+
+sub lock_held($scfg) {
+ return (($LOCK_HELD{ lock_id($scfg) } // 0) == $$) ? 1 : 0;
+}
+
+# Whether a step changes the target, by the vocabulary of the fake target,
+# independently of the plugin.
+sub mutating_step($step) {
+ return 1 if ref($step) ne 'ARRAY';
+ my ($command, $subcommand) = $step->@*;
+ return 0 if grep { $command eq $_ } qw(test grep cat printf env);
+ return 0 if $command eq 'zfs' && ($subcommand eq 'get' || $subcommand eq 'list');
+ return 1;
+}
+
+# Whether steps change the target, not counting the module load of a locked read.
+sub changing($steps) {
+ return scalar(grep { mutating_step($_) && !step_is($_, 'modprobe') } $steps->@*);
+}
+
+my $plugin_mock = Test::MockModule->new($PLUGIN);
+my $cluster_mock = Test::MockModule->new('PVE::Cluster');
+my $storage_mock = Test::MockModule->new('PVE::Storage');
+my $sysfs_mock = Test::MockModule->new('PVE::SysFSTools');
+my $tools_mock = Test::MockModule->new('PVE::Tools');
+
+$plugin_mock->redefine(
+ _nvmet_run => sub($scfg, $steps, %opts) {
+ die "test error: no fake target\n" if !$FAKE;
+ my $rendered = nv('_nvmet_render', $steps);
+ $CORPUS{$rendered} //= $opts{op} // '';
+ return $FAKE->run($scfg, $steps, $rendered, %opts);
+ },
+);
+# The target is the only place that runs commands, and only through _nvmet_run.
+# A command is also a violation, in case the caller handles the error.
+my $no_command = sub($cmd, %opts) {
+ my $what = 'unexpected command ' . (ref($cmd) ? $cmd->[0] : $cmd);
+ push @VIOLATIONS, $what;
+ die "test error: $what\n";
+};
+$plugin_mock->redefine(run_command => $no_command);
+$tools_mock->redefine(run_command => $no_command);
+$plugin_mock->redefine(_now => sub () { return $NOW });
+$plugin_mock->redefine(
+ _sleep => sub($seconds) {
+ $NOW += $seconds;
+ $SLEPT += $seconds;
+ return;
+ },
+);
+$plugin_mock->redefine(_block_device => sub($path) { return $BLOCK{$path} });
+$plugin_mock->redefine(
+ _unlink_file => sub($path) {
+ push @UNLINKED, $path;
+ delete $FILES{$path};
+ return 1;
+ },
+);
+$plugin_mock->redefine(log_warn => sub($message) { push @WARNINGS, $message; return });
+my $sysfs_write = sub($path, $data, $allow_existing = undef) {
+ push @SYSFS_WRITES, [$path, $data];
+ return 1;
+};
+$sysfs_mock->redefine(file_write => $sysfs_write);
+# The host side runs its kernel-facing steps in a bounded child; here they
+# run inline.
+$tools_mock->redefine(
+ run_fork_with_timeout => sub($timeout, $code, $opts = undef) {
+ my $res = $code->();
+ return wantarray ? ($res, 0) : $res;
+ },
+);
+# UUIDs come from @UUIDS first, then from a sequence.
+$plugin_mock->redefine(
+ file_read_firstline => sub($path) {
+ if ($path eq '/proc/sys/kernel/random/uuid') {
+ return shift(@UUIDS) if @UUIDS;
+ $uuid_seq++;
+ return sprintf('%08x-7e57-4000-8000-%012x', $uuid_seq, $uuid_seq);
+ }
+ return $FILES{$path};
+ },
+);
+$plugin_mock->redefine(
+ file_set_contents => sub($path, $data, $perm = undef, @rest) {
+ push @WRITES, { path => $path, data => $data, perm => $perm };
+ return;
+ },
+);
+$plugin_mock->redefine(make_path => sub(@args) { push @WRITES, { make_path => [@args] }; return });
+$plugin_mock->redefine(_namespace_openers => sub($nqn) { return [] });
+
+$cluster_mock->redefine(
+ check_cfs_quorum => sub($noerr = undef) {
+ push @QUORUM, $noerr;
+ die "cluster not ready - no quorum?\n" if !$QUORATE && !$noerr;
+ return $QUORATE;
+ },
+);
+# Keeps the cfs_lock contract: the code's result with $@ cleared, or undef
+# with $@ set. pmxcfs locks are not re-entrant: a second request for a held
+# lock times out, like a mkdir on /etc/pve/priv/lock would.
+$cluster_mock->redefine(
+ cfs_lock_domain => sub($name, $timeout, $code, @param) {
+ push @LOCKS, { name => $name, timeout => $timeout, pid => $$, now => $NOW };
+ if ($LOCK_HELD{$name}) {
+ push @NESTED_LOCKS, $name;
+ $@ = "cfs-lock 'domain-$name' error: got lock request timeout\n";
+ return undef;
+ }
+ if (my $hook = $LOCK_HOOK) {
+ local $LOCK_HOOK;
+ $hook->($name);
+ }
+ local $LOCK_HELD{$name} = $$;
+ my $res = eval { $code->(@param) };
+ my $err = $@;
+ if ($err) {
+ $@ = $err;
+ return undef;
+ }
+ $@ = undef;
+ return $res;
+ },
+);
+$storage_mock->redefine(config => sub () { return { ids => {%CONFIG} } });
+
+# ---------------------------------------------------------------------------
+# FakeTarget: ZFS datasets and an nvmet configfs tree with the kernel rules
+# the plugin depends on. It accepts only the command vocabulary of the
+# plugin; anything else is recorded as a protocol violation.
+# ---------------------------------------------------------------------------
+
+package FakeTarget {
+ use Digest::SHA qw(sha256_hex);
+ use Storable qw(dclone);
+
+ my $RR = quotemeta($ROOT);
+
+ # fail => [$match, $error, $times]: the steps that match (an argv prefix,
+ # { write => $suffix, value => $value } or a sub of the step) fail $times
+ # times with $error.
+ sub new($class, %opts) {
+ my $pools = delete($opts{pools}) // ['tank'];
+ if (my $fail = delete($opts{fail})) {
+ my ($match, $error, $times) = $fail->@*;
+ my $matches =
+ ref($match) eq 'CODE' ? $match
+ : ref($match) eq 'HASH'
+ ? sub($step) { main::write_to($step, $match->{write}, $match->{value}) }
+ : sub($step) { main::step_is($step, $match->@*) };
+ my $count = 0;
+ $opts{step_fault} = sub($step, $call) {
+ return undef if !$matches->($step) || $count >= ($times // 99);
+ $count++;
+ return $error;
+ };
+ }
+ my $self = bless {
+ m => {
+ ds => {},
+ snaps => {},
+ seq => 0,
+ subsystems => {},
+ ports => {},
+ hosts => {},
+ mounted => 1,
+ loaded => 1,
+ available => '1073741824',
+ used => '1048576',
+ },
+ calls => [],
+ violations => [],
+ faults => {}, # call index => before | after | late | cut:<step> | lost:<step>
+ late => [], # calls that ssh gave up on, applied by land()
+ # { after => call index, mode => before | unreachable | failed }
+ read_fault => undef,
+ step_fault => undef, # sub ($step, $call) returning an error text
+ before_call => undef,
+ after_call => undef,
+ udev_delay => 0, # failing `test -b` polls after a zvol (re)appears
+ unbindable => {}, # port id => 1: its address is missing on the target
+ unreachable => 0,
+ secrets => [$KEY, $KEY_B],
+ %opts,
+ }, $class;
+ $self->{m}->{ds}->{$_} = { type => 'filesystem', props => {} } for $pools->@*;
+ return $self;
+ }
+
+ sub from_state($class, $state, %opts) {
+ my $self = $class->new(%opts);
+ $self->{m} = dclone($state);
+ return $self;
+ }
+
+ # --- building a state -------------------------------------------------
+
+ sub add_zvol($self, $name, %o) {
+ my %props;
+ @props{qw(proxmox:nvme-subsys proxmox:nvme-nsid proxmox:nvme-uuid)} = $o{identity}->@*
+ if $o{identity};
+ $self->{m}->{ds}->{$name} = {
+ type => 'volume',
+ props => \%props,
+ volsize => $o{volsize} // 1073741824,
+ origin => $o{origin} // '-',
+ devwait => 0,
+ };
+ return $self;
+ }
+
+ sub add_snapshot($self, $snapshot, %o) {
+ my ($name) = split /\@/, $snapshot;
+ my $ds = $self->{m}->{ds}->{$name};
+ $self->{m}->{snaps}->{$snapshot} = {
+ props => $o{props} // dclone($ds->{props}),
+ volsize => $ds->{volsize},
+ seq => ++$self->{m}->{seq},
+ };
+ return $self;
+ }
+
+ sub add_subsystem($self, $nqn, %o) {
+ $self->{m}->{subsystems}->{$nqn} = {
+ attr => {
+ attr_model => $o{model} // $MODEL,
+ attr_serial => $o{serial} // PVE::Storage::ZFSNVMePlugin::_nvmet_serial($nqn),
+ attr_allow_any_host => $o{allow_any_host} // '0',
+ },
+ acl => { map { $_ => 1 } ($o{acl} // [])->@* },
+ ns => {},
+ };
+ return $self;
+ }
+
+ sub add_namespace($self, $nqn, $nsid, $uuid, $dev, $enable = 1) {
+ $self->{m}->{subsystems}->{$nqn}->{ns}->{$nsid} = {
+ enable => "$enable",
+ device_path => $dev,
+ device_uuid => $uuid,
+ buffered_io => '0',
+ };
+ return $self;
+ }
+
+ sub add_port($self, $id, $address, $service, %o) {
+ $self->{m}->{ports}->{$id} = {
+ attr => {
+ addr_trtype => 'tcp',
+ addr_adrfam => $o{family} // 'ipv4',
+ addr_traddr => $address,
+ addr_trsvcid => "$service",
+ },
+ links => { map { $_ => 1 } ($o{links} // [])->@* },
+ };
+ return $self;
+ }
+
+ # nvmet creates the key attributes of a host world-readable
+ sub host_entry($key = undef) {
+ return { key => $key, mode => { map { $_ => '0644' } qw(dhchap_key dhchap_ctrl_key) } };
+ }
+
+ sub add_host($self, $hostnqn, $key = undef) {
+ $self->{m}->{hosts}->{$hostnqn} = host_entry($key);
+ return $self;
+ }
+
+ # A target restart: configfs is empty and, unless $loaded, nvmet is not
+ # loaded yet.
+ sub reboot($self, $loaded = 0) {
+ my $m = $self->{m};
+ $m->{$_} = {} for qw(subsystems ports hosts);
+ $m->{loaded} = $loaded;
+ $_->{devwait} = 0 for grep { $_->{type} eq 'volume' } values $m->{ds}->%*;
+ return $self;
+ }
+
+ # --- execution --------------------------------------------------------
+
+ sub run($self, $scfg, $steps, $rendered, %opts) {
+ my $call = {
+ index => scalar($self->{calls}->@*),
+ op => $opts{op},
+ steps => dclone($steps),
+ rendered => $rendered,
+ timeout => $opts{timeout},
+ input => defined($opts{input}) ? 1 : 0,
+ locked => main::lock_held($scfg),
+ mutating => (grep { main::mutating_step($_) } $steps->@*) ? 1 : 0,
+ changing => main::changing($steps),
+ now => $main::NOW,
+ };
+ push $self->{calls}->@*, $call;
+ $self->audit($call, $opts{input});
+ $self->{before_call}->($self, $call) if $self->{before_call};
+ my $res = $self->execute($call, $steps, $opts{input});
+ $call->{rc} = $res->{rc};
+ $call->{err} = $res->{err};
+ $self->audit_text($call, $res->{err}, $res->{out}->@*);
+ $self->{after_call}->($self, $call) if $self->{after_call};
+ return $res;
+ }
+
+ # Violations are recorded for the fake and for the whole run, which the
+ # last subtest checks.
+ sub flag($self, @what) {
+ push $self->{violations}->@*, @what;
+ push @main::VIOLATIONS, @what;
+ }
+
+ sub violation($self, $what) {
+ $self->flag($what);
+ die "FAKEERR:protocol violation: $what\n";
+ }
+
+ sub err($message) {
+ die "FAKEERR:$message\n";
+ }
+
+ sub audit($self, $call, $input) {
+ my @bad;
+ my $op = $call->{op} // '';
+ push @bad, 'call without an operation label' if $op eq '';
+ for my $secret ($self->{secrets}->@*) {
+ push @bad, "key in the command of '$op'" if index($call->{rendered}, $secret) >= 0;
+ }
+ my $keys = grep { ref($_) eq 'HASH' && exists($_->{key}) } $call->{steps}->@*;
+ push @bad, "key write without stdin in '$op'" if $keys && !defined($input);
+ push @bad, "stdin without a key write in '$op'" if defined($input) && !$keys;
+ push @bad, "stdin is not a configured key in '$op'"
+ if defined($input) && !grep { $input eq "$_\n" } $self->{secrets}->@*;
+ push @bad, "target change without the target lock in '$op'"
+ if $call->{mutating} && !$call->{locked};
+ $self->flag(@bad);
+ }
+
+ sub audit_text($self, $call, @texts) {
+ for my $text (grep { defined } @texts) {
+ for my $secret ($self->{secrets}->@*) {
+ $self->flag("key in the output of '$call->{op}'") if index($text, $secret) >= 0;
+ }
+ }
+ }
+
+ # Applies the calls that ssh gave up on, as the target finally runs them:
+ # each chain stops at its first failing step.
+ sub land($self) {
+ for my $late (splice($self->{late}->@*)) {
+ for my $step ($late->{steps}->@*) {
+ last if !eval { $self->step($step, $late->{input}); 1 };
+ }
+ }
+ return $self;
+ }
+
+ # A fault mode fails a call before it runs (rc 1), after it ran (the
+ # connection breaks: 255), at one of its steps (cut: the connection breaks
+ # and the remote shell stops; lost: it breaks and the rest of the chain
+ # still runs, later), or ssh gives up on it while it runs to its end later
+ # (late: -1).
+ sub execute($self, $call, $steps, $input) {
+ my $closed = 'Connection to 192.0.2.10 closed by remote host.';
+ my $broken = { rc => 255, out => [], err => $closed };
+ my $no_route = 'ssh: connect to host 192.0.2.10: No route to host';
+ return { rc => 255, out => [], err => $no_route } if $self->{unreachable};
+ my $read_fault = $self->{read_fault};
+ if ($read_fault && !$call->{mutating} && $call->{index} > $read_fault->{after}) {
+ $self->{read_fault} = undef;
+ $call->{fault} = "read $read_fault->{mode}";
+ return { rc => 255, out => [], err => $no_route }
+ if $read_fault->{mode} eq 'unreachable';
+ return { rc => -1, out => [], err => 'ssh failed' } if $read_fault->{mode} eq 'failed';
+ return { rc => 1, out => [], err => 'injected read failure' };
+ }
+ my $mode = $self->{faults}->{ $call->{index} } // '';
+ $call->{fault} = $mode if $mode;
+ return { rc => 1, out => [], err => 'injected failure' } if $mode eq 'before';
+ if ($mode eq 'late') {
+ push $self->{late}->@*, { steps => dclone($steps), input => $input };
+ return { rc => -1, out => [], err => 'timeout' };
+ }
+ my ($cut) = $mode =~ /\Acut:([0-9]+)\z/;
+ my ($lost) = $mode =~ /\Alost:([0-9]+)\z/;
+ my @out;
+ for my $index (0 .. $steps->$#*) {
+ return $broken if defined($cut) && $index == $cut;
+ if (defined($lost) && $index == $lost) {
+ my @rest = $steps->@[$index .. $steps->$#*];
+ push $self->{late}->@*, { steps => dclone(\@rest), input => $input };
+ return $broken;
+ }
+ my $step = $steps->[$index];
+ my $error = $self->{step_fault} ? $self->{step_fault}->($step, $call) : undef;
+ if (!defined($error)) {
+ my @lines = eval { $self->step($step, $input) };
+ my $e = $@;
+ if (!$e) {
+ push @out, @lines;
+ next;
+ }
+ if ($e !~ s/\AFAKEERR://) {
+ $self->flag("fake target error: $e");
+ return { rc => 2, out => \@out, err => 'fake target error' };
+ }
+ chomp($error = $e);
+ }
+ return { rc => 1, out => \@out, err => $error eq '' ? 'exit code 1' : $error };
+ }
+ return $broken if $mode eq 'after';
+ return { rc => 0, out => \@out, err => '' };
+ }
+
+ sub step($self, $step, $input) {
+ if (ref($step) eq 'HASH' && exists($step->{write})) {
+ $self->write_attr($step->{write}, $step->{value});
+ return ();
+ }
+ if (ref($step) eq 'HASH') {
+ err('dd: error reading standard input') if !defined($input);
+ (my $key = $input) =~ s/\n\z//;
+ my @failed;
+ for my $path ($step->{key}->@*) {
+ eval { $self->write_key($path, $key) };
+ push @failed, $@ if $@;
+ }
+ die $failed[0] if @failed;
+ return ();
+ }
+ my ($command, @args) = $step->@*;
+ my $method = "cmd_$command";
+ $self->violation("command '$command'") if !$self->can($method);
+ return $self->$method(@args);
+ }
+
+ # --- configfs ---------------------------------------------------------
+
+ sub available($self) {
+ err("find: '$ROOT': No such file or directory")
+ if !$self->{m}->{mounted} || !$self->{m}->{loaded};
+ }
+
+ sub parts($self, $path) {
+ return () if $path !~ m{\A$RR/(.+)\z};
+ return split m{/}, $1;
+ }
+
+ sub zvol_name($self, $dev) {
+ return $dev =~ m{\A/dev/zvol/(.+)\z} ? $1 : undef;
+ }
+
+ sub block_device($self, $dev, $poll) {
+ my $name = $self->zvol_name($dev) // return 0;
+ my $ds = $self->{m}->{ds}->{$name} // return 0;
+ return 0 if $ds->{type} ne 'volume';
+ if ($ds->{devwait} > 0) {
+ $ds->{devwait}-- if $poll;
+ return 0;
+ }
+ return 1;
+ }
+
+ sub busy($self, $name) {
+ for my $subsys (values $self->{m}->{subsystems}->%*) {
+ return 1
+ if grep { $_->{enable} eq '1' && $_->{device_path} eq "/dev/zvol/$name" }
+ values $subsys->{ns}->%*;
+ }
+ return 0;
+ }
+
+ sub new_uuid($self) {
+ my $seq = ++$self->{m}->{seq};
+ return sprintf('%08x-dead-4000-8000-%012x', $seq, $seq);
+ }
+
+ sub write_attr($self, $path, $value) {
+ $self->available;
+ my @p = $self->parts($path) or $self->violation("write '$path'");
+ my $m = $self->{m};
+ if ($p[0] eq 'subsystems' && @p == 3) {
+ my $subsys = $m->{subsystems}->{ $p[1] } // err("$path: No such file or directory");
+ $self->violation("write '$path'")
+ if $p[2] !~ /\A(?:attr_model|attr_serial|attr_allow_any_host)\z/;
+ if ($p[2] eq 'attr_allow_any_host') {
+ err("$path: Invalid argument") if $value !~ /\A[01]\z/;
+ err("$path: Invalid argument") if $value eq '1' && $subsys->{acl}->%*;
+ }
+ $subsys->{attr}->{ $p[2] } = "$value";
+ } elsif ($p[0] eq 'subsystems' && @p == 5 && $p[2] eq 'namespaces') {
+ my $subsys = $m->{subsystems}->{ $p[1] } // err("$path: No such file or directory");
+ my $ns = $subsys->{ns}->{ $p[3] } // err("$path: No such file or directory");
+ my $attr = $p[4];
+ if ($attr eq 'enable') {
+ err("$path: Invalid argument") if $value !~ /\A[01]\z/;
+ err("$path: No such device")
+ if $value eq '1'
+ && $ns->{enable} ne '1'
+ && !$self->block_device($ns->{device_path}, 0);
+ $ns->{enable} = "$value";
+ } elsif ($attr =~ /\A(?:device_path|device_uuid|buffered_io)\z/) {
+ err("$path: Device or resource busy") if $ns->{enable} eq '1';
+ if ($attr eq 'device_uuid') {
+ err("$path: Invalid argument") if $value !~ $UUID_RE;
+ $value = lc($value);
+ }
+ $ns->{$attr} = "$value";
+ } elsif ($attr eq 'revalidate_size') {
+ err("$path: Invalid argument") if $ns->{enable} ne '1' || $value ne '1';
+ $self->{revalidated}->{"$p[1]/$p[3]"}++;
+ } else {
+ $self->violation("write '$path'");
+ }
+ } elsif ($p[0] eq 'ports' && @p == 3) {
+ my $port = $m->{ports}->{ $p[1] } // err("$path: No such file or directory");
+ $self->violation("write '$path'")
+ if $p[2] !~ /\Aaddr_(?:trtype|adrfam|traddr|trsvcid)\z/;
+ err("$path: Permission denied") if $port->{links}->%*;
+ $port->{attr}->{ $p[2] } = "$value";
+ } else {
+ $self->violation("write '$path'");
+ }
+ }
+
+ sub write_key($self, $path, $key) {
+ $self->available;
+ my @p = $self->parts($path);
+ $self->violation("key write to '$path'")
+ if @p != 3 || $p[0] ne 'hosts' || $p[2] ne 'dhchap_key';
+ my $host = $self->{m}->{hosts}->{ $p[1] } // err("tee: $path: No such file or directory");
+ err("tee: $path: Invalid argument") if $key !~ /\ADHHC-1:/;
+ $self->violation("key write to the world-readable '$path'")
+ if ($host->{mode}->{ $p[2] } // '') ne '0600';
+ $host->{key} = $key;
+ }
+
+ sub cmd_mkdir($self, @paths) {
+ $self->available;
+ my $m = $self->{m};
+ for my $path (@paths) {
+ my @p = $self->parts($path) or $self->violation("mkdir '$path'");
+ my $exists = "mkdir: cannot create directory '$path': File exists";
+ my $missing = "mkdir: cannot create directory '$path': No such file or directory";
+ if ($p[0] eq 'subsystems' && @p == 2) {
+ err($exists) if $m->{subsystems}->{ $p[1] };
+ $m->{subsystems}->{ $p[1] } = {
+ attr => {
+ attr_model => 'Linux',
+ attr_serial => substr(sha256_hex("serial $p[1]"), 0, 16),
+ attr_allow_any_host => '0',
+ },
+ acl => {},
+ ns => {},
+ };
+ } elsif ($p[0] eq 'subsystems' && @p == 4 && $p[2] eq 'namespaces') {
+ my $subsys = $m->{subsystems}->{ $p[1] } // err($missing);
+ err("mkdir: cannot create directory '$path': Invalid argument")
+ if $p[3] !~ /\A[0-9]+\z/ || $p[3] == 0 || $p[3] > 0xfffffffe;
+ err($exists) if $subsys->{ns}->{ $p[3] };
+ $subsys->{ns}->{ $p[3] } = {
+ enable => '0',
+ device_path => '(null)',
+ device_uuid => $self->new_uuid,
+ buffered_io => '0',
+ };
+ } elsif ($p[0] eq 'ports' && @p == 2 && $p[1] =~ /\A[0-9]+\z/) {
+ err($exists) if $m->{ports}->{ $p[1] };
+ $m->{ports}->{ $p[1] } = {
+ attr => { map { ("addr_$_" => '') } qw(trtype adrfam traddr trsvcid) },
+ links => {},
+ };
+ } elsif ($p[0] eq 'hosts' && @p == 2) {
+ err($exists) if $m->{hosts}->{ $p[1] };
+ $m->{hosts}->{ $p[1] } = host_entry();
+ } else {
+ $self->violation("mkdir '$path'");
+ }
+ }
+ return ();
+ }
+
+ sub cmd_chmod($self, $mode, @paths) {
+ $self->available;
+ $self->violation("chmod '$mode'") if $mode ne '0600';
+ for my $path (@paths) {
+ my @p = $self->parts($path);
+ $self->violation("chmod '$path'")
+ if @p != 3 || $p[0] ne 'hosts' || $p[2] !~ /\Adhchap_(?:ctrl_)?key\z/;
+ my $host = $self->{m}->{hosts}->{ $p[1] }
+ // err("chmod: cannot access '$path': No such file or directory");
+ $host->{mode}->{ $p[2] } = $mode;
+ }
+ return ();
+ }
+
+ sub cmd_rmdir($self, @paths) {
+ $self->available;
+ my $m = $self->{m};
+ my @errors;
+ for my $path (@paths) {
+ my @p = $self->parts($path) or $self->violation("rmdir '$path'");
+ my $fail = sub($why) { push @errors, "rmdir: failed to remove '$path': $why" };
+ if ($p[0] eq 'subsystems' && @p == 4 && $p[2] eq 'namespaces') {
+ my $subsys = $m->{subsystems}->{ $p[1] };
+ $fail->('No such file or directory')
+ if !$subsys || !delete($subsys->{ns}->{ $p[3] });
+ } elsif ($p[0] eq 'subsystems' && @p == 2) {
+ my $subsys = $m->{subsystems}->{ $p[1] };
+ if (!$subsys) {
+ $fail->('No such file or directory');
+ } elsif ($subsys->{ns}->%* || $subsys->{acl}->%*) {
+ $fail->('Directory not empty');
+ } elsif (grep { $_->{links}->{ $p[1] } } values $m->{ports}->%*) {
+ $fail->('Device or resource busy');
+ } else {
+ delete $m->{subsystems}->{ $p[1] };
+ }
+ } elsif ($p[0] eq 'hosts' && @p == 2) {
+ if (!$m->{hosts}->{ $p[1] }) {
+ $fail->('No such file or directory');
+ } elsif (grep { $_->{acl}->{ $p[1] } } values $m->{subsystems}->%*) {
+ $fail->('Device or resource busy');
+ } else {
+ delete $m->{hosts}->{ $p[1] };
+ }
+ } else {
+ $self->violation("rmdir '$path'");
+ }
+ }
+ err($errors[0]) if @errors;
+ return ();
+ }
+
+ sub cmd_rm($self, @paths) {
+ $self->available;
+ my $m = $self->{m};
+ my @errors;
+ for my $path (@paths) {
+ my @p = $self->parts($path);
+ my $missing = "rm: cannot remove '$path': No such file or directory";
+ if (@p == 4 && $p[0] eq 'ports' && $p[2] eq 'subsystems') {
+ my $port = $m->{ports}->{ $p[1] };
+ push @errors, $missing if !$port || !delete($port->{links}->{ $p[3] });
+ } elsif (@p == 4 && $p[0] eq 'subsystems' && $p[2] eq 'allowed_hosts') {
+ my $subsys = $m->{subsystems}->{ $p[1] };
+ push @errors, $missing if !$subsys || !delete($subsys->{acl}->{ $p[3] });
+ } else {
+ $self->violation("rm '$path'");
+ }
+ }
+ err($errors[0]) if @errors;
+ return ();
+ }
+
+ sub cmd_ln($self, $flag, $target, $link) {
+ $self->available;
+ my $m = $self->{m};
+ my @t = $self->parts($target);
+ my @l = $self->parts($link);
+ my $fail = sub($why) { err("ln: failed to create symbolic link '$link': $why") };
+ if (@l == 4 && $l[0] eq 'ports' && $l[2] eq 'subsystems') {
+ $self->violation("ln '$target' '$link'")
+ if @t != 2 || $t[0] ne 'subsystems' || $t[1] ne $l[3];
+ my $port = $m->{ports}->{ $l[1] } // $fail->('No such file or directory');
+ $fail->('No such file or directory') if !$m->{subsystems}->{ $t[1] };
+ $fail->('File exists') if $port->{links}->{ $l[3] };
+ my $a = $port->{attr};
+ $fail->('Invalid argument')
+ if $a->{addr_trtype} ne 'tcp'
+ || $a->{addr_adrfam} !~ /\Aipv[46]\z/
+ || $a->{addr_traddr} eq ''
+ || $a->{addr_trsvcid} eq '';
+ if (!$port->{links}->%*) { # the first link enables the port
+ $fail->('Cannot assign requested address') if $self->{unbindable}->{ $l[1] };
+ my @fields = qw(addr_trtype addr_adrfam addr_traddr addr_trsvcid);
+ my $address = join(' ', $a->@{@fields});
+ for my $id (keys $m->{ports}->%*) {
+ my $other = $m->{ports}->{$id};
+ next if $id eq $l[1] || !$other->{links}->%*;
+ $fail->('Address already in use')
+ if join(' ', $other->{attr}->@{@fields}) eq $address;
+ }
+ }
+ $port->{links}->{ $l[3] } = 1;
+ } elsif (@l == 4 && $l[0] eq 'subsystems' && $l[2] eq 'allowed_hosts') {
+ $self->violation("ln '$target' '$link'")
+ if @t != 2 || $t[0] ne 'hosts' || $t[1] ne $l[3];
+ my $subsys = $m->{subsystems}->{ $l[1] } // $fail->('No such file or directory');
+ $fail->('No such file or directory') if !$m->{hosts}->{ $t[1] };
+ $fail->('Invalid argument') if $subsys->{attr}->{attr_allow_any_host} eq '1';
+ $fail->('File exists') if $subsys->{acl}->{ $l[3] };
+ $subsys->{acl}->{ $l[3] } = 1;
+ } else {
+ $self->violation("ln '$target' '$link'");
+ }
+ return ();
+ }
+
+ sub cmd_test($self, $flag, $path) {
+ if ($flag eq '-b') {
+ err('') if !$self->block_device($path, 1);
+ return ();
+ }
+ $self->available;
+ my $m = $self->{m};
+ my @p = $self->parts($path);
+ my $found;
+ if (@p == 4 && $p[0] eq 'subsystems' && $p[2] eq 'allowed_hosts') {
+ $found = ($m->{subsystems}->{ $p[1] } // {})->{acl}->{ $p[3] };
+ } elsif (@p == 4 && $p[0] eq 'ports' && $p[2] eq 'subsystems') {
+ $found = ($m->{ports}->{ $p[1] } // {})->{links}->{ $p[3] };
+ } else {
+ $self->violation("test $flag '$path'");
+ }
+ err('') if !$found;
+ return ();
+ }
+
+ sub cmd_grep($self, $flag, $value, $path) {
+ $self->available;
+ my @p = $self->parts($path);
+ $self->violation("grep '$path'")
+ if @p != 3 || $p[0] ne 'subsystems' || $p[2] ne 'attr_allow_any_host';
+ my $subsys = $self->{m}->{subsystems}->{ $p[1] }
+ // err("grep: $path: No such file or directory");
+ err('') if $subsys->{attr}->{attr_allow_any_host} ne $value;
+ return ();
+ }
+
+ sub cmd_cat($self, $path) {
+ $self->violation("cat '$path'") if $path ne '/proc/mounts';
+ return (
+ 'sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0',
+ 'proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0',
+ (
+ $self->{m}->{mounted}
+ ? ('configfs /sys/kernel/config configfs rw,relatime 0 0')
+ : ()
+ ),
+ );
+ }
+
+ sub cmd_mount($self, @args) {
+ err('mount: /sys/kernel/config: none already mounted on /sys/kernel/config.')
+ if $self->{m}->{mounted};
+ $self->{m}->{mounted} = 1;
+ return ();
+ }
+
+ sub cmd_modprobe($self, $module) {
+ $self->violation("modprobe '$module'") if $module ne 'nvmet_tcp';
+ $self->{m}->{loaded} = 1;
+ return ();
+ }
+
+ sub cmd_printf($self, @args) {
+ $self->violation('printf') if @args != 2 || $args[0] ne '%s\n' || $args[1] ne $MARKER;
+ return ($MARKER);
+ }
+
+ # The configfs read; 'golden commands' pins its argv.
+ sub cmd_env($self, @args) {
+ my @hosts = map { $args[$_ + 1] =~ m{\A$RR/hosts/([^/]+)/dhchap_key\z} ? ($1) : () }
+ grep { $args[$_] eq '-path' } 0 .. $#args;
+ $self->available;
+ return $self->configfs_lines(\@hosts);
+ }
+
+ sub configfs_lines($self, $hosts) {
+ my $m = $self->{m};
+ my (@dirs, @links, @attrs, @digests);
+ push @dirs, "D $ROOT", map { "D $ROOT/$_" } qw(hosts ports subsystems);
+ push @dirs, map { "D $ROOT/hosts/$_" } sort keys $m->{hosts}->%*;
+ for my $id (sort { $a <=> $b } keys $m->{ports}->%*) {
+ my $port = $m->{ports}->{$id};
+ push @dirs, "D $ROOT/ports/$id", "D $ROOT/ports/$id/subsystems";
+ push @links, map { "L $ROOT/ports/$id/subsystems/$_" } sort keys $port->{links}->%*;
+ push @attrs,
+ map { "$ROOT/ports/$id/$_:$port->{attr}->{$_}" } sort keys $port->{attr}->%*;
+ }
+ for my $nqn (sort keys $m->{subsystems}->%*) {
+ my $subsys = $m->{subsystems}->{$nqn};
+ my $S = "$ROOT/subsystems/$nqn";
+ push @dirs, "D $S", "D $S/allowed_hosts", "D $S/namespaces";
+ push @links, map { "L $S/allowed_hosts/$_" } sort keys $subsys->{acl}->%*;
+ push @attrs, map { "$S/$_:$subsys->{attr}->{$_}" } sort keys $subsys->{attr}->%*;
+ for my $id (sort { $a <=> $b } keys $subsys->{ns}->%*) {
+ my $ns = $subsys->{ns}->{$id};
+ push @dirs, "D $S/namespaces/$id";
+ push @attrs,
+ map { "$S/namespaces/$id/$_:$ns->{$_}" }
+ qw(buffered_io enable device_uuid device_path);
+ }
+ }
+ for my $hostnqn ($hosts->@*) {
+ my $host = $m->{hosts}->{$hostnqn} // next;
+ push @digests,
+ sha256_hex(($host->{key} // '') . "\n") . " $ROOT/hosts/$hostnqn/dhchap_key";
+ }
+ return (@dirs, @links, @attrs, @digests);
+ }
+
+ # --- zfs --------------------------------------------------------------
+
+ sub cmd_zfs($self, $subcommand, @args) {
+ my $method = "zfs_$subcommand";
+ $self->violation("zfs $subcommand") if !$self->can($method);
+ return $self->$method(@args);
+ }
+
+ # Options with values are listed with 1, flags with 0.
+ sub options($self, $args, %spec) {
+ my %o;
+ my @rest = $args->@*;
+ while (@rest && $rest[0] =~ /\A-/) {
+ my $option = shift @rest;
+ if ($option eq '-Hp') {
+ $o{H} = $o{p} = 1;
+ next;
+ }
+ if ($option =~ /\A-d([0-9]+)\z/) {
+ $o{d} = [$1];
+ next;
+ }
+ my $name = substr($option, 1);
+ $self->violation("zfs option '$option'") if !exists($spec{$name});
+ if ($spec{$name}) {
+ push $o{$name}->@*, shift(@rest);
+ } else {
+ $o{$name} = 1;
+ }
+ }
+ return (\%o, @rest);
+ }
+
+ sub properties_of($self, $assignments) {
+ my %props;
+ for my $assignment (($assignments // [])->@*) {
+ $self->violation("zfs property '$assignment'") if $assignment !~ /\A([^=]+)=(.*)\z/;
+ $props{$1} = $2;
+ }
+ return \%props;
+ }
+
+ sub datasets_under($self, $target, $depth) {
+ my $m = $self->{m};
+ return () if !$m->{ds}->{$target};
+ return sort grep {
+ my $name = $_;
+ $name eq $target
+ || (index($name, "$target/") == 0
+ && (() = substr($name, length($target)) =~ m{/}g) <= $depth)
+ } keys $m->{ds}->%*;
+ }
+
+ sub property($self, $name, $prop) {
+ my $m = $self->{m};
+ my $ds = $m->{ds}->{$name};
+ return ($ds->{type}, '-') if $prop eq 'type';
+ if ($prop =~ /:/) {
+ return ($ds->{props}->{$prop}, 'local') if defined($ds->{props}->{$prop});
+ my $parent = $name;
+ while ($parent =~ s{/[^/]+\z}{}) {
+ my $value = ($m->{ds}->{$parent} // last)->{props}->{$prop};
+ return ($value, "inherited from $parent") if defined($value);
+ }
+ return ('-', '-');
+ }
+ return ($m->{available}, '-') if $prop eq 'available';
+ return ($m->{used}, '-') if $prop eq 'used';
+ return ($ds->{volsize} // '-', '-') if $prop eq 'volsize';
+ return ('4096', '-') if $prop eq 'usedbydataset';
+ $self->violation("zfs property '$prop'");
+ }
+
+ sub zfs_get($self, @args) {
+ my ($o, $props, @targets) = $self->options(\@args, H => 0, p => 0, d => 1, t => 1, o => 1);
+ $self->violation('zfs get') if @targets != 1 || !$o->{H};
+ $self->violation('zfs get inventory')
+ if $props =~ /\Atype,proxmox:/
+ && !main::same(['get', @args], main::expected_inventory_read($targets[0]));
+ my $target = $targets[0];
+ my @fields = split /,/, ($o->{o} // ['name,property,value,source'])->[0];
+ my %types = map { $_ => 1 } split /,/, ($o->{t} // ['filesystem,volume'])->[0];
+ my @datasets = $self->datasets_under($target, $o->{d} ? $o->{d}->[0] : 0)
+ or err("cannot open '$target': dataset does not exist");
+ my @out;
+
+ for my $name (grep { $types{ $self->{m}->{ds}->{$_}->{type} } } @datasets) {
+ for my $prop (split /,/, $props) {
+ my ($value, $source) = $self->property($name, $prop);
+ my %row = (name => $name, property => $prop, value => $value, source => $source);
+ push @out, join("\t", map { $row{$_} } @fields);
+ }
+ }
+ return @out;
+ }
+
+ sub list_field($self, $row, $field) {
+ my $m = $self->{m};
+ return $row if $field eq 'name';
+ if (my $snap = $m->{snaps}->{$row}) {
+ return 1000 + $snap->{seq} if $field eq 'guid';
+ return 1700000000 + $snap->{seq} if $field eq 'creation';
+ $self->violation("zfs list snapshot field '$field'");
+ }
+ my $ds = $m->{ds}->{$row};
+ return $ds->{type} eq 'volume' ? $ds->{volsize} : '-' if $field eq 'volsize';
+ return $ds->{origin} // '-' if $field eq 'origin';
+ return $ds->{type} if $field eq 'type';
+ $self->violation("zfs list field '$field'");
+ }
+
+ sub zfs_list($self, @args) {
+ my ($o, @targets) =
+ $self->options(\@args, H => 0, p => 0, r => 0, d => 1, t => 1, o => 1, s => 1);
+ $self->violation('zfs list') if @targets != 1 || !$o->{H};
+ my $m = $self->{m};
+ my $target = $targets[0];
+ my @fields = split /,/, ($o->{o} // ['name'])->[0];
+ my %types = map { $_ => 1 } split /,/, ($o->{t} // ['filesystem,volume'])->[0];
+ my @rows;
+ if ($target =~ /\@/) {
+ err("cannot open '$target': dataset does not exist") if !$m->{snaps}->{$target};
+ @rows = ($target);
+ } else {
+ my $depth = $o->{d} ? $o->{d}->[0] : $o->{r} ? 1000 : 0;
+ my @datasets = $self->datasets_under($target, $depth)
+ or err("cannot open '$target': dataset does not exist");
+ if ($types{snapshot}) {
+ my %under = map { $_ => 1 } @datasets;
+ push @rows, sort { $m->{snaps}->{$a}->{seq} <=> $m->{snaps}->{$b}->{seq} }
+ grep { $under{ (split /\@/)[0] } } keys $m->{snaps}->%*;
+ }
+ push @rows, grep { $types{ $m->{ds}->{$_}->{type} } } @datasets;
+ }
+ return map {
+ my $row = $_;
+ join("\t", map { $self->list_field($row, $_) } @fields)
+ } @rows;
+ }
+
+ sub zfs_create($self, @args) {
+ my ($o, @targets) = $self->options(\@args, s => 0, b => 1, o => 1, V => 1);
+ $self->violation('zfs create') if @targets != 1 || !$o->{V};
+ my $m = $self->{m};
+ my $name = $targets[0];
+ my ($parent) = $name =~ m{\A(.+)/[^/]+\z} or $self->violation('zfs create name');
+ $self->violation('zfs create size') if $o->{V}->[0] !~ /\A([0-9]+)k\z/;
+ my $size = $1 * 1024;
+ err("cannot create '$name': parent does not exist") if !$m->{ds}->{$parent};
+ err("cannot create '$name': dataset already exists") if $m->{ds}->{$name};
+ $m->{ds}->{$name} = {
+ type => 'volume',
+ props => $self->properties_of($o->{o}),
+ volsize => $size,
+ origin => '-',
+ devwait => $self->{udev_delay},
+ sparse => $o->{s} ? 1 : 0,
+ blocksize => $o->{b} ? $o->{b}->[0] : undef,
+ };
+ return ();
+ }
+
+ sub zfs_clone($self, @args) {
+ my ($o, $origin, $name, @extra) = $self->options(\@args, o => 1);
+ $self->violation('zfs clone') if @extra || !defined($name);
+ my $m = $self->{m};
+ my $snap = $m->{snaps}->{$origin} // err("cannot open '$origin': dataset does not exist");
+ err("cannot create '$name': dataset already exists") if $m->{ds}->{$name};
+ $m->{ds}->{$name} = {
+ type => 'volume',
+ props => $self->properties_of($o->{o}),
+ volsize => $snap->{volsize},
+ origin => $origin,
+ devwait => $self->{udev_delay},
+ };
+ return ();
+ }
+
+ sub zfs_destroy($self, @args) {
+ my ($o, $target, @extra) = $self->options(\@args, r => 0);
+ $self->violation('zfs destroy') if @extra || !defined($target);
+ my $m = $self->{m};
+ my $clones = sub($snapshot) {
+ return grep { ($_->{origin} // '-') eq $snapshot } values $m->{ds}->%*;
+ };
+ if ($target =~ /\@/) {
+ $self->violation('zfs destroy -r of a snapshot') if $o->{r};
+ err("could not find any snapshots to destroy; check snapshot names.")
+ if !$m->{snaps}->{$target};
+ err("cannot destroy snapshot $target: snapshot has dependent clones")
+ if $clones->($target);
+ delete $m->{snaps}->{$target};
+ return ();
+ }
+ $self->violation('zfs destroy without -r') if !$o->{r};
+ err("cannot open '$target': dataset does not exist") if !$m->{ds}->{$target};
+ err("cannot destroy '$target': dataset is busy") if $self->busy($target);
+ my @snaps = grep { index($_, "$target\@") == 0 } keys $m->{snaps}->%*;
+ err("cannot destroy '$target': filesystem has dependent clones")
+ if grep { $clones->($_) } @snaps;
+ delete $m->{snaps}->{$_} for @snaps;
+ delete $m->{ds}->{$target};
+ return ();
+ }
+
+ # Stricter than ZFS: user properties revert to their value at snapshot
+ # time, so the plugin must set the identity again after a rollback.
+ sub zfs_rollback($self, @args) {
+ $self->violation('zfs rollback') if @args != 1 || $args[0] !~ /\@/;
+ my $m = $self->{m};
+ my ($name) = split /\@/, $args[0];
+ my $snap = $m->{snaps}->{ $args[0] }
+ // err("cannot open '$args[0]': dataset does not exist");
+ err("cannot rollback to '$args[0]': more recent snapshots or bookmarks exist")
+ if grep { index($_, "$name\@") == 0 && $m->{snaps}->{$_}->{seq} > $snap->{seq} }
+ keys $m->{snaps}->%*;
+ err("cannot rollback '$name': dataset is busy") if $self->busy($name);
+ my $ds = $m->{ds}->{$name};
+ $ds->{props} = dclone($snap->{props});
+ $ds->{volsize} = $snap->{volsize};
+ $ds->{devwait} = $self->{udev_delay};
+ return ();
+ }
+
+ sub zfs_set($self, @args) {
+ my $target = pop @args;
+ $self->violation('zfs set') if !@args;
+ my $m = $self->{m};
+ my $object = $target =~ /\@/ ? $m->{snaps}->{$target} : $m->{ds}->{$target};
+ err("cannot open '$target': dataset does not exist") if !$object;
+ for my $assignment (@args) {
+ $self->violation("zfs set '$assignment'") if $assignment !~ /\A([^=]+)=(.*)\z/;
+ my ($prop, $value) = ($1, $2);
+ if ($prop eq 'volsize') {
+ $self->violation('zfs set volsize') if $value !~ /\A([0-9]+)k\z/;
+ $object->{volsize} = $1 * 1024;
+ } elsif ($prop =~ /:/) {
+ $object->{props}->{$prop} = $value;
+ } else {
+ $self->violation("zfs set '$prop'");
+ }
+ }
+ return ();
+ }
+
+ # Like OpenZFS, which renames the minor of a zvol that is open: an
+ # exported zvol is renamed under its namespace.
+ sub zfs_rename($self, @args) {
+ $self->violation('zfs rename') if @args != 2;
+ my ($old, $new) = @args;
+ my $m = $self->{m};
+ err("cannot open '$old': dataset does not exist") if !$m->{ds}->{$old};
+ err("cannot rename to '$new': dataset already exists") if $m->{ds}->{$new};
+ $m->{ds}->{$new} = delete $m->{ds}->{$old};
+ for my $snap (grep { index($_, "$old\@") == 0 } keys $m->{snaps}->%*) {
+ my $renamed = $new . substr($snap, length($old));
+ $m->{snaps}->{$renamed} = delete $m->{snaps}->{$snap};
+ for my $ds (values $m->{ds}->%*) {
+ $ds->{origin} = $renamed if ($ds->{origin} // '-') eq $snap;
+ }
+ }
+ $m->{ds}->{$new}->{devwait} = $self->{udev_delay};
+ return ();
+ }
+
+ sub zfs_snapshot($self, @args) {
+ $self->violation('zfs snapshot') if @args != 1 || $args[0] !~ /\A([^@]+)\@(.+)\z/;
+ my ($name, $snap) = ($1, $2);
+ err("cannot create snapshot '$args[0]': invalid character in name")
+ if $snap !~ /\A[A-Za-z0-9_.: -]+\z/;
+ my $m = $self->{m};
+ my $ds = $m->{ds}->{$name} // err("cannot open '$name': dataset does not exist");
+ err("cannot create snapshot '$args[0]': dataset already exists")
+ if $m->{snaps}->{ $args[0] };
+ $m->{snaps}->{ $args[0] } =
+ { props => dclone($ds->{props}), volsize => $ds->{volsize}, seq => ++$m->{seq} };
+ return ();
+ }
+}
+
+# The inventory read written down independently of the plugin code.
+my $INVENTORY_PROPS =
+ 'type,proxmox:nvme-subsys,proxmox:nvme-nsid,proxmox:nvme-uuid,proxmox:nvme-last-nsid';
+
+sub expected_inventory_read($pool) {
+ return [
+ 'get',
+ '-H',
+ '-p',
+ '-d',
+ '1',
+ '-t',
+ 'filesystem,volume',
+ '-o',
+ 'name,property,value,source',
+ $INVENTORY_PROPS,
+ $pool,
+ ];
+}
+
+# ---------------------------------------------------------------------------
+# Flow helpers and invariants
+# ---------------------------------------------------------------------------
+
+# Runs $code against $fake and returns what happened during the run.
+sub flow($fake, $code) {
+ local $FAKE = $fake;
+ local @LOCKS = ();
+ local @NESTED_LOCKS = ();
+ local @WARNINGS = ();
+ local @SYSFS_WRITES = ();
+
+ my $start = scalar($fake->{calls}->@*);
+ my $result = eval { $code->() };
+ my $error = $@;
+ my @calls = $fake->{calls}->@*;
+ return {
+ error => $error,
+ result => $result,
+ calls => [@calls[$start .. $#calls]],
+ locks => [@LOCKS],
+ nested => [@NESTED_LOCKS],
+ warnings => [@WARNINGS],
+ sysfs_writes => [@SYSFS_WRITES],
+ };
+}
+
+sub ops($res) {
+ return [map { $_->{op} } $res->{calls}->@*];
+}
+
+sub changes($res) {
+ return scalar(grep { $_->{changing} } $res->{calls}->@*);
+}
+
+# Our subsystem published on two ports to two hosts, no volumes yet.
+sub target_fake(%opts) {
+ my $fake = FakeTarget->new(pools => ['tank', 'other'], %opts);
+ $fake->add_host($_, $KEY) for @HOSTS;
+ $fake->add_subsystem($NQN, acl => [@HOSTS]);
+ $fake->add_port(1, '192.0.2.21', 4420, links => [$NQN]);
+ $fake->add_port(2, '192.0.2.22', 4420, links => [$NQN]);
+ return $fake;
+}
+
+sub add_volume($fake, $name, $nsid, $uuid, %o) {
+ $fake->add_zvol("tank/$name", identity => [$NQN, $nsid, $uuid]);
+ $fake->add_namespace($NQN, $nsid, $uuid, "/dev/zvol/tank/$name", $o{enable} // 1)
+ if !$o{unexported};
+ return $fake;
+}
+
+# A converged target with three owned volumes, an unowned leftover, a volume
+# of another subsystem in our pool, and a foreign subsystem that shares the
+# first host and port 1.
+sub lifecycle_fake(%opts) {
+ my $fake = target_fake(%opts);
+ add_volume($fake, 'vm-100-disk-0', 1, $U{1});
+ add_volume($fake, 'vm-101-disk-0', 2, $U{2});
+ add_volume($fake, 'base-102-disk-0', 3, $U{3});
+ $fake->add_snapshot('tank/vm-100-disk-0@snap1');
+ $fake->add_snapshot('tank/base-102-disk-0@__base__');
+ $fake->add_zvol('tank/vm-900-disk-0');
+ $fake->add_zvol('tank/vm-901-disk-0', identity => [$FOREIGN_NQN, 7, $U{7}]);
+ $fake->add_zvol('other/foreign-disk', identity => [$FOREIGN_NQN, 1, $U{8}]);
+ $fake->add_subsystem(
+ $FOREIGN_NQN,
+ model => 'Linux',
+ serial => '0123456789abcdef',
+ acl => [$HOSTS[0]],
+ );
+ $fake->add_namespace($FOREIGN_NQN, 1, $U{8}, '/dev/zvol/other/foreign-disk');
+ $fake->{m}->{ports}->{1}->{links}->{$FOREIGN_NQN} = 1;
+ return $fake;
+}
+
+sub owned_volumes($m, $nqn = $NQN, $pool = 'tank') {
+ my %owned;
+ for my $name (sort keys $m->{ds}->%*) {
+ my $ds = $m->{ds}->{$name};
+ next if $ds->{type} ne 'volume' || $name !~ m{\A\Q$pool\E/[^/]+\z};
+ next if ($ds->{props}->{'proxmox:nvme-subsys'} // '') ne $nqn;
+ $owned{$name} = [map { $ds->{props}->{"proxmox:nvme-$_"} } qw(nsid uuid)];
+ }
+ return \%owned;
+}
+
+# Everything on the target that does not belong to the storage under test.
+# The last NSID handed out, on its pool, belongs to the storage.
+sub foreign_view($m, $port_ids, $nqn, $hostnqns, $pool = 'tank') {
+ my %ours = map { $_ => 1 } $hostnqns->@*;
+ my $dataset = sub($name) {
+ my $ds = $m->{ds}->{$name};
+ return $ds if $name ne $pool;
+ my %props = $ds->{props}->%*;
+ delete $props{'proxmox:nvme-last-nsid'};
+ return { $ds->%*, props => \%props };
+ };
+ return {
+ subsystems =>
+ { map { $_ => $m->{subsystems}->{$_} } grep { $_ ne $nqn } keys $m->{subsystems}->%* },
+ datasets => {
+ map { $_ => $dataset->($_) }
+ grep { ($m->{ds}->{$_}->{props}->{'proxmox:nvme-subsys'} // '') ne $nqn }
+ keys $m->{ds}->%*
+ },
+ hosts => { map { $_ => $m->{hosts}->{$_} } grep { !$ours{$_} } keys $m->{hosts}->%* },
+ ports => {
+ map {
+ my $port = $m->{ports}->{$_};
+ my @links = $port ? sort grep { $_ ne $nqn } keys $port->{links}->%* : ();
+ ($_ => $port ? [$port->{attr}, \@links] : undef)
+ } $port_ids->@*
+ },
+ };
+}
+
+# (i), (ii), (vi) and (vii), checked after every call.
+sub online_violations($fake, $ctx) {
+ my $m = $fake->{m};
+ my $nqn = $ctx->{nqn};
+ my @bad;
+ if (my $subsys = $m->{subsystems}->{$nqn}) {
+ my $owned = owned_volumes($m, $nqn, $ctx->{pool});
+ my %identity = map { ("/dev/zvol/$_" => $owned->{$_}) } keys $owned->%*;
+ my %seen;
+ for my $id (sort keys $subsys->{ns}->%*) {
+ my $ns = $subsys->{ns}->{$id};
+ push @bad, "(ii) UUID $ns->{device_uuid} used by two namespaces"
+ if $seen{ lc($ns->{device_uuid}) }++;
+ next if $ns->{enable} ne '1';
+ my $want = $identity{ $ns->{device_path} };
+ push @bad, "(i) namespace $id exports $ns->{device_path} under another identity"
+ if !$want || $want->[0] ne $id || lc($want->[1]) ne lc($ns->{device_uuid});
+ }
+ if (grep { $_->{links}->{$nqn} } values $m->{ports}->%*) {
+ push @bad, '(vi) published while any host may connect'
+ if $subsys->{attr}->{attr_allow_any_host} ne '0';
+ for my $hostnqn ($ctx->{teardown} ? () : $ctx->{hosts}->@*) {
+ push @bad, "(vi) published without the ACL of $hostnqn"
+ if !$subsys->{acl}->{$hostnqn};
+ push @bad, "(vi) published without the key of $hostnqn"
+ if (($m->{hosts}->{$hostnqn} // {})->{key} // '') ne $ctx->{key};
+ }
+ }
+ }
+ push @bad,
+ '(vii) objects of other storages changed'
+ if !same(
+ foreign_view($m, $ctx->{port_ids}, $nqn, $ctx->{hosts}, $ctx->{pool}),
+ $ctx->{foreign},
+ );
+ return @bad;
+}
+
+# (iii): owned identities stay valid, unique and attached to their volume.
+sub identity_violations($m, $ctx) {
+ my @bad;
+ my $owned = owned_volumes($m, $ctx->{nqn}, $ctx->{pool});
+ my (%nsids, %uuids);
+ for my $name (sort keys $owned->%*) {
+ my ($nsid, $uuid) = $owned->{$name}->@*;
+ push @bad, "(iii) invalid identity on $name"
+ if ($nsid // '') !~ /\A[1-9][0-9]*\z/ || ($uuid // '') !~ $UUID_RE;
+ push @bad, "(iii) NSID $nsid on two volumes" if $nsids{ $nsid // '' }++;
+ push @bad, "(iii) UUID $uuid on two volumes" if $uuids{ lc($uuid // '') }++;
+ }
+ for my $name (sort keys $ctx->{initial_owned}->%*) {
+ my $identity = join('/', $ctx->{initial_owned}->{$name}->@*);
+ my @holders = grep { join('/', $owned->{$_}->@*) eq $identity } keys $owned->%*;
+ next if !@holders && ($ctx->{may_vanish} // '') eq $name;
+ my %allowed = map { $_ => 1 } $name, ($ctx->{renames}->{$name} // ());
+ push @bad, "(iii) identity of $name lost" if @holders != 1 || !$allowed{ $holders[0] };
+ }
+ return @bad;
+}
+
+# A creation cut right after its mkdir leaves an unused subsystem with the
+# kernel's default model, which another tool could have created as well.
+# Activation refuses it until an administrator removes it.
+sub default_subsystem($m, $nqn) {
+ my $subsys = $m->{subsystems}->{$nqn} // return 0;
+ return
+ $subsys->{attr}->{attr_model} eq 'Linux'
+ && !$subsys->{ns}->%*
+ && !$subsys->{acl}->%*
+ && !grep { $_->{links}->{$nqn} } values $m->{ports}->%*;
+}
+
+# (v): one more activation exports every owned volume exactly once.
+sub convergence_violations($fake, $ctx) {
+ my $res = flow($fake, sub { activate($ctx->{scfg}, $ctx->{key}, $ctx->{hosts}) });
+ if (my $error = $res->{error}) {
+ return ()
+ if $error =~ /not created by Proxmox VE/ && default_subsystem($fake->{m}, $ctx->{nqn});
+ return "(v) activation afterwards failed: $error";
+ }
+ my $m = $fake->{m};
+ my $owned = owned_volumes($m, $ctx->{nqn}, $ctx->{pool});
+ my $subsys = $m->{subsystems}->{ $ctx->{nqn} } // return '(v) subsystem missing';
+ my %want = map { $owned->{$_}->[0] => ["/dev/zvol/$_", lc($owned->{$_}->[1]), '1'] }
+ keys $owned->%*;
+ my %have = map {
+ my $ns = $subsys->{ns}->{$_};
+ ($_ => [$ns->{device_path}, lc($ns->{device_uuid}), $ns->{enable}])
+ } keys $subsys->{ns}->%*;
+ my @bad;
+ push @bad, '(v) exported namespaces differ from the owned volumes' if !same(\%want, \%have);
+ # An interrupted port creation leaves an incomplete port that is ignored;
+ # the portal is then served by a new port with the same address.
+ for my $portal ($PORTALS->@*) {
+ my ($address, $service) = $portal->@{qw(address port)};
+ push @bad, "(v) not published on $address"
+ if !grep {
+ $_->{links}->{ $ctx->{nqn} }
+ && $_->{attr}->{addr_traddr} eq $address
+ && $_->{attr}->{addr_trsvcid} eq "$service"
+ } values $m->{ports}->%*;
+ }
+ return @bad;
+}
+
+sub run_case($initial, $ctx, $faults, $read_fault = undef) {
+ my $fake = FakeTarget->from_state($initial);
+ $fake->{faults} = $faults;
+ $fake->{read_fault} = $read_fault;
+ my @online;
+ $fake->{after_call} = sub($f, $call) {
+ push @online,
+ map { "call $call->{index} ($call->{op}): $_" } online_violations($f, $ctx);
+ };
+ my $res = flow($fake, $ctx->{action});
+ $res->{fake} = $fake;
+ $res->{online} = \@online;
+ $res->{faults} = { $faults->%*, ($read_fault ? (read => $read_fault->{mode}) : ()) };
+ return $res;
+}
+
+sub case_violations($ctx, $res) {
+ my $fake = $res->{fake};
+ my @bad;
+ push @bad, 'domain lock taken ' . scalar($res->{locks}->@*) . ' times'
+ if $res->{locks}->@* > 1;
+ push @bad, 'nested domain lock request' if $res->{nested}->@*;
+ push @bad, 'key in the error text' if grep { index($res->{error}, $_) >= 0 } $KEY, $KEY_B;
+
+ # The result must match the outcome: success only when the goal is
+ # reached, and a flow whose only faults are lost replies (create and
+ # clone, which cannot settle one with a read) may fail after reaching its
+ # goal only with an unknown target state.
+ my @missing = $ctx->{done}->($fake->{m}, $res);
+ push @bad, map { "success without reaching the goal: $_" } @missing if $res->{error} eq '';
+ my @modes = values $res->{faults}->%*;
+ push @bad, "failure after reaching the goal: $res->{error}"
+ if $ctx->{lost_replies}
+ && $res->{error} ne ''
+ && $res->{error} !~ /the target state is unknown\n\z/
+ && !@missing
+ && @modes
+ && !grep { $_ ne 'after' } @modes;
+
+ # A call that ssh gave up on completes on the target afterwards. When the
+ # rest of it changes the target, the outcome was unknown.
+ if ($fake->{late}->@*) {
+ if (
+ grep {
+ grep { mutating_step($_) } $_->{steps}->@*
+ } $fake->{late}->@*
+ ) {
+ push @bad, "late call after a success" if $res->{error} eq '';
+ push @bad, "late call reported without an unknown state: $res->{error}"
+ if $res->{error} !~ /the target state is unknown\n\z/;
+ }
+ $fake->land;
+ push @bad, map { "after the late call: $_" } online_violations($fake, $ctx);
+ }
+ push @bad, identity_violations($fake->{m}, $ctx);
+ $fake->{faults} = {};
+ $fake->{read_fault} = undef;
+ if ($ctx->{retry}) {
+ my $retry = flow($fake, $ctx->{retry});
+ push @bad, "retry failed: $retry->{error}" if $retry->{error};
+ push @bad, $ctx->{goal}->($fake->{m}) if !$retry->{error};
+ } else {
+ push @bad, convergence_violations($fake, $ctx);
+ }
+ push @bad, $res->{online}->@*;
+ push @bad, map { "protocol: $_" } $fake->{violations}->@*;
+ return @bad;
+}
+
+# Fault sweep: every mutating call of a flow fails, and then every later
+# mutating call of that run fails as well, or the first read after it. After
+# each run: (i) every enabled namespace of the subsystem exports the zvol of
+# its identity, (ii) no UUID is used twice, (iii) owned identities are kept
+# and unique, (v) one more activation (or a retried removal) converges, (vi)
+# the subsystem is never published before its ACLs, keys and
+# allow_any_host=0, (vii) nothing of other storages changes, every change ran
+# under one domain lock, and the result matches the outcome. (i), (ii), (vi)
+# and (vii) are checked after every call; refusals are covered by their own
+# tests.
+sub sweep($name, $ctx) {
+ my $initial = dclone($ctx->{setup}->()->{m});
+ $ctx->{nqn} //= $NQN;
+ $ctx->{pool} //= 'tank';
+ $ctx->{hosts} //= [@HOSTS];
+ $ctx->{key} //= $KEY;
+ $ctx->{scfg} //= scfg();
+ $ctx->{initial_owned} = owned_volumes($initial, $ctx->{nqn}, $ctx->{pool});
+ $ctx->{port_ids} = [sort keys $initial->{ports}->%*];
+ $ctx->{foreign} =
+ foreign_view($initial, $ctx->{port_ids}, $ctx->{nqn}, $ctx->{hosts}, $ctx->{pool});
+
+ my $baseline = run_case($initial, $ctx, {});
+ is($baseline->{error}, '', "$name: succeeds without faults");
+ is_deeply([$ctx->{done}->($baseline->{fake}->{m}, $baseline)], [], "$name: reaches its goal");
+ is_deeply([case_violations($ctx, $baseline)], [], "$name: invariants hold without faults");
+
+ # A call fails in each mode of FakeTarget::execute, at each step of its
+ # chain. A second failure, in the compensation or the next round, is one
+ # that fails before or after its call, or the first read after the first
+ # failure fails or finds the target unreachable.
+ my $modes = sub($call) {
+ my @steps = 1 .. $call->{steps}->$#*;
+ return ('before', 'after', 'late', (map { "cut:$_" } @steps), map { "lost:$_" } @steps);
+ };
+ my @first = grep { $_->{mutating} } $baseline->{calls}->@*;
+ ok(scalar(@first), "$name: changes the target");
+ my ($runs, @failures) = (0);
+ for my $first (@first) {
+ my $k = $first->{index};
+ for my $mode ($modes->($first)) {
+ my $res = run_case($initial, $ctx, { $k => $mode });
+ $runs++;
+ my @later = grep { $_->{mutating} && $_->{index} > $k } $res->{calls}->@*;
+ push @failures, map { "call $k $mode: $_" } case_violations($ctx, $res);
+ for my $second (@later) {
+ my $j = $second->{index};
+ for my $again_mode (qw(before after)) {
+ my $again = run_case($initial, $ctx, { $k => $mode, $j => $again_mode });
+ $runs++;
+ push @failures,
+ map { "call $k $mode, call $j $again_mode: $_" }
+ case_violations($ctx, $again);
+ }
+ }
+ for my $read_mode (qw(before unreachable)) {
+ my $read_fault = { after => $k, mode => $read_mode };
+ my $again = run_case($initial, $ctx, { $k => $mode }, $read_fault);
+ $runs++;
+ push @failures,
+ map { "call $k $mode, next read $read_mode: $_" } case_violations($ctx, $again);
+ }
+ }
+ }
+ ok(!@failures, "$name: the invariants hold in $runs fault injections")
+ or diag(join("\n", @failures));
+}
+
+# ---------------------------------------------------------------------------
+# Fixtures and the fake target formats
+# ---------------------------------------------------------------------------
+
+my $FIXTURE_ZFS = slurp("$FIXTURES/zfs_inventory.txt");
+my $FIXTURE_CFS = slurp("$FIXTURES/configfs_snapshot.txt");
+my $FIXTURE_DIGESTS = join('', map { "$KEY_SHA $ROOT/hosts/$_/dhchap_key\n" } @FIXTURE_HOSTS);
+
+sub fixture_fake() {
+ my $fake = FakeTarget->new(pools => ['tank']);
+ $fake->add_host($_) for @FIXTURE_HOSTS;
+ $fake->add_subsystem($FIXTURE_NQN, acl => [@FIXTURE_HOSTS]);
+ $fake->add_port($_, "192.0.2.2$_", 4420, links => [$FIXTURE_NQN]) for 1, 2;
+ $fake->add_zvol('tank/vm-100-disk-0', identity => [$FIXTURE_NQN, 5, $FIXTURE_UUID5]);
+ $fake->add_zvol('tank/vm-100-cloudinit', identity => [$FIXTURE_NQN, 6, $FIXTURE_UUID6]);
+ $fake->add_namespace($FIXTURE_NQN, 5, $FIXTURE_UUID5, '/dev/zvol/tank/vm-100-disk-0');
+ $fake->add_namespace($FIXTURE_NQN, 6, $FIXTURE_UUID6, '/dev/zvol/tank/vm-100-cloudinit');
+ return $fake;
+}
+
+subtest 'the fake target answers in the formats of the fixture target' => sub {
+ my $fake = fixture_fake();
+ my @zfs = $fake->zfs_get(expected_inventory_read('tank')->@[1 .. 10]);
+ is(join('', map { "$_\n" } @zfs), $FIXTURE_ZFS, 'the ZFS inventory equals the fixture');
+ my $cfs = join('', map { "$_\n" } $fake->configfs_lines([]));
+ is_deeply(
+ nv('_nvmet_parse_configfs', $cfs),
+ nv('_nvmet_parse_configfs', $FIXTURE_CFS),
+ 'the configfs read parses to the fixture',
+ );
+};
+
+# ---------------------------------------------------------------------------
+# Parsers
+# ---------------------------------------------------------------------------
+
+sub zfs_rows($name, $type, $nqn = '-', $nsid = '-', $uuid = '-', $source = 'local', $last = '-') {
+ my $source_of = sub($value) { $value eq '-' ? '-' : $source };
+ return (
+ "$name\ttype\t$type\t-",
+ "$name\tproxmox:nvme-subsys\t$nqn\t" . $source_of->($nqn),
+ "$name\tproxmox:nvme-nsid\t$nsid\t" . $source_of->($nsid),
+ "$name\tproxmox:nvme-uuid\t$uuid\t" . $source_of->($uuid),
+ "$name\tproxmox:nvme-last-nsid\t$last\t" . $source_of->($last),
+ );
+}
+
+sub inventory(@rows) {
+ return nv('_nvmet_parse_zfs_inventory', join('', map { "$_\n" } @rows), 'tank');
+}
+
+my @POOL = zfs_rows('tank', 'filesystem');
+my @ONE = zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, $U{1});
+my @TWO = zfs_rows('tank/vm-101-disk-0', 'volume', $NQN, 2, $U{2});
+
+subtest 'ZFS inventory parser' => sub {
+ is_deeply(
+ inventory(@POOL, @ONE, @TWO),
+ {
+ types => {
+ tank => 'filesystem',
+ 'tank/vm-100-disk-0' => 'volume',
+ 'tank/vm-101-disk-0' => 'volume',
+ },
+ volumes => {
+ 'tank/vm-100-disk-0' => { nqn => $NQN, nsid => 1, uuid => $U{1} },
+ 'tank/vm-101-disk-0' => { nqn => $NQN, nsid => 2, uuid => $U{2} },
+ },
+ last_nsid => 0,
+ },
+ 'complete inventory',
+ );
+ my $pool_last = sub($last, $source = 'local') {
+ return inventory(
+ zfs_rows('tank', 'filesystem', '-', '-', '-', $source, $last),
+ zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, $U{1}, 'local', '-'),
+ )->{last_nsid};
+ };
+ is($pool_last->(7), 7, 'the last NSID handed out is read from the pool');
+ is($pool_last->(7, 'inherited from tank'), 0, 'but not inherited');
+ is($pool_last->('x'), 0, 'and only when it is a valid NSID');
+ is(
+ inventory(@POOL, zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, $U{1}, 'local', 9))
+ ->{last_nsid},
+ 0,
+ 'a volume does not carry it',
+ );
+ my $short_owner = "tank/vm-101-disk-0\tproxmox:nvme-subsys\t$NQN";
+ my $foreign_source = "tank/vm-101-disk-0\tproxmox:nvme-uuid\t$U{2}\tgarbage";
+ for my $case (
+ [
+ 'missing owner row',
+ [@POOL, @ONE, @TWO[0, 2, 3]],
+ qr/incomplete ZFS properties on 'tank\/vm-101-disk-0'/,
+ ],
+ [
+ 'short row',
+ [@POOL, @ONE, $TWO[0], $short_owner, @TWO[2, 3]],
+ qr/malformed ZFS inventory row/,
+ ],
+ [
+ 'duplicate property',
+ [@POOL, @ONE, @TWO, $TWO[1]],
+ qr/duplicate ZFS property 'proxmox:nvme-subsys'/,
+ ],
+ [
+ 'unknown property',
+ [@POOL, @ONE, @TWO, "tank/vm-101-disk-0\tcompression\ton\tlocal"],
+ qr/unexpected ZFS property on 'tank\/vm-101-disk-0'/,
+ ],
+ [
+ 'extra field',
+ [@POOL, @ONE, @TWO[0 .. 2], "$TWO[3]\textra"],
+ qr/malformed ZFS inventory row/,
+ ],
+ [
+ 'unknown source',
+ [@POOL, @ONE, @TWO[0 .. 2], $foreign_source],
+ qr/invalid ZFS property source/,
+ ],
+ ['missing pool rows', [@ONE, @TWO], qr/missing the configured pool/],
+ [
+ 'missing pool type row',
+ [@POOL[1 .. 4], @ONE],
+ qr/incomplete ZFS properties on 'tank'/,
+ ],
+ [
+ 'pool name prefix',
+ [@POOL, zfs_rows('tank2/vm-1-disk-0', 'volume')],
+ qr/outside configured pool/,
+ ],
+ [
+ 'depth 2 dataset',
+ [@POOL, zfs_rows('tank/sub/vm-1-disk-0', 'volume')],
+ qr/outside configured pool/,
+ ],
+ [
+ 'invalid type',
+ [@POOL, "tank/vm-100-disk-0\ttype\tsnapshot\t-", @ONE[1 .. 3]],
+ qr/invalid ZFS dataset type/,
+ ],
+ [
+ 'value with CR',
+ [@POOL, @ONE[0 .. 2], "tank/vm-100-disk-0\tproxmox:nvme-uuid\t$U{1}\r\tlocal"],
+ qr/malformed ZFS inventory row/,
+ ],
+ [
+ 'inherited from a malformed pool',
+ [
+ @POOL,
+ @ONE[0 .. 2],
+ "tank/vm-100-disk-0\tproxmox:nvme-uuid\t$U{1}\tinherited from bad pool",
+ ],
+ qr/invalid ZFS pool name/,
+ ],
+ ) {
+ my ($name, $rows, $error) = $case->@*;
+ eval { inventory($rows->@*) };
+ like($@, $error, "rejects $name");
+ }
+
+ is_deeply(
+ inventory(@POOL),
+ { types => { tank => 'filesystem' }, volumes => {}, last_nsid => 0 },
+ 'a verified empty pool',
+ );
+ my $received = inventory(
+ @POOL, zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, $U{1}, 'received'),
+ );
+ is($received->{volumes}->{'tank/vm-100-disk-0'}->{nqn}, $NQN, 'received properties count');
+ my $inherited = inventory(
+ zfs_rows('tank', 'filesystem', $NQN, '-', '-'),
+ zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, $U{1}, 'inherited from tank'),
+ );
+ is_deeply(
+ $inherited->{volumes}->{'tank/vm-100-disk-0'},
+ { nqn => '-', nsid => '-', uuid => '-' },
+ 'inherited properties never own a volume',
+ );
+ my $subvol = inventory(@POOL, zfs_rows('tank/subvol-100-disk-0', 'filesystem'));
+ ok(
+ $subvol->{types}->{'tank/subvol-100-disk-0'} eq 'filesystem'
+ && !$subvol->{volumes}->{'tank/subvol-100-disk-0'},
+ 'a filesystem child is a dataset but not a volume',
+ );
+
+ # a direct child with a name PVE never uses is carried as not owned
+ my $spaced = inventory(@POOL, zfs_rows('tank/my data', 'volume', $NQN, 9, $U{9}));
+ is($spaced->{types}->{'tank/my data'}, 'volume',
+ 'a name with a space is kept as a dataset');
+ is($spaced->{volumes}->{'tank/my data'}->{nqn}, '-', 'a name with a space is never owned');
+ is_deeply(nv('_nvmet_desired_namespaces', $spaced, $NQN), {}, 'and never exported');
+ eval { inventory(@POOL, "tank/my data\tcompression\ton\tlocal") };
+ is($@, "unexpected ZFS property\n", 'errors do not echo names PVE never uses');
+
+ my $fixture = nv('_nvmet_parse_zfs_inventory', $FIXTURE_ZFS, 'tank');
+ is_deeply(
+ $fixture->{volumes},
+ {
+ 'tank/vm-100-disk-0' => { nqn => $FIXTURE_NQN, nsid => 5, uuid => $FIXTURE_UUID5 },
+ 'tank/vm-100-cloudinit' =>
+ { nqn => $FIXTURE_NQN, nsid => 6, uuid => $FIXTURE_UUID6 },
+ },
+ 'the fixture inventory',
+ );
+ eval { nv('_nvmet_parse_zfs_inventory', $FIXTURE_ZFS, 'bad pool') };
+ like($@, qr/invalid ZFS pool name/, 'the configured pool is validated');
+};
+
+subtest 'ZFS property values and sources' => sub {
+ for my $case (
+ [undef, 'local'],
+ ['', 'local'],
+ ["a\nb", 'local'],
+ ["a\tb", 'local'],
+ ['x', ''],
+ ['x', undef],
+ ['x', "local\r"],
+ ) {
+ eval { nv('_nvmet_property_value', $case->@*) };
+ like($@, qr/malformed ZFS property value/, 'rejects a malformed value or source');
+ }
+ is(nv('_nvmet_property_value', $NQN, 'local'), $NQN, 'local values count');
+ is(nv('_nvmet_property_value', $NQN, 'received'), $NQN, 'received values count');
+ is(nv('_nvmet_property_value', '-', '-'), '-', 'unset values');
+ is(
+ nv('_nvmet_property_value', $NQN, 'inherited from tank/a'),
+ '-',
+ 'inherited values do not',
+ );
+ eval { nv('_nvmet_property_value', $NQN, 'default') };
+ like($@, qr/invalid ZFS property source/, 'rejects other sources');
+ eval { nv('_nvmet_property_value', $NQN, '-') };
+ like($@, qr/invalid ZFS property source/, 'rejects a value without a source');
+ eval { nv('_nvmet_property_value', $NQN, 'inherited from tank;x') };
+ like($@, qr/invalid ZFS pool name/, 'rejects an inherited source outside pool names');
+};
+
+subtest 'configfs parser' => sub {
+ my $with_digests = nv('_nvmet_parse_configfs', $FIXTURE_CFS . $FIXTURE_DIGESTS);
+ is($with_digests->{hosts}->{$_}->{key_sha256}, $KEY_SHA, 'key digest of a fixture host')
+ for @FIXTURE_HOSTS;
+ my $binary = nv(
+ '_nvmet_parse_configfs',
+ $FIXTURE_CFS . join('', map { "$KEY_SHA *$ROOT/hosts/$_/dhchap_key\n" } @FIXTURE_HOSTS),
+ );
+ is($binary->{hosts}->{ $FIXTURE_HOSTS[0] }->{key_sha256}, $KEY_SHA, 'binary-mode digests');
+
+ my $without = sub($re) { return $FIXTURE_CFS =~ s/^$re\n//mr };
+ for my $case (
+ [
+ 'missing root',
+ $without->(qr{D \Q$ROOT\E}),
+ qr/^NVMe target configfs is unavailable$/,
+ ],
+ [
+ 'a namespace without enable',
+ $without->(qr{.*namespaces/5/enable:1}),
+ qr/incomplete NVMe namespace '5' of subsystem '\Q$FIXTURE_NQN\E'/,
+ ],
+ [
+ 'a port without address',
+ $without->(qr{.*ports/2/addr_traddr.*}),
+ qr/incomplete NVMe port '2'/,
+ ],
+ [
+ 'a duplicate attribute',
+ "$FIXTURE_CFS$ROOT/subsystems/$FIXTURE_NQN/attr_serial:X\n",
+ qr/duplicate NVMe target configfs attribute/,
+ ],
+ [
+ 'an attribute without its directory',
+ "$FIXTURE_CFS$ROOT/subsystems/nqn.x:y/attr_model:Z\n",
+ qr/incomplete NVMe subsystem 'nqn.x:y'/,
+ ],
+ [
+ 'a link to a missing port',
+ "${FIXTURE_CFS}L $ROOT/ports/9/subsystems/$FIXTURE_NQN\n",
+ qr/incomplete NVMe port '9'/,
+ ],
+ [
+ 'a digest for a missing host',
+ "$FIXTURE_CFS$KEY_SHA $ROOT/hosts/nqn.x:gone/dhchap_key\n",
+ qr/key digest for unknown NVMe host 'nqn.x:gone'/,
+ ],
+ [
+ 'a malformed digest',
+ $FIXTURE_CFS . substr($KEY_SHA, 1) . " $ROOT/hosts/$FIXTURE_HOSTS[0]/dhchap_key\n",
+ qr/unexpected NVMe target configfs line/,
+ ],
+ [
+ 'a duplicate digest',
+ "$FIXTURE_CFS$FIXTURE_DIGESTS$FIXTURE_DIGESTS",
+ qr/duplicate DH-HMAC-CHAP key digest/,
+ ],
+ ) {
+ my ($name, $text, $error) = $case->@*;
+ eval { nv('_nvmet_parse_configfs', $text) };
+ like($@, $error, "rejects $name");
+ }
+ eval { nv('_nvmet_parse_configfs', "$FIXTURE_CFS$KEY and more\n") };
+ is($@, "unexpected NVMe target configfs line\n", 'a garbage line is rejected without echo');
+ eval { nv('_nvmet_parse_configfs', "${FIXTURE_CFS}D $ROOT/subsystems/bad name\n") };
+ is($@, "incomplete NVMe subsystem\n", 'malformed names are not echoed');
+
+ my $tolerated = nv(
+ '_nvmet_parse_configfs',
+ join(
+ '',
+ $FIXTURE_CFS,
+ "D $ROOT/ports/1/referrals/x\n",
+ "L $ROOT/subsystems/$FIXTURE_NQN/passthru/x\n",
+ "D $ROOT/subsystems/$FIXTURE_NQN/namespaces/5/ana\n",
+ "$ROOT/ports/1/param_inline_data_size:16384\n",
+ "$ROOT/subsystems/$FIXTURE_NQN/attr_version:1.3\n",
+ ),
+ );
+ is_deeply(
+ $tolerated,
+ nv('_nvmet_parse_configfs', $FIXTURE_CFS),
+ 'other objects are ignored',
+ );
+ my $unset = $FIXTURE_CFS =~ s{(namespaces/6/device_path:).*}{$1(null)}r;
+ $unset =~ s{(namespaces/5/device_path:).*}{$1};
+ my $null = nv('_nvmet_parse_configfs', $unset);
+ is(
+ $null->{subsystems}->{$FIXTURE_NQN}->{namespaces}->{6}->{device_path},
+ '(null)',
+ 'a (null) device',
+ );
+ is(
+ $null->{subsystems}->{$FIXTURE_NQN}->{namespaces}->{5}->{device_path},
+ '',
+ 'an empty device',
+ );
+};
+
+subtest 'state marker and mount table' => sub {
+ my ($zfs, $cfs) = nv('_nvmet_split_state', "a\tb\n$MARKER\nD x\n");
+ is_deeply([$zfs, $cfs], ["a\tb\n", "D x\n"], 'splits at the marker');
+ for my $text ("a\n", "a\n$MARKER\nb\n$MARKER\n", "a\n $MARKER\n", "a\n${MARKER}x\n") {
+ eval { nv('_nvmet_split_state', $text) };
+ like(
+ $@,
+ qr/malformed NVMe target state/,
+ 'rejects a missing, repeated or altered marker',
+ );
+ }
+ my $mounts = "sysfs /sys sysfs rw 0 0\nnone /sys/kernel/config configfs rw 0 0\n";
+ ok(nv('_nvmet_parse_mounts', $mounts), 'configfs is mounted');
+ ok(!nv('_nvmet_parse_mounts', "sysfs /sys sysfs rw 0 0\n"), 'configfs is not mounted');
+ ok(!nv('_nvmet_parse_mounts', "none /mnt configfs rw 0 0\n"), 'configfs elsewhere');
+ ok(!nv('_nvmet_parse_mounts', "x /sys/kernel/config tmpfs rw 0 0\n"),
+ 'another file system');
+ ok(!nv('_nvmet_parse_mounts', ''), 'empty mount table');
+};
+
+# ---------------------------------------------------------------------------
+# Planners
+# ---------------------------------------------------------------------------
+
+my $S = "$ROOT/subsystems/$NQN";
+sub write_step($path, $value) { return { write => $path, value => $value } }
+
+# The step that makes the key attributes of hosts readable by root only.
+sub chmod_step(@hosts) {
+ return ['chmod', '0600', map { ("$_/dhchap_key", "$_/dhchap_ctrl_key") } @hosts];
+}
+
+sub cfs_model(%o) {
+ my $model = { subsystems => {}, ports => {}, hosts => {} };
+ if (!$o{no_subsystem}) {
+ $model->{subsystems}->{$NQN} = {
+ attr_model => $MODEL,
+ attr_serial => nv('_nvmet_serial', $NQN),
+ attr_allow_any_host => '0',
+ acl => {},
+ namespaces => {},
+ ($o{subsystem} // {})->%*,
+ };
+ }
+ return $model;
+}
+
+sub ns_model($uuid, $dev, $enable = '1') {
+ return { enable => $enable, device_path => $dev, device_uuid => $uuid, buffered_io => '0' };
+}
+
+sub build_steps($nsid, $uuid, $dev) {
+ my $ns = "$S/namespaces/$nsid";
+ return [
+ ['test', '-b', $dev],
+ ['mkdir', $ns],
+ write_step("$ns/device_path", $dev),
+ write_step("$ns/device_uuid", $uuid),
+ write_step("$ns/buffered_io", 0),
+ write_step("$ns/enable", 1),
+ ];
+}
+
+subtest 'owned identity' => sub {
+ my $inv = inventory(
+ @POOL,
+ @ONE,
+ @TWO,
+ zfs_rows('tank/vm-102-disk-0', 'filesystem'),
+ zfs_rows('tank/vm-103-disk-0', 'volume'),
+ zfs_rows('tank/vm-104-disk-0', 'volume', $FOREIGN_NQN, 1, $U{1}),
+ );
+ is_deeply(
+ [nv('_nvmet_owned_identity', $inv, $NQN, 'tank/vm-100-disk-0')],
+ [1, $U{1}],
+ 'identity of an owned volume; the same identity under another NQN is allowed',
+ );
+ for my $case (
+ ['tank/vm-999-disk-0', qr/does not exist/],
+ ['tank/vm-102-disk-0', qr/is not a ZFS volume/],
+ ['tank/vm-103-disk-0', qr/is not owned by NVMe subsystem/],
+ ['tank/vm-104-disk-0', qr/is not owned by NVMe subsystem/],
+ ) {
+ eval { nv('_nvmet_owned_identity', $inv, $NQN, $case->[0]) };
+ like($@, $case->[1], "refuses $case->[0]");
+ }
+ for my $nsid (0, 0xffffffff, 'x', '01') {
+ my $bad =
+ inventory(@POOL, zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, $nsid, $U{1}));
+ eval { nv('_nvmet_owned_identity', $bad, $NQN, 'tank/vm-100-disk-0') };
+ like($@, qr/invalid NSID/, "refuses NSID '$nsid'");
+ }
+ my $bad = inventory(@POOL, zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, 'nope'));
+ eval { nv('_nvmet_owned_identity', $bad, $NQN, 'tank/vm-100-disk-0') };
+ like($@, qr/invalid namespace UUID/, 'refuses a malformed UUID');
+ for my $other ([1, $U{2}], [2, $U{1}]) {
+ my $dup = inventory(
+ @POOL, @ONE, zfs_rows('tank/vm-101-disk-0', 'volume', $NQN, $other->@*),
+ );
+ eval { nv('_nvmet_owned_identity', $dup, $NQN, 'tank/vm-100-disk-0') };
+ like($@, qr/duplicate NVMe identity on 'tank\/vm-100-disk-0'/, 'refuses a duplicate');
+ }
+ is(nv('_nvmet_serial', $NQN), 'PVEZFS' . substr(sha256_hex($NQN), 0, 14), 'serial formula');
+ is(
+ nv('_nvmet_parse_configfs', $FIXTURE_CFS)->{subsystems}->{$FIXTURE_NQN}->{attr_serial},
+ nv('_nvmet_serial', $FIXTURE_NQN),
+ 'the fixture subsystem carries the serial of its NQN',
+ );
+};
+
+subtest 'namespace ID allocation' => sub {
+ my $rows = sub(@ids) {
+ my $uuid = sub($id) { sprintf('%08d-0000-4000-8000-000000000000', $id) };
+ return inventory(
+ @POOL,
+ map { zfs_rows("tank/vm-$_-disk-0", 'volume', $NQN, $_, $uuid->($_)) } @ids,
+ );
+ };
+ my $cfs = cfs_model();
+ is(nv('_nvmet_allocate_nsid', inventory(@POOL), $cfs, $NQN), 1, 'first NSID');
+ is(nv('_nvmet_allocate_nsid', $rows->(1, 3), $cfs, $NQN), 4, 'a gap is not reused');
+ my $dirs =
+ cfs_model(subsystem => { namespaces => { 7 => ns_model($U{7}, '(null)', '0') } });
+ is(nv('_nvmet_allocate_nsid', $rows->(1), $dirs, $NQN), 8,
+ 'configfs-only namespaces count');
+ my $foreign =
+ inventory(@POOL, zfs_rows('tank/vm-9-disk-0', 'volume', $FOREIGN_NQN, 9, $U{9}));
+ my $foreign_cfs = cfs_model();
+ $foreign_cfs->{subsystems}->{$FOREIGN_NQN} = { namespaces => { 12 => {} } };
+ is(nv('_nvmet_allocate_nsid', $foreign, $foreign_cfs, $NQN), 1, 'others do not count');
+ my $invalid = inventory(@POOL, zfs_rows('tank/vm-1-disk-0', 'volume', $NQN, 'x', $U{1}));
+ is(nv('_nvmet_allocate_nsid', $invalid, $cfs, $NQN), 1, 'invalid NSIDs do not count');
+ my $top = inventory(
+ @POOL,
+ zfs_rows('tank/vm-1-disk-0', 'volume', $NQN, 1, $U{1}),
+ zfs_rows('tank/vm-2-disk-0', 'volume', $NQN, 0xfffffffe, $U{2}),
+ );
+ is(
+ nv('_nvmet_allocate_nsid', $top, $cfs, $NQN),
+ 2,
+ 'after the last NSID the lowest free one',
+ );
+ my $reserved = $rows->(1);
+ $reserved->{last_nsid} = 9;
+ is(nv('_nvmet_allocate_nsid', $reserved, $cfs, $NQN), 10, 'a reserved NSID is not reused');
+ $reserved->{last_nsid} = 0xfffffffe;
+ is(
+ nv('_nvmet_allocate_nsid', $reserved, $cfs, $NQN),
+ 2,
+ 'until the last NSID was handed out',
+ );
+};
+
+subtest 'export planner' => sub {
+ my $dev = '/dev/zvol/tank/vm-100-disk-0';
+ my $case = sub($namespaces) {
+ return cfs_model(subsystem => { namespaces => $namespaces });
+ };
+ my $build = build_steps(1, $U{1}, $dev);
+ my @plans = (
+ ['absent', {}, [$build], 'absent'],
+ ['present', { 1 => ns_model($U{1}, $dev) }, [], 'present'],
+ [
+ 'disabled',
+ { 1 => ns_model($U{1}, $dev, '0') },
+ [[['test', '-b', $dev], write_step("$S/namespaces/1/enable", 1)]],
+ 'disabled',
+ ],
+ [
+ 'disabled and incomplete',
+ { 1 => ns_model($U{9}, '(null)', '0') },
+ [[['rmdir', "$S/namespaces/1"], $build->@*]],
+ 'reclaim',
+ ],
+ [
+ 'enabled on the template name of the zvol',
+ { 1 => ns_model($U{1}, '/dev/zvol/tank/base-100-disk-0') },
+ [[
+ write_step("$S/namespaces/1/enable", 0),
+ ['rmdir', "$S/namespaces/1"],
+ $build->@*,
+ ]],
+ 'stale',
+ ],
+ );
+ for my $plan (@plans) {
+ my ($name, $namespaces, $units, $state) = $plan->@*;
+ is_deeply(
+ [nv('_nvmet_plan_export', $case->($namespaces), $NQN, 1, $U{1}, $dev)],
+ [$units, $state],
+ "plan for a namespace that is $name",
+ );
+ }
+ my $incomplete = $case->({ 1 => ns_model($U{9}, '(null)', '0') });
+ is(
+ nv('_nvmet_export_state', $incomplete, $NQN, 1, $U{1}, $dev),
+ 'incomplete',
+ 'a disabled namespace with another identity is incomplete',
+ );
+ is(
+ nv('_nvmet_export_state', cfs_model(no_subsystem => 1), $NQN, 1, $U{1}, $dev),
+ 'nosubsys',
+ 'no subsystem',
+ );
+ for my $refusal (
+ [
+ 'enabled with another UUID',
+ { 1 => ns_model($U{9}, $dev) },
+ qr/NVMe namespace ID '1' has a different identity/,
+ ],
+ [
+ 'enabled with another device',
+ { 1 => ns_model($U{1}, '/dev/zvol/tank/other') },
+ qr/different identity/,
+ ],
+ [
+ 'enabled with another UUID on the template name',
+ { 1 => ns_model($U{9}, '/dev/zvol/tank/base-100-disk-0') },
+ qr/different identity/,
+ ],
+ [
+ 'UUID in use at another NSID',
+ { 2 => ns_model($U{1}, '/dev/zvol/tank/other') },
+ qr/namespace UUID '\Q@{[ $U{1} ]}\E' is already in use/,
+ ],
+ ) {
+ my ($name, $namespaces, $error) = $refusal->@*;
+ eval { nv('_nvmet_plan_export', $case->($namespaces), $NQN, 1, $U{1}, $dev) };
+ like($@, $error, "refuses a namespace $name");
+ }
+ eval { nv('_nvmet_plan_export', cfs_model(no_subsystem => 1), $NQN, 1, $U{1}, $dev) };
+ like($@, qr/NVMe subsystem does not exist/, 'refuses without subsystem');
+};
+
+subtest 'unexport planner' => sub {
+ my $dev = '/dev/zvol/tank/vm-100-disk-0';
+ is_deeply(
+ [nv('_nvmet_plan_unexport', cfs_model(), $NQN, $U{1})],
+ [[], undef],
+ 'nothing to remove',
+ );
+ is_deeply(
+ [nv('_nvmet_plan_unexport', cfs_model(no_subsystem => 1), $NQN, $U{1})],
+ [[], undef],
+ 'no subsystem',
+ );
+ my ($units, $pre) = nv(
+ '_nvmet_plan_unexport',
+ cfs_model(subsystem => { namespaces => { 4 => ns_model($U{1}, $dev) } }),
+ $NQN,
+ $U{1},
+ );
+ is_deeply(
+ $units,
+ [[write_step("$S/namespaces/4/enable", 0), ['rmdir', "$S/namespaces/4"]]],
+ 'an enabled namespace is disabled, then removed',
+ );
+ ok($pre->{nsid} == 4 && $pre->{enabled}, 'and was enabled');
+ ($units, $pre) = nv(
+ '_nvmet_plan_unexport',
+ cfs_model(subsystem => { namespaces => { 4 => ns_model($U{1}, $dev, '0') } }),
+ $NQN,
+ $U{1},
+ );
+ is_deeply($units, [[['rmdir', "$S/namespaces/4"]]], 'a disabled namespace is only removed');
+ ok($pre->{nsid} == 4 && !$pre->{enabled}, 'and was disabled');
+ eval {
+ nv(
+ '_nvmet_plan_unexport',
+ cfs_model(
+ subsystem => {
+ namespaces =>
+ { 4 => ns_model($U{1}, $dev), 5 => ns_model($U{1}, $dev, '0') },
+ },
+ ),
+ $NQN,
+ $U{1},
+ );
+ };
+ like($@, qr/duplicate namespace UUID/, 'refuses a duplicate UUID');
+};
+
+subtest 'port lookup' => sub {
+ my $port = sub($family, $address, $service, %links) {
+ return {
+ addr_trtype => 'tcp',
+ addr_adrfam => $family,
+ addr_traddr => $address,
+ addr_trsvcid => $service,
+ links => {%links},
+ };
+ };
+ my $cfs = {
+ ports => {
+ 3 => $port->('ipv4', '192.0.2.21', '4420'),
+ 5 => $port->('ipv4', '192.0.2.21', '4420', $NQN => 1),
+ 6 => $port->('ipv4', '192.0.2.22', '4420'),
+ 7 => $port->('ipv6', '2001:db8:0:0::11', '4420'),
+ 8 => { $port->('ipv4', '192.0.2.23', '4420')->%*, addr_trtype => '' },
+ 9 => { $port->('ipv4', '', '4420')->%* },
+ },
+ };
+ my $find =
+ sub($nqn, @portal) { return nv('_nvmet_find_port', $cfs, $nqn, portal(@portal)) };
+ is($find->($NQN, 'ipv4', '192.0.2.21', 4420), 5, 'the linked port wins');
+ is($find->($FOREIGN_NQN, 'ipv4', '192.0.2.21', 4420), 3, 'else the lowest');
+ is($find->($NQN, 'ipv4', '192.0.2.22', 4420), 6, 'exact match');
+ ok(!defined($find->($NQN, 'ipv6', '192.0.2.22', 4420)), 'wrong family');
+ ok(!defined($find->($NQN, 'ipv4', '192.0.2.22', 4421)), 'wrong service');
+ ok(!defined($find->($NQN, 'ipv4', '192.0.2.23', 4420)), 'incomplete port');
+ is($find->($NQN, 'ipv6', '2001:db8::11', 4420), 7, 'IPv6 spellings match');
+};
+
+subtest 'activation planner' => sub {
+ my $conf = { nqn => $NQN, portals => $PORTALS, hostnqns => [@HOSTS], keysha => $KEY_SHA };
+ my $inv = inventory(@POOL, @ONE);
+ my $empty = { subsystems => {}, ports => {}, hosts => {} };
+ my $dev = '/dev/zvol/tank/vm-100-disk-0';
+ my $serial = nv('_nvmet_serial', $NQN);
+
+ # A creation interrupted after the model write is completed while the
+ # subsystem is still unused ('an interrupted subsystem creation' below).
+ my $unfinished = sub(%attr) {
+ return {
+ $empty->%*,
+ subsystems => {
+ $NQN => {
+ attr_serial => '0f1e2d3c4b5a6978',
+ attr_allow_any_host => '0',
+ acl => {},
+ namespaces => {},
+ %attr,
+ },
+ },
+ };
+ };
+ is_deeply(
+ nv(
+ '_nvmet_plan_activation',
+ $inv,
+ $unfinished->(attr_model => $MODEL, attr_allow_any_host => '1'),
+ $conf,
+ )->{prepublish}->[0],
+ [write_step("$S/attr_serial", $serial), write_step("$S/attr_allow_any_host", 0)],
+ 'an unused subsystem with our model is completed and denies unknown hosts',
+ );
+ for my $case (
+ [
+ 'a namespace',
+ sub($c) { $c->{subsystems}->{$NQN}->{namespaces}->{1} = ns_model($U{1}, $dev) },
+ ],
+ ['an ACL', sub($c) { $c->{subsystems}->{$NQN}->{acl}->{ $HOSTS[0] } = 1 }],
+ [
+ 'a port link',
+ sub($c) {
+ $c->{ports}->{7} = {
+ addr_trtype => 'tcp',
+ addr_adrfam => 'ipv4',
+ addr_traddr => '192.0.2.99',
+ addr_trsvcid => '4420',
+ links => { $NQN => 1 },
+ };
+ },
+ ],
+ ) {
+ my ($name, $change) = $case->@*;
+ my $used = $unfinished->(attr_model => $MODEL);
+ $change->($used);
+ eval { nv('_nvmet_plan_activation', $inv, $used, $conf) };
+ like(
+ $@,
+ qr/refusing to take over existing NVMe subsystem/,
+ "a subsystem with our model and another serial and $name is refused",
+ );
+ }
+ # the identities of every owned volume are validated before any unit
+ for my $case (
+ ['a duplicate NSID', [$NQN, 1, $U{2}], qr/duplicate NSID '1'/],
+ ['a duplicate UUID', [$NQN, 2, $U{1}], qr/duplicate namespace UUID/],
+ ['an invalid UUID', [$NQN, 2, 'bad'], qr/invalid namespace UUID/],
+ ) {
+ my ($name, $identity, $error) = $case->@*;
+ my $bad =
+ inventory(@POOL, @ONE, zfs_rows('tank/vm-101-disk-0', 'volume', $identity->@*));
+ eval { nv('_nvmet_desired_namespaces', $bad, $NQN) };
+ like($@, $error, "$name is refused");
+ }
+
+ my $state = sub(%o) {
+ my $cfs = cfs_model(
+ subsystem => {
+ acl => { map { $_ => 1 } @HOSTS },
+ namespaces => { 1 => ns_model($U{1}, $dev) },
+ ($o{subsystem} // {})->%*,
+ },
+ );
+ $cfs->{ports} = {
+ map {
+ $_ => {
+ addr_trtype => 'tcp',
+ addr_adrfam => 'ipv4',
+ addr_traddr => "192.0.2.2$_",
+ addr_trsvcid => '4420',
+ links => { $NQN => 1 },
+ }
+ } 1,
+ 2,
+ };
+ $cfs->{hosts} = { map { $_ => { key_sha256 => $KEY_SHA } } @HOSTS };
+ $o{change}->($cfs) if $o{change};
+ return $cfs;
+ };
+ is_deeply(
+ nv('_nvmet_plan_activation', $inv, $state->(), $conf),
+ { prepublish => [], port_ids => [1, 2] },
+ 'a converged target plans nothing',
+ );
+ is_deeply(
+ nv('_nvmet_plan_publish', $state->(), $NQN, [1, 2], [@HOSTS]),
+ [],
+ 'nor publishes',
+ );
+ is_deeply(
+ nv(
+ '_nvmet_plan_activation',
+ $inv,
+ $state->(subsystem => { attr_allow_any_host => '1' }),
+ $conf,
+ )->{prepublish},
+ [[write_step("$S/attr_allow_any_host", 0)]],
+ 'allow_any_host is reset',
+ );
+
+ # the key matrix for the second host
+ my $h = $HOSTS[1];
+ my $H = "$ROOT/hosts/$h";
+ my $other = sha256_hex("$KEY_B\n");
+ my $foreign_acl = sub($cfs) {
+ $cfs->{subsystems}->{$FOREIGN_NQN} = { acl => { $h => 1 }, namespaces => {} };
+ };
+ for my $case (
+ [
+ 'absent',
+ sub($c) { delete $c->{hosts}->{$h} },
+ [[['mkdir', $H]], [chmod_step($H), { key => ["$H/dhchap_key"] }]],
+ ],
+ ['matching', sub($c) { }, []],
+ [
+ 'different and unlinked',
+ sub($c) {
+ $c->{hosts}->{$h}->{key_sha256} = $other;
+ delete $c->{subsystems}->{$NQN}->{acl}->{$h};
+ },
+ [
+ [chmod_step($H), { key => ["$H/dhchap_key"] }],
+ [['ln', '-s', $H, "$S/allowed_hosts/$h"]],
+ ],
+ ],
+ [
+ 'empty and unlinked',
+ sub($c) {
+ $c->{hosts}->{$h}->{key_sha256} = $EMPTY_KEY_SHA;
+ delete $c->{subsystems}->{$NQN}->{acl}->{$h};
+ },
+ [
+ [chmod_step($H), { key => ["$H/dhchap_key"] }],
+ [['ln', '-s', $H, "$S/allowed_hosts/$h"]],
+ ],
+ ],
+ ) {
+ my ($name, $change, $units) = $case->@*;
+ my $plan = nv('_nvmet_plan_activation', $inv, $state->(change => $change), $conf);
+ is_deeply($plan->{prepublish}, $units, "key of a host that is $name");
+ }
+ for my $case (
+ [
+ 'different and linked by us',
+ sub($c) { $c->{hosts}->{$h}->{key_sha256} = $other },
+ qr/refusing to replace an in-use DH-HMAC-CHAP key/,
+ ],
+ [
+ 'different and linked elsewhere',
+ sub($c) {
+ $c->{hosts}->{$h}->{key_sha256} = $other;
+ delete $c->{subsystems}->{$NQN}->{acl}->{$h};
+ $foreign_acl->($c);
+ },
+ qr/in-use DH-HMAC-CHAP key/,
+ ],
+ [
+ 'empty and linked',
+ sub($c) { $c->{hosts}->{$h}->{key_sha256} = $EMPTY_KEY_SHA },
+ qr/in-use DH-HMAC-CHAP key/,
+ ],
+ [
+ 'without a digest',
+ sub($c) { $c->{hosts}->{$h}->{key_sha256} = undef },
+ qr/does not expose a DH-HMAC-CHAP key for host/,
+ ],
+ ) {
+ my ($name, $change, $error) = $case->@*;
+ eval { nv('_nvmet_plan_activation', $inv, $state->(change => $change), $conf) };
+ like($@, $error, "refuses the key of a host that is $name");
+ }
+
+ my $undesired = $state->(
+ change => sub($c) {
+ $c->{subsystems}->{$NQN}->{namespaces}->{7} =
+ ns_model($U{7}, '/dev/zvol/tank/gone');
+ $c->{subsystems}->{$NQN}->{namespaces}->{8} = ns_model($U{8}, '(null)', '0');
+ },
+ );
+ is_deeply(
+ nv('_nvmet_plan_activation', $inv, $undesired, $conf)->{prepublish},
+ [
+ [write_step("$S/namespaces/7/enable", 0), ['rmdir', "$S/namespaces/7"]],
+ [['rmdir', "$S/namespaces/8"]],
+ ],
+ 'undesired namespaces are disabled and removed',
+ );
+};
+
+subtest 'publish planner' => sub {
+ my $cfs = cfs_model(subsystem => { acl => { map { $_ => 1 } @HOSTS } });
+ $cfs->{ports} = {
+ 1 => { links => { $NQN => 1 } },
+ 2 => { links => {} },
+ 5 => { links => { $NQN => 1, $FOREIGN_NQN => 1 } },
+ 6 => { links => { $FOREIGN_NQN => 1 } },
+ };
+ my @guards = (
+ ['grep', '-qx', '0', "$S/attr_allow_any_host"],
+ map { ['test', '-L', "$S/allowed_hosts/$_"] } @HOSTS,
+ );
+ is_deeply(
+ nv('_nvmet_plan_publish', $cfs, $NQN, [1, 2], [@HOSTS]),
+ [
+ {
+ port => 2,
+ action => 'link',
+ steps => [@guards, ['ln', '-s', $S, "$ROOT/ports/2/subsystems/$NQN"]],
+ },
+ {
+ port => 5,
+ action => 'unlink',
+ steps => [['rm', "$ROOT/ports/5/subsystems/$NQN"]],
+ },
+ ],
+ 'links a missing port behind the guards and unlinks a stray port',
+ );
+ $cfs->{ports}->{2}->{links}->{$NQN} = 1;
+ delete $cfs->{ports}->{5};
+ is_deeply(nv('_nvmet_plan_publish', $cfs, $NQN, [1, 2], [@HOSTS]), [], 'converged');
+};
+
+subtest 'target removal planners' => sub {
+ my $conf_hosts =
+ [@HOSTS, 'nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-000000000003'];
+ my $cfs = cfs_model(subsystem => { acl => { map { $_ => 1 } @HOSTS } });
+ $cfs->{ports} = {
+ 2 => { links => { $NQN => 1 } },
+ 1 => { links => { $NQN => 1 } },
+ 3 => { links => {} },
+ };
+ is_deeply(
+ [nv('_nvmet_plan_delete_target', inventory(@POOL), $cfs, $NQN, $conf_hosts)],
+ [
+ [[
+ [
+ 'rm',
+ "$ROOT/ports/1/subsystems/$NQN",
+ "$ROOT/ports/2/subsystems/$NQN",
+ map { "$S/allowed_hosts/$_" } @HOSTS,
+ ],
+ ['rmdir', $S],
+ ]],
+ [sort $conf_hosts->@*],
+ ],
+ 'teardown removes port links first, then ACLs, then the subsystem',
+ );
+ # The candidates are the ACL and the configured hosts: a retry after a
+ # teardown that removed the ACLs but not the subsystem still finds them.
+ my $stale_host = 'nqn.2026-01.com.example:stale';
+ my $stale = cfs_model(subsystem => { acl => { $stale_host => 1 } });
+ is_deeply(
+ (nv('_nvmet_plan_delete_target', inventory(@POOL), $stale, $NQN, [@HOSTS]))[1],
+ [sort $stale_host, @HOSTS],
+ 'a host that is only in the ACL is a candidate too',
+ );
+ is_deeply(
+ [nv('_nvmet_plan_delete_target', inventory(@POOL), cfs_model(), $NQN, [@HOSTS])],
+ [[[['rmdir', $S]]], [sort @HOSTS]],
+ 'without ACLs the configured hosts are candidates',
+ );
+
+ my $orphans = {
+ subsystems => { $FOREIGN_NQN => { acl => { $HOSTS[0] => 1 } } },
+ hosts => { map { $_ => {} } @HOSTS },
+ };
+ is_deeply(
+ nv('_nvmet_plan_orphan_hosts', $orphans, [@HOSTS, @HOSTS, 'nqn.x:gone']),
+ [[['rmdir', "$ROOT/hosts/$HOSTS[1]"]]],
+ 'orphans exclude linked and missing hosts',
+ );
+ is_deeply(nv('_nvmet_plan_orphan_hosts', $orphans, [$HOSTS[0]]), [], 'no orphans');
+ $orphans->{hosts}->{'..'} = {};
+ is_deeply(
+ nv('_nvmet_plan_orphan_hosts', $orphans, ['..']),
+ [],
+ 'a host name read from the target is only used when it is an NQN',
+ );
+ my $odd = cfs_model(subsystem => { acl => { $HOSTS[0] => 1, '..' => 1 } });
+ eval { nv('_nvmet_plan_delete_target', inventory(@POOL), $odd, $NQN, [@HOSTS]) };
+ like($@, qr/it allows a malformed host name/, 'an ACL with a malformed name is refused');
+};
+
+subtest 'template name and chunking' => sub {
+ is(nv('_nvmet_template_name', 'tank/vm-100-disk-0'), 'tank/base-100-disk-0', 'vm to base');
+ is(nv('_nvmet_template_name', 'tank/sub/vm-1-disk-2'), 'tank/sub/base-1-disk-2', 'nested');
+ for my $name ('tank/base-100-disk-0', 'tank/subvol-100-disk-0', 'tank/xvm-1-disk-0') {
+ eval { nv('_nvmet_template_name', $name) };
+ like($@, qr/only VM zvols can become templates/, "refuses $name");
+ }
+
+ my @units = map { build_steps($_, $U{1}, "/dev/zvol/tank/vm-$_-disk-0") } 1 .. 400;
+ my $chunks = nv('_nvmet_chunk', \@units);
+ ok($chunks->@* > 1, 'large plans are split');
+ ok(
+ !grep({ length(nv('_nvmet_render', $_)) > 65536 } $chunks->@*),
+ 'no call exceeds 64 KiB',
+ );
+ ok(!grep({ $_->[0]->[0] ne 'test' || $_->@* % 6 } $chunks->@*), 'chunks hold whole units');
+ is_deeply([map { $_->@* } $chunks->@*], [map { $_->@* } @units], 'order is preserved');
+ is_deeply(nv('_nvmet_chunk', []), [], 'no units, no calls');
+ my $small = nv(
+ '_nvmet_chunk',
+ [@units[0 .. 3]],
+ length(nv('_nvmet_render', [map { $_->@* } @units[0 .. 1]])),
+ );
+ is(scalar($small->@*), 2, 'the limit is configurable');
+ eval { nv('_nvmet_chunk', [$units[0]], 10) };
+ like($@, qr/NVMe target command too long/, 'a unit over the limit is refused');
+ my $key_unit = [{ key => ["$ROOT/hosts/$HOSTS[0]/dhchap_key"] }];
+ my $mixed = nv('_nvmet_chunk', [@units[0 .. 199], $key_unit, @units[200 .. 399]]);
+ is(
+ scalar(
+ grep {
+ grep { ref($_) eq 'HASH' && $_->{key} } $_->@*
+ } $mixed->@*
+ ),
+ 1,
+ 'the key step is in exactly one call',
+ );
+};
+
+# ---------------------------------------------------------------------------
+# Flows against the fake target
+# ---------------------------------------------------------------------------
+
+sub secret_file($storeid) {
+ return "/etc/pve/priv/storage/$storeid.nvme-dhchap";
+}
+
+# The target part of a storage activation, with the key stored for the storage.
+sub activate($scfg = scfg(), $key = $KEY, $hostnqns = [@HOSTS], $portals = $PORTALS) {
+ local $FILES{ secret_file('st') } = $key;
+ return nv('_nvmet_activate_target', 'st', $scfg, $portals, $hostnqns, $key);
+}
+
+# The public operations of the flows, on lifecycle_fake().
+my %ACT = (
+ activate => sub { activate() },
+ alloc => sub { $PLUGIN->alloc_image('st', scfg(), 200, 'raw', undef, 1024) },
+ clone => sub { $PLUGIN->clone_image(scfg(), 'st', 'base-102-disk-0', 201) },
+ free => sub { $PLUGIN->free_image('st', scfg(), 'vm-101-disk-0') },
+ rollback =>
+ sub { $PLUGIN->volume_snapshot_rollback(scfg(), 'st', 'vm-100-disk-0', 'snap1') },
+ template => sub { $PLUGIN->create_base('st', scfg(), 'vm-101-disk-0') },
+ resize => sub { $PLUGIN->volume_resize(scfg(), 'st', 'vm-100-disk-0', 2 * 1024**3) },
+ remove => sub { nv('_nvmet_delete_target', scfg()) },
+);
+
+# Runs an action against a new lifecycle_fake(%opts).
+sub run_on($action, %opts) {
+ my $fake = lifecycle_fake(%opts);
+ return ($fake, flow($fake, $ACT{$action}));
+}
+
+# An action (a name of %ACT or a sub) that is refused without changing the target.
+sub refused($fake, $action, $error, $name) {
+ my $before = dclone($fake->{m});
+ my $res = flow($fake, ref($action) ? $action : $ACT{$action});
+ like($res->{error}, $error, "refuses $name");
+ ok(!changes($res) && same($before, $fake->{m}), "without changes for $name");
+ return $res;
+}
+
+sub ns_of($fake, $nsid, $nqn = $NQN) {
+ return ($fake->{m}->{subsystems}->{$nqn} // {})->{ns}->{$nsid};
+}
+
+sub exported($fake, $nsid, $uuid, $dev) {
+ my $ns = ns_of($fake, $nsid) // return 0;
+ return $ns->{enable} eq '1' && $ns->{device_uuid} eq $uuid && $ns->{device_path} eq $dev;
+}
+
+sub step_is($step, @prefix) {
+ return
+ ref($step) eq 'ARRAY'
+ && $step->@* >= @prefix
+ && join("\0", $step->@[0 .. $#prefix]) eq join("\0", @prefix);
+}
+
+sub write_to($step, $suffix, $value = undef) {
+ return
+ ref($step) eq 'HASH'
+ && exists($step->{write})
+ && $step->{write} =~ m{\Q$suffix\E\z}
+ && (!defined($value) || $step->{value} eq $value);
+}
+
+subtest 'path() is one read-only ZFS query' => sub {
+ my $fake = lifecycle_fake();
+ my $res = flow($fake, sub { [$PLUGIN->path(scfg(), 'vm-100-disk-0', 'st')] });
+ is($res->{error}, '', 'lookup succeeds');
+ is_deeply(
+ $res->{result},
+ ["/dev/disk/by-id/nvme-uuid.$U{1}", 100, 'images'],
+ 'the UUID link',
+ );
+ is_deeply(ops($res), ['read ZFS inventory'], 'one call');
+ is(scalar($res->{locks}->@*), 0, 'without the lock');
+ $res = flow($fake, sub { [$PLUGIN->path(scfg(), 'vm-100-disk-0', 'st', 'snap1')] });
+ like($res->{error}, qr/direct access to snapshots not implemented/, 'snapshots');
+ is(scalar($res->{calls}->@*), 0, 'are refused locally');
+};
+
+subtest 'a failed read is retried' => sub {
+ local $SLEPT = 0;
+ my $fake = lifecycle_fake(read_fault => { after => -1, mode => 'before' });
+ my $res = flow($fake, sub { [$PLUGIN->path(scfg(), 'vm-100-disk-0', 'st')] });
+ is($res->{error}, '', 'a read that fails once');
+ is_deeply(ops($res), ['read ZFS inventory', 'read ZFS inventory'], 'is repeated');
+ is($SLEPT, 0.2, 'after 200 ms');
+
+ $fake = lifecycle_fake(fail => [['zfs', 'get'], 'I/O error']);
+ $res = flow($fake, sub { [$PLUGIN->path(scfg(), 'vm-100-disk-0', 'st')] });
+ is($res->{error}, "cannot read NVMe target state: I/O error\n",
+ 'a read that keeps failing');
+ is(scalar($res->{calls}->@*), 3, 'is tried three times');
+
+ $fake = lifecycle_fake(read_fault => { after => -1, mode => 'unreachable' });
+ $res = flow($fake, sub { [$PLUGIN->path(scfg(), 'vm-100-disk-0', 'st')] });
+ like($res->{error}, qr/NVMe target '192\.0\.2\.10' is unreachable/,
+ 'an unreachable target');
+ is(scalar($res->{calls}->@*), 1, 'is not tried again');
+};
+
+subtest 'activate_volume' => sub {
+ my %forced;
+ my $activations = 0;
+ my $activation = sub($class, $storeid, $scfg, $cache = undef) {
+ $activations++;
+ $forced{$storeid} = $cache->{'zfsnvme-force-reconcile'}->{$storeid};
+ die "activation attempted\n";
+ };
+ $plugin_mock->redefine(activate_storage => $activation);
+
+ my $fake = lifecycle_fake();
+ delete $fake->{m}->{subsystems}->{$NQN}->{ns}->{2};
+ my $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-101-disk-0') });
+ like($res->{error}, qr/activation attempted/, 'a missing namespace forces an activation');
+ is($forced{st}, 1, 'the activation is forced past its fast path');
+ is_deeply(ops($res), ['read target state'], 'after one read');
+ ok(!$res->{calls}->[0]->{mutating} && !$res->{locks}->@*, 'without a change or the lock');
+
+ $fake = lifecycle_fake();
+ ns_of($fake, 2)->{device_uuid} = $U{9};
+ $activations = 0;
+ $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-101-disk-0') });
+ like(
+ $res->{error},
+ qr/NVMe namespace ID '2' has a different identity/,
+ 'refuses an enabled namespace with another identity',
+ );
+ is($activations, 0, 'without activating');
+ $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-101-disk-0', 'snap') });
+ like($res->{error}, qr/unable to activate snapshot/, 'snapshots are refused');
+
+ # The local device: its udev link and whether it is the namespace.
+ my $ok = 1;
+ $plugin_mock->redefine(_nvmet_local_namespace_ok => sub(@args) { return $ok });
+ my $link = "/dev/disk/by-id/nvme-uuid.$U{1}";
+ local %BLOCK = ($link => 1);
+ $fake = target_fake();
+ add_volume($fake, 'vm-100-disk-0', 1, $U{1});
+ $activations = 0;
+ $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-100-disk-0') });
+ is($res->{error}, '', 'a converged volume activates');
+ is_deeply(ops($res), ['read target state'], 'with one read');
+ is(scalar($res->{locks}->@*) + $activations, 0, 'without lock or activation');
+
+ for my $case (
+ ['disabled', sub($f) { ns_of($f, 1)->{enable} = '0' }],
+ ['absent', sub($f) { delete $f->{m}->{subsystems}->{$NQN}->{ns}->{1} }],
+ ['without subsystem', sub($f) { delete $f->{m}->{subsystems}->{$NQN} }],
+ [
+ 'on the template name of the zvol',
+ sub($f) { ns_of($f, 1)->{device_path} = '/dev/zvol/tank/base-100-disk-0' },
+ ],
+ [
+ 'being built',
+ sub($f) {
+ $f->{m}->{subsystems}->{$NQN}->{ns}->{1} = ns_model($U{9}, '(null)', '0');
+ },
+ ],
+ ) {
+ my ($name, $change) = $case->@*;
+ $fake = target_fake();
+ add_volume($fake, 'vm-100-disk-0', 1, $U{1});
+ $change->($fake);
+ %forced = ();
+ $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-100-disk-0') });
+ is($forced{st}, 1, "a namespace that is $name on the target is exported again");
+ }
+
+ $fake = target_fake();
+ add_volume($fake, 'vm-100-disk-0', 1, $U{1});
+ $ok = 0;
+ $activations = 0;
+ $plugin_mock->redefine(activate_storage => sub(@args) { $activations++; return 1 });
+ $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-100-disk-0') });
+ like(
+ $res->{error},
+ qr/NVMe namespace for 'vm-100-disk-0' has an unexpected identity/,
+ 'a local device of another namespace is never used',
+ );
+ is($activations, 1, 'after one forced activation');
+ is_deeply(ops($res), ['read target state'], 'and one read');
+ $plugin_mock->unmock('_nvmet_local_namespace_ok');
+
+ # While the device is missing, live controllers are rescanned.
+ my $file_mock = Test::MockModule->new('PVE::File');
+ $file_mock->redefine(
+ dir_glob_foreach => sub($dir, $regex, $func) {
+ return if $dir ne '/sys/class/nvme';
+ $func->($_) for qw(nvme7 nvme8 nvme9);
+ },
+ );
+ local %FILES = (
+ '/sys/class/nvme/nvme7/subsysnqn' => $NQN,
+ '/sys/class/nvme/nvme7/state' => 'live',
+ '/sys/class/nvme/nvme8/subsysnqn' => $NQN,
+ '/sys/class/nvme/nvme8/state' => 'connecting',
+ '/sys/class/nvme/nvme9/subsysnqn' => $FOREIGN_NQN,
+ '/sys/class/nvme/nvme9/state' => 'live',
+ );
+ $plugin_mock->redefine(activate_storage => sub(@args) { return 1 });
+ $fake = lifecycle_fake();
+ delete $fake->{m}->{subsystems}->{$NQN}->{ns}->{2};
+ my $start = $NOW;
+ $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-101-disk-0') });
+ like(
+ $res->{error},
+ qr/NVMe namespace for 'vm-101-disk-0' did not appear/,
+ 'a missing device',
+ );
+ is($NOW - $start, 10, 'after 10 seconds');
+ my $rescan = ['/sys/class/nvme/nvme7/rescan_controller', "1\n"];
+ is_deeply(
+ $res->{sysfs_writes},
+ [($rescan) x 5],
+ 'the live controller is rescanned every 2 s',
+ );
+ is_deeply($res->{warnings}, [], 'without a warning');
+
+ # The stock file_write on files that fail: a rescan that fails is a task
+ # warning with the errno text, and a controller that went away since it
+ # was listed needs none.
+ my $file_write = $sysfs_mock->original('file_write');
+ my $dir = tempdir(CLEANUP => 1);
+ my @perl_warnings;
+ local $SIG{__WARN__} = sub($warning) { push @perl_warnings, $warning };
+ for my $case (
+ ['/dev/full', 'No space left on device'],
+ [$dir, 'Is a directory'],
+ ["$dir/gone/rescan_controller", undef],
+ ) {
+ my ($path, $reason) = $case->@*;
+ $sysfs_mock->redefine(file_write => sub($file, @args) { $file_write->($path, @args) });
+ $res = flow($fake, sub { $PLUGIN->activate_volume('st', scfg(), 'vm-101-disk-0') });
+ is_deeply(
+ $res->{warnings},
+ defined($reason) ? [("cannot rescan NVMe controller 'nvme7': $reason") x 5] : [],
+ defined($reason)
+ ? "a failed rescan is a task warning with the errno text ($reason)"
+ : 'a controller that went away is not',
+ );
+ }
+ is_deeply(\@perl_warnings, [], 'and file_write warns about none');
+ $sysfs_mock->redefine(file_write => $sysfs_write);
+ $file_mock->unmock_all();
+ $plugin_mock->unmock('activate_storage');
+};
+
+subtest 'activation of an empty target' => sub {
+ my $fake = FakeTarget->new(pools => ['tank']);
+ $fake->add_zvol('tank/vm-100-disk-0', identity => [$NQN, 1, $U{1}]);
+ my $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'the target is configured');
+ is_deeply(
+ [map { $_->{locked} } $res->{calls}->@*],
+ [0, 1, 1, 1, 1, 1],
+ 'read, then lock, read, apply, verify and publish',
+ );
+ is_deeply(
+ [map { [$_->@{qw(name timeout)}] } $res->{locks}->@*],
+ [['zfsnvme-192.0.2.10', 30]],
+ 'under the domain lock of the target, waiting up to 30 seconds for it',
+ );
+ my $m = $fake->{m};
+ my $subsys = $m->{subsystems}->{$NQN};
+ is_deeply(
+ $subsys->{attr},
+ {
+ attr_model => $MODEL,
+ attr_serial => nv('_nvmet_serial', $NQN),
+ attr_allow_any_host => '0',
+ },
+ 'the subsystem carries our marker',
+ );
+ is_deeply($subsys->{acl}, { map { $_ => 1 } @HOSTS }, 'every host has an ACL');
+ is_deeply([map { $m->{hosts}->{$_}->{key} } @HOSTS], [$KEY, $KEY], 'and the key');
+ ok(exported($fake, 1, $U{1}, '/dev/zvol/tank/vm-100-disk-0'), 'the volume is exported');
+
+ $res = flow($fake, $ACT{activate});
+ is_deeply(ops($res), ['read target state'], 'a converged target costs one read');
+ ok(!$res->{locks}->@* && !$res->{calls}->[0]->{mutating}, 'without lock or change');
+};
+
+subtest 'activation refusals change nothing' => sub {
+ for my $case (
+ [
+ 'a foreign subsystem at our NQN',
+ sub($f) { $f->add_subsystem($NQN, model => 'Other Storage', serial => 'abc') },
+ qr/refusing to take over existing NVMe subsystem/,
+ ],
+ [
+ 'a used subsystem with the default model',
+ sub($f) {
+ $f->add_host($HOSTS[0], $KEY);
+ $f->add_subsystem($NQN, model => 'Linux', serial => 'abc', acl => [$HOSTS[0]]);
+ },
+ qr/refusing to take over existing NVMe subsystem/,
+ ],
+ [
+ 'a duplicate UUID on a published target',
+ sub($f) {
+ $f->{m} = lifecycle_fake()->{m};
+ $f->add_zvol('tank/vm-150-disk-0', identity => [$NQN, 7, $U{5}]);
+ $f->add_zvol('tank/vm-151-disk-0', identity => [$NQN, 8, $U{5}]);
+ },
+ qr/duplicate namespace UUID '\Q@{[ $U{5} ]}\E'/,
+ ],
+ [
+ 'an enabled namespace of another volume',
+ sub($f) {
+ $f->add_zvol('tank/vm-100-disk-0', identity => [$NQN, 1, $U{1}]);
+ $f->add_subsystem($NQN);
+ $f->add_namespace($NQN, 1, $U{9}, '/dev/zvol/tank/other');
+ },
+ qr/NVMe namespace ID '1' has a different identity/,
+ ],
+ ) {
+ my ($name, $setup, $error) = $case->@*;
+ my $fake = FakeTarget->new(pools => ['tank']);
+ $setup->($fake);
+ my $res = refused($fake, 'activate', $error, $name);
+ unlike($res->{error}, qr/DHHC-1/, 'without key material in the message');
+ }
+};
+
+subtest 'nothing is published unless a fresh read converges' => sub {
+ my $acl = "$S/allowed_hosts/$HOSTS[1]";
+ my $failing = sub($limit) {
+ my $failures = 0;
+ return sub($step, $call) {
+ return undef
+ if !step_is($step, 'ln', '-s') || $step->[3] ne $acl || $failures >= $limit;
+ $failures++;
+ return "ln: failed to create symbolic link '$acl': Invalid argument";
+ };
+ };
+ my $fake = FakeTarget->new(pools => ['tank'], step_fault => $failing->(99));
+ my $res = flow($fake, $ACT{activate});
+ like(
+ $res->{error},
+ qr/NVMe target did not converge: ln: failed to create symbolic link/,
+ 'a plan that fails twice stops',
+ );
+ is(
+ scalar(grep { $_->{op} eq 'configure NVMe target' } $res->{calls}->@*),
+ 2,
+ 'in two rounds',
+ );
+ is(scalar(grep { $_->{op} =~ /\Alink / } $res->{calls}->@*), 0, 'and publishes nothing');
+ ok(!grep({ $_->{links}->%* } values $fake->{m}->{ports}->%*),
+ 'no port links the subsystem');
+
+ $fake = FakeTarget->new(pools => ['tank'], step_fault => $failing->(1));
+ $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'a transient failure is repaired by the second round');
+ is(scalar(grep { $_->{op} =~ /\Alink / } $res->{calls}->@*), 2, 'which then publishes');
+
+ $fake = FakeTarget->new(pools => ['tank']);
+ $fake->{m}->{mounted} = 0;
+ $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'configfs is mounted when it is missing');
+ my @seen = grep { /mount/ } ops($res)->@*;
+ is_deeply(\@seen, ['read mounts', 'mount configfs'], 'after reading the mount table');
+ is(
+ $res->{calls}->[-1]->{op},
+ 'link NVMe subsystem on port 2',
+ 'and the target is published',
+ );
+
+ $fake = FakeTarget->new(pools => ['tank']);
+ $fake->{step_fault} = sub($step, $call) {
+ return step_is($step, 'env') ? "find: '$ROOT/hosts': Permission denied" : undef;
+ };
+ $res = flow($fake, $ACT{activate});
+ like(
+ $res->{error},
+ qr/cannot read NVMe target state: find: '\Q$ROOT\E\/hosts': Permission denied/,
+ 'an unreadable, mounted configfs stops the activation',
+ );
+ ok(!grep({ $_ eq 'mount configfs' } ops($res)->@*), 'without mounting');
+ is(changes($res), 0, 'and without changes');
+};
+
+subtest 'an interrupted subsystem creation' => sub {
+ # The chain that creates the subsystem stops after its mkdir or after the
+ # model write, for example when the remote shell is killed. Call 2 is the
+ # configuration. Its outcome is unknown; the next activation repairs it.
+ my $marker = {
+ attr_model => $MODEL,
+ attr_serial => nv('_nvmet_serial', $NQN),
+ attr_allow_any_host => '0',
+ };
+ my $completed = sub($fake, $what) {
+ is_deeply($fake->{m}->{subsystems}->{$NQN}->{attr}, $marker, "$what: our marker");
+ ok(
+ exported($fake, 1, $U{1}, '/dev/zvol/tank/vm-100-disk-0'),
+ "$what: exports the volume",
+ );
+ ok(
+ $fake->{m}->{ports}->{1}->{links}->{$NQN}
+ && $fake->{m}->{ports}->{2}->{links}->{$NQN},
+ "$what: and publishes it",
+ );
+ is_deeply($fake->{violations}, [], "$what: no protocol violation");
+ };
+ my $new = sub(%faults) {
+ my $fake = FakeTarget->new(pools => ['tank'], faults => {%faults});
+ $fake->add_zvol('tank/vm-100-disk-0', identity => [$NQN, 1, $U{1}]);
+ return $fake;
+ };
+
+ # After the model write, only this plugin can have created the subsystem.
+ my $fake = $new->(2 => 'cut:2');
+ my $res = flow($fake, $ACT{activate});
+ like(
+ $res->{error},
+ qr/'configure NVMe target' did not complete .* state is unknown\n\z/,
+ 'a cut after the model write',
+ );
+ ok(!grep({ $_->{links}->%* } values $fake->{m}->{ports}->%*), 'is unpublished');
+ $fake->{faults} = {};
+ $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'the next activation completes the subsystem');
+ my ($configure) = grep { $_->{op} eq 'configure NVMe target' } $res->{calls}->@*;
+ is_deeply(
+ $configure->{steps}->[0],
+ write_step("$S/attr_serial", $marker->{attr_serial}),
+ 'by writing the serial',
+ );
+ $completed->($fake, 'next activation after the model write');
+
+ # Right after the mkdir, the subsystem looks like one of another tool.
+ $fake = $new->(2 => 'cut:1');
+ $res = flow($fake, $ACT{activate});
+ like($res->{error}, qr/state is unknown\n\z/, 'a cut right after the mkdir');
+ $fake->{faults} = {};
+ $res = flow($fake, $ACT{activate});
+ like(
+ $res->{error},
+ qr/refusing to take over existing NVMe subsystem .* not created by Proxmox VE/,
+ 'is refused by the next activation',
+ );
+ is($fake->{m}->{subsystems}->{$NQN}->{attr}->{attr_model}, 'Linux',
+ 'the subsystem is kept');
+ ok(!grep({ $_->{links}->%* } values $fake->{m}->{ports}->%*), 'and unpublished');
+ delete $fake->{m}->{subsystems}->{$NQN};
+ $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'once an administrator removed it, the next activation creates it');
+ $completed->($fake, 'activation after the removal');
+};
+
+subtest 'quorum and reachability' => sub {
+ my $fake = FakeTarget->new(pools => ['tank']);
+ local $QUORATE = 0;
+ local @QUORUM = ();
+ my $res = flow($fake, $ACT{activate});
+ like($res->{error}, qr/cluster not quorate - refusing NVMe target changes/, 'no quorum');
+ is_deeply(\@QUORUM, [1], 'with a quorum check that does not wait');
+ is(scalar($res->{locks}->@*), 0, 'before requesting the lock');
+ is_deeply(ops($res), ['read target state'], 'after the lockless read');
+ $QUORATE = 1;
+
+ $fake->{unreachable} = 1;
+ $res = flow($fake, $ACT{activate});
+ like(
+ $res->{error},
+ qr/NVMe target '192\.0\.2\.10' is unreachable: ssh: connect/,
+ 'an unreachable target fails in the lockless read',
+ );
+ ok(!$res->{locks}->@* && $res->{calls}->@* == 1, 'without lock or retry');
+
+ $fake = lifecycle_fake();
+ local $QUORATE = 0;
+ $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'a converged target needs no quorum');
+};
+
+subtest 'create' => sub {
+ my ($fake, $res) = run_on('alloc');
+ is($res->{error}, '', 'allocation succeeds');
+ is($res->{result}, 'vm-200-disk-0', 'with the next free name');
+ is_deeply(
+ [map { $_->{locked} } $res->{calls}->@*],
+ [0, 1, 1, 1, 1, 1, 1],
+ 'the name lookup without the lock, the rest under it',
+ );
+ my $uuid = $fake->{m}->{ds}->{'tank/vm-200-disk-0'}->{props}->{'proxmox:nvme-uuid'};
+ like($uuid, $UUID_RE, 'a new UUID');
+ ok(exported($fake, 4, $uuid, '/dev/zvol/tank/vm-200-disk-0'), 'exported at the next NSID');
+
+ my $thick = scfg();
+ delete $thick->@{qw(sparse blocksize)};
+ $fake = lifecycle_fake();
+ $res =
+ flow($fake, sub { $PLUGIN->alloc_image('st', $thick, 200, 'raw', 'vm-200-disk-1', 4000) });
+ is($res->{result}, 'vm-200-disk-1', 'an explicit name is used');
+ my ($create) = grep { $_->{op} eq 'create zvol' } $res->{calls}->@*;
+ is_deeply(
+ [grep { /\A(?:-[sb]|[0-9]+k)\z/ } $create->{steps}->[0]->@*],
+ ['4096k'],
+ 'the size is rounded up to KiB; without sparse and blocksize the zvol is thick',
+ );
+
+ ($fake, $res) = run_on('alloc', udev_delay => 3);
+ is($res->{error}, '', 'a slow udev');
+ is(scalar(grep { $_ eq 'wait for zvol' } ops($res)->@*), 4, 'adds polls');
+
+ local @UUIDS = ($U{1}, $U{9});
+ ($fake, $res) = run_on('alloc');
+ is(
+ $fake->{m}->{ds}->{'tank/vm-200-disk-0'}->{props}->{'proxmox:nvme-uuid'},
+ $U{9},
+ 'a UUID that is in use is drawn again',
+ );
+ local @UUIDS = ($U{1}) x 10;
+ ($fake, $res) = run_on('alloc');
+ is($res->{error}, "cannot generate an unused namespace UUID\n", 'but not forever');
+ is(changes($res), 0, 'and nothing changes');
+ @UUIDS = ();
+
+ ($fake, $res) = run_on('alloc', faults => { 3 => 'after' });
+ like(
+ $res->{error},
+ qr/'create zvol' did not complete .*state is unknown\n\z/,
+ 'a lost reply aborts even when the create reached the target',
+ );
+ is($res->{calls}->[-1]->{op}, 'create zvol', 'no read tries to settle it');
+ ok(!ns_of($fake, 4), 'the abandoned operation does not export it');
+ $fake->{faults} = {};
+ $res = flow($fake, $ACT{activate});
+ ok(!$res->{error} && ns_of($fake, 4), 'the next activation exports the owned zvol');
+
+ ($fake, $res) = run_on('alloc', faults => { 5 => 'before' });
+ like($res->{error}, qr/'export namespace' failed: injected failure/, 'a failed export');
+ ok(!$fake->{m}->{ds}->{'tank/vm-200-disk-0'} && !ns_of($fake, 4), 'destroys the new zvol');
+ is($res->{locks}->@* + $res->{nested}->@*, 1, 'the compensation reuses the lock');
+
+ # The export may still run on the target after its connection broke.
+ ($fake, $res) = run_on('alloc', faults => { 5 => 'after' });
+ like(
+ $res->{error},
+ qr/\A.*'export namespace' did not complete \(Connection.*state is unknown\n\z/,
+ 'a lost reply of the export leaves the state unknown',
+ );
+ ok(!grep({ /destroy|remove/ } ops($res)->@*), 'and is not compensated');
+ ok($fake->{m}->{ds}->{'tank/vm-200-disk-0'} && ns_of($fake, 4), 'so the disk is kept');
+
+ ($fake, $res) = run_on(
+ 'alloc',
+ before_call => sub($f, $call) {
+ $f->add_zvol('tank/vm-777-disk-0', identity => [$NQN, 4, $U{9}])
+ if $call->{index} == 6 && !$f->{m}->{ds}->{'tank/vm-777-disk-0'};
+ },
+ );
+ like(
+ $res->{error},
+ qr/duplicate NVMe identity on 'tank\/vm-200-disk-0'/,
+ 'a duplicate that appears before the verify read is refused',
+ );
+ ok(
+ !$fake->{m}->{ds}->{'tank/vm-200-disk-0'} && !ns_of($fake, 4),
+ 'the new zvol is destroyed',
+ );
+ ok($fake->{m}->{ds}->{'tank/vm-777-disk-0'}, 'the other zvol is kept');
+
+ ($fake, $res) = run_on(
+ 'alloc',
+ before_call => sub($f, $call) {
+ my $ds = $f->{m}->{ds}->{'tank/vm-200-disk-0'};
+ $ds->{props}->{'proxmox:nvme-uuid'} = $U{9} if $ds && $call->{index} == 6;
+ },
+ );
+ is(
+ $res->{error},
+ "NVMe identity of zvol 'tank/vm-200-disk-0' changed\n",
+ 'an identity that changes before the verify read is refused',
+ );
+ ok(!ns_of($fake, 4), 'the new namespace is removed');
+ ok($fake->{m}->{ds}->{'tank/vm-200-disk-0'}, 'but a zvol without our identity is kept');
+
+ # A namespace of another zvol that was renamed away while exported uses
+ # the device path of the new zvol: only what this call built is removed.
+ ($fake, $res) = run_on(
+ 'alloc',
+ faults => { 5 => 'before' },
+ before_call => sub($f, $call) {
+ $f->add_namespace($NQN, 9, $U{9}, '/dev/zvol/tank/vm-200-disk-0')
+ if $call->{index} == 0;
+ },
+ );
+ like($res->{error}, qr/'export namespace' failed: injected failure/, 'a failed export');
+ ok(
+ exported($fake, 9, $U{9}, '/dev/zvol/tank/vm-200-disk-0'),
+ 'keeps an enabled namespace of another UUID with the same device path',
+ );
+ ok(
+ !grep({ grep { write_to($_, '/namespaces/9/enable') } $_->{steps}->@* }
+ $res->{calls}->@*),
+ 'without touching it',
+ );
+
+ ($fake, $res) = run_on(
+ 'alloc',
+ faults => { 5 => 'before' },
+ fail => [['zfs', 'destroy'], "cannot destroy 'tank/vm-200-disk-0': dataset is busy"],
+ );
+ like(
+ $res->{error},
+ qr/'export namespace' failed: injected failure/,
+ 'keeps the first error',
+ );
+ my $cleanup = qr/\Afailed to clean up zvol 'vm-200-disk-0': NVMe target operation/;
+ is(
+ scalar(grep { /$cleanup 'destroy zvol' failed: cannot destroy/ } $res->{warnings}->@*),
+ 1,
+ 'a failed cleanup is reported',
+ );
+
+ # ssh gives up on a call, which the target still runs to its end later
+ ($fake, $res) = run_on('alloc', faults => { 3 => 'late' });
+ is(
+ $res->{error},
+ "NVMe target operation 'create zvol' did not complete (timeout);"
+ . " the target state is unknown\n",
+ 'a create that did not complete in time',
+ );
+ is($res->{calls}->[-1]->{op}, 'create zvol', 'is not followed by anything');
+ my $second =
+ flow($fake, sub { $PLUGIN->alloc_image('st', scfg(), 201, 'raw', undef, 1024) });
+ is($second->{error}, '', 'another allocation meanwhile');
+ $fake->land;
+ is_deeply(
+ [map { owned_volumes($fake->{m})->{"tank/vm-$_-disk-0"}->[0] } 200, 201],
+ [4, 5],
+ 'never gets the NSID of the create that completes afterwards',
+ );
+ $res = flow($fake, $ACT{activate});
+ ok(
+ !$res->{error} && ns_of($fake, 4) && ns_of($fake, 5),
+ 'and the next activation exports both',
+ );
+
+ ($fake, $res) = run_on(
+ 'alloc',
+ before_call =>
+ sub($f, $call) { die "received interrupt\n" if $call->{op} eq 'export namespace' },
+ );
+ is($res->{error}, "received interrupt\n", 'a stopped task');
+ ok(!grep({ /destroy|remove/ } ops($res)->@*), 'is not compensated either');
+
+ ($fake, $res) = run_on('alloc', read_fault => { after => 5, mode => 'failed' });
+ is(
+ $res->{error},
+ "NVMe target operation 'read target state' did not complete (ssh failed);"
+ . " the target state is unknown\n",
+ 'a read under the lock that ssh did not run to its end',
+ );
+ ok(!grep({ /destroy|remove/ } ops($res)->@*), 'is not followed by a compensation');
+
+ $fake = lifecycle_fake();
+ $fake->add_zvol('tank/vm-200-disk-0');
+ my $named = sub { $PLUGIN->alloc_image('st', scfg(), 200, 'raw', 'vm-200-disk-0', 1024) };
+ refused($fake, $named, qr/zvol 'tank\/vm-200-disk-0' already exists/, 'an existing zvol');
+ $fake = lifecycle_fake();
+ delete $fake->{m}->{subsystems}->{$NQN};
+ refused(
+ $fake,
+ 'alloc',
+ qr/NVMe subsystem does not exist; activate the storage first/,
+ 'an allocation without the subsystem',
+ );
+ $res =
+ flow($fake, sub { $PLUGIN->alloc_image('st', scfg(), 200, 'raw', 'vm-201-disk-0', 1024) });
+ like($res->{error}, qr/illegal name 'vm-201-disk-0'/, 'names must belong to the VM');
+};
+
+subtest 'clone' => sub {
+ my ($fake, $res) = run_on('clone');
+ is($res->{error}, '', 'a linked clone');
+ is($res->{result}, 'base-102-disk-0/vm-201-disk-0', 'is named after its base');
+ my $clone = $fake->{m}->{ds}->{'tank/vm-201-disk-0'};
+ is($clone->{origin}, 'tank/base-102-disk-0@__base__', 'from the base snapshot');
+ my $uuid = $clone->{props}->{'proxmox:nvme-uuid'};
+ ok(exported($fake, 4, $uuid, '/dev/zvol/tank/vm-201-disk-0'), 'with its own identity');
+
+ $fake = lifecycle_fake();
+ $res =
+ flow($fake, sub { $PLUGIN->clone_image(scfg(), 'st', 'base-102-disk-0', 201, 'missing') });
+ like(
+ $res->{error},
+ qr/'create zvol' failed: cannot open 'tank\/base-102-disk-0\@missing'/,
+ 'a missing snapshot',
+ );
+ ok(!$fake->{m}->{ds}->{'tank/vm-201-disk-0'}, 'leaves nothing behind');
+ $res = flow($fake, sub { $PLUGIN->clone_image(scfg(), 'st', 'base-102-disk-0', 201, '') });
+ is($res->{error}, '', 'an empty snapshot name');
+ is(
+ $fake->{m}->{ds}->{'tank/vm-201-disk-0'}->{origin},
+ 'tank/base-102-disk-0@__base__',
+ 'means the base snapshot',
+ );
+
+ for my $case (
+ ['basevol-102-disk-0', qr/clone_image requires a ZFS volume/],
+ ['vm-100-disk-0', qr/clone_image only works on base images/],
+ ) {
+ $res = flow($fake, sub { $PLUGIN->clone_image(scfg(), 'st', $case->[0], 201) });
+ like($res->{error}, $case->[1], "refuses $case->[0]");
+ is(scalar($res->{calls}->@*), 0, 'locally');
+ }
+ $res =
+ flow($fake, sub { $PLUGIN->clone_image(scfg(), 'st', 'base-102-disk-0', 201, 'a b') });
+ like($res->{error}, qr/invalid snapshot name/, 'refuses a malformed snapshot name');
+};
+
+subtest 'destroy' => sub {
+ my $dev = '/dev/zvol/tank/vm-101-disk-0';
+ my ($fake, $res) = run_on('free');
+ is($res->{error}, '', 'a volume is freed');
+ is_deeply(ops($res), ['read target state', 'destroy zvol'], 'in two calls');
+ ok(!$fake->{m}->{ds}->{'tank/vm-101-disk-0'} && !ns_of($fake, 2), 'both are gone');
+ $res = flow($fake, $ACT{free});
+ is($res->{error}, '', 'a missing volume is already freed');
+ is(changes($res), 0, 'without changes');
+
+ for my $case (
+ [
+ 'a volume that is not owned',
+ 'vm-900-disk-0',
+ undef,
+ qr/is not owned by NVMe subsystem/,
+ ],
+ [
+ 'a UUID exported at another NSID',
+ 'vm-101-disk-0',
+ sub($f) { $f->add_namespace($NQN, 9, $U{2}, '/dev/zvol/tank/x', 0) },
+ qr/namespace UUID '\Q@{[ $U{2} ]}\E' is already in use/,
+ ],
+ [
+ 'another identity at its NSID',
+ 'vm-101-disk-0',
+ sub($f) { ns_of($f, 2)->{device_uuid} = $U{9} },
+ qr/NVMe namespace ID '2' has a different identity/,
+ ],
+ [
+ 'a duplicate identity',
+ 'vm-101-disk-0',
+ sub($f) { $f->add_zvol('tank/vm-104-disk-0', identity => [$NQN, 2, $U{9}]) },
+ qr/duplicate NVMe identity/,
+ ],
+ ) {
+ my ($name, $volume, $change, $error) = $case->@*;
+ $fake = lifecycle_fake();
+ $change->($fake) if $change;
+ refused($fake, sub { $PLUGIN->free_image('st', scfg(), $volume) }, $error, $name);
+ }
+ $res = flow($fake, sub { $PLUGIN->free_image('st', scfg(), 'subvol-100-disk-0') });
+ like($res->{error}, qr/free_image requires a ZFS volume/, 'subvolumes are refused');
+
+ my $busy = 'Device or resource busy';
+ ($fake, $res) =
+ run_on('free', fail => [{ write => '/namespaces/2/enable', value => 0 }, $busy]);
+ like($res->{error}, qr/cannot disable namespace '2': .*busy/, 'a failed disable');
+ ok(exported($fake, 2, $U{2}, $dev), 'keeps the namespace');
+
+ ($fake, $res) = run_on('free', fail => [['rmdir', "$S/namespaces/2"], $busy]);
+ like(
+ $res->{error},
+ qr/cannot remove namespace '2': Device or resource busy\n\z/,
+ 'a failed rmdir',
+ );
+ ok(exported($fake, 2, $U{2}, $dev), 're-enables the namespace');
+ is($res->{calls}->[-1]->{op}, 'enable namespace', 'from a fresh read');
+
+ my $rmdir_and_enable = sub($s) {
+ step_is($s, 'rmdir', "$S/namespaces/2") || write_to($s, '/namespaces/2/enable', 1);
+ };
+ ($fake, $res) = run_on('free', fail => [$rmdir_and_enable, $busy]);
+ like(
+ $res->{error},
+ qr/cannot remove namespace '2': .*; cannot restore namespace: /,
+ 'a failed restore is reported too',
+ );
+
+ my $destroy = ['zfs', 'destroy', '-r', 'tank/vm-101-disk-0'];
+ local $SLEPT = 0;
+ ($fake, $res) = run_on('free', fail => [$destroy, $busy]);
+ like(
+ $res->{error},
+ qr/\Afailed to destroy 'tank\/vm-101-disk-0': Device or resource busy; namespace restored/,
+ 'a zvol that stays busy',
+ );
+ is(scalar(grep { $_ eq 'destroy zvol' } ops($res)->@*), 6, 'is destroyed six times');
+ is($SLEPT, 5, 'a second apart');
+ ok(exported($fake, 2, $U{2}, $dev), 'and its namespace is restored');
+
+ ($fake, $res) = run_on('free', fail => [$destroy, $busy, 3]);
+ is($res->{error}, '', 'a zvol that becomes free is destroyed by a retry');
+ ok(!$fake->{m}->{ds}->{'tank/vm-101-disk-0'}, 'and is gone');
+
+ ($fake, $res) = run_on('free', fail => [$destroy, $busy, 1], faults => { 3 => 'after' });
+ like(
+ $res->{error},
+ qr/'destroy zvol' did not complete .* state is unknown\n\z/,
+ 'a retry whose reply is lost',
+ );
+ is($res->{calls}->[-1]->{op}, 'destroy zvol', 'is not followed by anything');
+
+ ($fake, $res) = run_on(
+ 'free',
+ fail => [$destroy, $busy],
+ read_fault => { after => 1, mode => 'unreachable' },
+ );
+ is(
+ $res->{error},
+ "failed to destroy 'tank/vm-101-disk-0': Device or resource busy\n",
+ 'a failed destroy whose outcome cannot be read is a failure',
+ );
+ ok($fake->{m}->{ds}->{'tank/vm-101-disk-0'}, 'and the zvol is still there');
+
+ ($fake, $res) = run_on(
+ 'free',
+ step_fault => sub($step, $call) {
+ return 'dataset is busy' if step_is($step, $destroy->@*);
+ return 'File exists' if step_is($step, 'mkdir', "$S/namespaces/2");
+ return undef;
+ },
+ );
+ like(
+ $res->{error},
+ qr/failed to destroy 'tank\/vm-101-disk-0': dataset is busy; namespace restoration also/,
+ 'a failed restore after the retries',
+ );
+
+ $fake = lifecycle_fake(fail => [$destroy, $busy]);
+ delete $fake->{m}->{subsystems}->{$NQN}->{ns}->{2};
+ $res = flow($fake, $ACT{free});
+ like(
+ $res->{error},
+ qr/\Afailed to destroy 'tank\/vm-101-disk-0': Device or resource busy\n\z/,
+ 'an unexported busy zvol is reported without restore',
+ );
+ ok(!ns_of($fake, 2), 'and stays unexported');
+
+ $fake = lifecycle_fake();
+ delete $fake->{m}->{subsystems}->{$NQN};
+ delete $_->{links}->{$NQN} for values $fake->{m}->{ports}->%*;
+ $res = flow($fake, $ACT{free});
+ is($res->{error}, '', 'a volume is freed without subsystem');
+ ok(!$fake->{m}->{ds}->{'tank/vm-101-disk-0'}, 'nothing exports it');
+};
+
+subtest 'rollback' => sub {
+ my $dev = '/dev/zvol/tank/vm-100-disk-0';
+ my ($fake, $res) = run_on('rollback');
+ is($res->{error}, '', 'a rollback');
+ is_deeply(
+ ops($res),
+ ['read target state', 'rollback zvol', 'wait for zvol', 'restore namespace'],
+ 'unexports, rolls back and exports again',
+ );
+ ok(exported($fake, 1, $U{1}, $dev), 'with the same identity');
+
+ # A snapshot without the identity properties: the rollback loses them.
+ my $bare = sub(%opts) {
+ my $f = lifecycle_fake(%opts);
+ $f->add_snapshot('tank/vm-100-disk-0@bare', props => {});
+ return $f;
+ };
+ for my $case (
+ ['the disable', { write => '/namespaces/1/enable', value => 0 }],
+ ['the rmdir', ['rmdir', "$S/namespaces/1"]],
+ ['the rollback', ['zfs', 'rollback']],
+ ['the identity', ['zfs', 'set']],
+ ) {
+ my ($name, $match) = $case->@*;
+ $fake = $bare->(fail => [$match, "injected $name failure", 1]);
+ $res = flow(
+ $fake,
+ sub { $PLUGIN->volume_snapshot_rollback(scfg(), 'st', 'vm-100-disk-0', 'bare') },
+ );
+ like(
+ $res->{error},
+ qr/\ANVMe target operation 'rollback zvol' failed: injected \Q$name\E failure\n\z/,
+ "a failure at $name is reported",
+ );
+ ok(exported($fake, 1, $U{1}, $dev), "the namespace is restored after $name");
+ is_deeply(
+ owned_volumes($fake->{m})->{'tank/vm-100-disk-0'},
+ [1, $U{1}],
+ 'with identity',
+ );
+ }
+ my @restore = grep { $_->{op} eq 'restore namespace' } $res->{calls}->@*;
+ ok(step_is($restore[0]->{steps}->[0], 'zfs', 'set'), 'a lost identity is written first');
+
+ ($fake, $res) = run_on(
+ 'rollback',
+ step_fault => sub($step, $call) {
+ return 'rollback failed' if step_is($step, 'zfs', 'rollback');
+ return 'mkdir failed' if step_is($step, 'mkdir');
+ return undef;
+ },
+ );
+ like(
+ $res->{error},
+ qr/
+ \Arollback\ failed:\ NVMe\ target\ operation\ 'rollback\ zvol'\ failed:
+ \ rollback\ failed;
+ \ namespace\ restoration\ failed:\ NVMe\ target\ operation\ 'restore\ namespace'
+ \ failed:\ mkdir\ failed\n\z
+ /x,
+ 'both failures are reported',
+ );
+ ($fake, $res) = run_on('rollback', fail => [['mkdir'], 'mkdir failed']);
+ like(
+ $res->{error},
+ qr/\Anamespace restoration failed after rollback: .*mkdir failed\n\z/,
+ 'a failed export after a good rollback is reported',
+ );
+
+ $fake = lifecycle_fake();
+ for my $case (
+ ['a malformed snapshot name', 'vm-100-disk-0', 'a b', qr/invalid snapshot name/],
+ [
+ 'a subvolume',
+ 'subvol-100-disk-0',
+ 'snap1',
+ qr/snapshot rollback requires a ZFS volume/,
+ ],
+ ['a volume that is not owned', 'vm-900-disk-0', 'snap1', qr/is not owned/],
+ ) {
+ my ($name, $volume, $snap, $error) = $case->@*;
+ my $rollback = sub { $PLUGIN->volume_snapshot_rollback(scfg(), 'st', $volume, $snap) };
+ refused($fake, $rollback, $error, $name);
+ }
+ my $taken = lifecycle_fake();
+ $taken->add_namespace($NQN, 1, $U{9}, '/dev/zvol/tank/vm-900-disk-0');
+ refused(
+ $taken,
+ 'rollback',
+ qr/NVMe namespace ID '1' has a different identity/,
+ 'a namespace ID that holds another identity',
+ );
+ delete $fake->{m}->{subsystems}->{$NQN};
+ refused(
+ $fake,
+ 'rollback',
+ qr/NVMe subsystem does not exist/,
+ 'a rollback without the subsystem',
+ );
+};
+
+subtest 'template' => sub {
+ my $old = '/dev/zvol/tank/vm-101-disk-0';
+ my $new = '/dev/zvol/tank/base-101-disk-0';
+ my ($fake, $res) = run_on('template');
+ is($res->{result}, 'base-101-disk-0', 'a template');
+ is_deeply(
+ ops($res),
+ ['read target state', 'rename zvol', 'wait for zvol', 'create template'],
+ 'is renamed, exported and snapshotted',
+ );
+ ok(exported($fake, 2, $U{2}, $new), 'under the same identity');
+ ok($fake->{m}->{snaps}->{'tank/base-101-disk-0@__base__'}, 'with its base snapshot');
+
+ my $restored = sub($f) {
+ return
+ exported($f, 2, $U{2}, $old)
+ && $f->{m}->{ds}->{'tank/vm-101-disk-0'}
+ && !$f->{m}->{ds}->{'tank/base-101-disk-0'};
+ };
+ for my $case (
+ ['the unexport', sub($s, $c) { write_to($s, '/namespaces/2/enable', 0) }],
+ ['the rename', sub($s, $c) { step_is($s, 'zfs', 'rename', 'tank/vm-101-disk-0') }],
+ ['the export', sub($s, $c) { step_is($s, 'mkdir') && $c->{op} eq 'create template' }],
+ ['the snapshot', sub($s, $c) { step_is($s, 'zfs', 'snapshot') }],
+ ) {
+ my ($name, $match) = $case->@*;
+ my $fault =
+ sub($step, $call) { $match->($step, $call) ? "injected $name failure" : undef };
+ ($fake, $res) = run_on('template', step_fault => $fault);
+ my $prefix = qr/\Atemplate conversion failed: NVMe target operation '[a-z ]+' failed:/;
+ like(
+ $res->{error},
+ qr/$prefix injected \Q$name\E failure\n\z/,
+ "a failure at $name is reported",
+ );
+ ok($restored->($fake), "the old name is exported again after $name");
+ }
+
+ ($fake, $res) = run_on(
+ 'template',
+ after_call => sub($f, $call) {
+ $f->{m}->{ds}->{'tank/base-101-disk-0'}->{devwait} = 1000
+ if $call->{op} eq 'rename zvol';
+ },
+ );
+ like(
+ $res->{error},
+ qr/\Atemplate conversion failed: zvol '\Q$new\E' is not a block device after 10 seconds\n/,
+ 'a device that never appears',
+ );
+ ok($restored->($fake), 'is renamed back');
+
+ ($fake, $res) = run_on('template', faults => { 1 => 'late' });
+ like(
+ $res->{error},
+ qr/\ANVMe target operation 'rename zvol' did not complete .* state is unknown\n\z/,
+ 'a rename that does not complete in time is passed on as it is',
+ );
+ ok(!grep({ $_->{op} =~ /back|restore/ } $res->{calls}->@*), 'is not compensated');
+ $fake->land;
+ $res = flow($fake, $ACT{activate});
+ ok(!$res->{error} && exported($fake, 2, $U{2}, $new), 'the next activation exports it');
+
+ my $taken = lifecycle_fake();
+ $taken->add_namespace($NQN, 2, $U{9}, '/dev/zvol/tank/vm-900-disk-0');
+ refused(
+ $taken,
+ 'template',
+ qr/NVMe namespace ID '2' has a different identity/,
+ 'a namespace ID that holds another identity',
+ );
+ $fake = lifecycle_fake();
+ $fake->add_zvol('tank/base-101-disk-0');
+ refused(
+ $fake,
+ 'template',
+ qr/template zvol 'tank\/base-101-disk-0' already exists/,
+ 'a taken name',
+ );
+ $res = flow($fake, sub { $PLUGIN->create_base('st', scfg(), 'base-102-disk-0') });
+ like($res->{error}, qr/create_base not possible with base image/, 'refuses a base');
+ refused(
+ $fake,
+ sub { $PLUGIN->create_base('st', scfg(), 'vm-900-disk-0') },
+ qr/is not owned/,
+ 'a volume that is not owned',
+ );
+};
+
+subtest 'resize' => sub {
+ my ($fake, $res) = run_on('resize');
+ is($res->{error}, '', 'an exported volume grows');
+ is($res->{result}, 2 * 1024**2, 'the new size in KiB is returned');
+ is_deeply(ops($res), ['read target state', 'resize zvol'], 'read, then resize');
+ ok(!grep({ !$_->{locked} } $res->{calls}->@*), 'under the lock');
+ is($fake->{revalidated}->{"$NQN/1"}, 1,
+ 'the namespace reads the new size in the same call');
+
+ $fake = lifecycle_fake();
+ delete $fake->{m}->{subsystems}->{$NQN}->{ns}->{1};
+ $res = flow($fake, $ACT{resize});
+ is($res->{error}, '', 'an unexported volume grows');
+ is(scalar($res->{calls}->[1]->{steps}->@*), 1, 'without revalidation');
+ $fake = lifecycle_fake();
+ ns_of($fake, 1)->{enable} = '0';
+ $res = flow($fake, $ACT{resize});
+ is(scalar($res->{calls}->[1]->{steps}->@*), 1, 'a disabled namespace is not revalidated');
+ $fake = lifecycle_fake()->reboot(0);
+ $res = flow($fake, $ACT{resize});
+ is($res->{error}, '', 'a volume grows after a target restart');
+ is($fake->{m}->{ds}->{'tank/vm-100-disk-0'}->{volsize}, 2 * 1024**3,
+ 'once nvmet is loaded');
+
+ for my $case (
+ [
+ 'a duplicate UUID',
+ 'vm-100-disk-0',
+ sub($f) { $f->add_namespace($NQN, 9, $U{1}, '/dev/zvol/tank/x', 0) },
+ qr/duplicate namespace UUID/,
+ ],
+ ['a volume that is not owned', 'vm-900-disk-0', sub($f) { }, qr/is not owned/],
+ ['a volume of another subsystem', 'vm-901-disk-0', sub($f) { }, qr/is not owned/],
+ ) {
+ my ($name, $volname, $change, $error) = $case->@*;
+ $fake = lifecycle_fake();
+ $change->($fake);
+ my $resize = sub { $PLUGIN->volume_resize(scfg(), 'st', $volname, 2 * 1024**3) };
+ refused($fake, $resize, $error, $name);
+ }
+ ($fake, $res) = run_on('resize', fail => [['zfs', 'set'], 'out of space']);
+ like($res->{error}, qr/'resize zvol' failed: out of space/, 'a failed resize');
+ is_deeply(ops($res), ['read target state', 'resize zvol'], 'stops there');
+ ($fake, $res) =
+ run_on('resize', fail => [{ write => 'revalidate_size' }, 'Invalid argument']);
+ like($res->{error}, qr/'resize zvol' failed: Invalid argument/, 'a failed revalidation');
+ is($fake->{m}->{ds}->{'tank/vm-100-disk-0'}->{volsize}, 2 * 1024**3, 'keeps the new size');
+};
+
+sub removal_fake(%opts) {
+ my $fake = target_fake(%opts);
+ $fake->add_zvol('other/foreign-disk', identity => [$FOREIGN_NQN, 1, $U{8}]);
+ $fake->add_subsystem(
+ $FOREIGN_NQN,
+ model => 'Linux',
+ serial => '0123456789abcdef',
+ acl => [$HOSTS[0]],
+ );
+ $fake->add_namespace($FOREIGN_NQN, 1, $U{8}, '/dev/zvol/other/foreign-disk');
+ $fake->{m}->{ports}->{1}->{links}->{$FOREIGN_NQN} = 1;
+ return $fake;
+}
+
+subtest 'target removal' => sub {
+ my $fake = removal_fake();
+ my $res = flow($fake, $ACT{remove});
+ is($res->{error}, '', 'the subsystem is removed');
+ is_deeply(
+ ops($res),
+ [
+ 'read target state',
+ 'remove NVMe subsystem',
+ 'read target state',
+ 'remove orphan NVMe hosts',
+ ],
+ 'teardown, then orphans from a fresh read',
+ );
+ my $m = $fake->{m};
+ ok(
+ !$m->{subsystems}->{$NQN} && $m->{hosts}->{ $HOSTS[0] } && !$m->{hosts}->{ $HOSTS[1] },
+ 'subsystem and orphan host are gone, the host linked by another subsystem stays',
+ );
+ ok($m->{ports}->{1} && $m->{ports}->{2}, 'ports are never removed');
+ $res = flow($fake, $ACT{remove});
+ is($res->{error}, '', 'a removed subsystem is already removed');
+ is_deeply(ops($res), ['read target state'], 'with nothing left to do');
+
+ $fake = removal_fake();
+ delete $fake->{m}->{subsystems}->{$NQN};
+ delete $_->{links}->{$NQN} for values $fake->{m}->{ports}->%*;
+ $res = flow($fake, $ACT{remove});
+ is_deeply(
+ ops($res),
+ ['read target state', 'remove orphan NVMe hosts'],
+ 'without subsystem the configured hosts are candidates',
+ );
+ ok(
+ $fake->{m}->{hosts}->{ $HOSTS[0] } && !$fake->{m}->{hosts}->{ $HOSTS[1] },
+ 'only unlinked hosts go',
+ );
+
+ for my $case (
+ [
+ 'an owned volume',
+ sub($f) { add_volume($f, 'vm-100-disk-0', 1, $U{1}, unexported => 1) },
+ qr/owned ZFS volume 'tank\/vm-100-disk-0' exists/,
+ ],
+ [
+ 'a foreign subsystem',
+ sub($f) { $f->{m}->{subsystems}->{$NQN}->{attr}->{attr_model} = 'Linux' },
+ qr/refusing to delete foreign NVMe subsystem/,
+ ],
+ [
+ 'remaining namespaces',
+ sub($f) { $f->add_namespace($NQN, 3, $U{3}, '(null)', 0) },
+ qr/namespaces remain/,
+ ],
+ ) {
+ my ($name, $change, $error) = $case->@*;
+ $fake = removal_fake();
+ $change->($fake);
+ refused($fake, 'remove', $error, $name);
+ }
+
+ $fake =
+ removal_fake(fail => [['rmdir', "$ROOT/hosts/$HOSTS[1]"], 'Device or resource busy']);
+ $res = flow($fake, $ACT{remove});
+ is($res->{error}, '', 'a failed orphan removal');
+ like(
+ $res->{warnings}->[0],
+ qr/could not remove orphan NVMe host\(s\): Device or resource busy/,
+ 'only warns',
+ );
+
+ $fake = removal_fake(fail => [['rmdir', $S], 'Directory not empty']);
+ $res = flow($fake, $ACT{remove});
+ like(
+ $res->{error},
+ qr/cannot remove NVMe subsystem '\Q$NQN\E': Directory not empty/,
+ 'a failed teardown is reported',
+ );
+ ok($fake->{m}->{subsystems}->{$NQN}, 'and the subsystem stays');
+};
+
+subtest 'snapshots and the generic ZFS calls' => sub {
+ my $fake = lifecycle_fake();
+ my $res =
+ flow($fake, sub { $PLUGIN->volume_snapshot(scfg(), 'st', 'vm-100-disk-0', 'snap_2.0') });
+ is($res->{error}, '', 'a snapshot');
+ ok($fake->{m}->{snaps}->{'tank/vm-100-disk-0@snap_2.0'}, 'is taken');
+ is(scalar($res->{locks}->@*), 1, 'under the target lock');
+ $res = flow(
+ $fake,
+ sub { $PLUGIN->volume_rollback_is_possible(scfg(), 'st', 'vm-100-disk-0', 'snap1') },
+ );
+ like(
+ $res->{error},
+ qr/'snap1' is not most recent snapshot/,
+ 'only from the latest snapshot',
+ );
+ $res = flow(
+ $fake,
+ sub { $PLUGIN->volume_snapshot_delete(scfg(), 'st', 'vm-100-disk-0', 'snap_2.0') },
+ );
+ ok(
+ !$res->{error} && !$fake->{m}->{snaps}->{'tank/vm-100-disk-0@snap_2.0'},
+ 'deleted by name',
+ );
+ is(scalar($res->{locks}->@*), 1, 'under the target lock too');
+ $res = flow(
+ $fake,
+ sub { $PLUGIN->volume_rollback_is_possible(scfg(), 'st', 'vm-100-disk-0', 'snap1') },
+ );
+ is($res->{result}, 1, 'now the rollback is possible');
+ $res = flow(
+ $fake,
+ sub { $PLUGIN->volume_rollback_is_possible(scfg(), 'st', 'vm-100-disk-0', 'gone') },
+ );
+ like($res->{error}, qr/snapshot 'gone' does not exist/, 'and needs an existing snapshot');
+ $res = flow($fake, sub { $PLUGIN->volume_snapshot_info(scfg(), 'st', 'vm-100-disk-0') });
+ is_deeply([sort keys $res->{result}->%*], ['snap1'], 'snapshot information');
+
+ $res = flow($fake, sub { [$PLUGIN->volume_size_info(scfg(), 'st', 'vm-100-disk-0', 7)] });
+ is_deeply($res->{result}, [1073741824, 'raw', 4096, undef], 'size information');
+ is($res->{calls}->[0]->{timeout}, 7, 'with the timeout of the caller');
+ $res =
+ flow($fake, sub { scalar($PLUGIN->volume_size_info(scfg(), 'st', 'vm-100-disk-0')) });
+ is($res->{result}, 1073741824, 'the size alone in scalar context');
+
+ # Snapshot names are validated before zfs reads '%' and ',' in them as a
+ # range and a list, and the pool name wherever a call uses it.
+ for my $case (
+ ['volume_snapshot', 'a b'],
+ ['volume_snapshot_delete', 'snap1%'],
+ ['volume_rollback_is_possible', 'snap1,snap2'],
+ ) {
+ my ($method, $snap) = $case->@*;
+ $res = refused(
+ $fake,
+ sub { $PLUGIN->$method(scfg(), 'st', 'vm-100-disk-0', $snap) },
+ qr/\Ainvalid snapshot name\n\z/,
+ "$method with the snapshot name '$snap'",
+ );
+ is(scalar($res->{calls}->@*), 0, 'locally');
+ }
+ my $bad_pool = scfg(pool => '-rH');
+ for my $case (
+ ['list_images', sub { $PLUGIN->list_images('st', $bad_pool) }],
+ [
+ 'volume_size_info',
+ sub { $PLUGIN->volume_size_info($bad_pool, 'st', 'vm-100-disk-0') },
+ ],
+ [
+ 'volume_snapshot_info',
+ sub { $PLUGIN->volume_snapshot_info($bad_pool, 'st', 'vm-100-disk-0') },
+ ],
+ [
+ 'volume_snapshot',
+ sub { $PLUGIN->volume_snapshot($bad_pool, 'st', 'vm-100-disk-0', 'snap2') },
+ ],
+ ) {
+ $res = refused(
+ $fake,
+ $case->[1],
+ qr/\Ainvalid ZFS pool name\n\z/,
+ "$case->[0] with an invalid pool name",
+ );
+ is(scalar($res->{calls}->@*), 0, 'locally');
+ }
+ my @warnings;
+ {
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ $res = flow($fake, sub { [$PLUGIN->status('st', $bad_pool)] });
+ }
+ is_deeply(
+ [$res->{result}, $res->{calls}, \@warnings],
+ [[0, 0, 0, 0], [], ["storage 'st': invalid ZFS pool name\n"]],
+ 'status with an invalid pool name is inactive, locally',
+ );
+
+ # The plugin creates zvols only.
+ for my $case (
+ [
+ 'volume_snapshot',
+ sub { $PLUGIN->volume_snapshot(scfg(), 'st', 'subvol-100-disk-0', 's') },
+ ],
+ [
+ 'volume_size_info',
+ sub { $PLUGIN->volume_size_info(scfg(), 'st', 'subvol-100-disk-0') },
+ ],
+ ) {
+ $res = refused(
+ $fake,
+ $case->[1],
+ qr/\A$case->[0] requires a ZFS volume\n\z/,
+ "$case->[0] of a subvolume",
+ );
+ is(scalar($res->{calls}->@*), 0, 'locally');
+ }
+};
+
+subtest 'lock ownership' => sub {
+ my $fake = lifecycle_fake();
+ pipe(my $reader, my $writer) or die "pipe: $!\n";
+ my $child;
+ $fake->{before_call} = sub($f, $call) {
+ return if $child || $call->{op} ne 'create zvol';
+ $child = fork() // die "fork: $!\n";
+ return if $child;
+ close($reader);
+ my $res = flow(
+ $f, sub { $PLUGIN->volume_resize(scfg(), 'st', 'vm-100-disk-0', 2 * 1024**3, 0) },
+ );
+ my $locked = grep { $_->{pid} == $$ } $res->{locks}->@*;
+ my @counts = ($locked, scalar($res->{nested}->@*), scalar($res->{calls}->@*));
+ print {$writer} "@counts\n";
+ close($writer);
+ POSIX::_exit(0);
+ };
+ my $res = flow($fake, sub { $PLUGIN->alloc_image('st', scfg(), 200, 'raw', undef, 1024) });
+ close($writer);
+ my $line = <$reader>;
+ waitpid($child, 0);
+ is($res->{error}, '', 'the parent keeps its lock');
+ is($line, "1 1 0\n", 'a child requests the lock itself, waits and changes nothing');
+
+ local $QUORATE = 0;
+ $fake = lifecycle_fake();
+ for my $action (qw(alloc free rollback template resize remove)) {
+ $res = flow($fake, $ACT{$action});
+ like($res->{error}, qr/cluster not quorate/, "$action needs quorum");
+ ok(!$res->{locks}->@* && !changes($res), 'and fails before the lock');
+ }
+};
+
+subtest 'target call timeouts' => sub {
+ my ($fake, $res) = run_on('alloc', after_call => sub($f, $call) { $NOW += 100 });
+ is($res->{error}, '', 'slow target calls do not end an operation');
+ is_deeply(
+ [map { $_->{timeout} } grep { $_->{locked} } $res->{calls}->@*],
+ [15, 60, 60, 15, 30, 15],
+ 'reads take up to 15 s, zfs changes 60 s and configfs changes 30 s',
+ );
+
+ # in a worker, a zfs change may take an hour, like in the other ZFS plugins
+ my $rpcenv_mock = Test::MockModule->new('PVE::RPCEnvironment');
+ $rpcenv_mock->redefine(is_worker => sub(@args) { return 1 });
+ my %timeouts;
+ for my $action (qw(alloc template resize rollback free)) {
+ (undef, $res) = run_on($action);
+ $timeouts{ $_->{op} } = $_->{timeout} for $res->{calls}->@*;
+ }
+ is_deeply(
+ [
+ @timeouts{
+ 'reserve namespace ID',
+ 'create zvol',
+ 'rename zvol',
+ 'create template',
+ 'resize zvol',
+ 'rollback zvol',
+ 'restore namespace',
+ 'destroy zvol',
+ },
+ ],
+ [(3600) x 8],
+ 'every zfs change',
+ );
+ $rpcenv_mock->unmock_all();
+};
+
+# ---------------------------------------------------------------------------
+# Fault sweep
+# ---------------------------------------------------------------------------
+
+# The goals of the swept flows. They only read the state: a lookup that
+# created a missing namespace would change the outcome of the next check.
+sub exported_ns($m, $nsid) {
+ my $subsys = $m->{subsystems}->{$NQN} // return undef;
+ return $subsys->{ns}->{$nsid};
+}
+
+sub template_done($m, $res) {
+ my $ds = owned_volumes($m)->{'tank/base-101-disk-0'} // return 'template missing';
+ my $ns = exported_ns($m, 2) // return 'template not exported';
+ return 'template not exported' if $ns->{device_path} ne '/dev/zvol/tank/base-101-disk-0';
+ return $m->{snaps}->{'tank/base-101-disk-0@__base__'} ? () : 'base snapshot missing';
+}
+
+sub new_volume_done($name) {
+ return sub($m, $res) {
+ my $owned = owned_volumes($m)->{"tank/$name"} // return "$name missing";
+ my $ns = exported_ns($m, $owned->[0]) // return "$name not exported";
+ return () if $ns->{enable} eq '1' && $ns->{device_uuid} eq $owned->[1];
+ return "$name not exported";
+ };
+}
+
+sub removal_goal($m) {
+ my @bad;
+ push @bad, 'subsystem left' if $m->{subsystems}->{$NQN};
+ push @bad, 'orphan host left' if $m->{hosts}->{ $HOSTS[1] };
+ push @bad, 'shared host removed' if !$m->{hosts}->{ $HOSTS[0] };
+ push @bad, 'port removed' if !$m->{ports}->{1} || !$m->{ports}->{2};
+ return @bad;
+}
+
+subtest 'fault sweep' => sub {
+ sweep(
+ 'create',
+ {
+ setup => \&lifecycle_fake,
+ lost_replies => 1,
+ action => $ACT{alloc},
+ done => new_volume_done('vm-200-disk-0'),
+ },
+ );
+ sweep(
+ 'clone',
+ {
+ setup => \&lifecycle_fake,
+ lost_replies => 1,
+ action => $ACT{clone},
+ done => new_volume_done('vm-201-disk-0'),
+ },
+ );
+ sweep(
+ 'destroy',
+ {
+ setup => \&lifecycle_fake,
+ action => $ACT{free},
+ may_vanish => 'tank/vm-101-disk-0',
+ done => sub($m, $res) { $m->{ds}->{'tank/vm-101-disk-0'} ? 'volume left' : () },
+ },
+ );
+ sweep(
+ 'rollback',
+ {
+ setup => \&lifecycle_fake,
+ action => $ACT{rollback},
+ done => sub($m, $res) {
+ my $ns = exported_ns($m, 1) // return 'not exported';
+ return $ns->{enable} eq '1' ? () : 'not exported';
+ },
+ },
+ );
+ sweep(
+ 'template',
+ {
+ setup => \&lifecycle_fake,
+ action => $ACT{template},
+ renames => { 'tank/vm-101-disk-0' => 'tank/base-101-disk-0' },
+ done => \&template_done,
+ },
+ );
+ sweep(
+ 'resize',
+ {
+ setup => \&lifecycle_fake,
+ action => $ACT{resize},
+ done => sub($m, $res) {
+ my $ds = $m->{ds}->{'tank/vm-100-disk-0'} // return 'volume missing';
+ return 'not resized' if $ds->{volsize} != 2 * 1024**3;
+ return $res->{fake}->{revalidated}->{"$NQN/1"} ? () : 'not revalidated';
+ },
+ },
+ );
+ sweep(
+ 'activation after a configfs loss',
+ {
+ setup => sub () { lifecycle_fake()->reboot(1) },
+ action => $ACT{activate},
+ done => sub($m, $res) { () },
+ },
+ );
+ sweep(
+ 'target removal',
+ {
+ setup => \&removal_fake,
+ action => $ACT{remove},
+ retry => $ACT{remove},
+ goal => \&removal_goal,
+ teardown => 1,
+ done => sub($m, $res) { $m->{subsystems}->{$NQN} ? 'subsystem left' : () },
+ },
+ );
+};
+
+# ---------------------------------------------------------------------------
+# Two storages on one target, serialized by the lock mock
+# ---------------------------------------------------------------------------
+
+subtest 'two storages on one target' => sub {
+ my $nqn_b = 'nqn.2026-01.com.example:zfsnvme-b';
+ my $scfg_a = scfg(pool => 'tank/a');
+ my $scfg_b = scfg(pool => 'tank/b', subsysnqn => $nqn_b);
+ my $new = sub () { FakeTarget->new(pools => [qw(tank tank/a tank/b)]) };
+
+ # B, with another key, takes the lock first, between A's lockless read
+ # and A's locked read
+ my $fake = $new->();
+ my ($res, $b_res);
+ {
+ local $LOCK_HOOK = sub($name) {
+ $b_res = flow($fake, sub { activate($scfg_b, $KEY_B) });
+ };
+ $res = flow($fake, sub { activate($scfg_a, $KEY) });
+ }
+ is($b_res->{error}, '', 'B configures the target first');
+ like($res->{error}, qr/in-use DH-HMAC-CHAP key/, 'A is refused by its locked read');
+ ok(!$fake->{m}->{subsystems}->{$NQN}, 'without creating anything');
+ is_deeply(
+ [map { $fake->{m}->{hosts}->{$_}->{key} } @HOSTS],
+ [$KEY_B, $KEY_B],
+ "B's key is kept",
+ );
+
+ # (a) a target restart between the verify read and the publish
+ for my $loaded (0, 1) {
+ $fake = FakeTarget->new(pools => ['tank']);
+ my $restarted = 0;
+ my @online;
+ my $ctx =
+ { nqn => $NQN, pool => 'tank', hosts => [@HOSTS], key => $KEY, port_ids => [] };
+ $ctx->{foreign} = foreign_view($fake->{m}, [], $NQN, [@HOSTS]);
+ $fake->{before_call} = sub($f, $call) {
+ $f->reboot($loaded) if $call->{op} =~ /\Alink / && !$restarted++;
+ };
+ $fake->{after_call} = sub($f, $call) { push @online, online_violations($f, $ctx) };
+ $res = flow($fake, $ACT{activate});
+ like(
+ $res->{error},
+ qr/cannot publish NVMe subsystem '\Q$NQN\E'/,
+ 'a restart before the publish fails it',
+ );
+ ok(!grep({ $_->{links}->%* } values $fake->{m}->{ports}->%*), 'nothing is linked');
+ $fake->{before_call} = undef;
+ $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'the next activation restores the target');
+ is_deeply(\@online, [], 'never published before the ACLs and keys');
+ ok(
+ $fake->{m}->{ports}->{1}->{links}->{$NQN}
+ && $fake->{m}->{ports}->{2}->{links}->{$NQN},
+ 'and publishes it',
+ );
+ }
+
+ # ports are shared, whoever creates them
+ $fake = $new->();
+ {
+ local $LOCK_HOOK = sub($name) {
+ $b_res = flow($fake, sub { activate($scfg_b, $KEY) });
+ };
+ $res = flow($fake, sub { activate($scfg_a, $KEY) });
+ }
+ ok(!$res->{error} && !$b_res->{error}, 'two storages with one key on the same portals');
+ is_deeply(
+ [sort map { $_->{attr}->{addr_traddr} } values $fake->{m}->{ports}->%*],
+ ['192.0.2.21', '192.0.2.22'],
+ 'share one port per address',
+ );
+ ok(
+ !grep({ !($_->{links}->{$NQN} && $_->{links}->{$nqn_b}) }
+ values $fake->{m}->{ports}->%*),
+ 'both subsystems are published on both',
+ );
+
+ # lifecycle operations of both storages
+ my ($a_vol, $b_vol);
+ {
+ local $LOCK_HOOK = sub($name) {
+ $b_vol = flow(
+ $fake, sub { $PLUGIN->alloc_image('b', $scfg_b, 300, 'raw', undef, 1024) },
+ );
+ };
+ $a_vol =
+ flow($fake, sub { $PLUGIN->alloc_image('a', $scfg_a, 300, 'raw', undef, 1024) });
+ }
+ is_deeply(
+ [$a_vol->{result}, $b_vol->{result}],
+ ['vm-300-disk-0', 'vm-300-disk-0'],
+ 'volumes in both pools',
+ );
+ is_deeply(
+ [
+ sort keys $fake->{m}->{subsystems}->{$NQN}->{ns}->%*,
+ sort keys $fake->{m}->{subsystems}->{$nqn_b}->{ns}->%*,
+ ],
+ [1, 1],
+ 'with independent namespace IDs',
+ );
+};
+
+# ---------------------------------------------------------------------------
+# Target details
+# ---------------------------------------------------------------------------
+
+subtest 'each port is published on its own' => sub {
+ my $fake = FakeTarget->new(pools => ['tank'], unbindable => { 2 => 1 });
+ my $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'a port that cannot bind its address');
+ like(
+ join("\n", $res->{warnings}->@*),
+ qr/cannot publish NVMe subsystem '\Q$NQN\E' on port 2: .*Cannot assign requested address/,
+ 'only warns',
+ );
+ ok(
+ $fake->{m}->{ports}->{1}->{links}->{$NQN} && !$fake->{m}->{ports}->{2}->{links}->{$NQN},
+ 'while the other port serves the subsystem',
+ );
+ $res = flow($fake, $ACT{activate});
+ ok(grep({ $_ eq 'link NVMe subsystem on port 2' } ops($res)->@*), 'and is retried');
+
+ $fake = FakeTarget->new(pools => ['tank'], unbindable => { 1 => 1, 2 => 1 });
+ $res = flow($fake, $ACT{activate});
+ like(
+ $res->{error},
+ qr/\Acannot publish NVMe subsystem '\Q$NQN\E': ln: .*Cannot assign requested address\n\z/,
+ 'without any port the activation fails',
+ );
+};
+
+subtest 'UUIDs are compared in lower case' => sub {
+ my $upper = uc($U{9} =~ tr/9/a/r);
+ my $lower = lc($upper);
+ is(
+ inventory(@POOL, zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, $upper))->{volumes}
+ ->{'tank/vm-100-disk-0'}->{uuid},
+ $lower,
+ 'the inventory normalizes the UUID',
+ );
+ my $dup = inventory(
+ @POOL,
+ zfs_rows('tank/vm-100-disk-0', 'volume', $NQN, 1, $upper),
+ zfs_rows('tank/vm-101-disk-0', 'volume', $NQN, 2, $lower),
+ );
+ eval { nv('_nvmet_owned_identity', $dup, $NQN, 'tank/vm-100-disk-0') };
+ like($@, qr/duplicate NVMe identity/, 'a UUID that differs only in case is a duplicate');
+
+ my $fake = target_fake();
+ $fake->add_zvol('tank/vm-100-disk-0', identity => [$NQN, 1, $upper]);
+ my $res = flow($fake, $ACT{activate});
+ is($res->{error}, '', 'the volume is exported');
+ ok(exported($fake, 1, $lower, '/dev/zvol/tank/vm-100-disk-0'), 'under its UUID');
+ $res = flow($fake, $ACT{activate});
+ is_deeply(ops($res), ['read target state'], 'which then is converged');
+};
+
+subtest 'removing the storage is best effort' => sub {
+ my $file_mock = Test::MockModule->new('PVE::File');
+ $file_mock->redefine(
+ dir_glob_foreach => sub($dir, $regex, $func) {
+ $func->('nvme7') if $dir eq '/sys/class/nvme';
+ },
+ );
+ local %FILES = (%FILES, '/sys/class/nvme/nvme7/subsysnqn' => $NQN);
+ my $remove = sub($fake) {
+ local @UNLINKED = ();
+ my $res = flow($fake, sub { $PLUGIN->on_delete_hook('st', scfg()) });
+ $res->{unlinked} = [sort @UNLINKED];
+ $res->{disconnects} =
+ scalar(grep { $_->[0] eq '/sys/class/nvme/nvme7/delete_controller' }
+ $res->{sysfs_writes}->@*);
+ return $res;
+ };
+
+ my $fake = lifecycle_fake();
+ my $before = dclone($fake->{m});
+ my $res = $remove->($fake);
+ is($res->{error}, '', 'a storage that owns volumes can be removed');
+ my $owned = "refusing to delete NVMe subsystem '$NQN': owned ZFS volume"
+ . " 'tank/base-102-disk-0' exists";
+ like(
+ join("\n", $res->{warnings}->@*),
+ qr/keeping the NVMe target configuration of storage 'st': \Q$owned\E/,
+ 'its volumes and subsystem are kept',
+ );
+ ok(!changes($res) && same($before, $fake->{m}), 'the target is untouched');
+ is_deeply($res->{unlinked}, [secret_file('st')], 'the key file is removed');
+ is($res->{disconnects}, 1, 'the local paths are disconnected');
+
+ $fake = removal_fake();
+ local $FILES{ secret_file('st') } = $KEY;
+ my $key_at_first_call;
+ $fake->{before_call} =
+ sub($f, $call) { $key_at_first_call //= $FILES{ secret_file('st') } };
+ $res = $remove->($fake);
+ is($res->{error}, '', 'an empty storage is removed');
+ ok(
+ !$fake->{m}->{subsystems}->{$NQN} && !$fake->{m}->{hosts}->{ $HOSTS[1] },
+ 'with its subsystem and orphan hosts',
+ );
+ ok(scalar($res->{calls}->@*) && !defined($key_at_first_call), 'after its key is removed');
+ $fake->{before_call} = undef;
+
+ # Another node read the key before the removal, and its activation waited
+ # for the target lock until the removal released it.
+ $res =
+ flow($fake, sub { nv('_nvmet_activate_target', 'st', scfg(), $PORTALS, [@HOSTS], $KEY) });
+ is($res->{error}, "storage 'st' is being removed or its key changed\n",
+ 'a late activation');
+ ok(
+ !changes($res)
+ && !$fake->{m}->{subsystems}->{$NQN}
+ && !$fake->{m}->{hosts}->{ $HOSTS[1] },
+ 'does not restore the target',
+ );
+
+ $plugin_mock->redefine(
+ _namespace_openers => sub($nqn) { return ['qemu (PID 7, /dev/nvme0n1p1)'] });
+ $fake = removal_fake();
+ $res = $remove->($fake);
+ is($res->{error}, '', 'a storage with open namespaces can be removed');
+ like(
+ $res->{warnings}->[0],
+ qr/not disconnecting NVMe storage 'st': .*in use by qemu \(PID 7, \/dev\/nvme0n1p1/,
+ 'without disconnecting',
+ );
+ is($res->{disconnects}, 0, 'the paths stay connected');
+ is_deeply($res->{unlinked}, [secret_file('st')], 'and its key file is removed');
+ $plugin_mock->redefine(_namespace_openers => sub($nqn) { return [] });
+};
+
+# ---------------------------------------------------------------------------
+# Renderer
+# ---------------------------------------------------------------------------
+
+my $INVENTORY_TEXT = 'zfs get -H -p -d 1 -t filesystem,volume -o name,property,value,source'
+ . ' type,proxmox:nvme-subsys,proxmox:nvme-nsid,proxmox:nvme-uuid,proxmox:nvme-last-nsid tank';
+my $MARKER_TEXT = q{printf '%s\n' ZFSNVME-CONFIGFS};
+my $CONFIGFS_TEXT =
+ q{env 'LC_ALL=C' find /sys/kernel/config/nvmet}
+ . q{ '(' -path '/sys/kernel/config/nvmet/subsystems/*/passthru'}
+ . q{ -o -path '/sys/kernel/config/nvmet/ports/*/ana_groups'}
+ . q{ -o -path '/sys/kernel/config/nvmet/ports/*/referrals' ')' -type d -prune}
+ . q{ -o -type d -exec printf 'D %s\n' '{}' +}
+ . q{ -o -type l -exec printf 'L %s\n' '{}' +}
+ . q{ -o -type f '(' -name enable -o -name device_path -o -name device_uuid -o -name buffered_io}
+ . q{ -o -name attr_model -o -name attr_serial -o -name attr_allow_any_host}
+ . q{ -o -name addr_trtype -o -name addr_adrfam -o -name addr_traddr -o -name addr_trsvcid ')'}
+ . q{ -exec grep '' /dev/null '{}' +};
+my $CONFIGFS_KEYS_TEXT =
+ $CONFIGFS_TEXT
+ . q{ -o -type f '('}
+ . join(' -o', map { " -path $ROOT/hosts/$_/dhchap_key" } @HOSTS)
+ . q{ ')' -exec sha256sum '{}' +};
+my $STATE_TEXT = "$INVENTORY_TEXT && $MARKER_TEXT && $CONFIGFS_TEXT";
+my $LOCKED_STATE_TEXT = "modprobe nvmet_tcp && $STATE_TEXT";
+
+sub w_text($path, $value) {
+ return "printf '%s\\n' $value > $path";
+}
+
+sub build_text($nsid, $uuid, $dev) {
+ my $ns = "$S/namespaces/$nsid";
+ return join(
+ ' && ',
+ "test -b $dev", "mkdir $ns",
+ w_text("$ns/device_path", $dev),
+ w_text("$ns/device_uuid", $uuid),
+ w_text("$ns/buffered_io", 0),
+ w_text("$ns/enable", 1),
+ );
+}
+
+sub rendered($res) {
+ return [map { $_->{rendered} } $res->{calls}->@*];
+}
+
+subtest 'golden commands' => sub {
+ my @H = map { "$ROOT/hosts/$_" } @HOSTS;
+ my $serial = 'PVEZFS' . substr(sha256_hex($NQN), 0, 14);
+ my $port = sub($id, $address) {
+ my $P = "$ROOT/ports/$id";
+ return join(
+ ' && ',
+ "mkdir $P",
+ w_text("$P/addr_trtype", 'tcp'),
+ w_text("$P/addr_adrfam", 'ipv4'),
+ w_text("$P/addr_traddr", $address),
+ w_text("$P/addr_trsvcid", 4420),
+ );
+ };
+ my $link = sub($id) {
+ return join(
+ ' && ',
+ "grep -qx 0 $S/attr_allow_any_host",
+ (map { "test -L $S/allowed_hosts/$_" } @HOSTS),
+ "ln -s $S $ROOT/ports/$id/subsystems/$NQN",
+ );
+ };
+
+ my $fake = FakeTarget->new(pools => ['tank']);
+ $fake->add_zvol('tank/vm-100-disk-0', identity => [$NQN, 1, $U{1}]);
+ is_deeply(
+ rendered(flow($fake, $ACT{activate})),
+ [
+ "$INVENTORY_TEXT && $MARKER_TEXT && $CONFIGFS_KEYS_TEXT",
+ "modprobe nvmet_tcp && $INVENTORY_TEXT && $MARKER_TEXT && $CONFIGFS_KEYS_TEXT",
+ join(
+ ' && ',
+ "mkdir $S",
+ w_text("$S/attr_model", q{'Proxmox ZFS NVMe'}),
+ w_text("$S/attr_serial", $serial),
+ w_text("$S/attr_allow_any_host", 0),
+ $port->(1, '192.0.2.21'),
+ $port->(2, '192.0.2.22'),
+ "mkdir $H[0]",
+ "mkdir $H[1]",
+ "chmod 0600 $H[0]/dhchap_key $H[0]/dhchap_ctrl_key $H[1]/dhchap_key"
+ . " $H[1]/dhchap_ctrl_key",
+ "dd ibs=4096 obs=8192 2>/dev/null | tee $H[0]/dhchap_key $H[1]/dhchap_key"
+ . ' >/dev/null',
+ "ln -s $H[0] $S/allowed_hosts/$HOSTS[0]",
+ "ln -s $H[1] $S/allowed_hosts/$HOSTS[1]",
+ build_text(1, $U{1}, '/dev/zvol/tank/vm-100-disk-0'),
+ ),
+ "$INVENTORY_TEXT && $MARKER_TEXT && $CONFIGFS_KEYS_TEXT",
+ $link->(1),
+ $link->(2),
+ ],
+ 'read, configure with a key from stdin, verify and publish',
+ );
+ $fake = lifecycle_fake();
+ is_deeply(
+ rendered(flow($fake, sub { $PLUGIN->path(scfg(), 'vm-100-disk-0', 'st') })),
+ [$INVENTORY_TEXT],
+ 'the ZFS inventory',
+ );
+ my $res = flow($fake, sub { $PLUGIN->alloc_image('st', scfg(), 200, 'raw', undef, 1024) });
+ my $uuid = $fake->{m}->{ds}->{'tank/vm-200-disk-0'}->{props}->{'proxmox:nvme-uuid'};
+ is_deeply(
+ rendered($res),
+ [
+ 'zfs list -o name,volsize,origin,type -t volume,filesystem -d1 -Hp tank',
+ $LOCKED_STATE_TEXT,
+ "zfs set 'proxmox:nvme-last-nsid=4' tank",
+ "zfs create -s -b 16k -o 'proxmox:nvme-subsys=$NQN' -o 'proxmox:nvme-nsid=4'"
+ . " -o 'proxmox:nvme-uuid=$uuid' -V 1024k tank/vm-200-disk-0",
+ 'test -b /dev/zvol/tank/vm-200-disk-0',
+ build_text(4, $uuid, '/dev/zvol/tank/vm-200-disk-0'),
+ $STATE_TEXT,
+ ],
+ 'read, reserve, create, wait, export and verify',
+ );
+ is_deeply(
+ rendered(flow(
+ $fake,
+ sub { $PLUGIN->volume_resize(scfg(), 'st', 'vm-200-disk-0', 2 * 1024**3, 0) },
+ )),
+ [
+ $LOCKED_STATE_TEXT,
+ "zfs set 'volsize=2097152k' tank/vm-200-disk-0 && "
+ . w_text("$S/namespaces/4/revalidate_size", 1),
+ ],
+ 'read, then resize and revalidate',
+ );
+ is_deeply(
+ rendered(flow($fake, sub { $PLUGIN->free_image('st', scfg(), 'vm-101-disk-0') })),
+ [
+ $LOCKED_STATE_TEXT,
+ join(
+ ' && ',
+ w_text("$S/namespaces/2/enable", 0),
+ "rmdir $S/namespaces/2",
+ 'zfs destroy -r tank/vm-101-disk-0',
+ ),
+ ],
+ 'unexport and destroy',
+ );
+ is_deeply(
+ rendered(flow(
+ $fake,
+ sub { $PLUGIN->volume_snapshot_rollback(scfg(), 'st', 'vm-100-disk-0', 'snap1') },
+ )),
+ [
+ $LOCKED_STATE_TEXT,
+ join(' && ',
+ w_text("$S/namespaces/1/enable", 0),
+ "rmdir $S/namespaces/1",
+ 'zfs rollback tank/vm-100-disk-0@snap1',
+ "zfs set 'proxmox:nvme-subsys=$NQN' 'proxmox:nvme-nsid=1'"
+ . " 'proxmox:nvme-uuid=$U{1}' tank/vm-100-disk-0"),
+ 'test -b /dev/zvol/tank/vm-100-disk-0',
+ build_text(1, $U{1}, '/dev/zvol/tank/vm-100-disk-0'),
+ ],
+ 'unexport, roll back, write the identity and export again',
+ );
+ is_deeply(
+ rendered(flow($fake, sub { $PLUGIN->create_base('st', scfg(), 'vm-100-disk-0') })),
+ [
+ $LOCKED_STATE_TEXT,
+ join(' && ',
+ w_text("$S/namespaces/1/enable", 0),
+ "rmdir $S/namespaces/1",
+ 'zfs rename tank/vm-100-disk-0 tank/base-100-disk-0'),
+ 'test -b /dev/zvol/tank/base-100-disk-0',
+ build_text(1, $U{1}, '/dev/zvol/tank/base-100-disk-0')
+ . ' && zfs snapshot tank/base-100-disk-0@__base__',
+ ],
+ 'unexport, rename, export and snapshot',
+ );
+ $res = flow($fake, sub { $PLUGIN->clone_image(scfg(), 'st', 'base-102-disk-0', 201) });
+ $uuid = $fake->{m}->{ds}->{'tank/vm-201-disk-0'}->{props}->{'proxmox:nvme-uuid'};
+ is_deeply(
+ [map { $_->{rendered} } $res->{calls}->@[2, 3]],
+ [
+ "zfs set 'proxmox:nvme-last-nsid=5' tank",
+ "zfs clone -o 'proxmox:nvme-subsys=$NQN' -o 'proxmox:nvme-nsid=5'"
+ . " -o 'proxmox:nvme-uuid=$uuid' tank/base-102-disk-0\@__base__ tank/vm-201-disk-0",
+ ],
+ 'reserve and clone',
+ );
+
+ $fake = lifecycle_fake(
+ step_fault => sub($s, $c) { step_is($s, 'rmdir', "$S/namespaces/2") ? 'busy' : undef },
+ );
+ $res = flow($fake, sub { $PLUGIN->free_image('st', scfg(), 'vm-101-disk-0') });
+ is(
+ $res->{calls}->[-1]->{rendered},
+ 'test -b /dev/zvol/tank/vm-101-disk-0 && ' . w_text("$S/namespaces/2/enable", 1),
+ 'enable again',
+ );
+
+ $fake = removal_fake();
+ is_deeply(
+ rendered(flow($fake, sub { nv('_nvmet_delete_target', scfg()) })),
+ [
+ $LOCKED_STATE_TEXT,
+ "rm $ROOT/ports/1/subsystems/$NQN $ROOT/ports/2/subsystems/$NQN"
+ . " $S/allowed_hosts/$HOSTS[0] $S/allowed_hosts/$HOSTS[1] && rmdir $S",
+ $STATE_TEXT,
+ "rmdir $H[1]",
+ ],
+ 'teardown and orphan hosts',
+ );
+
+ $fake = FakeTarget->new(pools => ['tank']);
+ $fake->{m}->{mounted} = 0;
+ $res = flow($fake, $ACT{activate});
+ ok(grep({ $_ eq 'cat /proc/mounts' } rendered($res)->@*), 'the mount table');
+ ok(
+ grep({ $_ eq 'mount -t configfs none /sys/kernel/config' } rendered($res)->@*),
+ 'the mount',
+ );
+
+ $fake = target_fake();
+ $fake->add_port(5, '192.0.2.99', 4420, links => [$NQN]);
+ is(
+ rendered(flow($fake, $ACT{activate}))->[-1],
+ "rm $ROOT/ports/5/subsystems/$NQN",
+ 'unlink',
+ );
+
+ $fake = lifecycle_fake();
+ $fake->{m}->{subsystems}->{$NQN}->{attr}->{attr_allow_any_host} = '1';
+ $fake->{m}->{subsystems}->{$NQN}->{acl} = {};
+ is(
+ rendered(flow($fake, $ACT{activate}))->[2],
+ join(
+ ' && ',
+ w_text("$S/attr_allow_any_host", 0),
+ map { "ln -s $ROOT/hosts/$_ $S/allowed_hosts/$_" } @HOSTS,
+ ),
+ 'allow_any_host before the ACLs',
+ );
+
+ $fake = lifecycle_fake();
+ my @generic = (
+ [sub { [$PLUGIN->status('st', scfg())] }, 'zfs get -o value -Hp available,used tank'],
+ [
+ sub { $PLUGIN->volume_snapshot_info(scfg(), 'st', 'vm-100-disk-0') },
+ 'zfs list -Hp -r -t snapshot -o name,guid,creation tank/vm-100-disk-0',
+ ],
+ [
+ sub { $PLUGIN->volume_rollback_is_possible(scfg(), 'st', 'vm-100-disk-0', 'snap1') }
+ ,
+ 'zfs list -H -r -t snapshot -o name -s creation tank/vm-100-disk-0',
+ ],
+ [
+ sub { [$PLUGIN->volume_size_info(scfg(), 'st', 'vm-100-disk-0')] },
+ 'zfs get -o value -Hp volsize,usedbydataset tank/vm-100-disk-0',
+ ],
+ [
+ sub { $PLUGIN->volume_snapshot(scfg(), 'st', 'vm-100-disk-0', 'snap2') },
+ 'zfs snapshot tank/vm-100-disk-0@snap2',
+ ],
+ [
+ sub { $PLUGIN->volume_snapshot_delete(scfg(), 'st', 'vm-100-disk-0', 'snap2') },
+ 'zfs destroy tank/vm-100-disk-0@snap2',
+ ],
+ );
+
+ for my $case (@generic) {
+ is(rendered(flow($fake, $case->[0]))->[0], $case->[1], $case->[1]);
+ }
+ is(
+ rendered(flow($fake, sub { $PLUGIN->list_images('st', scfg()) }))->[1],
+ 'zfs get -H -d 1 -o name,value,source proxmox:nvme-subsys tank',
+ 'the ownership query',
+ );
+};
+
+sub sh($command, $input = undef) {
+ my $err = gensym;
+ my $pid = open3(my $in, my $out, $err, '/bin/sh', '-c', $command);
+ print {$in} $input if defined($input);
+ close($in);
+ my $stdout = do { local $/; <$out> }
+ // '';
+ my $stderr = do { local $/; <$err> }
+ // '';
+ waitpid($pid, 0) == $pid or die "wait for test shell: $!\n";
+ my $status = $?;
+ return ($status & 127 ? 128 + ($status & 127) : $status >> 8, $stdout, $stderr);
+}
+
+# The subtests that run rendered commands need these tools. A Debian build
+# has them, so a missing one is an error, never a silently skipped test.
+{
+ my @tools = qw(find grep sha256sum dd tee);
+ BAIL_OUT('needs /bin/sh with ' . join(', ', @tools))
+ if !-x '/bin/sh' || (sh('command -v ' . join(' ', @tools)))[0] != 0;
+}
+
+subtest 'quoting' => sub {
+ my $dir = tempdir(CLEANUP => 1);
+ for my $value (
+ 'a b',
+ q{it's},
+ "\$(touch $dir/pwned)",
+ "`touch $dir/pwned`",
+ '-n',
+ '*',
+ '%s\n',
+ q{"x"},
+ 'x;y',
+ 'a && b',
+ '|',
+ '~root',
+ "tab\there",
+ '',
+ '$HOME',
+ 'a\\b',
+ '#c',
+ ) {
+ my $file = "$dir/value";
+ my ($rc) = sh(nv('_nvmet_render', [write_step($file, $value)]));
+ is($rc . slurp($file), "0$value\n", 'a write keeps ' . ($value =~ s/\t/\\t/r));
+ my (undef, $out) = sh(nv('_nvmet_render', [['printf', '%s\n', $value]]));
+ is($out, "$value\n", 'an argument keeps ' . ($value =~ s/\t/\\t/r));
+ }
+ ok(!-e "$dir/pwned", 'no value is executed');
+};
+
+subtest 'renderer rejections' => sub {
+ for my $case (
+ ['a newline in a value', [write_step("$S/x", "a\nb")]],
+ ['a NUL in a value', [write_step("$S/x", "a\0b")]],
+ ['a CR in an argument', [['zfs', 'get', "a\rb"]]],
+ ['an undefined argument', [['zfs', 'get', undef]]],
+ ['an undefined value', [write_step("$S/x", undef)]],
+ ['a reference as argument', [['zfs', 'get', []]]],
+ ['a relative write', [write_step('x', 1)]],
+ ['a relative key path', [{ key => ['x'] }]],
+ ['an empty key step', [{ key => [] }]],
+ ['two key steps', [{ key => ['/a'] }, { key => ['/b'] }]],
+ ['bash', [['bash', '-c', 'true']]],
+ ['sh', [['sh', '-c', 'true']]],
+ ['perl', [['perl', '-e', '1']]],
+ ['an absolute command', [['/bin/rm', '/a']]],
+ ['an empty command', [[]]],
+ ['a write with extra keys', [{ write => '/a', value => 1, mode => 1 }]],
+ ['an unknown step', [{ run => '/a' }]],
+ ['a string step', ['mkdir /a']],
+ ['no steps', []],
+ ['a string', 'mkdir /a'],
+ ) {
+ eval { nv('_nvmet_render', $case->[1]) };
+ is($@, "internal error: invalid NVMe target step\n", "rejects $case->[0]");
+ }
+};
+
+subtest 'the rendered chains on a configfs stand-in' => sub {
+ my $dir = tempdir(CLEANUP => 1);
+ my $root = "$dir/nvmet";
+ mkdir($_) or die "mkdir $_: $!\n" for $root, map { "$root/$_" } qw(hosts ports subsystems);
+ my $device = "$dir/device";
+ symlink('/dev/null', $device) or die "symlink: $!\n";
+ my $box = sub($path) { $path =~ s{\A\Q$ROOT\E(?=/|\z)}{$root}r };
+ my $kind = sub($path) {
+ my $rel = substr($path, length($root) + 1);
+ return 'subsystem' if $rel =~ m{\Asubsystems/[^/]+\z};
+ return 'namespace' if $rel =~ m{\Asubsystems/[^/]+/namespaces/[0-9]+\z};
+ return 'port' if $rel =~ m{\Aports/[0-9]+\z};
+ return 'host' if $rel =~ m{\Ahosts/[^/]+\z};
+ die "unexpected directory $path\n";
+ };
+ my %attrs = (
+ subsystem => {
+ attr_model => 'Linux',
+ attr_serial => '0123456789abcdef',
+ attr_allow_any_host => 0,
+ },
+ namespace => {
+ enable => 0,
+ device_path => '(null)',
+ device_uuid => $U{9},
+ buffered_io => 0,
+ },
+ port => { addr_trtype => '', addr_adrfam => '', addr_traddr => '', addr_trsvcid => '' },
+ host => { dhchap_key => '', dhchap_ctrl_key => '' },
+ );
+ my %groups = (subsystem => ['namespaces', 'allowed_hosts'], port => ['subsystems']);
+ # configfs creates attributes and default groups with each directory and
+ # removes them with it; the stand-in does both with the same commands.
+ my $shim = sub($steps) {
+ my @out;
+ for my $step ($steps->@*) {
+ if (ref($step) eq 'HASH' && exists($step->{write})) {
+ push @out, write_step($box->($step->{write}), $step->{value});
+ } elsif (ref($step) eq 'HASH') {
+ push @out, { key => [map { $box->($_) } $step->{key}->@*] };
+ } elsif ($step->[0] eq 'test' && $step->[1] eq '-b') {
+ push @out, ['test', '-L', $device];
+ } elsif ($step->[0] eq 'mkdir') {
+ for my $path (map { $box->($_) } $step->@[1 .. $step->$#*]) {
+ my $type = $kind->($path);
+ push @out, ['mkdir', $path, map { "$path/$_" } ($groups{$type} // [])->@*];
+ push @out, map { write_step("$path/$_", $attrs{$type}->{$_}) }
+ sort keys $attrs{$type}->%*;
+ }
+ } elsif ($step->[0] eq 'rmdir') {
+ for my $path (map { $box->($_) } $step->@[1 .. $step->$#*]) {
+ my $type = $kind->($path);
+ push @out, ['rm', map { "$path/$_" } sort keys $attrs{$type}->%*];
+ push @out, ['rmdir', map { "$path/$_" } $groups{$type}->@*]
+ if $groups{$type};
+ push @out, ['rmdir', $path];
+ }
+ } else {
+ push @out, [map { $box->($_) } $step->@*];
+ }
+ }
+ return \@out;
+ };
+ my $run = sub($steps, $input = undef) {
+ my ($rc, undef, $err) = sh(nv('_nvmet_render', $shim->($steps)), $input);
+ return ($rc, $err);
+ };
+
+ my $capture = FakeTarget->new(pools => ['tank']);
+ flow($capture, $ACT{activate});
+ my ($find) = grep { step_is($_, 'env') } $capture->{calls}->[0]->{steps}->@*;
+ my $read = sub () {
+ my ($rc, $out, $err) = sh(nv('_nvmet_render', $shim->([$find])));
+ die "configfs read failed: $err\n" if $rc;
+ $out =~ s{\Q$root\E}{$ROOT}g;
+ return nv('_nvmet_parse_configfs', $out);
+ };
+ my $inv = inventory(@POOL, @ONE);
+ my $conf = { nqn => $NQN, portals => $PORTALS, hostnqns => [@HOSTS], keysha => $KEY_SHA };
+ my $plan = nv('_nvmet_plan_activation', $inv, $read->(), $conf);
+ my ($rc, $err) = $run->([map { $_->@* } $plan->{prepublish}->@*], "$KEY\n");
+ is($rc, 0, 'the whole configuration runs as one chain') or diag($err);
+ my $cfs = $read->();
+ is_deeply(
+ nv('_nvmet_plan_activation', $inv, $cfs, $conf)->{prepublish},
+ [],
+ 'and converges',
+ );
+ is_deeply(
+ [map { $cfs->{hosts}->{$_}->{key_sha256} } @HOSTS],
+ [$KEY_SHA, $KEY_SHA],
+ 'the digests read back equal sha256 of the key and a newline',
+ );
+ is_deeply(
+ [map { (stat("$root/hosts/$_/dhchap_key"))[2] & 07777 } @HOSTS],
+ [0600, 0600],
+ 'and the key attributes are readable by their owner only',
+ );
+
+ # Only the kernel's own groups are skipped: the ACL of another tool's
+ # subsystem named like one of them is read and protects the key.
+ my $other = "$root/subsystems/referrals";
+ mkdir($_) or die "mkdir $_: $!\n" for $other, "$other/allowed_hosts", "$other/namespaces";
+ for my $attr (keys $attrs{subsystem}->%*) {
+ open(my $fh, '>', "$other/$attr") or die "open: $!\n";
+ print {$fh} "$attrs{subsystem}->{$attr}\n";
+ close($fh);
+ }
+ symlink("$root/hosts/$HOSTS[0]", "$other/allowed_hosts/$HOSTS[0]") or die "symlink: $!\n";
+ mkdir($_)
+ or die "mkdir $_: $!\n"
+ for "$root/ports/1/referrals", "$root/ports/1/referrals/r";
+ my (undef, $raw) = sh(nv('_nvmet_render', $shim->([$find])));
+ ok(
+ $read->()->{subsystems}->{referrals}->{acl}->{ $HOSTS[0] },
+ 'a subsystem named referrals',
+ );
+ unlike($raw, qr{/ports/1/referrals}, 'while the referrals of a port are skipped');
+ unlink("$other/allowed_hosts/$HOSTS[0]", map { "$other/$_" } keys $attrs{subsystem}->%*);
+ rmdir($_)
+ or die "rmdir $_: $!\n"
+ for "$other/allowed_hosts", "$other/namespaces", $other, "$root/ports/1/referrals/r",
+ "$root/ports/1/referrals";
+
+ for my $unit (nv('_nvmet_plan_publish', $cfs, $NQN, $plan->{port_ids}, [@HOSTS])->@*) {
+ ($rc) = $run->($unit->{steps});
+ is($rc, 0, "the guarded link to port $unit->{port}");
+ }
+ is_deeply(nv('_nvmet_plan_publish', $read->(), $NQN, [1, 2], [@HOSTS]), [], 'publishes');
+
+ unlink("$root/ports/1/subsystems/$NQN", "$root/subsystems/$NQN/allowed_hosts/$HOSTS[1]");
+ my ($unit) = nv('_nvmet_plan_publish', $read->(), $NQN, [1], [@HOSTS])->@*;
+ ($rc) = $run->($unit->{steps});
+ ok($rc && !-l "$root/ports/1/subsystems/$NQN", 'the guard blocks a link without every ACL');
+ symlink("$root/hosts/$HOSTS[1]", "$root/subsystems/$NQN/allowed_hosts/$HOSTS[1]") or die;
+ ($rc) = $run->([write_step("$ROOT/subsystems/$NQN/attr_allow_any_host", 1)]);
+ ($rc) = $run->($unit->{steps});
+ ok($rc && !-l "$root/ports/1/subsystems/$NQN", 'and while any host may connect');
+ $run->([write_step("$ROOT/subsystems/$NQN/attr_allow_any_host", 0)]);
+ ($rc) = $run->($unit->{steps});
+ ok(!$rc && -l "$root/ports/1/subsystems/$NQN", 'but links once both hold');
+
+ my ($units) = nv('_nvmet_plan_unexport', $read->(), $NQN, $U{1});
+ ($rc) = $run->([map { $_->@* } $units->@*]);
+ ok(!$rc && !-e "$root/subsystems/$NQN/namespaces/1", 'the unexport chain removes it');
+ my ($teardown, $candidates) = nv(
+ '_nvmet_plan_delete_target', inventory(@POOL), $read->(), $NQN, [@HOSTS],
+ );
+ ($rc) = $run->([map { $_->@* } $teardown->@*]);
+ ok(!$rc && !-e "$root/subsystems/$NQN", 'the teardown chain removes the subsystem');
+ ($rc) = $run->([map { $_->@* } nv('_nvmet_plan_orphan_hosts', $read->(), $candidates)->@*]);
+ ok(!$rc && !-e "$root/hosts/$HOSTS[0]" && !-e "$root/hosts/$HOSTS[1]", 'and the hosts');
+ ok(-d "$root/ports/1" && -d "$root/ports/2", 'ports stay');
+};
+
+# Last: every command rendered during this test run, and every protocol
+# violation recorded (by a fake target: a key on a command line or in output,
+# a change without the lock; or a local command).
+subtest 'every rendered command is a POSIX command chain' => sub {
+ is_deeply(\@VIOLATIONS, [], 'no flow violated the target protocol');
+ my %shapes;
+ for my $command (keys %CORPUS) {
+ (my $shape = $command) =~ s/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}/U/gi;
+ $shape =~ s/[0-9]+/N/g;
+ $shapes{$shape} //= $command;
+ }
+ ok(keys(%shapes) >= 40, 'the corpus covers ' . keys(%shapes) . ' command shapes');
+ my $meta = qr/[;&|<>`\$(){}\\*?\[\]~#!"]/;
+ my @bad;
+ for my $command (sort values %shapes) {
+ push @bad, "sh -n: $command" if system('/bin/sh', '-n', '-c', $command) != 0;
+ push @bad, "bash-ism: $command"
+ if $command =~ /\[\[|\$\(\(|<<<|\$'|pipefail|(?:\A|&& )(?:function|source|\.) /;
+ (my $bare = $command) =~ s/'[^']*'|\\'//g;
+ for my $segment (split / && /, $bare) {
+ next
+ if $segment =~ m{\Add\ ibs=4096\ obs=8192\ 2>/dev/null\ \|\ tee(?:\ /[^\s;&|<>]+)+
+ \ >/dev/null\z}x;
+ if ($segment =~ /\Aprintf +(\S*) +> (\S+)\z/) {
+ push @bad, "write: $segment" if "$1$2" =~ $meta;
+ next;
+ }
+ push @bad, "shell syntax: $segment" if $segment =~ $meta;
+ }
+ }
+ is_deeply(\@bad, [], 'every command is a plain POSIX command chain');
+};
+
+done_testing();
diff --git a/src/test/zfsnvme_test.pm b/src/test/zfsnvme_test.pm
new file mode 100644
index 00000000..3b311bfa
--- /dev/null
+++ b/src/test/zfsnvme_test.pm
@@ -0,0 +1,2353 @@
+package PVE::Storage::TestZFSNVMe;
+
+# Storage API and local NVMe host side of the zfsnvme plugin. The target side
+# is covered by zfsnvme_target_test.pm. Nothing here opens a connection or
+# changes the host outside a temporary directory: every probe of the local
+# host is mocked, and the children that the plugin forks for its connect and
+# delete steps run inline, except where the child itself is tested.
+
+use v5.36;
+
+use lib qw(..);
+
+use Compress::Zlib qw(crc32);
+use Config;
+use Errno qw(EACCES ECONNREFUSED EINVAL ENOENT);
+use Fcntl qw(O_NOCTTY O_RDWR);
+use File::Temp qw(tempdir);
+use MIME::Base64 qw(encode_base64);
+use POSIX qw(
+ ECHO ECHONL ICANON OPOST SIG_BLOCK SIGALRM SIGHUP SIGINT SIGQUIT SIGTERM TCSANOW WNOHANG
+ sigprocmask
+);
+use Test::MockModule;
+use Test::More;
+
+use PVE::Storage;
+use PVE::Storage::ZFSNVMePlugin;
+
+my $PLUGIN = 'PVE::Storage::ZFSNVMePlugin';
+my $NQN = 'nqn.2026-01.com.example:test';
+my $OTHER_NQN = 'nqn.2026-01.com.example:other';
+my $UUID = '12345678-1234-1234-1234-123456789abc';
+my $ROOT = '/sys/kernel/config/nvmet';
+my $hostnqn_a = 'nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-000000000001';
+my $hostnqn_b = 'nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-000000000002';
+
+sub make_key($hash, $length, $seed = 1) {
+ my $raw = join('', map { chr(($_ * 131 + $seed * 17) % 256) } 1 .. $length);
+ return "DHHC-1:$hash:" . encode_base64($raw . pack('V', crc32($raw)), '') . ':';
+}
+my $KEY = make_key('00', 32);
+my $KEY_B = make_key('00', 32, 2);
+
+sub scfg(%override) {
+ return {
+ type => 'zfsnvme',
+ server => '192.0.2.10',
+ pool => 'tank',
+ subsysnqn => $NQN,
+ 'nvme-portals' => '192.0.2.21,192.0.2.22',
+ 'nvme-host-ifaces' => 'ens19,ens20',
+ 'nvme-host-nqns' => "$hostnqn_a,$hostnqn_b",
+ %override,
+ };
+}
+
+# Calls a plugin package sub by name, so a mocked sub is the one called.
+sub nv($name, @args) {
+ my $code = $PLUGIN->can($name) // die "plugin has no sub '$name'\n";
+ return $code->(@args);
+}
+
+# ---------------------------------------------------------------------------
+# Mocks. Target calls are answered by $TARGET, the ssh command of the runner
+# by $COMMAND; sysfs and key files are read from %FILES and listed from %DIRS,
+# block devices are %BLOCK and symbolic links %LINKS. The children of the
+# bounded host steps run inline and record their bound in @FORKS. Waits
+# advance $NOW. The host side runs no external command: only the runner
+# tests, which set $COMMAND, may reach run_command.
+# ---------------------------------------------------------------------------
+
+our ($TARGET, $COMMAND, $NOW);
+our (%FILES, %DIRS, %CONFIG, %BLOCK, %LINKS, @TARGET_CALLS, @WARNINGS, @WRITES);
+our (@SYSFS_WRITES, @GLOBS, @CONNECTS, @ACTIVATIONS, @UNLINKED, @RESTRICTED, @DELETED, @FORKS);
+our (%REFUSE, %CONNECT_STATE); # address => the connect is refused, the new controller's state
+$NOW = 1_000_000;
+
+my $nvme_mock = Test::MockModule->new($PLUGIN);
+my $file_mock = Test::MockModule->new('PVE::File');
+my $sysfs_mock = Test::MockModule->new('PVE::SysFSTools');
+my $tools_mock = Test::MockModule->new('PVE::Tools');
+my $network_mock = Test::MockModule->new('PVE::Network');
+my $storage_mock = Test::MockModule->new('PVE::Storage');
+my $parent_mock = Test::MockModule->new('PVE::Storage::Plugin');
+
+$nvme_mock->redefine(
+ _nvmet_run => sub($scfg, $steps, %opts) {
+ push @TARGET_CALLS, { steps => $steps, %opts };
+ die "unexpected NVMe target call '$opts{op}'\n" if !$TARGET;
+ return $TARGET->($steps, %opts);
+ },
+);
+# A command is also recorded, in case the caller handles the error; the last
+# test checks that there was none.
+our @COMMANDS;
+my $no_command = sub($cmd, %opts) {
+ push @COMMANDS, $cmd;
+ die "test error: unexpected command '" . (ref($cmd) ? $cmd->[0] : $cmd) . "'\n";
+};
+$nvme_mock->redefine(
+ run_command => sub($cmd, %opts) {
+ return $COMMAND ? $COMMAND->($cmd, %opts) : $no_command->($cmd, %opts);
+ },
+);
+$tools_mock->redefine(run_command => $no_command);
+$nvme_mock->redefine(_now => sub () { return $NOW });
+$nvme_mock->redefine(_sleep => sub($seconds) { $NOW += $seconds; return });
+$nvme_mock->redefine(_block_device => sub($path) { return $BLOCK{$path} });
+$nvme_mock->redefine(_link_target => sub($path) { return $LINKS{$path} });
+$nvme_mock->redefine(_restrict_attr => sub($path) { push @RESTRICTED, $path; return });
+$nvme_mock->redefine(_unlink_file => sub($path) { push @UNLINKED, $path; return 1 });
+$nvme_mock->redefine(log_warn => sub($message) { push @WARNINGS, $message; return });
+$nvme_mock->redefine(file_read_firstline => sub($path) { return $FILES{$path} });
+$nvme_mock->redefine(
+ file_set_contents => sub($path, $data, $perm = undef, @rest) {
+ push @WRITES, { path => $path, data => $data, perm => $perm };
+ return;
+ },
+);
+$nvme_mock->redefine(make_path => sub(@args) { push @WRITES, { make_path => [@args] }; return });
+$nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+
+# The connect child: creates a controller of the portal named in the options.
+my $connect_mock = sub($options, $names) {
+ my %option = map { split(/=/, $_, 2) } split(/,/, $options);
+ push @CONNECTS, "$option{traddr}\@$option{host_iface}";
+ die "connect failed: Connection refused\n" if $REFUSE{ $option{traddr} };
+ my $instance = 70 + scalar(@CONNECTS);
+ add_controller(
+ "nvme$instance",
+ $option{traddr},
+ $option{trsvcid},
+ $option{host_iface},
+ $CONNECT_STATE{ $option{traddr} } // 'live',
+ );
+ return $instance;
+};
+$nvme_mock->redefine(_fabrics_connect => $connect_mock);
+# The deletion child: the controllers disappear from sysfs.
+my $delete_mock = sub($controllers) {
+ for my $controller ($controllers->@*) {
+ push @DELETED, $controller->{name};
+ $DIRS{'/sys/class/nvme'} =
+ [grep { $_ ne $controller->{name} } ($DIRS{'/sys/class/nvme'} // [])->@*];
+ }
+ return scalar($controllers->@*);
+};
+$nvme_mock->redefine(_delete_controllers => $delete_mock);
+my $fork_inline = sub($timeout, $code, $opts = undef) {
+ push @FORKS, $timeout;
+ my $res = $code->();
+ return wantarray ? ($res, 0) : $res;
+};
+$tools_mock->redefine(run_fork_with_timeout => $fork_inline);
+$file_mock->redefine(
+ dir_glob_foreach => sub($dir, $regex, $func) {
+ push @GLOBS, [$dir, $regex];
+ for my $entry (($DIRS{$dir} // [])->@*) {
+ if (my @res = $entry =~ m/^($regex)$/) {
+ $func->(@res);
+ }
+ }
+ },
+);
+my $sysfs_write = sub($path, $data, $allow_existing = undef) {
+ push @SYSFS_WRITES, [$path, $data];
+ $FILES{$path} = $data =~ s/\n\z//r;
+ return 1;
+};
+$sysfs_mock->redefine(file_write => $sysfs_write);
+$network_mock->redefine(tcp_ping => sub($host, $port, $timeout = undef) { return 1 });
+$storage_mock->redefine(config => sub () { return { ids => {%CONFIG} } });
+
+# A local controller of $NQN, as nvme-core shows it in sysfs.
+sub add_controller($name, $address, $port, $iface, $state = 'live', $nqn = $NQN) {
+ my $base = "/sys/class/nvme/$name";
+ push $DIRS{'/sys/class/nvme'}->@*, $name;
+ $FILES{"$base/subsysnqn"} = $nqn;
+ $FILES{"$base/state"} = $state;
+ $FILES{"$base/address"} = "traddr=$address,trsvcid=$port,host_iface=$iface";
+ $FILES{"$base/reconnect_delay"} //= '2';
+ $FILES{"$base/ctrl_loss_tmo"} //= '600';
+ $FILES{"$base/fast_io_fail_tmo"} //= 'off';
+ return;
+}
+
+sub reset_host() {
+ %DIRS = ('/sys/class/nvme-subsystem' => ['nvme-subsys7']);
+ %FILES = (
+ '/sys/module/nvme_core/parameters/multipath' => 'Y',
+ '/etc/nvme/hostnqn' => $hostnqn_a,
+ '/etc/nvme/hostid' => '12345678-1234-1234-1234-123456789abc',
+ '/sys/class/nvme-subsystem/nvme-subsys7/subsysnqn' => $NQN,
+ );
+ %BLOCK = %LINKS = %CONNECT_STATE = ();
+ @CONNECTS = @ACTIVATIONS = @SYSFS_WRITES = @WRITES = @WARNINGS = @GLOBS = ();
+ @RESTRICTED = @UNLINKED = @DELETED = @FORKS = ();
+ $NOW += 61; # a new minute: no storage is in its slow-path backoff
+ return;
+}
+
+# ---------------------------------------------------------------------------
+# Volume names and features (same formats as the other ZFS plugins)
+# ---------------------------------------------------------------------------
+
+# [feature, volume, snapshot, running, expected]
+for my $case (
+ ['copy', 'base-100-disk-0', undef, 0, 1],
+ ['copy', 'vm-100-disk-0', undef, 0, 1],
+ ['copy', 'vm-100-disk-0', undef, 1, 1],
+ ['copy', 'base-100-disk-0/vm-101-disk-0', undef, 0, 1],
+ ['copy', 'vm-100-disk-0', 'snap', 0, undef],
+ ['clone', 'base-100-disk-0', undef, undef, 1],
+ ['clone', 'vm-100-disk-0', undef, undef, undef],
+ ['template', 'vm-100-disk-0', undef, undef, 1],
+ ['snapshot', 'vm-100-disk-0', undef, 0, 1],
+ ['snapshot', 'vm-100-disk-0', 'snap', 0, 1],
+) {
+ my ($feature, $volname, $snap, $running, $expected) = $case->@*;
+ my @args = defined($running) ? ($snap, $running, {}) : ();
+ is(
+ $PLUGIN->volume_has_feature({}, $feature, 'nvmetest', $volname, @args),
+ $expected,
+ "$feature of $volname"
+ . ($snap ? '@' . $snap : '')
+ . ($running ? ' while running' : ''),
+ );
+}
+ok(!$PLUGIN->storage_can_replicate({}, 'nvmetest'), 'no storage replication');
+
+for my $case (
+ ['vm-100-disk-0', ['images', 'vm-100-disk-0', 100, undef, undef, '', 'raw']],
+ ['base-100-disk-0', ['images', 'base-100-disk-0', 100, undef, undef, 1, 'raw']],
+ ['subvol-100-disk-0', ['images', 'subvol-100-disk-0', 100, undef, undef, '', 'subvol']],
+ ['basevol-100-disk-0', ['images', 'basevol-100-disk-0', 100, undef, undef, 1, 'subvol']],
+ [
+ 'base-100-disk-0/vm-200-disk-0',
+ ['images', 'vm-200-disk-0', 200, 'base-100-disk-0', 100, '', 'raw'],
+ ],
+ [
+ 'basevol-100-disk-0/subvol-200-disk-0',
+ ['images', 'subvol-200-disk-0', 200, 'basevol-100-disk-0', 100, '', 'subvol'],
+ ],
+) {
+ my ($name, $expected) = $case->@*;
+ is_deeply([$PLUGIN->parse_volname($name)], $expected, "parse_volname keeps the tuple of $name");
+}
+for my $name ('not-a-volume', 'vm-no-id-disk-0', 'vm-100-disk 0', 'vm-100-') {
+ eval { $PLUGIN->parse_volname($name) };
+ like($@, qr/unable to parse zfs volume name/, "rejects invalid volume name $name");
+}
+
+is_deeply(
+ \@PVE::Storage::ZFSNVMePlugin::ISA,
+ ['PVE::Storage::Plugin'],
+ 'the backend inherits directly from the storage plugin base',
+);
+for my $method (qw(
+ zfs_request zfs_get_lu_name zfs_create_lu zfs_resize_lu zfs_list_zvol zfs_parse_zvol_list
+ zfs_get_properties zfs_get_pool_stats zfs_create_zvol zfs_delete_zvol zfs_get_base
+))
+{
+ ok(!$PLUGIN->can($method), "the ZFS helper $method is private");
+}
+
+# ---------------------------------------------------------------------------
+# Configuration
+# ---------------------------------------------------------------------------
+
+is(nv('verify_nvme_nqn', $hostnqn_a), $hostnqn_a, 'accepts a standard NQN');
+ok(!nv('verify_nvme_nqn', 'not-an-nqn', 1), 'rejects an invalid NQN');
+ok(!nv('verify_nvme_nqn', 'nqn.x:' . ('a' x 220), 1), 'rejects a long NQN');
+is_deeply(
+ nv('parse_nvme_host_nqns', "$hostnqn_a, $hostnqn_b"),
+ [$hostnqn_a, $hostnqn_b],
+ 'parses the host allow-list',
+);
+ok(!nv('parse_nvme_host_nqns', "$hostnqn_a,$hostnqn_a", 1), 'rejects duplicate host NQNs');
+ok(!nv('parse_nvme_host_nqns', '', 1), 'requires a host NQN');
+
+is_deeply(
+ nv('parse_nvme_portals', '198.51.100.11:4420,[2001:db8::11]:4421,198.51.100.12'),
+ [
+ { address => '198.51.100.11', port => 4420, family => 'ipv4' },
+ { address => '2001:db8::11', port => 4421, family => 'ipv6' },
+ { address => '198.51.100.12', port => 4420, family => 'ipv4' },
+ ],
+ 'parses IPv4 and IPv6 portals',
+);
+is_deeply(
+ [
+ map { $_->{address} }
+ nv('parse_nvme_portals', '[2001:DB8:0:0::11],[2001:db8::0:12]:4421')->@*
+ ],
+ ['2001:db8::11', '2001:db8::12'],
+ 'IPv6 addresses are canonical',
+);
+eval { nv('parse_nvme_portals', '[2001:db8::11]:4420,[2001:db8:0::11]:4420'); };
+like($@, qr/duplicate NVMe\/TCP portal/, 'two spellings of one IPv6 portal are a duplicate');
+eval { nv('parse_nvme_portals', '198.51.100.11:4420,198.51.100.11:4420') };
+like($@, qr/duplicate NVMe\/TCP portal/, 'duplicate portal is rejected');
+eval { nv('parse_nvme_portals', '198.51.100.11,198.51.100.11:04420') };
+is($@, "duplicate NVMe/TCP portal '198.51.100.11:04420'\n", 'a port with a leading zero');
+eval { nv('parse_nvme_portals', '198.51.100.11:4421,[::ffff:198.51.100.11]:4421') };
+is(
+ $@,
+ "duplicate NVMe/TCP portal '[::ffff:198.51.100.11]:4421'\n",
+ 'an IPv4-mapped IPv6 address of an IPv4 portal',
+);
+ok(!nv('parse_nvme_portals', '198.51.100.11:70000', 1), 'rejects an invalid port');
+ok(!nv('parse_nvme_portals', '[198.51.100.11]', 1), 'rejects IPv4 in brackets');
+my $too_many = join(',', map { "198.51.100.$_:4420" } 1 .. 17);
+ok(!nv('parse_nvme_portals', $too_many, 1), 'limits the number of paths');
+
+is_deeply(
+ nv(
+ '_configured_portals',
+ {
+ 'nvme-portals' => '198.51.100.11:4420,198.51.100.12:4421',
+ 'nvme-host-ifaces' => 'ens20,ens21',
+ },
+ ),
+ [
+ { address => '198.51.100.11', port => 4420, family => 'ipv4', host_iface => 'ens20' },
+ { address => '198.51.100.12', port => 4421, family => 'ipv4', host_iface => 'ens21' },
+ ],
+ 'binds each portal to its local interface',
+);
+eval {
+ nv(
+ '_configured_portals',
+ {
+ 'nvme-portals' => '198.51.100.11,198.51.100.12',
+ 'nvme-host-ifaces' => 'ens20',
+ },
+ );
+};
+like($@, qr/one interface for each/, 'portal and interface counts must match');
+ok(!nv('parse_nvme_host_ifaces', 'ens20,not/an/interface', 1), 'rejects an invalid interface name');
+for my $name ('.', '..') {
+ ok(!nv('parse_nvme_host_ifaces', "ens20,$name", 1), "rejects the directory name '$name'");
+}
+for my $option ('nvme-host-ifaces', 'nvme-host-nqns') {
+ my $opts = $PLUGIN->options()->{$option};
+ ok(!$opts->{optional} && !$opts->{fixed}, "$option is required, and can be changed");
+ my $config = scfg(type => 'zfsnvme', content => 'images', blocksize => '16k');
+ delete $config->{$option};
+ eval { $PLUGIN->check_config('st', $config, 1, 1) };
+ like($@, qr/missing value for required option '\Q$option\E'/, "a new storage needs $option");
+}
+$nvme_mock->redefine(_local_iface_exists => sub($iface) { return $iface eq 'ens20' });
+eval { nv('_validate_local_ifaces', [{ host_iface => 'ens20' }, { host_iface => 'ens21' }]); };
+like($@, qr/host interface 'ens21' does not exist/, 'a missing local interface fails preflight');
+$nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+
+my $listener_used = sub($address, $port, $storeid = 'existing') {
+ return "NVMe/TCP portal '$address' port $port is already used by storage '$storeid';"
+ . " give each storage its own address or port\n";
+};
+# [name, the existing storage, our overrides, error]
+for my $case (
+ [
+ 'the NQN of another storage',
+ { server => '192.0.2.11', pool => 'tank/existing', subsysnqn => $NQN },
+ {},
+ qr/NQN is already used by storage 'existing'/,
+ ],
+ [
+ 'the NQN and the listener of another storage',
+ { pool => 'data', subsysnqn => $NQN, 'nvme-portals' => '192.0.2.21' },
+ {},
+ "NVMe subsystem NQN is already used by storage 'existing'\n",
+ ],
+ [
+ 'the pool of another storage',
+ { pool => 'tank' },
+ {},
+ qr/ZFS pool 'tank' on '192\.0\.2\.10' is already used/,
+ ],
+ [
+ 'a pool inside ours',
+ { pool => 'tank/sub' },
+ {},
+ qr/ZFS pool 'tank' on '192\.0\.2\.10' overlaps the pool of storage 'existing'/,
+ ],
+ [
+ 'a pool above ours',
+ { pool => 'tank' },
+ { pool => 'tank/sub' },
+ qr/overlaps the pool of storage 'existing'/,
+ ],
+ [
+ 'a pool above ours on another server',
+ { pool => 'tank', server => '192.0.2.99' },
+ { pool => 'tank/sub' },
+ undef,
+ ],
+ ['a pool around ours', { pool => 'ta' }, {}, undef],
+ ['a parent pool', { pool => 'tan' }, {}, undef],
+ # one NVMe/TCP listener (family, address, port) per storage, on any server
+ [
+ 'the listener of another storage',
+ { pool => 'data', 'nvme-portals' => '192.0.2.31,192.0.2.22' },
+ {},
+ $listener_used->('192.0.2.22', 4420),
+ ],
+ [
+ 'the listener of another storage that names the default port',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21:4420' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the listener of a disabled storage',
+ { pool => 'data', disable => 1, 'nvme-portals' => '192.0.2.21' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the listener of a storage that spells the server another way',
+ { server => 'nas.example', pool => 'data', 'nvme-portals' => '192.0.2.21' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the listener of a storage on another server',
+ { server => '192.0.2.99', pool => 'tank', 'nvme-portals' => '192.0.2.21' },
+ {},
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'an IPv6 listener written another way',
+ { pool => 'data', 'nvme-portals' => '[2001:db8:0::21]' },
+ { 'nvme-portals' => '[2001:DB8::0021]:4420' },
+ $listener_used->('2001:db8::21', 4420),
+ ],
+ [
+ 'an IPv4 listener reached through an IPv4-mapped IPv6 address',
+ { pool => 'data', 'nvme-portals' => '[::ffff:192.0.2.21]' },
+ {},
+ $listener_used->('::ffff:192.0.2.21', 4420),
+ ],
+ [
+ 'an IPv4-mapped IPv6 address of an IPv4 listener',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21' },
+ { 'nvme-portals' => '[::FFFF:c000:215]' },
+ $listener_used->('192.0.2.21', 4420),
+ ],
+ [
+ 'the same addresses on other ports',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21:4421,192.0.2.22:4421' },
+ {},
+ undef,
+ ],
+ [
+ 'the same address on another port through another spelling of the server',
+ {
+ server => 'nas.example',
+ pool => 'data',
+ 'nvme-portals' => '192.0.2.31,192.0.2.22:4421',
+ },
+ {},
+ "storage 'existing' reaches target address '192.0.2.22' through server 'nas.example';"
+ . " use the same server value for both storages\n",
+ ],
+ [
+ 'an IPv6 address written another way through another spelling of the server',
+ { server => 'nas.example', pool => 'data', 'nvme-portals' => '[2001:db8::0:21]:4421' },
+ { 'nvme-portals' => '[2001:db8::21]' },
+ qr/\Astorage 'existing' reaches target address '2001:db8::21' through server/,
+ ],
+ [
+ 'other addresses on another server',
+ { server => 'nas.example', pool => 'tank', 'nvme-portals' => '192.0.2.31,192.0.2.32' },
+ {},
+ undef,
+ ],
+ [
+ 'other addresses on the same server',
+ { pool => 'data', 'nvme-portals' => '192.0.2.31,[2001:db8::22]' },
+ {},
+ undef,
+ ],
+ ['a storage without portals', { pool => 'data' }, {}, undef],
+ # it cannot be activated, and is checked when its portals are fixed
+ [
+ 'a storage whose portals do not parse',
+ { pool => 'data', 'nvme-portals' => '192.0.2.21,192.0.2.300' },
+ {},
+ undef,
+ ],
+ [
+ 'the listener of another storage type',
+ { type => 'zfs', pool => 'tank', 'nvme-portals' => '192.0.2.21' },
+ {},
+ undef,
+ ],
+) {
+ my ($name, $other, $ours, $error) = $case->@*;
+ my $existing = {
+ type => 'zfsnvme',
+ server => '192.0.2.10',
+ subsysnqn => $OTHER_NQN,
+ pool => 'x',
+ $other->%*,
+ };
+ my $cfg = { ids => { existing => $existing } };
+ eval { nv('_assert_unique_target', 'new', scfg($ours->%*), $cfg) };
+ if (ref($error)) {
+ like($@, $error, "refuses $name");
+ } elsif (defined($error)) {
+ is($@, $error, "refuses $name");
+ } else {
+ is($@, '', "accepts $name");
+ }
+}
+
+{
+ my $states = {
+ '198.51.100.11:4420' => [{ state => 'live', host_iface => 'eth0' }],
+ '198.51.100.12:4420' => [
+ { state => 'connecting', host_iface => 'eth1' },
+ { state => 'live', host_iface => 'ens21' },
+ ],
+ '198.51.100.13:4420' => [{ state => 'dead', host_iface => 'ens22' }],
+ };
+ my $portals = [
+ { address => '198.51.100.11', port => 4420, host_iface => 'ens20' },
+ { address => '198.51.100.12', port => 4420, host_iface => 'ens21' },
+ { address => '198.51.100.13', port => 4420, host_iface => 'ens22' },
+ ];
+ is(nv('_live_portal_count', $states, $portals), 1, 'the wrong interface is not healthy');
+ is(nv('_live_portal_count', $states, $portals, 1), 2, 'but it carries I/O');
+}
+
+# DHHC-1:<hash>:<base64 of the key and its little-endian CRC-32>:
+for my $case (['00', 32], ['00', 48], ['00', 64], ['01', 32], ['02', 48], ['03', 64]) {
+ my $key = make_key($case->@*);
+ is(nv('_validate_secret', $key), $key, "accepts a $case->[1] byte key with hash $case->[0]");
+}
+my $bad_crc = do {
+ my $raw = 'k' x 32;
+ 'DHHC-1:00:' . encode_base64($raw . pack('V', crc32($raw) ^ 1), '') . ':';
+};
+for my $case (
+ ['a plaintext secret', 'plaintext'],
+ ['a key without the final colon', substr($KEY, 0, -1)],
+ ['an unknown hash', make_key('04', 32)],
+ ['a 48 byte key for SHA-256', make_key('01', 48)],
+ ['a 32 byte key for SHA-384', make_key('02', 32)],
+ ['a 32 byte key for SHA-512', make_key('03', 32)],
+ ['a 16 byte key', make_key('00', 16)],
+ ['a wrong CRC', $bad_crc],
+ ['truncated base64', substr($KEY, 0, -2) . ':'],
+ ['a key with a trailing newline', "$KEY\n"],
+) {
+ my ($name, $key) = $case->@*;
+ eval { nv('_validate_secret', $key) };
+ is($@, "invalid NVMe DH-HMAC-CHAP key representation\n", "rejects $name without echoing it");
+}
+eval { nv('_validate_secret', undef) };
+is($@, "missing NVMe DH-HMAC-CHAP key\n", 'a missing key');
+# check_config only validates. Defaults are applied where they are used.
+{
+ $parent_mock->redefine(
+ check_config => sub($class, $id, $config, $create, $skip = undef) { return $config },
+ );
+ my $config = scfg();
+ my $copy = { $config->%* };
+ is_deeply($PLUGIN->check_config('st', $config, 1, 1), $copy, 'no defaults on create');
+ is_deeply(
+ $PLUGIN->check_config('st', { 'nvme-host-ifaces' => 'ens20,ens21' }, 0),
+ { 'nvme-host-ifaces' => 'ens20,ens21' },
+ 'a partial update is accepted',
+ );
+ eval { $PLUGIN->check_config('st', scfg('nvme-fast-io-fail-tmo' => 700), 1, 1) };
+ like($@, qr/must not exceed nvme-ctrl-loss-tmo/, 'validated against the default');
+ eval { $PLUGIN->check_config('st', scfg('nvme-host-ifaces' => 'ens19'), 1, 1) };
+ like($@, qr/one interface for each/, 'cross-field validation stays');
+ # the pool is validated like every later use of it validates it
+ is(
+ $PLUGIN->check_config('st', scfg(pool => 'tank/nvme.1'), 1, 1)->{pool},
+ 'tank/nvme.1',
+ 'a nested pool is accepted',
+ );
+ for my $pool ('-rH', 'tank/vm 1', '') {
+ eval { $PLUGIN->check_config('st', scfg(pool => $pool), 1, 1) };
+ is($@, "invalid ZFS pool name\n", "the pool name '$pool' is refused on create");
+ eval { $PLUGIN->check_config('st', { pool => $pool }, 0) };
+ is($@, "invalid ZFS pool name\n", 'and on update');
+ }
+ $parent_mock->unmock('check_config');
+}
+eval {
+ nv(
+ '_validate_fail_fast_timeout',
+ { 'nvme-ctrl-loss-tmo' => 30, 'nvme-fast-io-fail-tmo' => 31 },
+ 600,
+ );
+};
+like($@, qr/must not exceed nvme-ctrl-loss-tmo/, 'fast I/O fail cannot outlive the loss timeout');
+eval {
+ nv(
+ '_validate_fail_fast_timeout',
+ { 'nvme-ctrl-loss-tmo' => -1, 'nvme-fast-io-fail-tmo' => 30 },
+ 600,
+ );
+};
+is($@, '', 'fast I/O fail stays valid with infinite reconnects');
+
+# ---------------------------------------------------------------------------
+# Storage hooks and secrets
+# ---------------------------------------------------------------------------
+
+{
+ my $secret = '/etc/pve/priv/storage/nvmetest.nvme-dhchap';
+ local %CONFIG = ();
+ local %FILES = ();
+ local @WRITES = ();
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg()) };
+ is($@, "missing NVMe DH-HMAC-CHAP key\n", 'a new storage needs a key');
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY) };
+ is($@, '', 'a new storage stores its key');
+ is_deeply(
+ [grep { $_->{path} } @WRITES],
+ [{ path => $secret, data => "$KEY\n", perm => 0600 }],
+ 'readable by root only',
+ );
+ is_deeply(
+ [map { $_->{make_path} } grep { $_->{make_path} } @WRITES],
+ [['/etc/pve/priv/storage', { mode => 0700 }]],
+ 'in a private directory',
+ );
+
+ local $FILES{$secret} = $KEY;
+ @WRITES = ();
+ eval {
+ $PLUGIN->on_update_hook_full(
+ 'nvmetest',
+ scfg(),
+ { 'nvme-host-ifaces' => 'ens21,ens22' },
+ );
+ };
+ is($@, '', 'a partial update validates against the current configuration');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, undef, { 'dhchap-key' => $KEY }) };
+ is($@, '', 'the same key is accepted');
+ eval {
+ $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, undef, { 'dhchap-key' => $KEY_B });
+ };
+ like($@, qr/NVMe DH-HMAC-CHAP key rotation is not supported/, 'a different key is refused');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), { 'nvme-host-nqns' => $hostnqn_a }) };
+ like($@, qr/removing NVMe host NQN '\Q$hostnqn_b\E' is not supported/, 'no host removal');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, ['nvme-host-nqns']) };
+ like($@, qr/at least one NVMe host NQN is required/, 'deleting the host list is refused');
+ @WRITES = ();
+ eval {
+ my $update = { 'nvme-host-nqns' => "$hostnqn_a,$hostnqn_b,nqn.x:c" };
+ $PLUGIN->on_update_hook_full('nvmetest', scfg(), $update);
+ };
+ is($@, '', 'adding a host is accepted');
+ is_deeply(\@WRITES, [], 'without storing the key again');
+
+ delete local $FILES{$secret};
+ @WRITES = ();
+ eval { $PLUGIN->on_update_hook_full('nvmetest', scfg(), {}, undef, { 'dhchap-key' => $KEY }) };
+ is($@, '', 'a storage without key file');
+ is_deeply(
+ [grep { $_->{path} } @WRITES],
+ [{ path => $secret, data => "$KEY\n", perm => 0600 }],
+ 'stores the new key',
+ );
+}
+
+# nvmet keeps one key per host NQN: storages on one target that share a host
+# must share the key.
+{
+ my $other = {
+ type => 'zfsnvme',
+ server => '192.0.2.10',
+ pool => 'data',
+ subsysnqn => $OTHER_NQN,
+ 'nvme-host-nqns' => $hostnqn_b,
+ };
+ my $cfg = { ids => { other => $other, nvmetest => scfg() } };
+ local %FILES = ('/etc/pve/priv/storage/other.nvme-dhchap' => $KEY_B);
+ eval { nv('_assert_shared_host_key', 'nvmetest', scfg(), $KEY, $cfg) };
+ is(
+ $@,
+ "storage 'other' uses a different DH-HMAC-CHAP key for the same NVMe host NQNs"
+ . " on '192.0.2.10'\n",
+ 'a different key for a shared host is refused',
+ );
+ for my $case (
+ ['the same key', $KEY_B, {}],
+ ['another server', $KEY, { server => '192.0.2.11' }],
+ ['no shared host', $KEY, { 'nvme-host-nqns' => 'nqn.2026-01.com.example:other-host' }],
+ ['another storage type', $KEY, { type => 'zfs' }],
+ ) {
+ my ($name, $key, $change) = $case->@*;
+ my $ids = { ids => { other => { $other->%*, $change->%* } } };
+ eval { nv('_assert_shared_host_key', 'nvmetest', scfg(), $key, $ids); };
+ is($@, '', "accepts $name");
+ }
+ {
+ local %FILES = ();
+ eval { nv('_assert_shared_host_key', 'nvmetest', scfg(), $KEY, $cfg); };
+ is($@, '', 'a storage without a key file is skipped');
+ }
+
+ local %CONFIG = (other => $other);
+ local @WRITES = ();
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY) };
+ like($@, qr/storage 'other' uses a different DH-HMAC-CHAP key/, 'on_add_hook refuses it');
+ unlike($@, qr/DHHC-1/, 'without naming a key');
+ is_deeply([grep { $_->{path} } @WRITES], [], 'and stores no key');
+ eval { $PLUGIN->on_add_hook('nvmetest', scfg(), 'dhchap-key' => $KEY_B) };
+ is($@, '', 'the same key is accepted');
+
+ local $FILES{'/etc/pve/priv/storage/nvmetest.nvme-dhchap'} = $KEY;
+ my $current = scfg('nvme-host-nqns' => $hostnqn_a);
+ eval {
+ $PLUGIN->on_update_hook_full(
+ 'nvmetest',
+ $current,
+ { 'nvme-host-nqns' => "$hostnqn_a,$hostnqn_b" },
+ );
+ };
+ like($@, qr/storage 'other' uses a different DH-HMAC-CHAP key/, 'nor shared by an update');
+ eval { $PLUGIN->on_update_hook_full('nvmetest', $current, { 'nvme-iopolicy' => 'numa' }) };
+ is($@, '', 'other updates are accepted');
+}
+
+# Adding and updating a storage check its listeners; an update checks the new
+# portals, and the current definition of the storage itself does not count.
+{
+ my $secret = '/etc/pve/priv/storage/nvmetest.nvme-dhchap';
+ my $other = scfg(
+ subsysnqn => $OTHER_NQN,
+ pool => 'data',
+ 'nvme-portals' => '192.0.2.23',
+ 'nvme-host-ifaces' => 'ens21',
+ );
+ local %CONFIG = (other => $other);
+ local %FILES = ();
+ local @WRITES = ();
+ my $shared = scfg('nvme-portals' => '192.0.2.21,192.0.2.23');
+ eval { $PLUGIN->on_add_hook('nvmetest', $shared, 'dhchap-key' => $KEY) };
+ is($@, $listener_used->('192.0.2.23', 4420, 'other'), 'on_add_hook refuses a used listener');
+ is_deeply([grep { $_->{path} } @WRITES], [], 'and stores no key');
+
+ %CONFIG = (other => $other, nvmetest => scfg());
+ $FILES{$secret} = $KEY;
+ my $update = sub($current, $portals) {
+ eval {
+ $PLUGIN->on_update_hook_full('nvmetest', $current, { 'nvme-portals' => $portals });
+ };
+ return $@;
+ };
+ is($update->(scfg(), '192.0.2.22,192.0.2.21'), '', 'an update keeps its own listeners');
+ is(
+ $update->(scfg(), '192.0.2.21,192.0.2.23:4420'),
+ $listener_used->('192.0.2.23', 4420, 'other'),
+ 'on_update_hook_full refuses a used listener',
+ );
+ is($update->(scfg(), '192.0.2.21,192.0.2.23:4421'), '', 'but not its address on another port');
+ is($update->($shared, '192.0.2.21,192.0.2.22'), '', 'an update can leave a used listener');
+ is_deeply([grep { $_->{path} } @WRITES], [], 'without storing the key again');
+}
+
+# pvesm reads the key from a file, so it never appears on a command line.
+{
+ require PVE::CLI::pvesm;
+
+ my $dir = tempdir(CLEANUP => 1);
+ my $file = sub($name, $content) {
+ open(my $fh, '>', "$dir/$name") or die "open: $!\n";
+ print {$fh} $content;
+ close($fh);
+ return "$dir/$name";
+ };
+ my $padded = $file->('padded', " $KEY \nsecond line\n");
+ my $empty = $file->('empty', "\n");
+ my %map = map {
+ my $command = $_;
+ (
+ $command => (
+ grep { $_->{name} eq 'dhchap-key' }
+ PVE::CLI::pvesm::param_mapping($command)->@*
+ )[0],
+ )
+ } qw(create update);
+ ok($map{create} && $map{update}, 'pvesm create and update map dhchap-key');
+ my $read = $map{create}->{func};
+ eval { $read->($KEY) };
+ is(
+ $@,
+ "dhchap-key expects the path of a file containing the key\n",
+ 'a key in place of the file name is refused without repeating it',
+ );
+ is($read->($padded), $KEY, 'the first line of the file, trimmed');
+ eval { $read->($empty) };
+ like($@, qr/key file '.*' is empty/, 'an empty file is refused');
+ eval { $read->('/dev/null') };
+ like($@, qr/is empty/, 'a file that is not regular, like /dev/stdin, is read');
+ eval { $read->($dir) };
+ like($@, qr/expects the path of a file/, 'a directory is refused');
+}
+
+# ---------------------------------------------------------------------------
+# Volumes through the target runner
+# ---------------------------------------------------------------------------
+
+sub target(%answers) {
+ return sub($steps, %opts) {
+ my $answer = $answers{ $opts{op} } // die "unexpected NVMe target call '$opts{op}'\n";
+ return $answer->($steps, %opts) if ref($answer) eq 'CODE';
+ return { rc => 0, out => $answer, err => '' };
+ };
+}
+
+my @volume_list = (
+ "tank\t-\t-\tfilesystem",
+ "tank/vm-100-disk-0\t1048576\t-\tvolume",
+ "tank/vm-200-disk-0\t1048576\t-\tvolume",
+ "tank/vm-300-disk-0\t1048576\t-\tvolume",
+ "tank/vm-400-disk-0\t1048576\t-\tvolume",
+ "tank/base-90-disk-0\t1048576\t-\tvolume",
+ "tank/vm-101-disk-0\t1048576\ttank/base-90-disk-0\@__base__\tvolume",
+ "tank/vm-102-disk-0\t1048576\ttankXprod/base-90-disk-0\@__base__\tvolume",
+ "tank/subvol-103-disk-0\t-\t-\tfilesystem",
+ "tank/vm-104-disk-0\t-\t-\tfilesystem",
+);
+my @ownership = (
+ "tank\t-\t-",
+ "tank/vm-100-disk-0\t$NQN\tlocal",
+ "tank/vm-200-disk-0\t-\t-",
+ "tank/vm-300-disk-0\t$NQN\tinherited from tank",
+ "tank/vm-400-disk-0\t$NQN\treceived",
+ "tank/base-90-disk-0\t$NQN\tlocal",
+ "tank/vm-101-disk-0\t$NQN\tlocal",
+ "tank/vm-102-disk-0\t$NQN\tlocal",
+ "tank/subvol-103-disk-0\t$OTHER_NQN\tlocal",
+ "tank/vm-104-disk-0\t$NQN\tlocal",
+);
+{
+ local $TARGET = target('zfs list' => \@volume_list, 'zfs get' => \@ownership);
+ my $images = $PLUGIN->list_images('nvmetest', scfg());
+ my %by_volid = map { $_->{volid} => $_ } $images->@*;
+ my %by_name = map { $_->{name} => $_ } $images->@*;
+ is_deeply(
+ [sort keys %by_name],
+ ['base-90-disk-0', 'vm-100-disk-0', 'vm-101-disk-0', 'vm-102-disk-0', 'vm-400-disk-0'],
+ 'listing requires a zvol with a local or received owner',
+ );
+ is(
+ $by_name{'vm-102-disk-0'}->{parent},
+ 'tankXprod/base-90-disk-0@__base__',
+ 'a foreign pool origin is not mistaken for a local parent',
+ );
+ is_deeply(
+ $by_volid{'nvmetest:base-90-disk-0/vm-101-disk-0'},
+ {
+ name => 'vm-101-disk-0',
+ size => 1048576,
+ parent => 'base-90-disk-0@__base__',
+ format => 'raw',
+ vmid => 101,
+ volid => 'nvmetest:base-90-disk-0/vm-101-disk-0',
+ },
+ 'a linked clone keeps the volume ID format of the ZFS plugins',
+ );
+ is_deeply(
+ [map { $_->{volid} } $PLUGIN->list_images('nvmetest', scfg(), 400)->@*],
+ ['nvmetest:vm-400-disk-0'],
+ 'filtered by VM',
+ );
+ my $listed = $PLUGIN->list_images('nvmetest', scfg(), undef, ['nvmetest:vm-100-disk-0']);
+ is_deeply([map { $_->{volid} } $listed->@*], ['nvmetest:vm-100-disk-0'], 'by volume list');
+ is(
+ $PLUGIN->find_free_diskname('nvmetest', scfg(), 200),
+ 'vm-200-disk-1',
+ 'a name held by an unowned zvol is not handed out',
+ );
+ is($PLUGIN->find_free_diskname('nvmetest', scfg(), 90), 'vm-90-disk-1', 'nor one of a base');
+ is(
+ $PLUGIN->find_free_diskname('nvmetest', scfg(), 104),
+ 'vm-104-disk-1',
+ 'nor one held by a filesystem',
+ );
+ my @steps = map { $_->{steps}->@* } @TARGET_CALLS;
+ ok(!grep({ $_->[0] ne 'zfs' || $_->[1] !~ /\A(?:get|list)\z/ } @steps), 'listing only reads');
+}
+
+{
+ my @warnings;
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ for my $case (
+ [['100', '200'], [300, 100, 200, 1]],
+ [['-', '200'], [0, 0, 0, 0]],
+ [['1'], [0, 0, 0, 0]],
+ ) {
+ local $TARGET = target('zfs get' => $case->[0]);
+ is_deeply([$PLUGIN->status('nvmetest', scfg())], $case->[1], "status for '$case->[0]->@*'");
+ }
+ local $TARGET =
+ target('zfs get' => sub(@args) { return { rc => 255, out => [], err => 'no route' } });
+ is_deeply([$PLUGIN->status('nvmetest', scfg())], [0, 0, 0, 0], 'unreachable is inactive');
+ is(scalar(@warnings), 3, 'and every inactive status warns');
+ like($warnings[0], qr/unexpected ZFS pool usage for storage 'nvmetest'/, 'about the usage');
+ is(
+ $warnings[-1],
+ "storage 'nvmetest': zfs error on '192.0.2.10': no route\n",
+ 'or naming the storage and the target',
+ );
+}
+
+{
+ local @TARGET_CALLS = ();
+ local $TARGET = target();
+ eval { $PLUGIN->volume_resize(scfg(), 'nvmetest', 'vm-100-disk-0', 2 * 1024**3, 1) };
+ like(
+ $@,
+ qr/online resize is not supported for NVMe\/TCP block devices; stop the VM first/,
+ 'online resize is refused',
+ );
+ eval { $PLUGIN->volume_resize(scfg(), 'nvmetest', 'vm-100-disk-0', 2 * 1024**3, 0, 'snap') };
+ like($@, qr/resizing a snapshot is not supported/, 'as is resizing a snapshot');
+ is_deeply(\@TARGET_CALLS, [], 'before any target call');
+ for my $method (qw(volume_export volume_import rename_volume rename_snapshot)) {
+ eval { $PLUGIN->$method(scfg(), 'nvmetest', 'vm-100-disk-0') };
+ like($@, qr/not supported/, "$method is not supported");
+ }
+ for my $direction (qw(export import)) {
+ my $formats = "volume_${direction}_formats";
+ is_deeply(
+ [$PLUGIN->$formats(scfg(), 'nvmetest', 'vm-100-disk-0')],
+ [],
+ "no $direction formats",
+ );
+ }
+ is($PLUGIN->deactivate_volume('nvmetest', scfg(), 'vm-100-disk-0'), 1, 'no-op deactivation');
+ eval { $PLUGIN->deactivate_volume('nvmetest', scfg(), 'vm-100-disk-0', 'snap') };
+ like($@, qr/unable to deactivate snapshot/, 'snapshots cannot be deactivated');
+}
+
+{
+ $nvme_mock->redefine(_nvmet_volume_uuid => sub($scfg, $name) { return $UUID });
+ is_deeply(
+ $PLUGIN->qemu_blockdev_options(scfg(), 'nvmetest', 'vm-100-disk-0'),
+ { driver => 'host_device', filename => "/dev/disk/by-id/nvme-uuid.$UUID" },
+ 'the QEMU host_device driver on the stable namespace UUID link',
+ );
+ eval {
+ my $options = { 'snapshot-name' => 's' };
+ $PLUGIN->qemu_blockdev_options(scfg(), 'nvmetest', 'vm-100-disk-0', undef, $options);
+ };
+ like($@, qr/direct access to snapshots not implemented/, 'snapshots have no block device');
+ $nvme_mock->unmock('_nvmet_volume_uuid');
+}
+
+# ---------------------------------------------------------------------------
+# The runner: one ssh argv, no Perl, no shell on the local side
+# ---------------------------------------------------------------------------
+
+{
+ my $run = $nvme_mock->original('_nvmet_run');
+ my @runs;
+ local $COMMAND = sub($cmd, %opts) {
+ push @runs, { cmd => $cmd, %opts };
+ return 0;
+ };
+ my $steps = [['zfs', 'get', '-H', 'type', 'tank'], ['printf', '%s\n', 'x y']];
+ my $res = $run->(scfg(), $steps, op => 'test');
+ is_deeply(
+ $runs[0]->{cmd},
+ [
+ '/usr/bin/ssh',
+ '-o',
+ 'BatchMode=yes',
+ '-o',
+ 'ConnectTimeout=10',
+ '-o',
+ 'LogLevel=ERROR',
+ '-i',
+ '/etc/pve/priv/zfs/192.0.2.10_id_rsa',
+ 'root@192.0.2.10',
+ q{zfs get -H type tank && printf '%s\n' 'x y'},
+ ],
+ 'one ssh argv with the rendered command, and no login banner in errors',
+ );
+ unlike(join(' ', $runs[0]->{cmd}->@*), qr/perl/, 'no Perl runs on the target');
+ is($runs[0]->{timeout}, 15, 'reads time out after 15 seconds by default');
+ ok(!$runs[0]->{noerr} && !exists($runs[0]->{input}),
+ 'failures are exceptions, stdin is closed');
+ is_deeply($res, { rc => 0, out => [], err => '' }, 'a successful call');
+
+ @runs = ();
+ $run->(
+ scfg(),
+ [{ key => ["$ROOT/hosts/$hostnqn_a/dhchap_key"] }],
+ op => 'key',
+ input => "$KEY\n",
+ timeout => 7,
+ );
+ is($runs[0]->{input}, "$KEY\n", 'the key goes to stdin');
+ unlike(join(' ', $runs[0]->{cmd}->@*), qr/DHHC-1/, 'and never into the command line');
+ is($runs[0]->{timeout}, 7, 'with the timeout of the caller');
+
+ for my $case (
+ [
+ 'output and the first error line',
+ sub(%o) {
+ $o{outfunc}->('a');
+ $o{outfunc}->('b');
+ $o{errfunc}->('');
+ $o{errfunc}->('first');
+ $o{errfunc}->('second');
+ die "command 'ssh' failed: exit code 3\n";
+ },
+ { rc => 3, out => ['a', 'b'], err => 'first' },
+ ],
+ [
+ 'an exit code without message',
+ sub(%o) { die "command 'ssh' failed: exit code 2\n" },
+ { rc => 2, out => [], err => 'exit code 2' },
+ ],
+ [
+ 'a timeout',
+ sub(%o) { die "command 'ssh' failed: got timeout\n" },
+ { rc => -1, out => [], err => 'timeout' },
+ ],
+ [
+ 'an ssh that could not connect',
+ sub(%o) { die "command 'ssh' failed: exit code 255\n" },
+ { rc => 255, out => [], err => 'exit code 255' },
+ ],
+ [
+ 'an ssh killed by a signal',
+ sub(%o) { die "command 'ssh' failed: got signal 9\n" },
+ { rc => -1, out => [], err => 'ssh failed' },
+ ],
+ ) {
+ my ($name, $behaviour, $expected) = $case->@*;
+ local $COMMAND = sub($cmd, %opts) { return $behaviour->(%opts) };
+ is_deeply(
+ $run->(scfg(), [['cat', '/proc/mounts']], op => 'test'),
+ $expected,
+ "returns $name",
+ );
+ }
+ for my $exception ("received interrupt\n", "command 'ssh $KEY' failed: received interrupt\n") {
+ local $COMMAND = sub($cmd, %opts) { $opts{outfunc}->('partial'); die $exception };
+ eval { $run->(scfg(), [['cat', '/proc/mounts']], op => 'test') };
+ is($@, "received interrupt\n", 'a stopped task dies with the task marker and nothing else');
+ }
+ @runs = ();
+ eval { $run->(scfg(), [['cat', '/proc/mounts']]) };
+ like($@, qr/NVMe target call without label/, 'every call has a label');
+ eval { $run->(scfg(), [['printf', '%s', 'x' x 65536]], op => 'test') };
+ like($@, qr/NVMe target command too long/, 'oversized calls are refused');
+ is_deeply(\@runs, [], 'before running anything');
+}
+
+# ---------------------------------------------------------------------------
+# The shared storage lock
+# ---------------------------------------------------------------------------
+
+subtest 'vdisk_alloc dispatches under the shared storage lock' => sub {
+ my $cluster_mock = Test::MockModule->new('PVE::Cluster');
+ my (@locks, @allocations);
+ $cluster_mock->redefine(
+ cfs_lock_storage => sub($storeid, $timeout, $func, @param) {
+ push @locks, [$storeid, $timeout];
+ return $func->(@param);
+ },
+ );
+ $parent_mock->redefine(lookup => sub($class, $type) { return $PLUGIN });
+ $storage_mock->redefine(activate_storage => sub($cfg, $storeid) { return 1 });
+ $nvme_mock->redefine(
+ alloc_image => sub($class, $storeid, $scfg, $vmid, $fmt, $name, $size) {
+ push @allocations, [$storeid, $vmid, $fmt, $name, $size];
+ return $name;
+ },
+ );
+ my $cfg = { ids => { nvmetest => scfg(shared => 1) } };
+ is(
+ PVE::Storage::vdisk_alloc($cfg, 'nvmetest', 105, 'raw', 'vm-105-disk-0', 131_072),
+ 'nvmetest:vm-105-disk-0',
+ 'core allocation returns the allocated volume ID',
+ );
+ is_deeply(\@locks, [['nvmetest', undef]], 'cfs_lock_storage gets the timeout of the core');
+ is_deeply(
+ \@allocations,
+ [['nvmetest', 105, 'raw', 'vm-105-disk-0', 131_072]],
+ 'alloc_image runs once inside the lock',
+ );
+ $nvme_mock->unmock('alloc_image');
+ $storage_mock->unmock('activate_storage');
+ $parent_mock->unmock('lookup');
+};
+
+# ---------------------------------------------------------------------------
+# Local NVMe host side
+# ---------------------------------------------------------------------------
+
+# The connect options of a controller: one write to the fabrics device.
+{
+ my $portal = { address => '192.0.2.22', port => 4420, host_iface => 'ens21' };
+ my $options = sub($scfg) {
+ return nv(
+ '_fabrics_options', $scfg, $portal, $hostnqn_a, $UUID, $KEY,
+ );
+ };
+ my ($string, $names) = $options->({ subsysnqn => $NQN });
+ is(
+ $string,
+ "transport=tcp,traddr=192.0.2.22,trsvcid=4420,host_iface=ens21,nqn=$NQN,"
+ . "hostnqn=$hostnqn_a,hostid=$UUID,dhchap_secret=$KEY,keep_alive_tmo=5,"
+ . 'reconnect_delay=2,ctrl_loss_tmo=600',
+ 'the portal, the identities, the key and the default timeouts',
+ );
+ is_deeply(
+ $names,
+ [
+ qw(transport traddr trsvcid host_iface nqn hostnqn hostid dhchap_secret),
+ qw(keep_alive_tmo reconnect_delay ctrl_loss_tmo),
+ ],
+ 'with the names of the options',
+ );
+ my $tuned = {
+ subsysnqn => $NQN,
+ 'nvme-keep-alive-tmo' => 10,
+ 'nvme-reconnect-delay' => 5,
+ 'nvme-ctrl-loss-tmo' => 60,
+ 'nvme-fast-io-fail-tmo' => 15,
+ 'nvme-nr-io-queues' => 4,
+ };
+ ($string, $names) = $options->($tuned);
+ my $tail = 'keep_alive_tmo=10,reconnect_delay=5,ctrl_loss_tmo=60,'
+ . 'fast_io_fail_tmo=15,nr_io_queues=4';
+ like($string, qr/,\Q$tail\E\z/, 'the configured timeouts and queues');
+ is_deeply([$names->@[-2, -1]], ['fast_io_fail_tmo', 'nr_io_queues'], 'are named too');
+ ($string) = $options->({ $tuned->%*, 'nvme-fast-io-fail-tmo' => 0 });
+ like($string, qr/,fast_io_fail_tmo=0,/, 'a fast I/O fail timeout of 0 is a real value');
+ ($string) = $options->({ $tuned->%*, 'nvme-ctrl-loss-tmo' => -1 });
+ like($string, qr/,ctrl_loss_tmo=-1,/, 'an infinite loss timeout');
+
+ for my $value ('6 0', '60,duplicate_connect', "60\x00", '') {
+ eval { $options->({ $tuned->%*, 'nvme-ctrl-loss-tmo' => $value }) };
+ is(
+ $@,
+ "internal error: invalid NVMe connect option 'ctrl_loss_tmo'\n",
+ 'a value that would end the option early is refused without echoing it',
+ );
+ }
+}
+
+# The connect runs in a child bounded by 10 seconds. Its result and errors
+# pass through; a stopped task and a timeout have their own message.
+{
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ my $connect = sub($child) {
+ local @FORKS = ();
+ $nvme_mock->redefine(_fabrics_connect => $child);
+ my $res = eval { nv('_connect_portal', scfg(), $portal, $hostnqn_a, $UUID, $KEY); };
+ my $error = $@;
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+ return ($res, $error, [@FORKS]);
+ };
+ my ($res, $error, $forks) = $connect->(sub($options, $names) { return 7 });
+ is($res, 7, 'returns the instance of the new controller');
+ is_deeply($forks, [10], 'from a child bounded by 10 seconds');
+ for my $exception ("received interrupt\n", "interrupted by unexpected signal\n") {
+ (undef, $error) = $connect->(sub(@args) {
+ die $exception;
+ });
+ is($error, "received interrupt\n", 'a stopped task dies with the task marker');
+ }
+ my @warnings;
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ $tools_mock->redefine(
+ run_fork_with_timeout => sub($timeout, $code, $opts = undef) { return (undef, 1) },
+ );
+ (undef, $error) = $connect->(sub(@args) {
+ return 7;
+ });
+ is($error, "NVMe/TCP connect did not complete within 10 seconds\n", 'a timeout');
+ $tools_mock->redefine(
+ run_fork_with_timeout => sub($timeout, $code, $opts = undef) {
+ warn "malformed JSON string\n"; # what a child that died without a result leaves
+ return (undef, 0);
+ },
+ );
+ (undef, $error) = $connect->(sub(@args) {
+ return 7;
+ });
+ is($error, "NVMe/TCP connect left no result\n", 'a child without a result');
+ is_deeply(\@warnings, [], 'without the warning of run_fork_with_timeout in the task log');
+ $tools_mock->redefine(run_fork_with_timeout => $fork_inline);
+}
+
+# The signals a stopped task can bring that are blocked while a child runs.
+my %signal = (HUP => SIGHUP, INT => SIGINT, QUIT => SIGQUIT, TERM => SIGTERM, ALRM => SIGALRM);
+
+sub blocked_signals() {
+ my $mask = POSIX::SigSet->new();
+ sigprocmask(SIG_BLOCK, POSIX::SigSet->new(), $mask) or die "sigprocmask: $!\n";
+ return join(',', grep { $mask->ismember($signal{$_}) } sort keys %signal);
+}
+
+# The child itself: a real fork under the real run_fork_with_timeout.
+subtest 'the connect child' => sub {
+ $tools_mock->unmock('run_fork_with_timeout');
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ my $connect = sub() {
+ my $res = eval { nv('_connect_portal', scfg(), $portal, $hostnqn_a, $UUID, $KEY); };
+ return ($res, $@);
+ };
+ $nvme_mock->redefine(_fabrics_connect => sub(@args) { return 7 });
+ my ($res, $error) = $connect->();
+ is($res, 7, 'the result of the child reaches the parent');
+ is(blocked_signals(), '', 'and the signal mask is restored');
+ $nvme_mock->redefine(
+ _fabrics_connect => sub(@args) { die "connect failed: Connection refused\n" },
+ );
+ (undef, $error) = $connect->();
+ is($error, "connect failed: Connection refused\n", 'and so does its error');
+ is(blocked_signals(), '', 'with the signal mask restored');
+
+ # The warnings of the child go to the standard error of the task.
+ my $dir = tempdir(CLEANUP => 1);
+ $nvme_mock->redefine(_fabrics_connect => sub(@args) { warn "child warning\n"; return 7 });
+ open(my $saved, '>&', \*STDERR) or die "cannot save STDERR: $!\n";
+ open(STDERR, '>', "$dir/stderr") or die "cannot redirect STDERR: $!\n";
+ ($res, $error) = $connect->();
+ open(STDERR, '>&', $saved) or die "cannot restore STDERR: $!\n";
+ is($res, 7, 'a child that warns');
+ open(my $fh, '<', "$dir/stderr") or die "cannot read '$dir/stderr': $!\n";
+ is(join('', <$fh>), "child warning\n", 'is heard');
+ close($fh);
+
+ # A stopped task: the signal stays pending while the child runs and, once
+ # the child is reaped, the handler of the worker dies with the task marker.
+ for my $name (qw(TERM QUIT INT)) {
+ pipe(my $from_child, my $to_parent) or die "pipe: $!\n";
+ $nvme_mock->redefine(
+ _fabrics_connect => sub(@args) {
+ kill($name, getppid()) or die "kill: $!\n";
+ print {$to_parent} "$$ " . blocked_signals() . "\n";
+ close($to_parent);
+ return 7;
+ },
+ );
+ my $seen;
+ local $SIG{$name} = sub { # as in a PVE worker
+ chomp(my $report = <$from_child> // '');
+ my ($pid, $blocked) = split(/ /, $report, 2);
+ $seen = { blocked => $blocked, reaped => $pid && waitpid($pid, WNOHANG) == -1 };
+ die "received interrupt\n";
+ };
+ ($res, $error) = $connect->();
+ close($to_parent);
+ close($from_child);
+ is($error, "received interrupt\n", "$name stops the task with the task marker");
+ is(
+ $seen->{blocked},
+ 'HUP,INT,QUIT,TERM',
+ 'once the child, with the inherited mask, is done',
+ );
+ ok($seen->{reaped}, 'and reaped');
+ is(blocked_signals(), '', 'and the signal mask is restored');
+ }
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+ $tools_mock->redefine(run_fork_with_timeout => $fork_inline);
+};
+
+# The body of the connect child, inline. A pseudoterminal stands in for the
+# fabrics device: a character device that answers reads with the lines the
+# test writes to the master, and passes writes to the master.
+subtest 'the connect child body' => sub {
+ my $body = $nvme_mock->original('_fabrics_connect');
+ my $portal = { address => '192.0.2.21', port => 4420, host_iface => 'ens19' };
+ my ($options, $names) = nv('_fabrics_options', scfg(), $portal, $hostnqn_a, $UUID, $KEY);
+ my $tokens = sub(@names) {
+ return join(',', map { "$_=%s" } @names) . "\n";
+ };
+ # a body that waits for a line the test did not write must not hang the suite
+ local $SIG{ALRM} = sub { die "the child body did not finish\n" };
+ my $run = sub() {
+ @RESTRICTED = ();
+ alarm(30);
+ my $res = eval { $body->($options, $names) };
+ alarm(0);
+ return ($res, $@);
+ };
+ my $dir = tempdir(CLEANUP => 1);
+ my $file = "$dir/file";
+ open(my $fh, '>', $file) or die "cannot create '$file': $!\n";
+ close($fh);
+ for my $case (
+ [
+ 'a missing device',
+ "$dir/missing",
+ qr/\A'\Q$dir\E\/missing' does not exist; load the nvme-tcp kernel module\n\z/,
+ ],
+ ['a regular file', $file, qr/\A'\Q$file\E' is not a character device\n\z/],
+ [
+ 'a device without the option list',
+ '/dev/null',
+ qr/\Athe running kernel does not support the NVMe connect option 'transport'\n\z/,
+ ],
+ ) {
+ my ($name, $device, $expected) = $case->@*;
+ $nvme_mock->redefine(_fabrics_device => sub () { return $device });
+ my (undef, $error) = $run->();
+ like($error, $expected, "$name is refused");
+ unlike($error, qr/\Q$KEY\E/, 'without the key in the error');
+ }
+ is(-s $file, 0, 'and nothing is written before the device is checked');
+
+ my $pty = sub() {
+ # TIOCSPTLCK and TIOCGPTN are only known for these architectures
+ return if $Config{archname} !~ m/\A(?:x86_64|i[3-6]86|aarch64|arm|riscv64)-linux/;
+ sysopen(my $master, '/dev/ptmx', O_RDWR | O_NOCTTY) or return;
+ my $zero = pack('i', 0);
+ ioctl($master, 0x40045431, $zero) or return;
+ my $number = pack('i', 0);
+ ioctl($master, 0x80045430, $number) or return;
+ my $slave = '/dev/pts/' . unpack('i', $number);
+ # keeps the line discipline: canonical reads, no echo, no translation
+ sysopen(my $keep, $slave, O_RDWR | O_NOCTTY) or return;
+ my $termios = POSIX::Termios->new();
+ $termios->getattr(fileno($keep)) or die "tcgetattr: $!\n";
+ $termios->setlflag(($termios->getlflag() & ~(ECHO | ECHONL)) | ICANON);
+ $termios->setoflag($termios->getoflag() & ~OPOST);
+ $termios->setattr(fileno($keep), TCSANOW) or die "tcsetattr: $!\n";
+ return ($master, $slave, $keep);
+ };
+ my $received = sub($master) {
+ my $readable = '';
+ vec($readable, fileno($master), 1) = 1;
+ return '' if !select($readable, undef, undef, 0.1);
+ sysread($master, my $buffer, 65536) // die "cannot read the pseudoterminal: $!\n";
+ return $buffer;
+ };
+ my ($master, $slave, $keep) = $pty->();
+ SKIP: {
+ skip 'no pseudoterminal available', 25 if !$master;
+ $nvme_mock->redefine(_fabrics_device => sub () { return $slave });
+
+ my ($res, $error);
+ for my $instance (3, 12) {
+ syswrite($master, $tokens->($names->@*, 'tls'));
+ syswrite($master, "instance=$instance,cntlid=1\n");
+ ($res, $error) = $run->();
+ is($error, '', "a connect (instance $instance)");
+ is($res, $instance, 'returns the instance of the controller');
+ is($received->($master), $options, 'after exactly one write of the options');
+ my $attrs = "/sys/class/nvme/nvme$instance";
+ is_deeply(
+ \@RESTRICTED,
+ ["$attrs/dhchap_secret", "$attrs/dhchap_ctrl_secret"],
+ 'and restricts the secret attributes of that controller',
+ );
+ }
+
+ for my $missing (qw(host_iface nqn)) {
+ syswrite($master,
+ $tokens->(map { $_ eq $missing ? "${_}_suffix" : $_ } $names->@*));
+ ($res, $error) = $run->();
+ is(
+ $error,
+ "the running kernel does not support the NVMe connect option '$missing'\n",
+ "an option the kernel does not list ($missing)",
+ );
+ is($received->($master), '', 'is found before anything is written');
+ }
+
+ for my $result ("garbage\n", "instance=3,cntlid=1,garbage\n") {
+ syswrite($master, $tokens->($names->@*));
+ syswrite($master, $result);
+ ($res, $error) = $run->();
+ is($error, "unexpected connect result\n", 'an unexpected result is refused');
+ is($received->($master), $options, 'after the one write');
+ is_deeply(\@RESTRICTED, [], 'and nothing is restricted');
+ }
+
+ symlink($slave, "$dir/link") or die "symlink: $!\n";
+ $nvme_mock->redefine(_fabrics_device => sub () { return "$dir/link" });
+ ($res, $error) = $run->();
+ is(
+ $error,
+ "cannot open '$dir/link': Too many levels of symbolic links\n",
+ 'a symbolic link to the device is not followed',
+ );
+ $nvme_mock->redefine(_fabrics_device => sub () { return $slave });
+
+ # A failed write: the error has the errno text and never the options.
+ my $writes = 0;
+ $nvme_mock->redefine(
+ _fabrics_write => sub($fh, $data) { $writes++; $! = ECONNREFUSED; return undef },
+ );
+ syswrite($master, $tokens->($names->@*));
+ ($res, $error) = $run->();
+ is(
+ $error,
+ "connect failed: Connection refused\n",
+ 'a refused connect has the errno text',
+ );
+ is($writes, 1, 'after one write, which is not repeated');
+ is_deeply(\@RESTRICTED, [], 'and nothing is restricted');
+ $writes = 0;
+ $nvme_mock->redefine(
+ _fabrics_write => sub($fh, $data) { $writes++; return length($data) - 1 });
+ syswrite($master, $tokens->($names->@*));
+ syswrite($master, "instance=3,cntlid=1\n"); # never read: a short write ends the connect
+ ($res, $error) = $run->();
+ is($error, "connect failed: short write\n", 'a short write');
+ is($writes, 1, 'is not completed');
+ is_deeply(\@RESTRICTED, [], 'and restricts nothing');
+ $nvme_mock->unmock('_fabrics_write');
+ }
+ $nvme_mock->unmock('_fabrics_device');
+};
+
+# Deactivation deletes the controllers of the subsystem in one bounded child.
+{
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ add_controller('nvme3', '192.0.2.23', 4420, 'ens21', 'live', $OTHER_NQN);
+ $nvme_mock->redefine(
+ _namespace_openers =>
+ sub($nqn) { return ['qemu-system-x86_64 (PID 123, /dev/nvme0n1)'] },
+ );
+ eval { $PLUGIN->deactivate_storage('nvmetest', scfg()) };
+ like(
+ $@,
+ qr/refusing to disconnect.*namespace in use by qemu-system-x86_64/s,
+ 'deactivation refuses a namespace opened by a VM',
+ );
+ is_deeply(\@DELETED, [], 'and deletes nothing');
+ $nvme_mock->redefine(_namespace_openers => sub($nqn) { return [] });
+ is($PLUGIN->deactivate_storage('nvmetest', scfg()), 1, 'an unused storage is deactivated');
+ is_deeply(\@DELETED, ['nvme1', 'nvme2'], 'by deleting the controllers of its subsystem');
+ is_deeply(\@FORKS, [15], 'in one child bounded by 15 seconds');
+ is_deeply($DIRS{'/sys/class/nvme'}, ['nvme3'], 'the controllers of other subsystems stay');
+ is($PLUGIN->deactivate_storage('nvmetest', scfg()), 1, 'a storage without controllers');
+ is_deeply(\@FORKS, [15], 'needs no child');
+ $nvme_mock->unmock('_namespace_openers');
+
+ my $delete = $nvme_mock->original('_delete_controllers');
+ @SYSFS_WRITES = ();
+ is($delete->([{ name => 'nvme1' }, { name => 'nvme2' }]), 2, 'the child deletes each one');
+ is_deeply(
+ \@SYSFS_WRITES,
+ [map { ["/sys/class/nvme/$_/delete_controller", '1'] } qw(nvme1 nvme2)],
+ 'through sysfs',
+ );
+ # The stock file_write on files that fail: a failed write warns, with the
+ # errno text, and a failed open does not.
+ my $file_write = $sysfs_mock->original('file_write');
+ my $dir = tempdir(CLEANUP => 1);
+ my @warnings;
+ local $SIG{__WARN__} = sub($warning) { push @warnings, $warning };
+ for my $case (['/dev/full', 'No space left on device'], [$dir, 'Is a directory']) {
+ my ($path, $reason) = $case->@*;
+ $sysfs_mock->redefine(file_write => sub($file, @args) { $file_write->($path, @args) });
+ eval { $delete->([{ name => 'nvme1' }, { name => 'nvme2' }]) };
+ is(
+ $@,
+ "cannot delete NVMe controller 'nvme1': $reason\n",
+ "a failed delete names the controller and the errno text ($reason)",
+ );
+ }
+ $sysfs_mock->redefine(file_write => sub($file, @args) { $file_write->("$dir/a/b", @args) });
+ is(
+ $delete->([{ name => 'nvme1' }, { name => 'nvme2' }]),
+ 2,
+ 'a controller that went away since it was listed counts as deleted',
+ );
+ $sysfs_mock->redefine(
+ file_write => sub($path, $data, @rest) {
+ warn "error writing '$data' to '$path': Device or resource busy\n";
+ $! = 0;
+ return 0;
+ },
+ );
+ eval { $delete->([{ name => 'nvme1' }]) };
+ is(
+ $@,
+ "cannot delete NVMe controller 'nvme1': Device or resource busy\n",
+ 'the errno text of a failed write is the one of the warning',
+ );
+ is_deeply(\@warnings, [], 'which is not passed on');
+ $sysfs_mock->redefine(file_write => $sysfs_write);
+}
+
+# The users of the namespaces: file descriptors on a namespace or one of its
+# partitions, and kernel holders such as device-mapper.
+{
+ reset_host();
+ $DIRS{'/sys/class/nvme-subsystem/nvme-subsys7'} = ['nvme7n1', 'nvme7c1n1'];
+ $DIRS{'/sys/class/block/nvme7n1'} = ['nvme7n1p1', 'nvme7n1p2', 'holders'];
+ is_deeply(nv('_namespace_openers', $NQN), [], 'no device, no users');
+ my ($scan) = grep { $_->[0] eq '/sys/class/block/nvme7n1' } @GLOBS;
+ ok($scan, 'the partitions of the namespace are listed');
+ ok($scan && 'nvme7n1p1' =~ /^($scan->[1])$/ && 'nvme7n1' !~ /^($scan->[1])$/, 'only those');
+ ok(!grep({ $_->[0] eq '/sys/class/block/nvme7c1n1' } @GLOBS), 'not the path devices');
+
+ %BLOCK = map { ("/dev/$_" => 1) } qw(nvme7n1 nvme7n1p1 nvme7n1p2);
+ $DIRS{'/proc'} = [qw(100 200 300 self)];
+ $DIRS{'/proc/100/fd'} = [0, 1, 7];
+ $DIRS{'/proc/200/fd'} = [3];
+ $DIRS{'/proc/300/fd'} = [4];
+ %LINKS = (
+ '/proc/100/fd/0' => '/dev/null',
+ '/proc/100/fd/7' => '/dev/nvme7n1',
+ '/proc/200/fd/3' => '/dev/nvme7n1p1',
+ '/proc/300/fd/4' => '/dev/nvme8n1',
+ );
+ $FILES{'/proc/100/comm'} = 'qemu-system-x86';
+ $FILES{'/proc/200/comm'} = 'mkfs.ext4';
+ $DIRS{'/sys/class/block/nvme7n1p2/holders'} = ['dm-0'];
+ is_deeply(
+ nv('_namespace_openers', $NQN),
+ [
+ '/dev/nvme7n1p2 held by dm-0',
+ 'mkfs.ext4 (PID 200, /dev/nvme7n1p1)',
+ 'qemu-system-x86 (PID 100, /dev/nvme7n1)',
+ ],
+ 'open namespaces and partitions and their holders are users, other devices are not',
+ );
+}
+
+# The local device behind a namespace link must be that namespace.
+{
+ my $link = "/dev/disk/by-id/nvme-uuid.$UUID";
+ my $check = sub($target, %files) {
+ local %LINKS = (defined($target) ? ($link => $target) : ());
+ local %FILES = (
+ '/sys/block/nvme3n1/uuid' => uc($UUID),
+ '/sys/block/nvme3n1/nsid' => '7',
+ '/sys/block/nvme3n1/device/subsysnqn' => $NQN,
+ %files,
+ );
+ my $ok = nv('_nvmet_local_namespace_ok', $link, $NQN, 7, $UUID);
+ return $ok ? 1 : 0;
+ };
+ my $device = '../../nvme3n1';
+ is($check->($device), 1, 'accepts the namespace of the subsystem, whatever the UUID case');
+ is($check->($device, '/sys/block/nvme3n1/nsid' => '8'), 0, 'refuses another NSID');
+ is(
+ $check->($device, '/sys/block/nvme3n1/device/subsysnqn' => $OTHER_NQN),
+ 0,
+ 'another subsystem',
+ );
+ is(
+ $check->($device, '/sys/block/nvme3n1/uuid' => '22345678-1234-1234-1234-123456789abc'),
+ 0,
+ 'another UUID',
+ );
+ is($check->($device, '/sys/block/nvme3n1/uuid' => undef), 0, 'an unreadable device');
+ is($check->(undef), 0, 'a missing link');
+
+ for my $target ('../../nvme3c1n1', '../../nvme3n1p1', '../../sda') {
+ is($check->($target), 0, "a link to $target");
+ }
+
+ my $dir = tempdir(CLEANUP => 1);
+ symlink('../../nvme3n1', "$dir/link") or die "symlink: $!\n";
+ is($nvme_mock->original('_link_target')->("$dir/link"), '../../nvme3n1', 'read, not followed');
+}
+
+# Storage activation. Everything on the local host is mocked.
+my $activate = sub($storeid, $scfg, $cache = undef) {
+ local $FILES{"/etc/pve/priv/storage/$storeid.nvme-dhchap"} = $KEY;
+ local %CONFIG = (%CONFIG, $storeid => $scfg);
+ @ACTIVATIONS = ();
+ $nvme_mock->redefine(
+ _nvmet_activate_target => sub(@args) { push @ACTIVATIONS, [@args]; return },
+ );
+ my $res = eval { $PLUGIN->activate_storage($storeid, $scfg, $cache) };
+ my $error = $@;
+ $nvme_mock->unmock('_nvmet_activate_target');
+ return ($res, $error);
+};
+my $forced = sub($storeid) { return { 'zfsnvme-force-reconcile' => { $storeid => 1 } } };
+
+subtest 'activation preconditions' => sub {
+ my $file = sub($path, $value) {
+ return sub() { $FILES{$path} = $value }
+ };
+ my $missing_iface = sub() {
+ $nvme_mock->redefine(_local_iface_exists => sub($iface) { return $iface ne 'ens20' });
+ };
+ my $other_storage = sub(%override) {
+ return sub() { $CONFIG{other} = scfg(subsysnqn => $OTHER_NQN, %override) };
+ };
+ my $fabrics_injection = 'traddr=198.51.100.9';
+ for my $case (
+ [
+ 'NVMe kernel modules that are not loaded',
+ $file->('/sys/module/nvme_core/parameters/multipath', undef),
+ qr/the NVMe kernel modules are not loaded; load the nvme-tcp kernel module/,
+ ],
+ [
+ 'multipath disabled',
+ $file->('/sys/module/nvme_core/parameters/multipath', 'N'),
+ qr/native NVMe multipath is disabled/,
+ ],
+ [
+ 'no host NQN',
+ $file->('/etc/nvme/hostnqn', undef),
+ qr/missing \/etc\/nvme\/hostnqn; the nvme-cli package generates it/,
+ ],
+ [
+ 'a host that is not allowed',
+ $file->(
+ '/etc/nvme/hostnqn',
+ 'nqn.2014-08.org.nvmexpress:uuid:00000000-0000-4000-8000-00000000dead',
+ ),
+ qr/local NVMe host NQN .* is missing from nvme-host-nqns/,
+ ],
+ [
+ 'no host ID',
+ $file->('/etc/nvme/hostid', undef),
+ qr/missing \/etc\/nvme\/hostid; the nvme-cli package generates it/,
+ ],
+ [
+ 'the zero host ID',
+ $file->('/etc/nvme/hostid', '00000000-0000-0000-0000-000000000000'),
+ qr/invalid NVMe host ID/,
+ ],
+ [
+ 'a host ID with a connect option',
+ $file->('/etc/nvme/hostid', "$UUID,$fabrics_injection"),
+ qr/invalid NVMe host ID/,
+ ],
+ [
+ 'a host ID with a newline',
+ $file->('/etc/nvme/hostid', "$UUID\n"),
+ qr/invalid NVMe host ID/,
+ ],
+ [
+ 'a connection parameter that is not a number',
+ sub() { },
+ qr/invalid NVMe connection parameter 'reconnect-delay'/,
+ 'nvme-reconnect-delay' => "2,$fabrics_injection",
+ ],
+ [
+ 'a missing local interface',
+ $missing_iface,
+ qr/interface 'ens20' does not exist on this node/,
+ ],
+ [
+ 'a pool shared with another storage',
+ $other_storage->('nvme-portals' => '192.0.2.31,192.0.2.32'),
+ qr/ZFS pool 'tank' on '192\.0\.2\.10' is already used by storage 'other'/,
+ ],
+ [
+ 'a listener shared with another storage',
+ $other_storage->(pool => 'data', 'nvme-portals' => '192.0.2.31,192.0.2.22'),
+ qr/portal '192\.0\.2\.22' port 4420 is already used by storage 'other'/,
+ ],
+ ) {
+ my ($name, $setup, $error, %override) = $case->@*;
+ reset_host();
+ local %CONFIG = ();
+ $nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+ $setup->();
+ my (undef, $got) = $activate->('zfsnvme-unit-s', scfg(%override));
+ like($got, $error, "refuses $name");
+ is_deeply([@ACTIVATIONS, @CONNECTS, @SYSFS_WRITES], [], 'and does nothing');
+ }
+ $nvme_mock->redefine(_local_iface_exists => sub($iface) { return 1 });
+};
+
+subtest 'a stopped task ends the activation at the connect' => sub {
+ for my $case (
+ ["received interrupt\n", 1],
+ ["interrupted by unexpected signal\n", 1],
+ ["connect failed: Connection refused\n", 0],
+ ["NVMe/TCP connect did not complete within 10 seconds\n", 0],
+ ) {
+ my ($exception, $cancelled) = $case->@*;
+ reset_host();
+ my $calls = 0;
+ $nvme_mock->redefine(
+ _fabrics_connect => sub($options, $names) {
+ my %option = map { split(/=/, $_, 2) } split(/,/, $options);
+ ++$calls;
+ # cancellation must escape even if the write created a live path
+ add_controller("nvme$calls", $option{traddr}, 4420, $option{host_iface})
+ if $cancelled || $calls > 1;
+ die $exception if $calls == 1;
+ return $calls;
+ },
+ );
+ my ($res, $err) = $activate->('zfsnvme-cancel', scfg());
+ is($err, $cancelled ? "received interrupt\n" : '', 'only a stopped task escapes');
+ is($res, $cancelled ? undef : 1, 'an ordinary failure still permits a degraded path');
+ is($calls, $cancelled ? 1 : 2, 'a stopped task never attempts the next portal');
+ unlike($err . join('', @WARNINGS), qr/\Q$KEY\E/, 'errors and warnings hide the key');
+ }
+ $nvme_mock->redefine(_fabrics_connect => $connect_mock);
+
+ reset_host();
+ no warnings 'redefine';
+ local *PVE::Storage::ZFSNVMePlugin::_restrict_attr =
+ sub($path) { die "received interrupt\n" };
+ my ($res, $err) = $activate->('zfsnvme-cancel-scan', scfg());
+ is($err, "received interrupt\n",
+ 'cancellation in the post-connect permission scan escapes');
+ is(scalar(@CONNECTS), 1, 'no next portal after a cancelled permission scan');
+};
+
+# Deleting a controller runs in a bounded child: 5 seconds for a dead path
+# during an activation, which goes on, and 15 seconds for a deactivation,
+# which fails. Only a stopped task escapes an activation.
+subtest 'deleting a controller is bounded and keeps a stopped task' => sub {
+ my $interrupt = "received interrupt\n";
+ my $failed = "cannot delete NVMe controller 'nvme1'\n";
+ # [label, what the child does, activation error, deactivation error]
+ for my $case (
+ ['a stopped task', $interrupt, $interrupt, $interrupt],
+ ['a signalled child', "interrupted by unexpected signal\n", $interrupt, $interrupt],
+ ['a failed deletion', $failed, '', $failed],
+ [
+ 'a timeout',
+ undef,
+ '',
+ "disconnecting NVMe subsystem '$NQN' did not complete within 15 seconds\n",
+ ],
+ ) {
+ my ($label, $exception, $activation_error, $deactivation_error) = $case->@*;
+ $tools_mock->redefine(
+ run_fork_with_timeout => sub($seconds, $code, $opts = undef) {
+ push @FORKS, $seconds;
+ # without an exception, the deletion times out
+ return (undef, 1) if !defined($exception) && $seconds != 10;
+ return ($code->(), 0);
+ },
+ );
+ $nvme_mock->redefine(_delete_controllers => sub($controllers) { die $exception })
+ if defined($exception);
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'dead');
+ my ($res, $err) = $activate->('zfsnvme-delete', scfg());
+ is($err, $activation_error, "$label while a dead path is deleted");
+ is($FORKS[0], 5, 'in a child bounded by 5 seconds');
+ is(scalar(@CONNECTS), $activation_error ? 0 : 2, 'only a failure goes on to connect');
+ my $warned = $exception
+ // "deleting NVMe controller 'nvme1' did not complete within 5 seconds\n";
+ like(join("\n", @WARNINGS), qr/\Q$warned\E/, 'and is warned about')
+ if !$activation_error;
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ eval { $PLUGIN->deactivate_storage('zfsnvme-delete', scfg()) };
+ is($@, $deactivation_error, "$label fails the deactivation");
+ is_deeply(\@FORKS, [15], 'in a child bounded by 15 seconds');
+ $nvme_mock->redefine(_delete_controllers => $delete_mock);
+ }
+ $tools_mock->redefine(run_fork_with_timeout => $fork_inline);
+};
+
+subtest 'storage deletion preserves task cancellation at each catch boundary' => sub {
+ for my $case (
+ ['deactivate', "received interrupt\n", 1, 0],
+ ['deactivate', "ordinary disconnect failure\n", 0, 1],
+ [
+ 'deactivate',
+ "disconnecting NVMe subsystem '$NQN' did not complete within 15 seconds\n",
+ 0,
+ 1,
+ ],
+ ['target', "received interrupt\n", 1, 1],
+ ['target', "ordinary target failure\n", 0, 1],
+ ) {
+ my ($phase, $exception, $cancelled, $expected_target_calls) = $case->@*;
+ reset_host();
+ my $target_calls = 0;
+ no warnings 'redefine';
+ local *PVE::Storage::ZFSNVMePlugin::deactivate_storage = sub(@args) {
+ die $exception if $phase eq 'deactivate';
+ return 1;
+ };
+ local *PVE::Storage::ZFSNVMePlugin::_nvmet_delete_target = sub(@args) {
+ ++$target_calls;
+ die $exception if $phase eq 'target';
+ return;
+ };
+ eval { $PLUGIN->on_delete_hook('zfsnvme-delete-cancel', scfg()) };
+ is(
+ $@,
+ $cancelled ? "received interrupt\n" : '',
+ "$phase preserves only task cancellation",
+ );
+ is($target_calls, $expected_target_calls, 'no target deletion after a cancellation');
+ is_deeply(
+ \@UNLINKED,
+ ['/etc/pve/priv/storage/zfsnvme-delete-cancel.nvme-dhchap'],
+ 'the key file is removed first',
+ );
+ chomp(my $message = $exception);
+ like(
+ join("\n", @WARNINGS),
+ qr/not disconnecting NVMe storage 'zfsnvme-delete-cancel': \Q$message\E/,
+ 'an ordinary deactivation failure only warns',
+ ) if $phase eq 'deactivate' && !$cancelled;
+ }
+};
+
+subtest 'slow-path backoff' => sub {
+ reset_host();
+ local %REFUSE = ('192.0.2.22' => 1);
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ my $scfg = scfg();
+ my ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is($error, '', 'a degraded storage activates');
+ is(scalar(@ACTIVATIONS), 1, 'through the target');
+ is_deeply(
+ [$ACTIVATIONS[0]->@[0, 2 .. 4]],
+ [
+ 'zfsnvme-unit-a',
+ [
+ map { {
+ family => 'ipv4',
+ address => "192.0.2.2$_",
+ port => 4420,
+ host_iface => 'ens' . (18 + $_),
+ } } 1,
+ 2,
+ ],
+ [$hostnqn_a, $hostnqn_b],
+ $KEY,
+ ],
+ 'with the storage, its parsed portals, hosts and key',
+ );
+ like(
+ join("\n", @WARNINGS),
+ qr/storage 'zfsnvme-unit-a' is degraded: 1\/2 paths live/,
+ 'and warns',
+ );
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is($error, '', 'within a minute, a live path takes the fast path');
+ is(scalar(@ACTIVATIONS), 0, 'without a target call');
+ {
+ local $NOW = $NOW + 61;
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is(scalar(@ACTIVATIONS), 1, 'a minute later the target is tried again');
+ }
+ my $cache = $forced->('zfsnvme-unit-a');
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg, $cache);
+ is(scalar(@ACTIVATIONS), 1, 'a forced activation always reaches the target');
+ ok(!$cache->{'zfsnvme-force-reconcile'}->{'zfsnvme-unit-a'}, 'and consumes the request');
+ $FILES{'/sys/class/nvme/nvme1/state'} = 'dead';
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is(
+ $error,
+ "no live NVMe/TCP path for storage 'zfsnvme-unit-a'\n",
+ 'within a minute, without a live path the activation fails at once',
+ );
+ is_deeply([@ACTIVATIONS, @DELETED], [], 'without a target call or a reconnect');
+ {
+ local $NOW = $NOW + 61;
+ ($res, $error) = $activate->('zfsnvme-unit-a', $scfg);
+ is(scalar(@ACTIVATIONS), 1, 'a minute later the target is tried');
+ is_deeply(\@DELETED, ['nvme1'], 'and the dead path is reconnected');
+ }
+
+ reset_host();
+ local %REFUSE = ('192.0.2.22' => 1);
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ local $NOW = 30; # the monotonic clock shortly after boot
+ ($res, $error) = $activate->('zfsnvme-unit-b', $scfg);
+ is(scalar(@ACTIVATIONS), 1, 'a storage that was never activated is not in its backoff');
+
+ # A storage without any path waits for one once per backoff period, not
+ # on every status update.
+ reset_host();
+ local %REFUSE = ('192.0.2.21' => 1, '192.0.2.22' => 1);
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is($error, "no live NVMe/TCP path for storage 'zfsnvme-unit-d'\n", 'no path, no storage');
+ is_deeply(
+ [scalar(@ACTIVATIONS), scalar(@CONNECTS)],
+ [1, 2],
+ 'after the target and each portal',
+ );
+ @CONNECTS = ();
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is(
+ $error,
+ "no live NVMe/TCP path for storage 'zfsnvme-unit-d'\n",
+ 'within a minute it fails',
+ );
+ is_deeply([@ACTIVATIONS, @CONNECTS], [], 'at once, without a target call or a connect');
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg, $forced->('zfsnvme-unit-d'));
+ is_deeply(
+ [scalar(@ACTIVATIONS), scalar(@CONNECTS)],
+ [1, 2],
+ 'a forced activation tries again',
+ );
+ {
+ local $NOW = $NOW + 61;
+ @CONNECTS = ();
+ ($res, $error) = $activate->('zfsnvme-unit-d', $scfg);
+ is_deeply(
+ [scalar(@ACTIVATIONS), scalar(@CONNECTS)],
+ [1, 2],
+ 'so does one a minute later',
+ );
+ }
+
+ # A slow path whose target call fails starts the backoff as well.
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ local $FILES{'/etc/pve/priv/storage/zfsnvme-unit-t.nvme-dhchap'} = $KEY;
+ local %CONFIG = ('zfsnvme-unit-t' => $scfg);
+ my $calls = 0;
+ $nvme_mock->redefine(
+ _nvmet_activate_target => sub(@args) {
+ $calls++;
+ die "NVMe target '192.0.2.10' is unreachable: timeout\n";
+ },
+ );
+ eval { $PLUGIN->activate_storage('zfsnvme-unit-t', $scfg) };
+ like($@, qr/is unreachable/, 'an unreachable target fails the slow path');
+ eval { $PLUGIN->activate_storage('zfsnvme-unit-t', $scfg) };
+ is($@, '', 'within a minute the live path takes the fast path');
+ is($calls, 1, 'without another target call');
+ $nvme_mock->unmock('_nvmet_activate_target');
+};
+
+subtest 'connecting the paths' => sub {
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ $network_mock->redefine(
+ tcp_ping => sub($host, $port, $timeout = undef) { return $host ne '192.0.2.22' },
+ );
+ my (undef, $error) = $activate->('zfsnvme-unit-v', scfg(), $forced->('zfsnvme-unit-v'));
+ is_deeply(\@CONNECTS, [], 'an unreachable portal is not connected');
+ like(join("\n", @WARNINGS), qr/'192\.0\.2\.22:4420' is unreachable/, 'but warned about');
+ $network_mock->redefine(tcp_ping => sub($host, $port, $timeout = undef) { return 1 });
+
+ # After a target restart, the kernel reconnects its controllers itself.
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'connecting');
+ local %REFUSE = ('192.0.2.22' => 1);
+ my $sleeps = 0;
+ $nvme_mock->redefine(
+ _sleep => sub($seconds) {
+ $NOW += $seconds;
+ $FILES{'/sys/class/nvme/nvme1/state'} = 'live' if ++$sleeps == 3;
+ return;
+ },
+ );
+ (undef, $error) = $activate->('zfsnvme-unit-w', scfg());
+ is($error, '', 'an activation waits for a controller that reconnects');
+ is($sleeps, 3, 'until it is live');
+ $nvme_mock->redefine(_sleep => sub($seconds) { $NOW += $seconds; return });
+};
+
+subtest 'moving a path to its configured interface' => sub {
+ my $single = scfg('nvme-portals' => '192.0.2.21', 'nvme-host-ifaces' => 'ens19');
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ my ($res, $error) = $activate->('zfsnvme-unit-c', scfg());
+ is($error, '', 'a storage whose only live path uses another interface');
+ is_deeply(\@CONNECTS, ['192.0.2.21@ens19', '192.0.2.22@ens20'], 'connects both paths');
+ is_deeply(\@DELETED, ['nvme1'], 'and then disconnects the old one');
+ is_deeply(\@WARNINGS, [], 'the storage is healthy');
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ local %CONNECT_STATE = ('192.0.2.21' => 'connecting');
+ my $start = $NOW;
+ ($res, $error) = $activate->('zfsnvme-unit-g', $single);
+ is($error, '', 'a new path that does not become live');
+ is_deeply(\@DELETED, [], 'keeps the old path');
+ like(
+ join("\n", @WARNINGS),
+ qr/'192\.0\.2\.21:4420' is not live on 'ens19' yet; keeping its path on another interface/,
+ 'and warns',
+ );
+ like(join("\n", @WARNINGS), qr/is degraded: 0\/1 paths live/, 'the storage is degraded');
+ is($NOW - $start, 10, 'after waiting 10 seconds for the new path');
+ ($res, $error) = $activate->('zfsnvme-unit-g', $single);
+ ok(!$error && !@ACTIVATIONS, 'within a minute, the old path takes the fast path');
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ local %REFUSE = ('192.0.2.21' => 1);
+ ($res, $error) = $activate->('zfsnvme-unit-h', $single);
+ is($error, '', 'a new path that cannot connect');
+ is_deeply(\@DELETED, [], 'keeps the old path too');
+ like(
+ join("\n", @WARNINGS),
+ qr/192\.0\.2\.21:4420: connect failed: Connection refused/,
+ 'and warns',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'eth9');
+ my $connect = $PLUGIN->can('_connect_portal');
+ {
+ no warnings 'redefine';
+ local %REFUSE = ();
+ local *PVE::Storage::ZFSNVMePlugin::_connect_portal = sub($scfg, $portal, @ids) {
+ $connect->($scfg, $portal, @ids);
+ die "connection failed after creation\n";
+ };
+ ($res, $error) = $activate->('zfsnvme-unit-h-partial', $single);
+ }
+ ok(!$error && $res == 1, 'a partially successful connect leaves the storage usable');
+ is($FILES{'/sys/class/nvme/nvme71/state'}, 'live', 'a live replacement was created');
+ is_deeply(\@DELETED, [], 'the connect error still preserves the old interface path');
+ like(
+ join("\n", @WARNINGS),
+ qr/192\.0\.2\.21:4420: connection failed after creation/,
+ 'and preserves the original connect warning',
+ );
+};
+
+subtest 'reconnect timeouts reach connected controllers' => sub {
+ my $sysfs = sub () {
+ return [
+ map { [$_->[0] =~ s{\A/sys/class/nvme/}{}r, $_->[1] =~ s/\n\z//r] }
+ grep { $_->[0] =~ m{\A/sys/class/nvme/} } @SYSFS_WRITES
+ ];
+ };
+ my $case = sub($storeid, $scfg, %current) {
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ for my $name (qw(nvme1 nvme2)) {
+ $FILES{"/sys/class/nvme/$name/$_"} = $current{$_} for keys %current;
+ }
+ my ($res, $error) = $activate->($storeid, $scfg, $forced->($storeid));
+ is($error, '', "activation of $storeid");
+ return $sysfs->();
+ };
+ my $timeouts = scfg(
+ 'nvme-reconnect-delay' => 5,
+ 'nvme-ctrl-loss-tmo' => 60,
+ 'nvme-fast-io-fail-tmo' => 10,
+ );
+ my $written = [
+ map { (
+ ["$_/reconnect_delay", 5], ["$_/ctrl_loss_tmo", 60], ["$_/fast_io_fail_tmo", 10],
+ ) } qw(nvme1 nvme2)
+ ];
+ is_deeply($case->('zfsnvme-unit-i', $timeouts), $written, 'changes reach every controller');
+ is_deeply(
+ [grep { $_->[0] =~ /iopolicy/ } @SYSFS_WRITES],
+ [['/sys/class/nvme-subsystem/nvme-subsys7/iopolicy', "round-robin\n"]],
+ 'with the multipath policy',
+ );
+ my %current = (reconnect_delay => '5', ctrl_loss_tmo => '60', fast_io_fail_tmo => '10');
+ is_deeply(
+ $case->('zfsnvme-unit-j', $timeouts, %current),
+ [],
+ 'unchanged ones are not written',
+ );
+ is_deeply(
+ $case->('zfsnvme-unit-k', scfg('nvme-ctrl-loss-tmo' => -1)),
+ [map { ["$_/ctrl_loss_tmo", -1] } qw(nvme1 nvme2)],
+ 'an infinite loss timeout',
+ );
+ is_deeply(
+ $case->('zfsnvme-unit-l', scfg('nvme-ctrl-loss-tmo' => 7), ctrl_loss_tmo => '8'),
+ [],
+ 'the loss timeout the kernel rounds up to the reconnect delay',
+ );
+ is_deeply(
+ $case->('zfsnvme-unit-m', scfg(), fast_io_fail_tmo => '5'),
+ [map { ["$_/fast_io_fail_tmo", -1] } qw(nvme1 nvme2)],
+ 'an unset fast I/O fail timeout is turned off',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ my ($res, $error) = $activate->('zfsnvme-unit-n', $timeouts);
+ ok(!$error && $res == 1, 'a healthy storage activates on the fast path');
+ is(scalar(@ACTIVATIONS) + scalar(@CONNECTS), 0, 'without a target call or connect');
+ is_deeply($sysfs->(), $written, 'which also writes changed timeouts');
+ is_deeply(
+ [grep { $_->[0] =~ /iopolicy/ } @SYSFS_WRITES],
+ [['/sys/class/nvme-subsystem/nvme-subsys7/iopolicy', "round-robin\n"]],
+ 'and the multipath policy',
+ );
+ delete $FILES{'/etc/pve/priv/storage/zfsnvme-unit-n.nvme-dhchap'};
+ $res = eval {
+ local %CONFIG = ('zfsnvme-unit-n' => $timeouts);
+ $PLUGIN->activate_storage('zfsnvme-unit-n', $timeouts);
+ };
+ is($@, "missing NVMe DH-HMAC-CHAP key\n", 'the fast path needs the key file');
+
+ # file_write warns about a failed write, and is silent about a failed open,
+ # leaving its errno in $!
+ my @perl_warnings;
+ local $SIG{__WARN__} = sub($warning) { push @perl_warnings, $warning };
+ my $failing = sub($pattern, $errno, $warn) {
+ $sysfs_mock->redefine(
+ file_write => sub($path, $data, @rest) {
+ return $sysfs_write->($path, $data) if $path !~ $pattern;
+ $! = $errno;
+ return undef if !$warn;
+ warn "error writing '$data' to '$path': $!\n";
+ $! = ENOENT; # not the reason: file_write closed the file since
+ return 0;
+ },
+ );
+ };
+ my $reason = sub($errno) { local $! = $errno; return "$!" };
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/nvme1/ctrl_loss_tmo\z}, EINVAL, 1);
+ ($res, $error) = $activate->('zfsnvme-unit-e', $timeouts);
+ is($error, '', 'a timeout that cannot be written does not fail the activation');
+ my $einval = $reason->(EINVAL);
+ is_deeply(
+ [@WARNINGS, @perl_warnings],
+ ["cannot set ctrl_loss_tmo of NVMe controller 'nvme1': $einval"],
+ 'and is reported once, as a task warning with the reason',
+ );
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/nvme2/ctrl_loss_tmo\z}, EACCES, 0);
+ ($res, $error) = $activate->('zfsnvme-unit-tmo-open', $timeouts);
+ is($error, '', 'a timeout that cannot be opened does not fail the activation');
+ is_deeply(
+ [@WARNINGS, @perl_warnings],
+ ["cannot set ctrl_loss_tmo of NVMe controller 'nvme2': " . $reason->(EACCES)],
+ 'and is reported once, with the reason',
+ );
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/iopolicy\z}, EACCES, 0);
+ ($res, $error) = $activate->('zfsnvme-unit-f', $timeouts);
+ is(
+ $error,
+ 'unable to set NVMe multipath policy: ' . $reason->(EACCES) . "\n",
+ 'a policy that cannot be set fails the activation',
+ );
+ is_deeply([@WARNINGS, @perl_warnings], [], 'with the reason in the error only');
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $failing->(qr{/iopolicy\z}, EINVAL, 1);
+ ($res, $error) = $activate->('zfsnvme-unit-policy-write', $timeouts);
+ is(
+ $error,
+ "unable to set NVMe multipath policy: $einval\n",
+ 'a policy that cannot be written fails the activation',
+ );
+ is_deeply([@WARNINGS, @perl_warnings], [],
+ 'and the warning of file_write is not passed on');
+
+ # The stock file_write on an attribute that does not exist: unlike a
+ # deletion or a rescan, setting a timeout or the policy treats the failed
+ # open (ENOENT) as a failure like any other.
+ my $file_write = $sysfs_mock->original('file_write');
+ my $missing = tempdir(CLEANUP => 1) . '/a/b';
+ my $absent = sub($pattern) {
+ $sysfs_mock->redefine(
+ file_write => sub($path, $data, @rest) {
+ return $sysfs_write->($path, $data) if $path !~ $pattern;
+ return $file_write->($missing, $data, @rest);
+ },
+ );
+ };
+ my $enoent = $reason->(ENOENT);
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $absent->(qr{/nvme1/reconnect_delay\z});
+ ($res, $error) = $activate->('zfsnvme-unit-tmo-missing', $timeouts);
+ is($error, '', 'a missing timeout attribute does not fail the activation');
+ is_deeply(
+ [@WARNINGS, @perl_warnings],
+ ["cannot set reconnect_delay of NVMe controller 'nvme1': $enoent"],
+ 'but is reported once, as a task warning with the reason',
+ );
+ reset_host();
+ @perl_warnings = ();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ $absent->(qr{/iopolicy\z});
+ ($res, $error) = $activate->('zfsnvme-unit-policy-missing', $timeouts);
+ is(
+ $error,
+ "unable to set NVMe multipath policy: $enoent\n",
+ 'a missing policy attribute fails the activation',
+ );
+ is_deeply([@WARNINGS, @perl_warnings], [], 'with the reason in the error only');
+ $sysfs_mock->redefine(file_write => $sysfs_write);
+};
+
+subtest 'the key attributes of the controllers are private' => sub {
+ my $attrs = sub(@names) {
+ my @attrs = qw(dhchap_secret dhchap_ctrl_secret);
+ return [
+ map {
+ my $name = $_;
+ map { "/sys/class/nvme/$name/$_" } @attrs
+ } @names
+ ];
+ };
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ add_controller('nvme2', '192.0.2.22', 4420, 'ens20');
+ add_controller('nvme3', '192.0.2.23', 4420, 'ens21', 'live', $OTHER_NQN);
+ my ($res, $error) = $activate->('zfsnvme-unit-o', scfg());
+ is($error, '', 'a healthy storage');
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme1', 'nvme2'),
+ 'restricts its controllers on the fast path',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19');
+ ($res, $error) = $activate->('zfsnvme-unit-p', scfg(), $forced->('zfsnvme-unit-p'));
+ is($error, '', 'a forced activation');
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme1', 'nvme1', 'nvme71'),
+ 'restricts those of the existing controllers first, then those of new ones',
+ );
+
+ reset_host();
+ local %CONNECT_STATE = map { ($_ => 'connecting') } '192.0.2.21', '192.0.2.22';
+ ($res, $error) = $activate->('zfsnvme-unit-q', scfg());
+ is(
+ $error,
+ "no live NVMe/TCP path for storage 'zfsnvme-unit-q'\n",
+ 'an activation that fails',
+ );
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme71', 'nvme71', 'nvme72'),
+ 'each one after its connect',
+ );
+
+ reset_host();
+ add_controller('nvme1', '192.0.2.21', 4420, 'ens19', 'connecting');
+ $nvme_mock->redefine(_nvmet_activate_target => sub(@args) { die "unreachable\n" });
+ $res = eval {
+ local $FILES{'/etc/pve/priv/storage/zfsnvme-unit-x.nvme-dhchap'} = $KEY;
+ local %CONFIG = ('zfsnvme-unit-x' => scfg());
+ $PLUGIN->activate_storage('zfsnvme-unit-x', scfg());
+ };
+ is($@, "unreachable\n", 'a slow path that fails at the target');
+ is_deeply(\@RESTRICTED, $attrs->('nvme1'), 'still restricts the existing controllers');
+ $nvme_mock->unmock('_nvmet_activate_target');
+
+ # The first connect fails after it created a live controller; the scan of
+ # the permissions after it fails too in the second case.
+ my $connect = $PLUGIN->can('_connect_portal');
+ my $connect_error = "connection failed after creation\n";
+ for my $scan_error (0, 1) {
+ reset_host();
+ my $scan_failed = 0;
+ {
+ no warnings 'redefine';
+ local *PVE::Storage::ZFSNVMePlugin::_connect_portal = sub($scfg, $portal, @ids) {
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme71'),
+ 'a failed connect restricts both attributes before the next connect',
+ ) if @CONNECTS == 1 && !$scan_error;
+ $connect->($scfg, $portal, @ids);
+ die $connect_error if @CONNECTS == 1;
+ };
+ local *PVE::Storage::ZFSNVMePlugin::_restrict_attr = sub($path) {
+ push @RESTRICTED, $path;
+ eval { 1 }; # A permission helper must not erase the saved connect error.
+ die "permission scan failed\n" if $scan_error && !$scan_failed++;
+ return;
+ };
+ ($res, $error) = $activate->("zfsnvme-unit-secret-failure-$scan_error", scfg());
+ }
+ is($error, '', 'a connect error does not discard its live controller');
+ ok(
+ scalar(grep { $_ eq "192.0.2.21:4420: $connect_error" } @WARNINGS),
+ 'and warns about it',
+ );
+ if ($scan_error) {
+ ok(
+ scalar(
+ grep { $_ eq "cannot restrict NVMe controller attributes for '$NQN'" }
+ @WARNINGS
+ ),
+ 'the scan failure has its own warning',
+ );
+ unlike(join("\n", @WARNINGS), qr/permission scan failed/, 'without its exception');
+ } else {
+ is_deeply(
+ \@RESTRICTED,
+ $attrs->('nvme71', 'nvme71', 'nvme72'),
+ 'each attempt restricts the controllers, including a failed last connect',
+ );
+ }
+ }
+
+ my $dir = tempdir(CLEANUP => 1);
+ my $restrict = $nvme_mock->original('_restrict_attr');
+ for my $mode (0644, 0640, 0600, 0400) {
+ my $file = sprintf('%s/attr-%o', $dir, $mode);
+ open(my $fh, '>', $file) or die "open: $!\n";
+ close($fh);
+ chmod($mode, $file);
+ $restrict->($file);
+ is(
+ (stat($file))[2] & 07777,
+ $mode & 077 ? 0600 : $mode,
+ sprintf('an attribute with mode %o', $mode),
+ );
+ }
+ @WARNINGS = ();
+ $restrict->("$dir/missing");
+ is_deeply(\@WARNINGS, [], 'a missing attribute is skipped');
+ my $not_directory = "$dir/attr-600/child";
+ $restrict->($not_directory);
+ like(join("\n", @WARNINGS), qr/\Q$not_directory\E/, 'another stat failure warns');
+};
+
+subtest 'controllers match IPv6 portals in any spelling' => sub {
+ reset_host();
+ add_controller('nvme1', '2001:db8:0:0::11', 4420, 'ens19');
+ add_controller('nvme2', '2001:DB8::12', 4420, 'ens20');
+ my $scfg = scfg('nvme-portals' => '[2001:db8::11],[2001:db8::0:12]');
+ my ($res, $error) = $activate->('zfsnvme-unit-r', $scfg);
+ is($error, '', 'both paths are live');
+ is(scalar(@ACTIVATIONS) + scalar(@CONNECTS), 0, 'without a target call or connect');
+};
+
+is_deeply(\@COMMANDS, [], 'the host side ran no command');
+
+done_testing();
+
+1;
^ permalink raw reply related [relevance 5%]
* [PATCH docs v3] storage: document ZFS over NVMe/TCP
2026-10-05 0:26 8% [PATCH storage v3 0/4] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-10-05 0:26 9% ` [PATCH storage v3 1/4] zfsnvme: " Joaquin Varela
2026-10-05 0:26 5% ` [PATCH storage v3 2/4] test: add zfsnvme plugin tests Joaquin Varela
@ 2026-10-05 0:26 14% ` Joaquin Varela
2 siblings, 0 replies; 143+ results
From: Joaquin Varela @ 2026-10-05 0:26 UTC (permalink / raw)
To: pve-devel
Document the zfsnvme storage backend: target and node requirements,
its properties with a configuration example, native multipath and
DH-HMAC-CHAP authentication, security and availability limits, and the
lifecycle of the target configuration. Include the chapter in pvesm and
link its wiki page.
Every storage needs its own NVMe/TCP listeners on the target, and they
must not publish any other nvmet subsystem: nvmet rejects a connection
to a subsystem that is not published on the listener yet with DNR, and
the node deletes the controller regardless of the controller loss
timeout. The chapter says which portals and server values the backend
refuses for that reason, and that adding, updating or activating a
storage fails on them.
Nodes connect each path with a single write to /dev/nvme-fabrics and
delete controllers through sysfs, so nvme-cli is only needed for the
host identity files and as the administration tool. The chapter
states which connect options the running kernel must support, that
the key is never put on a command line or in a temporary file, and
which secret attributes are restricted to mode 0600 on the nodes and
on the target. Revoking a node also requires removing it from the
cluster and replacing the SSH key of every target, since every cluster
member can read the storage keys and the SSH keys give root access to
the targets.
It also explains what happens when every path stays down longer than
the controller loss timeout: the kernel removes the controllers and
the multipath block devices, and running guests have to be stopped and
started once the paths are back. A controller loss timeout of -1
needs a finite fast I/O fail timeout to keep guest I/O from blocking
for the whole outage.
Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
v3, accompanying "[PATCH storage v3 0/4] add ZFS over NVMe/TCP
storage plugin":
- the five v2 patches are squashed into one; the structure of the
chapter is unchanged
- changes that follow the storage v3 implementation:
- target requirements: the plugin only runs standard utilities over
SSH (listed), and the highest namespace ID handed out is kept in
the proxmox:nvme-last-nsid property of the pool
- nodes: paths are created through /dev/nvme-fabrics and deleted
through sysfs, so nvme-cli is only needed for the host identity
files (hostid must be a nonzero UUID) and as the administration
tool; the running kernel must support every connect option used,
and a failed connect is logged per portal
- every storage needs its own listeners (address and port), which
must not publish any other nvmet subsystem, because nvmet rejects
a subsystem that is not published on a listener yet with DNR and
the node then deletes the controller regardless of the controller
loss timeout; the plugin refuses a listener used by another
zfsnvme storage and a target address reached through a different
server value, and the server value is the key of the cluster-wide
lock per target
- target changes, including the restore after a target restart, take
that lock and therefore need quorum; an uncertain command result
aborts the operation and the next one reads the target again;
queries outside a transaction, such as capacity, do not take it
- one cluster per target, pools of one target must not overlap,
storages whose host NQNs overlap share the key
- nvme-host-ifaces and nvme-host-nqns are required in the schema,
an interface change is make-before-break, host NQNs can only be
added, so revoking a node has its own procedure
- sparse is no longer set by default, like in the web interface
- pvesm takes --dhchap-key as the path of a key file
- how the key reaches the kernel and the target, and the mode 0600
restriction of the secret attributes on the nodes and the target
- the connection tunables are applied to connected controllers on
the next activation
- no pvesm export/import
- removing the storage never deletes volumes; what deactivation and
the best-effort target cleanup do
- the optional transaction guard of storage 3/4: one sentence in the
target requirements and one paragraph in "Security and
Availability"; both go away if that patch is dropped
- corrections of v2 statements that were wrong or misleading:
- DH-HMAC-CHAP only authenticates the hosts to the target, with one
key shared by all nodes (v2: "authenticates the endpoints")
- the target kernel needs NVMe in-band authentication, which v2
already required but did not list
- the plugin itself loads nvmet_tcp and mounts configfs on the
target; loading the transport at boot is recommended, not required
- all-path loss: after the controller loss timeout the kernel
deletes the controllers and the multipath devices, and running
guests need a stop and start; a rejection deletes the controller
at once; -1 needs a finite fast I/O fail timeout. v2 only said
that I/O stays queued, and "600 seconds in the example" was wrong
because the example sets a fast I/O fail timeout of 30 seconds
- the configuration example uses documentation addresses and an
example NQN, and drops "shared 1", which is not a property of
this type
- the pvesm wiki link uses the page name of the chapter title
- nothing else was added, apart from wording ("controller loss
timeout" without hyphens) and the anchor for the cross-references to
"Security and Availability"; happy to trim further
v2: https://lore.proxmox.com/pve-devel/cover.1785636981.git.joaquinvarela@neatech.ar/
pve-storage-zfsnvme.adoc | 373 +++++++++++++++++++++++++++++++++++++++
pvesm.adoc | 4 +
2 files changed, 377 insertions(+)
create mode 100644 pve-storage-zfsnvme.adoc
diff --git a/pve-storage-zfsnvme.adoc b/pve-storage-zfsnvme.adoc
new file mode 100644
index 0000000..c590636
--- /dev/null
+++ b/pve-storage-zfsnvme.adoc
@@ -0,0 +1,373 @@
+[[storage_zfsnvme]]
+ZFS over NVMe/TCP Backend
+-------------------------
+ifdef::wiki[]
+:pve-toplevel:
+:title: Storage: ZFS over NVMe/TCP
+endif::wiki[]
+
+Storage pool type: `zfsnvme`
+
+This backend accesses a remote Linux machine with a ZFS pool and the kernel
+NVMe target through `ssh`. For each guest disk it creates a ZVOL, exports it as
+an NVMe namespace, and connects the {pve} nodes through native Linux NVMe/TCP
+multipath.
+
+The backend supports thin provisioning, snapshots, rollback, templates, linked
+clones, offline resize, and shared-storage live migration. Namespace UUIDs are
+stored as ZFS user properties, and the stable `nvme-uuid` device link is used
+for guest disks.
+
+Configuration
+~~~~~~~~~~~~~
+
+The target needs OpenZFS, configfs, and the `nvmet` and `nvmet-tcp` kernel
+modules with NVMe in-band authentication support. The backend runs target
+utilities over SSH and does all parsing and planning on the {pve} node, so
+neither Perl nor Bash is required on the target. Root's login shell must be a
+POSIX-compatible shell, and the target needs these standard utilities: `find`
+(with `-prune`, `-path`, and `-exec ... {} +`), `grep`, `env`, `printf`, `test`,
+`cat`, `mkdir`, `rmdir`, `rm`, `ln`, `chmod`, `dd`, `tee`, `sha256sum`,
+`modprobe`, and `mount`. The transaction guard described in
+xref:storage_zfsnvme_security[Security and Availability] also needs `/bin/sh` to
+be a POSIX-compatible shell, util-linux `flock` with `-w` and `-E` support, and
+`stat` with `-c '%u:%a'` support. Configure root SSH access like for the ZFS
+over iSCSI backend. The key for the server address is stored at
+`/etc/pve/priv/zfs/<server>_id_rsa`.
+
+The NVMe target modules must be installed on the target. The backend loads
+`nvmet_tcp` and, if necessary, mounts configfs before it restores the target
+configuration after a reboot, but loading the transport at boot is recommended.
+On a Linux target using systemd, load the transport at boot and verify the
+configfs mount:
+
+----
+# echo nvmet_tcp >/etc/modules-load.d/pve-nvmet.conf
+# modprobe nvmet_tcp
+# mountpoint /sys/kernel/config
+----
+
+The target configuration below configfs is derived state. It does not need a
+separate persistence service: after the module and ZFS pool are available, the
+backend reconstructs namespaces and UUIDs from ZFS user properties, and
+reconstructs the subsystem, host ACLs, and ports from the shared storage
+configuration during activation. The backend also records the highest
+namespace ID it handed out in the `proxmox:nvme-last-nsid` property of the
+pool dataset, so that a namespace ID is not reused for a new volume.
+
+Do not leave cloud-init device discovery enabled on a dedicated Linux target.
+A guest cloud-init ZVOL contains a `cidata` filesystem and can otherwise be
+mistaken for the target host's own NoCloud datasource during boot. After the
+target host is provisioned, remove cloud-init or disable it according to the
+distribution's documentation. For distributions supporting the standard
+disable marker, use:
+
+----
+# touch /etc/cloud/cloud-init.disabled
+----
+
+Each {pve} node needs the `nvme-tcp` module, native NVMe multipath, a unique
+`/etc/nvme/hostnqn`, and a nonzero UUID in `/etc/nvme/hostid`. The `nvme-cli`
+package creates both files and provides the NVMe administration tools.
+Interface names listed in the storage configuration must exist on every node
+where the storage is enabled.
+
+The backend does not use `nvme-cli` to connect or disconnect. It creates each
+missing path with a single write to the kernel's `/dev/nvme-fabrics` interface
+from a short-lived child process, supplying both host identities explicitly,
+and deletes controllers through sysfs. The running kernel must support every
+connect option the backend uses, including DH-HMAC-CHAP and `host_iface`;
+otherwise the connection fails with an error naming the option. A failed
+connection is logged as a warning for its portal, with the error text reported
+by the kernel.
+
+The following properties are specific to ZFS over NVMe/TCP:
+
+server::
+
+IP address or DNS name used for the SSH control connection. Connected guest I/O
+uses the independent NVMe/TCP data paths, but capacity reporting and lifecycle
+operations require this endpoint. Use a redundant management DNS name or VIP
+where the storage appliance provides one. Use the same value for a target in
+all storage definitions. A cluster-wide lock serializes transactions using this
+value. The backend can only detect another spelling of the same target, such as
+its IP address and its DNS name, when the storage definitions share a target
+address in `nvme-portals`.
+
+Use each target with only one {pve} cluster. Storage definitions on the same
+target need their own pool, NQN, and listener, see `nvme-portals`. They share
+the cluster-wide lock, which does not coordinate with other clusters.
+
+pool::
+
+ZFS pool or child dataset used exclusively by this storage definition. It must
+not contain, or be contained in, the pool of another storage definition on the
+same target. Do not share an NQN or pool with another cluster.
+
+subsysnqn::
+
+NVMe qualified name of the target subsystem. It must be unique across the
+cluster's storage definitions.
+
+nvme-portals::
+
+Comma-separated NVMe/TCP target addresses. The default service is `4420`.
+Specify IPv6 addresses in brackets, for example `[2001:db8::10]:4420`.
++
+Each portal is a listener on the target, that is, an address and port. Every
+storage definition needs its own listeners, and they must not publish any other
+nvmet subsystem, including target configuration not made by {pve}. nvmet
+rejects a connection to a subsystem that is not published on that listener yet
+with the Do Not Retry (DNR) status, for example while the target configuration
+is restored after a target restart, and the node then deletes the controller
+regardless of the controller loss timeout. The backend compares the portals
+with those of every other ZFS over NVMe/TCP storage definition, including
+disabled ones. Adding a storage, any update of its configuration, and its
+activation on a node fail if one of its portals uses an address and port that
+another storage definition already uses, whatever their `server` values, or an
+address, on any port, that another storage definition reaches through a
+different `server` value. IPv6 addresses are compared in canonical form, and an
+IPv4-mapped IPv6 address counts as the IPv4 address. Use different addresses or
+ports, and the same `server` value, for storage definitions on the same target.
+
+nvme-host-ifaces::
+
+Required. Comma-separated local interfaces, matched to `nvme-portals` by
+position. An explicit interface prevents a failed data path from reconnecting
+over the management network. Activation fails before changing target state if
+any configured interface is missing on the local node. When an interface
+changes, the backend connects the path on the new interface before it
+disconnects the old one.
+
+nvme-host-nqns::
+
+Required. Comma-separated contents of `/etc/nvme/hostnqn` from every cluster
+node that may activate the storage. The complete allow-list lets any one node
+restore all host ACLs before publishing the subsystem after a target reboot.
+Activation fails if the local node's Host NQN is absent. Update this property
+before enabling the storage on a newly added cluster node. Host NQNs can only
+be added. To revoke a host, follow the procedure in
+xref:storage_zfsnvme_security[Security and Availability], which requires
+removing the node from the cluster, a new SSH key for the target, and a new key.
+
+dhchap-key::
+
+NVMe DH-HMAC-CHAP secret in `DHHC-1` representation. The value is handled as a
+sensitive property and stored below `/etc/pve/priv/storage/` with mode `0600`.
+The target stores the key per Host NQN, so storage definitions on the same
+target whose `nvme-host-nqns` overlap must use the same key. Key rotation is
+not supported, see
+xref:storage_zfsnvme_security[Security and Availability].
+
+nvme-iopolicy::
+
+Native multipath policy: `round-robin`, `queue-depth`, or `numa`.
+
+nvme-keep-alive-tmo::
+
+Keep-alive timeout in seconds.
+
+nvme-reconnect-delay::
+
+Delay between controller reconnect attempts in seconds.
+
+nvme-ctrl-loss-tmo::
+
+Time in seconds during which the kernel keeps reconnecting a lost controller
+before it deletes the controller. `-1` retries indefinitely. See
+xref:storage_zfsnvme_security[Security and Availability] for the consequences.
+
+nvme-fast-io-fail-tmo::
+
+Optional time in seconds before outstanding I/O fails while a controller is
+reconnecting. If this property is absent, the kernel queues I/O until
+`nvme-ctrl-loss-tmo` expires. A configured value must not exceed a finite
+controller loss timeout. A value of `0` selects immediate fail-fast behavior.
+
+nvme-nr-io-queues::
+
+Optional number of I/O queues per controller.
+
+blocksize::
+
+ZFS volume block size.
+
+sparse::
+
+Use ZFS thin provisioning instead of reserving the full virtual size. If this
+property is not set, volumes are thick-provisioned, which is also the default
+in the web interface.
+
+.Configuration Example (`/etc/pve/storage.cfg`)
+----
+zfsnvme: nvme-shared
+ server 203.0.113.10
+ pool tank/pve-nvme
+ subsysnqn nqn.2026-01.com.example:pve-nvme
+ nvme-portals 192.0.2.10:4420,198.51.100.10:4420
+ nvme-host-ifaces ens1f0,ens1f1
+ nvme-host-nqns nqn.2014-08.org.nvmexpress:uuid:11111111-1111-1111-1111-111111111111,nqn.2014-08.org.nvmexpress:uuid:22222222-2222-2222-2222-222222222222
+ blocksize 16k
+ sparse 1
+ nvme-iopolicy round-robin
+ nvme-keep-alive-tmo 5
+ nvme-reconnect-delay 2
+ nvme-ctrl-loss-tmo 600
+ nvme-fast-io-fail-tmo 30
+ content images
+----
+
+The DH-HMAC-CHAP key is intentionally not shown in `storage.cfg`. Set it with
+the storage creation API or web interface. With `pvesm`, pass the path of a file
+that contains the key, for example `--dhchap-key /root/nvme-dhchap.key`. Create
+the file with mode `0600`, for example after `umask 077`, and remove it once the
+storage is created.
+
+[[storage_zfsnvme_security]]
+Security and Availability
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The target uses an ACL for the unique Host NQN of every node and never enables
+`allow_any_host`. All nodes share the DH-HMAC-CHAP key of the storage, and it
+only authenticates the hosts to the target. The target is not authenticated to
+the hosts, no Diffie-Hellman group is configured, and data is not encrypted.
+Host NQNs are not secret, so any holder of the key can connect as any allowed
+host. This backend does not configure NVMe/TCP TLS, so use isolated storage
+networks or equivalent protection.
+
+Apart from its key file, the backend keeps the key in memory. It passes the key
+to the local kernel in the connect write to `/dev/nvme-fabrics`, and to the
+target on the standard input of an SSH command. The key never appears on a
+command line, and the backend writes no temporary files.
+
+The kernel exposes the key with mode `0644` in the `dhchap_secret` sysfs
+attributes of the NVMe controllers on the nodes and in the host entries below
+`/sys/kernel/config/nvmet/hosts/` on the target. The backend attempts to
+restrict the controller attributes on the {pve} nodes to mode `0600` right after
+it creates a controller, during storage activation, and after each connection
+attempt. This is best effort: permission changes can fail, and controller
+attributes can appear or reappear after the permission check. Until then, any
+process on the node that can read sysfs, including processes in containers, can
+read the key. There is no guaranteed upper bound on the exposure interval. Check
+the actual permissions and activation warnings; do not rely on this mitigation
+to protect keys from untrusted local users. On the target, the backend restricts
+the `dhchap_key` and `dhchap_ctrl_key` attributes of a host entry to mode `0600`
+before it writes the key. A process on the target that opened one of these
+attributes before the change can still read the key through that descriptor.
+Host entries that already hold the key, for example ones created by hand, keep
+their mode. Limit shell access on both the target and the {pve} nodes to trusted
+administrators.
+
+To rotate the key, or to revoke a node:
+
+. To revoke a node, first remove it from the cluster. Every cluster member can
+ read the keys below `/etc/pve/priv/`: the DH-HMAC-CHAP key of every ZFS over
+ NVMe/TCP storage and the SSH key of every target, which gives root access to
+ the target, including its keys and volumes. Then replace the SSH key of each
+ target: create a new key pair at `/etc/pve/priv/zfs/<server>_id_rsa` (for
+ every `server` value used for the target), replace the old public key with
+ the new one in `/root/.ssh/authorized_keys` on the target, and check that
+ file for other unknown keys.
+. Move or remove every volume of the storage, including unused disks,
+ templates, VM state volumes, and disks with snapshots, which cannot be moved
+ while their snapshots exist. `pvesm list <storage>` must show no volume.
+. Remove this storage definition. The backend removes the subsystem from the
+ target once it owns no volumes. If the removal task warns that it kept the
+ NVMe target configuration, remove the remaining volumes, or the subsystem on
+ the target, before you continue.
+. On every other node that had the storage active, disconnect it with
+ `nvme disconnect --nqn <subsysnqn>` or reboot the node.
+. Create a new storage with a new key and a new `subsysnqn`, without the Host
+ NQN of a revoked node.
+
+To revoke a node, repeat this for every ZFS over NVMe/TCP storage of the
+cluster, since the node could read all of their keys. Other storage definitions
+on the same target that list any of the same Host NQNs share the key, because
+the target stores it per Host NQN. Rotate their keys together: remove all of
+them before you create the new ones.
+
+Shared access relies on {pve} cluster locking and fencing. Test quorum and
+fencing before placing production guests on the storage. Use independent
+failure domains for the configured paths and make sure the ZFS target itself
+is not a single point of failure.
+
+Changes to the target configuration, including restoring it after a target
+restart, are serialized by a cluster-wide lock per target and therefore require
+quorum. An uncertain command result aborts the operation; a subsequent
+operation reads the target again. Queries outside a transaction, such as
+capacity and namespace identity queries, do not take this lock. They can see
+intermediate state, and the underlying ZFS queries can still be delayed by
+storage activity.
+
+In addition, the transaction guard of the backend serializes the commands of
+each transaction with a lock on the target, in the runtime directory
+`/run/pve-storage-nvmet`. Before claiming a transaction, the backend observes
+the current owner without taking the target lock. The claim compares that
+observation under the lock before publishing a new token, so an abandoned claim
+cannot replace an owner that has since changed. Subsequent command groups,
+including reads, acquire the same lock and validate the token. This prevents a
+command delayed by an SSH failure or an expired cluster lock from modifying a
+volume after a newer operation has replaced it. The lock and token are shared by
+all pools and storage definitions on the target host, so they also reject
+commands from transactions that used another spelling of the server address.
+Queries outside a transaction do not wait for the target lock. The runtime
+directory must be owned by root with mode `0700`. Do not delete it or replace
+its `lock` or `owner` files while commands can still be running. A stuck command
+can block further changes; the backend does not break this lock to restore
+availability.
+
+Choose the all-path outage policy for the workload. The default configuration
+leaves `nvme-fast-io-fail-tmo` unset: transient outages can recover without
+guest block errors, but an I/O request can stall until the controller is lost.
+The default controller loss timeout is 600 seconds; the example instead
+explicitly sets a fast I/O fail timeout of 30 seconds. Set a shorter fast I/O
+fail timeout when the application prefers a prompt block error over a long
+stall. This is a service-level decision, not a universally safer default.
+
+When every path of a node stays down past the controller loss timeout, the
+kernel deletes the controllers and the multipath block devices of the storage on
+that node, and queued and new I/O fails. A running guest keeps the removed
+device open, so once the paths are back, stop and start the guest, for example
+with `qm stop <vmid>` and `qm start <vmid>`; a reboot inside the guest is not
+enough. A target that rejects the connection, for example because of an unknown
+Host NQN, a wrong key, or a listener that does not publish the subsystem yet
+(see `nvme-portals`), makes the kernel delete the controller regardless of the
+timeout. A controller loss timeout of `-1` keeps the devices, but combine it
+with a finite fast I/O fail timeout. Otherwise guest I/O, and stopping or
+migrating the guest, can block for the whole outage.
+
+Changes to `nvme-iopolicy`, `nvme-reconnect-delay`, `nvme-ctrl-loss-tmo`, and
+`nvme-fast-io-fail-tmo` are applied to connected controllers on the next
+storage activation. They do not affect an outage of all paths that is already
+in progress. `nvme-keep-alive-tmo` and `nvme-nr-io-queues` only apply to new
+controller connections, for example after a node reboot.
+
+Online resize of a running guest disk is not supported. Stop the VM before
+resizing; the new size is detected when the block device is reopened.
+
+The backend does not support volume transfer streams through `pvesm export`
+or `pvesm import`, including `raw+size`. Offline or remote migration workflows
+that require these streams cannot transfer disks to or from this backend.
+Shared-storage live migration remains supported: it does not transfer the disk
+contents.
+
+Removing the storage definition never deletes volumes. The node that removes it
+deactivates the storage, which deletes its controllers. Deactivation fails if
+one of the namespaces is still in use locally, or if the controllers cannot be
+deleted within 15 seconds (a deletion that is stuck in the kernel keeps the
+task waiting until the kernel returns); the removal then logs a warning and the
+node keeps its connections. Other nodes keep their connections. On each of
+them, run `nvme disconnect --nqn <subsysnqn>` or reboot the node. If no volumes
+of the storage remain, the backend also tries to remove the subsystem and
+unused host entries from the target. This cleanup is best effort: if it fails,
+or if volumes remain, the target configuration is kept and a warning is logged.
+
+Storage Features
+~~~~~~~~~~~~~~~~
+
+.Storage features for backend `zfsnvme`
+[width="100%",cols="m,m,3*d",options="header"]
+|==============================================================================
+|Content types |Image formats |Shared |Snapshots |Clones
+|images |raw |yes |yes |yes
+|==============================================================================
diff --git a/pvesm.adoc b/pvesm.adoc
index 5bd24b2..4ada3f0 100644
--- a/pvesm.adoc
+++ b/pvesm.adoc
@@ -439,6 +439,8 @@ See Also
* link:/wiki/Storage:_ZFS_over_ISCSI[Storage: ZFS over ISCSI]
+* link:/wiki/Storage:_ZFS_over_NVMe/TCP[Storage: ZFS over NVMe/TCP]
+
endif::wiki[]
ifndef::wiki[]
@@ -471,6 +473,8 @@ include::pve-storage-btrfs.adoc[]
include::pve-storage-zfs.adoc[]
+include::pve-storage-zfsnvme.adoc[]
+
ifdef::manvolnum[]
include::pve-copyright.adoc[]
^ permalink raw reply related [relevance 14%]
* [PATCH storage v3 0/4] add ZFS over NVMe/TCP storage plugin
@ 2026-10-05 0:26 8% Joaquin Varela
2026-10-05 0:26 9% ` [PATCH storage v3 1/4] zfsnvme: " Joaquin Varela
` (2 more replies)
0 siblings, 3 replies; 143+ results
From: Joaquin Varela @ 2026-10-05 0:26 UTC (permalink / raw)
To: pve-devel
Hi,
this is v3 of the zfsnvme backend: ZFS volumes on a remote Linux
target, exported with the kernel's nvmet over NVMe/TCP and used through
native NVMe multipath and DH-HMAC-CHAP on the nodes.
The scope is one remote Linux ZFS/nvmet target and its integration with
the PVE shared-storage API. This series does not implement target high
availability, pool ownership between target machines, or target fencing.
PVE remains responsible for VM placement and node fencing. The namespace
identity and reconnect behavior are intended to allow an independently
managed target to recover, but a multi-head target has not been qualified.
v2: https://lore.proxmox.com/pve-devel/cover.1785636979.git.joaquinvarela@neatech.ar/
Changes since v2, following Max's review:
1. The plugin inherits from PVE::Storage::Plugin directly. The ZFS
helpers it needs are private copies; volume names and their parsing
are the same as in the other ZFS plugins.
2. PVE::Storage::LunCmd::NVMET is gone; the nvmet code lives in the
plugin with an nvmet_ prefix.
3. There is no remote helper anymore. ZFS/configfs parsing,
storage-configuration validation and operation planning happen locally,
in functions that are tested on their own. Optional patch 3/4 adds a
fixed target-side transport guard, described below.
The target state is read in one call: 'zfs get' on the pool and its
direct children, and one 'find' over the nvmet configfs tree that
lists its objects, prints the attributes the plugin uses with 'grep'
and reads host keys only as 'sha256sum' digests. The first such read
of an operation under the target lock starts with
'modprobe nvmet_tcp'. Other reads are 'zfs get' and 'zfs list' like
in the other ZFS plugins, 'test -b' while a new zvol appears, and
'cat /proc/mounts' when that first locked read fails, to decide
whether configfs needs to be mounted. Changes are quoted simple
commands, joined with '&&' so that a step only runs after the
previous one succeeded, plus redirections into configfs attributes
and a 'dd | tee' pipe that writes the key from standard input,
without bash-isms. An export starts with 'test -b' on its zvol, and
each publish link repeats two read-only checks right before it links
the subsystem to a port: that the subsystem denies unknown hosts and
that every configured host has its ACL. A pmxcfs domain lock per
target serializes changes within the cluster. Patch 3/4 adds the only
shell control flow, see below.
4. opendir/readdir and glob were replaced by
PVE::File::dir_glob_foreach, nested where a sysfs walk spans several
directory levels, because dir_glob_regex returns only the first
match; IO::Socket::IP was replaced by PVE::Network::tcp_ping, and
IO::File by PVE::SysFSTools::file_write.
Other changes:
- Each storage needs its own NVMe/TCP listeners (address and port) on
the target. nvmet answers a connect to a listener that does not
publish the subsystem yet with DNR, and the node then deletes the
controller regardless of the controller loss timeout. After a target
restart the plugin restores one storage at a time, so storages that
shared a listener could lose their controllers. Adding, updating and
activating a storage now refuse a portal whose listener another
zfsnvme storage uses, also a disabled one, and a target address that
another storage reaches through a different server value, since the
server value names the lock per target. IPv6 addresses are compared
in canonical form.
- Nodes create each missing path with a single write to
/dev/nvme-fabrics in a short-lived child process
(PVE::Tools::run_fork_with_timeout) instead of running
'nvme connect --config'. With the Debian trixie versions tested here,
nvme-cli 2.13-2 and libnvme 1.13-2, the invocation with an explicit
host NQN and host ID re-issues connects to existing fabrics controllers
of that host, and its sysfs scan replaces the configured DH-HMAC-CHAP
host secret with the secret of an existing controller. On a node with
another NVMe/TCP controller
of the same host NQN, such as a second zfsnvme storage on a different
target, a new path can then be attempted with the other target's key.
The same happens with nvme-cli 2.16 and libnvme 1.16.2; nvme-cli 3.1
reworked 'nvme connect --config' and did not reproduce this behavior
in our tests. The direct write also keeps the key off command lines
and avoids a temporary nvme-cli configuration file. The key still
lives in the PVE private key file and the kernel attributes described
below. It uses sysopen rather than PVE::SysFSTools::file_write,
because the kernel returns the instance of the new controller on a
read of the descriptor that wrote the options. Controllers are
deleted and rescanned through sysfs. nvme-cli stays a dependency
because it creates /etc/nvme/hostnqn and /etc/nvme/hostid.
- The plugin restricts the DH-HMAC-CHAP secret attributes of the node
controllers, and of the target host entries it writes the key to, to
mode 0600. The kernel creates them world-readable, so on the nodes
this is best effort; the docs describe the remaining exposure.
- A correction to the v2 cover letter: the "verified 45.7 GB mixed-I/O
soak" ran for only 741 seconds and was a short checksum exercise; it
is not evidence of cache-independent readback or of crash durability.
The patches:
1/4 adds the backend.
2/4 adds the tests: the plugin against mocked host interfaces, and an
emulated target that checks every command the plugin plans and
replays single and double faults during each operation.
3/4 is optional, and a question for you. ssh does not stop a remote
command when the client gives up, so a delayed command of an
abandoned operation can still change the target after the next
operation started. This patch wraps every call made inside a locked
transaction, reads included, in a small, fixed POSIX sh guard: a
flock on a file below /run on the target, a per-transaction token
that every later command of the transaction checks, and a
compare-and-set of that token when a transaction starts. Read-only
calls outside a transaction do not use it. It excludes stale
control-plane commands; it does not fence hosts or guest I/O. It
adds two SSH round trips (owner observation and claim) to every
locked operation. Without it, the backend relies on the cluster lock
like ZFS over iSCSI does. Would you prefer to keep it, a smaller
variant with only the flock and the token check, or to drop it? 4/4
applies and passes its tests with or without 3/4.
4/4 is also a question: it overrides cluster_lock_storage so that the
shared storage lock waits up to 30 seconds instead of 10 when the
caller passes no timeout, since a target change over SSH can hold
it for several seconds. Explicit timeouts are unchanged. Would you
rather have this in the plugin, as a parameter in the core, or
should I reduce the SSH round trips per operation instead?
The series is much larger than v2: the plugin has about 3,300 lines,
because the local parsing and planning replace the remote helper, and
the tests about 7,800 (two test files and two fixtures). I can split
1/4 into the schema and pvesm, the target planning, the node connect
and the volume operations, and split or trim the test patch, whatever
is easier to review.
Testing: every patch passes 'make test' on its own, unprivileged and
with stock libpve-common-perl, and the Perl files are formatted with
proxmox-perltidy. On a nested two-node PVE 9 cluster (kernel 7.0.14)
with an Ubuntu 24.04 target (kernel 6.8), I ran the checks below with
a package built from the code of this series. The only exception is
the reproduction of the shared listener problem, which deliberately
used the code before the listener check:
- activation and DH-HMAC-CHAP on both nodes and both paths through the
new connect path: one read-write open of /dev/nvme-fabrics per path,
no nvme-cli process;
- allocation, snapshot, rollback, resize, template, linked clone and
free on both nodes;
- a node that already has another NVMe/TCP controller with the same host
NQN and a different key: the plugin connects with its own key, while a
single 'nvme connect --config' in the same situation issued five
connect writes and failed authentication;
- live migration in both directions under guest writes, with readback;
- the loss and restore of one path, and a 15-second loss of both paths,
under guest writes, without guest I/O errors;
- a target reboot under guest writes: the plugin rebuilt the target
configuration and the committed data verified;
- stopping an activation task while a connect was in flight, with stock
libpve-common-perl: no process was left behind and none of the six
cancellations left a controller; a controller created out of band, as
a cancelled connect can leave behind, is adopted by the next
activation;
- the controller loss behavior the docs describe: with a 20-second
controller loss timeout, the controllers and the multipath device were
removed and an open descriptor stayed dead, while -1 with a 5-second
fast I/O fail timeout failed I/O after about 15 seconds and kept the
device, which worked again once the paths were back;
- two storages that share a listener: with the code before the
listener check, after their configuration was removed from the
target, as a target restart does, nvmet rejected the reconnects of
the storage restored second with DNR, both nodes deleted its
controllers, and an open descriptor on its multipath device stayed
dead; with this series, adding the second storage on the same
listener is refused, and with a listener per storage both recovered
from the same removal, in either order, without deleting a
controller, while an open O_DIRECT descriptor kept reading the
written data, with one read blocked for about 5 seconds in each of
the two runs.
This is lab qualification, not hardware qualification.
I also saw Dietmar's RFC "add guided remote storage setup and SAN
visibility", which adds NVMe-oF transport and path status helpers to
Diskmanage. Once it is applied, the plugin can use them instead of its
own sysfs parsing:
https://lore.proxmox.com/pve-devel/20260731102156.3947857-1-dietmar@proxmox.com/
The documentation and the editor follow as replies to this cover
letter, as separate patches for pve-docs and pve-manager.
Joaquin Varela (4):
zfsnvme: add ZFS over NVMe/TCP storage plugin
test: add zfsnvme plugin tests
zfsnvme: fence target commands of abandoned transactions
zfsnvme: wait up to 30 seconds for the shared storage lock
debian/control | 1 +
src/PVE/CLI/pvesm.pm | 21 +-
src/PVE/Storage.pm | 2 +
src/PVE/Storage/Makefile | 1 +
src/PVE/Storage/Plugin.pm | 2 +-
src/PVE/Storage/ZFSNVMePlugin.pm | 3319 +++++++++++
src/test/run_plugin_tests.pl | 2 +
.../zfsnvme_fixtures/configfs_snapshot.txt | 38 +
src/test/zfsnvme_fixtures/zfs_inventory.txt | 15 +
src/test/zfsnvme_target_test.pm | 5299 +++++++++++++++++
src/test/zfsnvme_test.pm | 2429 ++++++++
11 files changed, 11126 insertions(+), 3 deletions(-)
create mode 100644 src/PVE/Storage/ZFSNVMePlugin.pm
create mode 100644 src/test/zfsnvme_fixtures/configfs_snapshot.txt
create mode 100644 src/test/zfsnvme_fixtures/zfs_inventory.txt
create mode 100644 src/test/zfsnvme_target_test.pm
create mode 100644 src/test/zfsnvme_test.pm
^ permalink raw reply [relevance 8%]
* [RFC pve-storage 11/27] diskmanage: add helper querying NVMe native multipath path state
2026-07-31 10:21 7% [RFC pve-storage/proxmox-widget-toolkit/pve-manager 00/27] add guided remote storage setup and SAN visibility Dietmar Maurer
2026-07-31 10:21 14% ` [RFC pve-storage 03/27] diskmanage: qualify NVMe over fabrics transport Dietmar Maurer
@ 2026-07-31 10:21 13% ` Dietmar Maurer
1 sibling, 0 replies; 143+ results
From: Dietmar Maurer @ 2026-07-31 10:21 UTC (permalink / raw)
To: pve-devel
NVMe over fabrics namespaces are usually handled by native NVMe
multipath instead of device mapper, so multipathd knows nothing
about them. The kernel exposes the equivalent information in sysfs:
a per-path namespace entry below each controller of a shared
subsystem, with the controller state and address and the ANA state
of the namespace on that path. Collect it per head namespace, so
path health can be reported uniformly for both multipath stacks.
Local single-controller devices have no per-path entries and are
not reported.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
src/PVE/Diskmanage.pm | 63 +++++++++++++++++++
.../nvme-subsystem/nvme-subsys0/nvme3/address | 1 +
.../nvme-subsys0/nvme3/nvme2c3n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme3/state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/address | 1 +
.../nvme-subsys0/nvme4/nvme2c4n1/ana_state | 1 +
.../nvme-subsystem/nvme-subsys0/nvme4/state | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/address | 1 +
.../nvme-subsystem/nvme-subsys1/nvme0/state | 1 +
.../multipath/nvme_path_status_expected.json | 19 ++++++
src/test/disklist_test.pm | 16 +++++
11 files changed, 106 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
create mode 100644 src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
create mode 100644 src/test/disk_tests/multipath/nvme_path_status_expected.json
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index a6730a6..706f696 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -969,6 +969,69 @@ sub get_multipath_status {
return $res;
}
+# Queries the path state of NVMe namespaces handled by native NVMe multipath, keyed by the
+# kernel device name of the head namespace (for example nvme0n1). The kernel creates a
+# per-path namespace entry (nvmeXcYnZ) below each controller of a shared subsystem; local
+# single-controller devices have none and are not reported.
+sub get_nvme_path_status {
+ my $res = {};
+
+ dir_glob_foreach(
+ '/sys/class/nvme-subsystem',
+ 'nvme-subsys\d+',
+ sub {
+ my ($subsys) = @_;
+ my $subsysdir = "/sys/class/nvme-subsystem/$subsys";
+
+ dir_glob_foreach(
+ $subsysdir,
+ 'nvme\d+',
+ sub {
+ my ($ctrl) = @_;
+ my $ctrldir = "$subsysdir/$ctrl";
+ my $state = file_read_firstline("$ctrldir/state") // return;
+ my $address = file_read_firstline("$ctrldir/address");
+
+ dir_glob_foreach(
+ $ctrldir,
+ 'nvme\d+c\d+n\d+',
+ sub {
+ my ($pathdev) = @_;
+ return if $pathdev !~ m/^nvme(\d+)c\d+n(\d+)$/;
+ my $head = "nvme$1n$2";
+
+ my $entry = { device => "/dev/$ctrl", state => $state };
+ $entry->{address} = $address
+ if defined($address) && $address ne '';
+ my $ana = file_read_firstline("$ctrldir/$pathdev/ana_state");
+ $entry->{'ana-state'} = $ana if defined($ana);
+
+ # 'change' is transient, inaccessible and persistent-loss
+ # paths cannot serve IO even on a live controller
+ my $usable = $state eq 'live'
+ && (!defined($ana)
+ || $ana eq 'optimized'
+ || $ana eq 'non-optimized');
+
+ my $status = $res->{$head} //= { active => 0, paths => [] };
+ $status->{active}++ if $usable;
+ push @{ $status->{paths} }, $entry;
+ },
+ );
+ },
+ );
+ },
+ );
+
+ # readdir order is not deterministic
+ for my $status (values %$res) {
+ @{ $status->{paths} } =
+ sort { $a->{device} cmp $b->{device} } @{ $status->{paths} };
+ }
+
+ return $res;
+}
+
# Returns the multipath device entry if the given path refers to a multipath mapped device.
sub lookup_multipath_map {
my ($devpath) = @_;
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
new file mode 100644
index 0000000..803fab3
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/address
@@ -0,0 +1 @@
+traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
new file mode 100644
index 0000000..e48c58f
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/nvme2c3n1/ana_state
@@ -0,0 +1 @@
+optimized
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
new file mode 100644
index 0000000..e23fe64
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme3/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
new file mode 100644
index 0000000..3661874
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/address
@@ -0,0 +1 @@
+traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
new file mode 100644
index 0000000..436c48e
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/nvme2c4n1/ana_state
@@ -0,0 +1 @@
+inaccessible
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
new file mode 100644
index 0000000..e23fe64
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys0/nvme4/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
new file mode 100644
index 0000000..f99fcb1
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/address
@@ -0,0 +1 @@
+0000:02:00.0
diff --git a/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
new file mode 100644
index 0000000..e23fe64
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme-subsystem/nvme-subsys1/nvme0/state
@@ -0,0 +1 @@
+live
diff --git a/src/test/disk_tests/multipath/nvme_path_status_expected.json b/src/test/disk_tests/multipath/nvme_path_status_expected.json
new file mode 100644
index 0000000..62611b3
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme_path_status_expected.json
@@ -0,0 +1,19 @@
+{
+ "nvme2n1": {
+ "active": 1,
+ "paths": [
+ {
+ "device": "/dev/nvme3",
+ "state": "live",
+ "address": "traddr=192.168.3.209,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "optimized"
+ },
+ {
+ "device": "/dev/nvme4",
+ "state": "live",
+ "address": "traddr=192.168.3.109,trsvcid=4420,src_addr=192.168.2.171",
+ "ana-state": "inaccessible"
+ }
+ ]
+ }
+}
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index e804485..0b090f8 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -113,6 +113,7 @@ sub mocked_file_read_firstline {
my $originalsub = $diskmanage_module->original('file_read_firstline');
$path =~ s|^/sys/block|disk_tests/$testcasedir|;
+ $path =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|;
return &$originalsub($path);
}
@@ -122,6 +123,12 @@ sub mocked_dir_glob_foreach {
my $lines = [];
+ # nvme subsystem trees are provided as directories, glob them like production code
+ if ($dir =~ s|^/sys/class/nvme-subsystem|disk_tests/$testcasedir/nvme-subsystem|) {
+ my $originalsub = $diskmanage_module->original('dir_glob_foreach');
+ return &$originalsub($dir, $regex, $sub);
+ }
+
# read lines in from file
if ($dir =~ m{^/sys/block$}) {
@$lines = split(/\n/, read_test_file('disklist'));
@@ -269,6 +276,15 @@ sub test_disk_list {
is_deeply($status, $expected_status, 'multipath status should be the same');
}
+ if (-f "disk_tests/$testcasedir/nvme_path_status_expected.json") {
+ my $status = PVE::Diskmanage::get_nvme_path_status();
+ my $expected_status = decode_json(read_test_file('nvme_path_status_expected.json'));
+
+ print Dumper($status) if $print;
+ $testcount++;
+ is_deeply($status, $expected_status, 'nvme path status should be the same');
+ }
+
done_testing($testcount);
};
}
--
2.47.3
^ permalink raw reply related [relevance 13%]
* [RFC pve-storage 03/27] diskmanage: qualify NVMe over fabrics transport
2026-07-31 10:21 7% [RFC pve-storage/proxmox-widget-toolkit/pve-manager 00/27] add guided remote storage setup and SAN visibility Dietmar Maurer
@ 2026-07-31 10:21 14% ` Dietmar Maurer
2026-07-31 10:21 13% ` [RFC pve-storage 11/27] diskmanage: add helper querying NVMe native multipath path state Dietmar Maurer
1 sibling, 0 replies; 143+ results
From: Dietmar Maurer @ 2026-07-31 10:21 UTC (permalink / raw)
To: pve-devel
lsblk reports plain 'nvme' for fabrics attached namespaces, so
clients cannot tell local PCIe drives from shared SAN namespaces.
Read the transport from the namespace controller, or from any
controller of the subsystem when the namespace belongs to a
subsystem due to native NVMe multipath, and report nvme-fc,
nvme-tcp, nvme-rdma or nvme-loop instead.
This lets clients like the SAN LUN scan or the local storage
creation dialogs decide which namespaces are suitable, instead of
hiding fabrics attached devices server side.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
src/PVE/Diskmanage.pm | 27 +++++++++++++++
src/test/disk_tests/multipath/disklist | 2 ++
.../multipath/disklist_expected.json | 33 +++++++++++++++++++
src/test/disk_tests/multipath/lsblk | 14 ++++++++
.../disk_tests/multipath/nvme8n1/device/model | 1 +
.../multipath/nvme8n1/device/transport | 1 +
.../multipath/nvme8n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme8n1/size | 1 +
src/test/disk_tests/multipath/nvme8n1_udevadm | 14 ++++++++
.../disk_tests/multipath/nvme9n1/device/model | 1 +
.../multipath/nvme9n1/device/transport | 1 +
.../multipath/nvme9n1/device/vendor | 1 +
.../multipath/nvme9n1/queue/rotational | 1 +
src/test/disk_tests/multipath/nvme9n1/size | 1 +
src/test/disk_tests/multipath/nvme9n1_udevadm | 12 +++++++
15 files changed, 111 insertions(+)
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme8n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme8n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme8n1/size
create mode 100644 src/test/disk_tests/multipath/nvme8n1_udevadm
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/model
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/transport
create mode 100644 src/test/disk_tests/multipath/nvme9n1/device/vendor
create mode 100644 src/test/disk_tests/multipath/nvme9n1/queue/rotational
create mode 100644 src/test/disk_tests/multipath/nvme9n1/size
create mode 100644 src/test/disk_tests/multipath/nvme9n1_udevadm
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index ed5181f..b006ec3 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -485,6 +485,26 @@ sub is_iscsi {
return 0;
}
+# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
+# its controller, or from any controller of its subsystem for native NVMe multipath setups.
+sub get_nvme_transport {
+ my ($sysdir) = @_;
+
+ my $transport = file_read_firstline("$sysdir/device/transport");
+ return $transport if defined($transport);
+
+ dir_glob_foreach(
+ "$sysdir/device",
+ 'nvme\d+',
+ sub {
+ my ($controller) = @_;
+ $transport //= file_read_firstline("$sysdir/device/$controller/transport");
+ },
+ );
+
+ return $transport;
+}
+
my sub is_ssdlike {
my ($type) = @_;
return $type eq 'ssd' || $type eq 'nvme';
@@ -577,6 +597,9 @@ sub get_disks {
# we do not want iscsi devices
return if is_iscsi($sysdir);
+ my $nvme_transport;
+ $nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
+
my $sysdata = get_sysdir_info($sysdir);
return if !defined($sysdata);
@@ -628,7 +651,11 @@ sub get_disks {
wearout => $wearout,
};
+ # lsblk reports plain 'nvme' for fabrics attached namespaces
my $transport = $lsblk_info->{$devpath}->{tran};
+ if (defined($nvme_transport) && $nvme_transport ne 'pcie') {
+ $transport = "nvme-$nvme_transport";
+ }
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
diff --git a/src/test/disk_tests/multipath/disklist b/src/test/disk_tests/multipath/disklist
index 9293589..f759ba9 100644
--- a/src/test/disk_tests/multipath/disklist
+++ b/src/test/disk_tests/multipath/disklist
@@ -7,3 +7,5 @@ dm-1
dm-2
dm-3
dm-4
+nvme8n1
+nvme9n1
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
index a8e74fa..ec44296 100644
--- a/src/test/disk_tests/multipath/disklist_expected.json
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -70,5 +70,38 @@
"by_id_link": "/dev/disk/by-id/scsi-36001405000000000000000000000000d",
"transport": "fc",
"used": "Device Mapper"
+ },
+ "nvme8n1": {
+ "devpath": "/dev/nvme8n1",
+ "size": 10737418240,
+ "vendor": "unknown",
+ "model": "FCMODEL",
+ "serial": "FCNVME1",
+ "wwn": "uuid.20000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/nvme-FCMODEL_FCNVME1",
+ "transport": "nvme-fc"
+ },
+ "nvme9n1": {
+ "devpath": "/dev/nvme9n1",
+ "size": 10737418240,
+ "vendor": "FABVEND",
+ "model": "FABRICS CTRL",
+ "serial": "FAB1",
+ "wwn": "uuid.10000000-0000-0000-0000-000000000001",
+ "gpt": 0,
+ "rpm": 0,
+ "type": "nvme",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "transport": "nvme-tcp"
}
}
diff --git a/src/test/disk_tests/multipath/lsblk b/src/test/disk_tests/multipath/lsblk
index 91f7457..dfc1ae1 100644
--- a/src/test/disk_tests/multipath/lsblk
+++ b/src/test/disk_tests/multipath/lsblk
@@ -58,6 +58,20 @@
"fstype": null,
"tran": null,
"pttype": null
+ },
+ {
+ "path": "/dev/nvme8n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
+ },
+ {
+ "path": "/dev/nvme9n1",
+ "parttype": null,
+ "fstype": null,
+ "tran": "nvme",
+ "pttype": null
}
]
}
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/model b/src/test/disk_tests/multipath/nvme8n1/device/model
new file mode 100644
index 0000000..1aac689
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/model
@@ -0,0 +1 @@
+FCMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/device/transport b/src/test/disk_tests/multipath/nvme8n1/device/transport
new file mode 100644
index 0000000..8b517d0
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/device/transport
@@ -0,0 +1 @@
+fc
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/queue/rotational b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
new file mode 100644
index 0000000..c227083
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1/size b/src/test/disk_tests/multipath/nvme8n1/size
new file mode 100644
index 0000000..8280959
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme8n1_udevadm b/src/test/disk_tests/multipath/nvme8n1_udevadm
new file mode 100644
index 0000000..d0cd5ea
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme8n1_udevadm
@@ -0,0 +1,14 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+N: nvme8n1
+S: disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVLINKS=/dev/disk/by-id/nvme-FCMODEL_FCNVME1
+E: DEVNAME=/dev/nvme8n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys8/nvme8n1
+E: DEVTYPE=disk
+E: ID_MODEL=FCMODEL
+E: ID_SERIAL=FCNVME_1
+E: ID_SERIAL_SHORT=FCNVME1
+E: ID_WWN=uuid.20000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=1
+E: SUBSYSTEM=block
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/model b/src/test/disk_tests/multipath/nvme9n1/device/model
new file mode 100644
index 0000000..aa0287c
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/model
@@ -0,0 +1 @@
+FABMODEL
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/transport b/src/test/disk_tests/multipath/nvme9n1/device/transport
new file mode 100644
index 0000000..f5483db
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/transport
@@ -0,0 +1 @@
+tcp
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/device/vendor b/src/test/disk_tests/multipath/nvme9n1/device/vendor
new file mode 100644
index 0000000..cdc6ddf
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/device/vendor
@@ -0,0 +1 @@
+FABVEND
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/queue/rotational b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
new file mode 100644
index 0000000..c227083
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/queue/rotational
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1/size b/src/test/disk_tests/multipath/nvme9n1/size
new file mode 100644
index 0000000..8280959
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1/size
@@ -0,0 +1 @@
+20971520
\ No newline at end of file
diff --git a/src/test/disk_tests/multipath/nvme9n1_udevadm b/src/test/disk_tests/multipath/nvme9n1_udevadm
new file mode 100644
index 0000000..b6d13cc
--- /dev/null
+++ b/src/test/disk_tests/multipath/nvme9n1_udevadm
@@ -0,0 +1,12 @@
+P: /devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+N: nvme9n1
+E: DEVNAME=/dev/nvme9n1
+E: DEVPATH=/devices/virtual/nvme-subsystem/nvme-subsys9/nvme9n1
+E: DEVTYPE=disk
+E: ID_MODEL=FABRICS CTRL
+E: ID_SERIAL=FABRICS_1
+E: ID_SERIAL_SHORT=FAB1
+E: ID_WWN=uuid.10000000-0000-0000-0000-000000000001
+E: MAJOR=259
+E: MINOR=0
+E: SUBSYSTEM=block
--
2.47.3
^ permalink raw reply related [relevance 14%]
* [RFC pve-storage/proxmox-widget-toolkit/pve-manager 00/27] add guided remote storage setup and SAN visibility
@ 2026-07-31 10:21 7% Dietmar Maurer
2026-07-31 10:21 14% ` [RFC pve-storage 03/27] diskmanage: qualify NVMe over fabrics transport Dietmar Maurer
2026-07-31 10:21 13% ` [RFC pve-storage 11/27] diskmanage: add helper querying NVMe native multipath path state Dietmar Maurer
0 siblings, 2 replies; 143+ results
From: Dietmar Maurer @ 2026-07-31 10:21 UTC (permalink / raw)
To: pve-devel
Adding remote storage currently starts with selecting a storage plugin
from the Add menu. The type-specific dialogs then assume that the
administrator already knows the Proxmox VE storage model and how the
selected backend maps to it.
This series adds a question-driven remote storage wizard. It first asks
which kind of storage to add, then separates connection, resource
selection, and common storage settings into focused steps. The existing
type-specific Add entries stay available for administrators who prefer
the direct workflow.
The wizard supports NFS, SMB/CIFS, iSCSI, Fibre Channel shared LVM, and
ZFS over iSCSI. The iSCSI shared LVM flow creates the connection storage
before selecting a logical unit number (LUN) and creating the LVM
storage. The Fibre Channel flow can initialize an unused SAN LUN or
reuse an existing volume group.
A dedicated NVMe over Fabrics wizard flow is not part of this RFC and
will be added in a follow-up. The SAN view already reports existing
NVMe-FC devices and native NVMe multipath state.
Multi-step submissions keep completed steps when a later request fails.
The wizard reports what it already created and how to finish the setup.
It does not try to roll back storage or volume groups automatically,
because doing so after a partial setup can be more destructive than
leaving the completed resource in place.
Device safety
-------------
Generic disk selectors currently also see remotely attached devices.
This makes it too easy to accidentally select a shared LUN for local
storage. The storage API now hides transports that unambiguously denote
remote attachment by default. Specialized callers can request them with
the new include-remote parameter; the widget-toolkit patch exposes the
corresponding includeRemoteDisks option.
This transport check is deliberately a guard, not proof that a device is
local or shared. It can diverge from that property in these cases:
- An exclusively assigned FC, FCoE, iSCSI, or NVMe fabrics LUN is safe
for local use but is hidden by default. Explicit opt-in handles this
false positive.
- SAS and missing or unknown transport information cannot distinguish a
local disk from a shared attachment. They therefore remain visible to
generic disk callers.
- The Fibre Channel wizard offers only FC and NVMe-FC devices by
default. Ambiguous SAS devices require enabling the local/unknown
transport list. FCoE and software-managed initiator transports stay
excluded.
The SAN scan combines disk usage, multipath maps, LVM volume groups,
configured storage entries, and iSCSI sessions. It rechecks an unused
device under the disk lock before creating a volume group. It scans one
selected node, however, and cannot prove that the same LUN is visible on
every node selected for the shared storage. This is intentional: the
wizard calls out the visibility requirement and leaves its verification
to the administrator, like the existing shared storage workflows.
SAN visibility
--------------
The new node view lists SAN LUNs separately from local disks and shows
transport, usage, storage ownership, and multipath health. It reports
path state from multipathd and native NVMe multipath on a best-effort
basis.
The same view shows the iSCSI targets and sessions known to the node.
It exposes the initiator identity, connection state, negotiated session
parameters, rescan, logout, and stale node-record cleanup. The storage
plugin remains responsible for session login and activation.
Questions for this RFC
----------------------
1. Is a guided workflow next to the existing expert dialogs the right UI
boundary?
2. Is default filtering with explicit remote-device opt-in an acceptable
safety model given the transport predicate limitations above?
3. Does the node SAN view provide the right boundary for LUN, multipath,
and iSCSI initiator observability?
Series order and dependencies
-----------------------------
Patches 01-14 add the pve-storage APIs and disk handling. Patch 15 adds
the widget-toolkit opt-in. Patches 16-27 add the pve-manager wizard and
node views. Apply them in that order.
pve-storage (01-14):
diskmanage: collect disk transport type from lsblk
diskmanage: add helper to list multipath devices
diskmanage: qualify NVMe over fabrics transport
disks: list: add include-remote parameter
diskmanage: include iSCSI session devices in disk enumeration
diskmanage: link multipath member disks to their map device
iscsi: factor out session device map from device list
api: scan: add san-luns method listing SAN LUN candidates
disks: lvm: allow creating volume groups on multipath devices
diskmanage: add helper querying multipath path state
diskmanage: add helper querying NVMe native multipath path state
api: scan: san-luns: report path state
iscsi plugin: list sessions of all transports and capture transport
api: add node-level iSCSI initiator target and session API
proxmox-widget-toolkit (15):
disk selectors: allow opting into remote devices
pve-manager (16-27):
ui: storage: allow switching the scan node of NFS/CIFS scan combos
ui: storage: add guided remote storage wizard with NFS support
ui: storage wizard: add SMB/CIFS support
ui: storage wizard: add iSCSI support
ui: storage wizard: add FC-attached SAN (shared LVM) support
ui: storage wizard: add ZFS over iSCSI support
ui: dc: storage: add remote storage wizard entry to the add menu
ui: node: add SAN LUNs panel
ui: san luns: show multipath path state
api: nodes: add iSCSI initiator API endpoint
pvenode: add iscsi commands
ui: san luns: show iSCSI targets and sessions
Diffstat
--------
pve-storage:
97 files changed, 2157 insertions(+), 52 deletions(-)
proxmox-widget-toolkit:
2 files changed, 16 insertions(+)
pve-manager:
17 files changed, 2447 insertions(+), 1 deletion(-)
--
2.47.3
^ permalink raw reply [relevance 7%]
* [PATCH proxmox-i18n v3] update Simplified Chinese translations
@ 2026-02-04 12:19 2% ` Kefu Chai
0 siblings, 0 replies; 143+ results
From: Kefu Chai @ 2026-02-04 12:19 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Kefu Chai <k.chai@proxmox.com>
---
zh_CN.po | 2663 +++++++++++++++++++++---------------------------------
1 file changed, 1028 insertions(+), 1635 deletions(-)
diff --git a/zh_CN.po b/zh_CN.po
index 70ae51c..f4e7532 100644
--- a/zh_CN.po
+++ b/zh_CN.po
@@ -7,53 +7,48 @@ msgid ""
msgstr ""
"Project-Id-Version: proxmox translations\n"
"Report-Msgid-Bugs-To: <support@proxmox.com>\n"
-"POT-Creation-Date: 2025-12-10 15:47+0100\n"
-"PO-Revision-Date: 2025-07-19 10:22+0800\n"
-"Last-Translator: Try. <rov7@qq.com>\n"
-"Language-Team: Chinese (simplified) <tianmotrue@163.com>\n"
+"POT-Creation-Date: 2026-02-04 17:28+0800\n"
+"PO-Revision-Date: 2026-02-04 20:18+0800\n"
+"Last-Translator: Kefu Chai <k.chai@proxmox.com>\n"
+"Language-Team: Chinese (simplified) <support@proxmox.com>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Poedit 3.4.4\n"
+"X-Generator: Poedit 3.6\n"
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:147
-#, fuzzy
msgid "# Excluded"
-msgstr "排除"
+msgstr "排除个数"
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:124
-#, fuzzy
msgid "# Included"
-msgstr "包括"
+msgstr "已包含个数"
#: proxmox-backup/www/window/VerifyAll.js:116
#: proxmox-backup/www/window/VerifyJobEdit.js:191
-#, fuzzy
msgid "# of Read Threads"
-msgstr "#工作线程"
+msgstr "读线程数"
#: proxmox-backup/www/window/VerifyAll.js:127
#: proxmox-backup/www/window/VerifyJobEdit.js:205
-#, fuzzy
msgid "# of Verify Threads"
-msgstr "#工作线程"
+msgstr "验证线程数"
#: proxmox-backup/www/tape/window/TapeBackup.js:129
#: proxmox-backup/www/tape/window/TapeBackupJob.js:184
msgid "# of Worker Threads"
-msgstr "#工作线程"
+msgstr "工作线程数"
#: pve-yew-mobile-gui/src/pages/page_node_status/dashboard_panel.rs:87
-#, fuzzy
msgid "% of one threads"
msgid_plural "% of {n} threads"
-msgstr[0] "#工作线程"
+msgstr[0] "%/{n}个线程"
#: pmg-gui/js/SystemOptions.js:88
msgid "'From:' for Admin Mail"
-msgstr "“来自于:”用于管理员邮件"
+msgstr "'From:' 用于 Admin Mail"
#: pve-manager/www/manager6/qemu/Options.js:103
msgid "(No boot device selected)"
@@ -61,7 +56,7 @@ msgstr "(没有选中启动设备)"
#: proxmox-yew-comp/src/form/pve/lxc_property/lxc_network_property.rs:91
msgid "(e.g. eth0)"
-msgstr ""
+msgstr "(例如 eth0)"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:98
msgid "(none)"
@@ -87,39 +82,36 @@ msgstr "/some/path"
#: pve-yew-mobile-gui/src/pages/page_node_status/dashboard_panel.rs:79
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:29
-#, fuzzy
msgid "1 Core"
msgid_plural "{n} Cores"
-msgstr[0] "核心"
+msgstr[0] "{n}个核心"
#: pve-yew-mobile-gui/src/pages/page_node_status/dashboard_panel.rs:80
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:30
#: proxmox-yew-comp/src/node_info.rs:238
-#, fuzzy
msgid "1 Socket"
msgid_plural "{n} Sockets"
-msgstr[0] "插槽"
+msgstr[0] "{n}个套接字"
#: proxmox-backup/www/datastore/OptionView.js:307
msgid "1048576 (0 disables cache)"
-msgstr ""
+msgstr "1048576 (0 禁用缓存)"
#: proxmox-backup/www/datastore/OptionView.js:299
msgid "1445 (24 hours 5 minutes)"
-msgstr ""
+msgstr "1445 (24 小时 5 分钟)"
#: pmg-gui/js/PBSConfig.js:39
msgid "5 Minutes"
-msgstr "5分钟"
+msgstr "5 分钟"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_connect.rs:244
-#, fuzzy
msgid "<IP/Hostname>:Port"
-msgstr "主机名/IP"
+msgstr "<IP/主机名>:端口"
#: proxmox-backup/www/window/TrafficControlEdit.js:306
msgid "A comma-separated list of networks to apply the (shared) limit."
-msgstr "要应用(共享)限制的以逗号分隔的网络列表。"
+msgstr "应用此共享限制的网络列表(逗号分隔)。"
#: proxmox-widget-toolkit/src/window/AddYubico.js:101
msgid "A currently valid Yubico OTP value"
@@ -146,12 +138,12 @@ msgstr "所选设备不在单独的 IOMMU 组中,请确保这是预期的。"
#: pve-manager/www/manager6/dc/RealmSyncJob.js:367
#: pve-manager/www/manager6/dc/SyncWindow.js:132
msgid "ACL"
-msgstr "ACL"
+msgstr "访问控制列表 (ACL)"
#: proxmox-yew-comp/src/auth_view.rs:447
#: proxmox-yew-comp/src/auth_edit_ldap.rs:241
msgid "ACLs"
-msgstr ""
+msgstr "访问控制列表"
#: proxmox-backup/www/config/CertificateView.js:63
#: proxmox-datacenter-manager/ui/src/certificates.rs:46
@@ -165,7 +157,7 @@ msgstr "ACME 账户/质询"
#: proxmox-yew-comp/src/acme/acme_plugins.rs:501
#: proxmox-yew-comp/src/acme/acme_plugins.rs:542
msgid "ACME DNS Plugin"
-msgstr "ACME DNS插件"
+msgstr "ACME DNS 插件"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:40
#: pve-manager/www/manager6/node/ACME.js:52
@@ -174,15 +166,13 @@ msgstr "ACME 目录"
#: proxmox-yew-comp/src/acme/acme_domains.rs:364
#: proxmox-yew-comp/src/acme/acme_domains.rs:385
-#, fuzzy
msgid "ACME Domain"
-msgstr "域名"
+msgstr "ACME 域名"
#. TRANSLATORS: ACME Stands for Automatic Certificate Management Environment
#: proxmox-datacenter-manager/ui/src/certificates.rs:34
-#, fuzzy
msgid "ACME Domains"
-msgstr "登录域"
+msgstr "ACME 域名"
#: proxmox-backup/www/Utils.js:479
msgid "ACME certificate renewal"
@@ -245,9 +235,8 @@ msgid "API Token"
msgstr "API 令牌"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_info.rs:340
-#, fuzzy
msgid "API Token Name"
-msgstr "令牌名称"
+msgstr "API 令牌名称"
#: pve-manager/www/manager6/dc/ACLView.js:40
#: pve-manager/www/manager6/dc/ACLView.js:227
@@ -265,9 +254,8 @@ msgid "API Tokens"
msgstr "API 令牌"
#: proxmox-yew-comp/src/apt_repositories.rs:571
-#, fuzzy
msgid "API call failed"
-msgstr "全部失败"
+msgstr "API 调用失败"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:222
#: proxmox-widget-toolkit/src/panel/Certificates.js:91
@@ -278,7 +266,7 @@ msgstr "全部失败"
msgid ""
"API server will be restarted to use new certificates, please reload web-"
"interface!"
-msgstr "API 服务器将重新启动以使用新的凭证,请重新加载web界面!"
+msgstr "API 服务器将重启以使用新证书,请重新加载 Web 界面!"
#: proxmox-backup/www/window/TokenEdit.js:15
msgid "API token"
@@ -286,22 +274,20 @@ msgstr "API 令牌"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:146
msgid "APT Repositories"
-msgstr "APT 存储库"
+msgstr "APT 软件源"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:308
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:315
-#, fuzzy
msgid "ASN"
-msgstr "SDN"
+msgstr "ASN"
#: pve-manager/www/manager6/window/UploadToStorage.js:289
msgid "Abort"
msgstr "中止"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:19
-#, fuzzy
msgid "Accept"
-msgstr "接受服务条款"
+msgstr "接受"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:116
#: pve-manager/www/manager6/node/ACME.js:198
@@ -317,9 +303,8 @@ msgid "Access Control"
msgstr "访问控制"
#: proxmox-backup/www/window/S3ClientEdit.js:91
-#, fuzzy
msgid "Access Key"
-msgstr "密钥"
+msgstr "访问密钥"
#: pve-manager/www/manager6/lxc/DeviceEdit.js:89
msgid "Access Mode in CT"
@@ -341,7 +326,7 @@ msgstr "账户"
#: proxmox-yew-comp/src/acme/acme_register_account.rs:108
#: proxmox-yew-comp/src/acme/acme_domains.rs:460
msgid "Account Name"
-msgstr "账户名"
+msgstr "账户名称"
#: pmg-gui/js/LDAPConfig.js:161
msgid "Account attribute name"
@@ -365,16 +350,16 @@ msgstr "操作"
#: pmg-gui/js/controller/QuarantineController.js:102
msgid "Action '{0}' for '{1}' items"
-msgstr "对 '{1}' 项目采取 '{0}' 操作"
+msgstr "对'{1}'项目采取'{0}'操作"
#: pmg-gui/js/Utils.js:803 pmg-gui/js/Utils.js:937
msgid "Action '{0}' for '{1}' items successful"
-msgstr "对 '{1}' 项目的 '{0}' 操作成功"
+msgstr "对'{1}'项目的'{0}'操作成功"
#: pmg-gui/js/Utils.js:804 pmg-gui/js/Utils.js:938
#: pmg-yew-quarantine-gui/src/spam_list.rs:159
msgid "Action '{0}' successful"
-msgstr "动作 '{0}' 成功"
+msgstr "动作'{0}'成功"
#: pmg-gui/js/NavigationTree.js:22 pmg-gui/js/Utils.js:57
msgid "Action Objects"
@@ -396,7 +381,7 @@ msgstr "操作"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:105
msgid "Activate AES instruction set for HW acceleration."
-msgstr ""
+msgstr "启用 AES 指令集以进行硬件加速。"
#: proxmox-widget-toolkit/src/form/NetworkSelector.js:114
#: proxmox-widget-toolkit/src/node/NetworkView.js:310
@@ -416,7 +401,7 @@ msgstr "运行中"
#: pve-manager/www/manager6/Utils.js:726 proxmox-yew-comp/src/auth_view.rs:296
#: proxmox-yew-comp/src/auth_edit_ldap.rs:402
msgid "Active Directory Server"
-msgstr "活动目录服务器(AD)"
+msgstr "Active Directory 服务器"
#: proxmox-backup/www/tape/ChangerStatus.js:876
msgid "Activity"
@@ -514,17 +499,16 @@ msgstr "活动"
#: proxmox-yew-comp/src/token_panel.rs:189
#: proxmox-yew-comp/src/token_panel.rs:388
msgid "Add"
-msgstr "添加"
+msgstr "新增"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:322
#: pve-manager/www/manager6/node/ACME.js:691
msgid "Add ACME Account"
-msgstr "添加 ACME 账户"
+msgstr "新增 ACME 账户"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/mobile.rs:670
-#, fuzzy
msgid "Add CD/DVD drive"
-msgstr "CD/DVD 驱动器"
+msgstr "添加 CD/DVD 驱动器"
#: proxmox-backup/www/NavigationTree.js:130
msgid "Add Datastore"
@@ -543,27 +527,24 @@ msgid "Add Fabric"
msgstr "添加Fabric"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/mobile.rs:653
-#, fuzzy
msgid "Add Hard Disk"
-msgstr "硬盘"
+msgstr "添加硬盘"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:71
msgid "Add Header"
-msgstr "添加标题栏"
+msgstr "新增标题"
#: proxmox-yew-comp/src/configuration/pve/lxc_resources_panel/mobile.rs:378
-#, fuzzy
msgid "Add Mount Point"
-msgstr "挂载点"
+msgstr "添加挂载点"
#: proxmox-backup/www/datastore/Content.js:1366
msgid "Add Namespace"
msgstr "新增命名空间"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/mobile.rs:684
-#, fuzzy
msgid "Add Network card"
-msgstr "IP 网络"
+msgstr "添加网卡"
#: pve-manager/www/manager6/sdn/FabricsView.js:107
#: pve-manager/www/manager6/sdn/FabricsView.js:168
@@ -585,9 +566,8 @@ msgid "Add Remote"
msgstr "添加远程"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:525
-#, fuzzy
msgid "Add Row"
-msgstr "添加远程"
+msgstr "添加行"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:93
msgid "Add Secret"
@@ -621,46 +601,41 @@ msgid "Add Tape"
msgstr "添加磁带"
#: proxmox-backup/www/window/TrafficControlEdit.js:449
-#, fuzzy
msgid "Add Timeframe"
-msgstr "时间表"
+msgstr "添加时间段"
#: pve-manager/www/manager6/window/USBMapEdit.js:26
msgid "Add USB mapping"
msgstr "添加 USB 映射"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:68
-#, fuzzy
msgid "Add VNet"
-msgstr "添加节点"
+msgstr "添加虚拟网络"
#: pve-manager/www/manager6/lxc/EnvEdit.js:157
-#, fuzzy
msgid "Add Variable"
-msgstr "可用"
+msgstr "添加变量"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:468
-#, fuzzy
msgid "Add Widget"
-msgstr "添加节点"
+msgstr "添加小部件"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:68
-#, fuzzy
msgid "Add Zone"
-msgstr "添加节点"
+msgstr "添加区域"
#: proxmox-widget-toolkit/src/window/AddTotp.js:11
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:165
msgid "Add a TOTP login factor"
-msgstr "添加一个 TOTP 登录因子"
+msgstr "新增 TOTP 登录因子"
#: proxmox-widget-toolkit/src/window/AddWebauthn.js:10
msgid "Add a Webauthn login token"
-msgstr "添加 Webauthn 登录令牌"
+msgstr "新增 WebAuthn 登录令牌"
#: proxmox-widget-toolkit/src/window/AddYubico.js:10
msgid "Add a Yubico OTP key"
-msgstr "添加 Yubico OTP 密钥"
+msgstr "新增 Yubico OTP 密钥"
#: pve-manager/www/manager6/qemu/OSTypeEdit.js:158
msgid "Add additional drive for VirtIO drivers"
@@ -681,14 +656,12 @@ msgid "Add as Storage"
msgstr "添加存储"
#: proxmox-yew-comp/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs:151
-#, fuzzy
msgid "Add as mount point"
-msgstr "挂载点"
+msgstr "添加为挂载点"
#: proxmox-yew-comp/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs:149
-#, fuzzy
msgid "Add as unused volume"
-msgstr "基本卷"
+msgstr "添加为未使用卷"
#: proxmox-backup/www/form/GroupFilter.js:409
msgid "Add exclude"
@@ -713,9 +686,8 @@ msgstr "将新池添加到集群存储配置。"
#: pve-manager/www/manager6/lxc/CreateWizard.js:90
#: pve-manager/www/manager6/qemu/CreateWizard.js:104
#: pve-manager/www/manager6/window/Restore.js:250
-#, fuzzy
msgid "Add to HA"
-msgstr "添加存储"
+msgstr "添加到高可用"
#: proxmox-widget-toolkit/src/panel/EmailRecipientPanel.js:75
msgid "Additional Recipient(s)"
@@ -764,9 +736,8 @@ msgid "Advanced"
msgstr "高级"
#: pve-manager/www/manager6/dc/MetricServerView.js:675
-#, fuzzy
msgid "Advanced JSON Configuration"
-msgstr "显示配置"
+msgstr "高级 JSON 配置"
#: pve-manager/www/manager6/sdn/zones/EvpnEdit.js:73
msgid "Advertise Subnets"
@@ -774,14 +745,12 @@ msgstr "广播子网"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRuleEdit.js:13
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRules.js:15
-#, fuzzy
msgid "Affinity"
-msgstr "CPU 绑定"
+msgstr "亲和性"
#: pve-manager/www/manager6/dc/Config.js:241
-#, fuzzy
msgid "Affinity Rules"
-msgstr "CPU 绑定"
+msgstr "亲和性规则"
#: proxmox-backup/www/tape/DriveStatus.js:402
msgid "Alert Flags"
@@ -841,14 +810,12 @@ msgid "All Functions"
msgstr "所有功能"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:570
-#, fuzzy
msgid "All Guests"
-msgstr "客户"
+msgstr "所有客户机"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:551
-#, fuzzy
msgid "All Nodes"
-msgstr "所有核心"
+msgstr "所有节点"
#: proxmox-backup/www/datastore/Content.js:1248
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:394
@@ -862,12 +829,12 @@ msgstr "全部 OK (旧的)"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:393
msgid "All OK, but some snapshots were not verified in last 30 days"
-msgstr ""
+msgstr "全部正常,但某些快照在过去 30 天内未验证"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:441
#: proxmox-yew-comp/src/apt_repositories.rs:300
msgid "All OK, you have production-ready repositories configured!"
-msgstr "一切正常,已经配置了生产就绪的存储库!"
+msgstr "一切正常,已配置适用于生产环境的软件源!"
#: pmg-gui/js/AuthEditOIDC.js:201
msgid "All auto-created users get audit role"
@@ -900,23 +867,20 @@ msgstr "全部匹配"
#: proxmox-yew-comp/src/form/pve/lxc_property/lxc_network_property.rs:262
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_network_property.rs:157
-#, fuzzy
msgid "All network devices in use."
-msgstr "无网络设备"
+msgstr "所有网络设备都在使用中。"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/tree.rs:709
-#, fuzzy
msgid "All nodes"
-msgstr "所有核心"
+msgstr "所有节点"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/tree.rs:666
-#, fuzzy
msgid "All remotes"
-msgstr "所有核心"
+msgstr "所有远程"
#: pve-yew-mobile-gui/src/pages/page_node_status/services_panel.rs:76
msgid "All required services are running"
-msgstr ""
+msgstr "所有必需的服务都在运行"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:506
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:900
@@ -925,16 +889,15 @@ msgstr "所有规则匹配"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:398
msgid "All snapshots verified at least once in last 30 days"
-msgstr ""
+msgstr "所有快照在过去 30 天内至少验证过一次"
#: pve-manager/www/manager6/node/ZFS.js:245 proxmox-backup/www/ZFSList.js:81
msgid "Allocated"
msgstr "已分配"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:254
-#, fuzzy
msgid "Allocation"
-msgstr "预分配"
+msgstr "分配"
#: proxmox-backup/www/tape/PoolConfig.js:121
#: proxmox-backup/www/tape/form/PoolSelector.js:30
@@ -949,7 +912,7 @@ msgstr "允许调试"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:84
msgid "Allow Direct IO"
-msgstr ""
+msgstr "允许直接 IO"
#: pmg-gui/js/SpamQuarantineOptions.js:69
#: pmg-gui/js/VirusQuarantineOptions.js:20
@@ -957,9 +920,8 @@ msgid "Allow HREFs"
msgstr "允许超链接"
#: pve-manager/www/manager6/qemu/MemoryEdit.js:156
-#, fuzzy
msgid "Allow KSM"
-msgstr "允许SMT"
+msgstr "允许 KSM"
#: pve-manager/www/manager6/qemu/SevEdit.js:103
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_amd_sev_property.rs:54
@@ -969,16 +931,16 @@ msgstr "允许密钥共享"
#: pve-manager/www/manager6/qemu/SevEdit.js:114
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_amd_sev_property.rs:62
msgid "Allow SMT"
-msgstr "允许SMT"
+msgstr "允许 SMT"
#. TRANSLATORS: As in "a chain of volumes, each referencing the next one".
#: pve-manager/www/manager6/storage/Base.js:85
msgid "Allow Snapshots as Volume-Chain"
-msgstr "允许将快照作为Volume-Chain"
+msgstr "允许 Snapshots as Volume-Chain"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:102
msgid "Allow guest OS to use 1GB size pages, if host HW supports it"
-msgstr ""
+msgstr "如果主机硬件支持,允许客户操作系统使用 1 GB 大小的页面"
#: pve-manager/www/manager6/window/BulkAction.js:107
msgid "Allow local disk migration"
@@ -987,7 +949,7 @@ msgstr "允许本地磁盘迁移"
#: pve-manager/www/manager6/qemu/MemoryEdit.js:164
msgid ""
"Allow the Kernel Samepage Merging daemon to merge memory pages of this VM."
-msgstr ""
+msgstr "允许内核的 Samepage Merging 守护进程合并此虚拟机的内存页。"
#: proxmox-widget-toolkit/src/Toolkit.js:103
#: proxmox-widget-toolkit/src/Toolkit.js:116
@@ -997,11 +959,11 @@ msgstr "允许的字符"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:98
msgid "Allows improved Spectre mitigation with AMD CPUs"
-msgstr ""
+msgstr "允许在 AMD CPU 上改进 Spectre 缓解"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:96
msgid "Allows improved Spectre mitigation with Intel CPUs"
-msgstr ""
+msgstr "允许在 Intel CPU 上启用增强的 Spectre 漏洞缓解机制"
#: pve-manager/www/manager6/UIOptions.js:80
#: pve-manager/www/manager6/UIOptions.js:82
@@ -1009,15 +971,14 @@ msgid "Alphabetical"
msgstr "按字母顺序排列的"
#: proxmox-yew-comp/src/apt_repositories.rs:540
-#, fuzzy
msgid "Already configured"
-msgstr "{0} 已配置"
+msgstr "已配置"
#: pve-manager/www/manager6/window/ConfirmRemoveResource.js:19
msgid ""
"Also removes resource from HA rules and removes rule if there are no other "
"resources in it"
-msgstr ""
+msgstr "同时从 HA 规则中删除资源,如果规则中没有其他资源则删除该规则"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:373
#: proxmox-widget-toolkit/src/node/NetworkView.js:287
@@ -1048,7 +1009,7 @@ msgstr "令牌注册期间发生错误。"
#: pve-yew-mobile-gui/src/pages/page_dashboard.rs:182
msgid "Analytics"
-msgstr ""
+msgstr "分析"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:120
#: proxmox-yew-comp/src/auth_edit_ldap.rs:342
@@ -1070,12 +1031,11 @@ msgstr "应用"
#: pve-manager/www/manager6/VNCConsole.js:42
msgid "Application container detected - console might not be fully functional."
-msgstr ""
+msgstr "检测到应用容器 - 控制台可能无法完全正常工作。"
#: proxmox-backup/www/window/TrafficControlEdit.js:290
-#, fuzzy
msgid "Applies to all users"
-msgstr "应用于新编辑"
+msgstr "应用于所有用户"
#: pve-manager/www/manager6/dc/OptionView.js:532
msgid "Applies to new edits"
@@ -1105,9 +1065,8 @@ msgid "Apply Custom Scores"
msgstr "应用自定义分数"
#: proxmox-datacenter-manager/ui/src/tasks.rs:73
-#, fuzzy
msgid "Apply SDN configuration"
-msgstr "应用配置"
+msgstr "应用 SDN 配置"
#: pmg-gui/js/Utils.js:904
msgid "Apply custom SpamAssassin scores"
@@ -1121,7 +1080,7 @@ msgstr "适用于所有网络"
msgid ""
"Applying pending SDN changes will also apply any pending local node network "
"changes. Proceed?"
-msgstr "应用待定的 SDN 更改也将应用任何待定的本地节点网络更改。继续?"
+msgstr "应用待定的 SDN 更改也将应用任何待定的本地节点网络更改。是否继续?"
#: proxmox-widget-toolkit/src/Utils.js:66 proxmox-yew-comp/src/lib.rs:296
msgid "Arabic"
@@ -1141,23 +1100,22 @@ msgid "Are you sure to remove the subscription key?"
msgstr "确定要删除订阅密钥吗?"
#: proxmox-yew-comp/src/configuration/pve/guest.rs:25
-#, fuzzy
msgid "Are you sure you want to delete volume {0}."
-msgstr "确定要分离该项 {0} 吗?"
+msgstr "确定要删除卷 {0} 吗。"
#: pve-manager/www/manager6/lxc/Resources.js:246
#: pve-manager/www/manager6/qemu/HardwareView.js:532
#: proxmox-yew-comp/src/configuration/pve/guest.rs:6
msgid "Are you sure you want to detach entry {0}"
-msgstr "确定要分离该项 {0} 吗?"
+msgstr "确定要分离 {0} 吗"
#: pmg-gui/js/PBSSnapshotView.js:224
msgid "Are you sure you want to forget snapshot {0}"
-msgstr "确定要删除快照 {0} 吗?"
+msgstr "确定要删除快照 {0} 吗"
#: proxmox-backup/www/tape/window/Erase.js:14
msgid "Are you sure you want to format tape '{0}' ?"
-msgstr "确定要格式化磁带 {0} 吗?"
+msgstr "确定要格式化磁带'{0}'吗?"
#: proxmox-backup/www/tape/ChangerStatus.js:837
#: proxmox-backup/www/tape/DriveStatus.js:242
@@ -1166,26 +1124,25 @@ msgstr "确定要格式化插入的磁带吗?"
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:217
#: proxmox-yew-comp/src/node_status_panel.rs:228
-#, fuzzy
msgid "Are you sure you want to reboot the node?"
-msgstr "确定要删除此条目"
+msgstr "确定要重启该节点吗?"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:109
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:317
msgid "Are you sure you want to remove '{0}'"
-msgstr "是否确实要删除 '{0}'"
+msgstr "确实要删除'{0}'"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:113
msgid "Are you sure you want to remove '{0}' entries for '{1}'"
-msgstr "是否确实要删除 '{1}' 的 '{0}' 项"
+msgstr "确实要删除'{1}'的'{0}'项"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:117
msgid "Are you sure you want to remove '{0}' on '{1}' for '{2}'"
-msgstr "是否确实要为 '{2}' 删除 '{1}' 上的 '{0}'"
+msgstr "确实要为'{2}'删除'{1}'上的'{0}'"
#: pve-manager/www/manager6/tree/DhcpTree.js:102
msgid "Are you sure you want to remove DHCP mapping {0}"
-msgstr "是否确实要删除 DHCP 映射 {0}"
+msgstr "确实要删除 DHCP 映射 {0}"
#: proxmox-widget-toolkit/src/button/Button.js:141 pmg-gui/js/RuleInfo.js:41
#: pmg-gui/js/UserBlockWelcomeList.js:181
@@ -1199,7 +1156,7 @@ msgstr "是否确实要删除 DHCP 映射 {0}"
#: proxmox-yew-comp/src/confirm_button.rs:11
#: proxmox-yew-comp/src/configuration/pve/guest.rs:14
msgid "Are you sure you want to remove entry {0}"
-msgstr "确定要删除该项 {0} 吗?"
+msgstr "确定要删除 {0} 吗?"
#: proxmox-backup/www/datastore/Content.js:672
msgid "Are you sure you want to remove snapshot {0}"
@@ -1207,24 +1164,23 @@ msgstr "确定要删除快照 {0} 吗?"
#: proxmox-backup/www/tape/window/MediaRemoveWindow.js:13
msgid "Are you sure you want to remove tape '{0}' ?"
-msgstr "是否确实要删除磁带 '{0}'?"
+msgstr "确实要删除磁带'{0}'?"
#: proxmox-yew-comp/src/token_panel.rs:200
-#, fuzzy
msgid ""
"Are you sure you want to remove the API token? All existing users of the "
"token will lose access!"
msgstr ""
-"是否重新生成API令牌'{0}'的机密?之前令牌密钥的所有用户都将失去访问权限!"
+"是否重新生成 API 令牌'{0}'的密钥?之前令牌密钥的所有用户都将失去访问权限!"
#: proxmox-widget-toolkit/src/panel/Certificates.js:246
msgid "Are you sure you want to remove the certificate"
-msgstr "确定要删除该证书吗"
+msgstr "确定要删除此证书吗"
#: proxmox-widget-toolkit/src/panel/Certificates.js:242
#: proxmox-yew-comp/src/acme/certificate_list.rs:128
msgid "Are you sure you want to remove the certificate used for {0}"
-msgstr "确定要删除用于 {0} 的凭证吗?"
+msgstr "确定要删除用于 {0} 的证书吗?"
#: pve-manager/www/manager6/sdn/FabricsView.js:438
msgid "Are you sure you want to remove the fabric \"{0}\"?"
@@ -1233,7 +1189,7 @@ msgstr "确定要移除fabric \"{0}\"吗?"
#: pve-manager/www/manager6/sdn/FabricsView.js:448
msgid ""
"Are you sure you want to remove the node \"{0}\" from the fabric \"{1}\"?"
-msgstr "确定要从fabric \"{1}\"中移除节点\"{0}\"吗?"
+msgstr "确定要从fabric\"{1}\"中移除节点\"{0}\"吗?"
#: pmg-gui/js/PBSSnapshotView.js:152
msgid "Are you sure you want to remove the schedule for {0}"
@@ -1246,14 +1202,12 @@ msgid "Are you sure you want to remove the subscription key?"
msgstr "确定要删除订阅密钥吗?"
#: proxmox-yew-comp/src/acl/acl_view.rs:215
-#, fuzzy
msgid "Are you sure you want to remove this ACL entry?"
-msgstr "确定要删除此条目"
+msgstr "确定要删除此 ACL 条目吗?"
#: proxmox-yew-comp/src/tfa/tfa_confirm_remove.rs:44
-#, fuzzy
msgid "Are you sure you want to remove this TFA entry?"
-msgstr "确定要删除此条目"
+msgstr "确定要删除此双因素认证条目吗?"
#: pve-manager/www/manager6/dc/ACLView.js:163
#: pve-manager/www/manager6/sdn/VnetACLView.js:187
@@ -1261,14 +1215,12 @@ msgid "Are you sure you want to remove this entry"
msgstr "确定要删除此条目"
#: proxmox-yew-comp/src/confirm_button.rs:12
-#, fuzzy
msgid "Are you sure you want to remove this entry?"
-msgstr "确定要删除此条目"
+msgstr "确定要删除此条目吗?"
#: proxmox-datacenter-manager/ui/src/remotes/config.rs:209
-#, fuzzy
msgid "Are you sure you want to remove this remote?"
-msgstr "确定要删除此条目"
+msgstr "确定要删除此远程吗?"
#: proxmox-widget-toolkit/src/window/TfaEdit.js:143
msgid "Are you sure you want to remove this {0} entry?"
@@ -1280,9 +1232,8 @@ msgstr "确定要删除 {0} 条目吗"
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:228
#: proxmox-yew-comp/src/node_status_panel.rs:237
-#, fuzzy
msgid "Are you sure you want to shut down the node?"
-msgstr "确定要删除此条目"
+msgstr "确定要关闭该节点吗?"
#: proxmox-widget-toolkit/src/panel/DiskList.js:432
msgid "Are you sure you want to wipe {0}?"
@@ -1290,7 +1241,7 @@ msgstr "确定要擦除 {0} 吗?"
#: pve-manager/www/manager6/sdn/fabrics/ospf/FabricEdit.js:14
msgid "Area"
-msgstr ""
+msgstr "区域"
#: pve-manager/www/manager6/node/LVM.js:113
msgid "Assigned to LVs"
@@ -1313,21 +1264,22 @@ msgstr "至少有一个不匹配"
msgid ""
"At least one remote could not be queried and has an unknown subscription "
"status."
-msgstr ""
+msgstr "至少有一个远程无法查询,订阅状态未知。"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:54
-#, fuzzy
msgid ""
"At least one remote does not have a valid subscription. Please visit <a "
"target=\"_blank\" href=\"https://www.proxmox.com\">www.proxmox.com</a> to "
"get a list of available options."
-msgstr "您没有此服务器的有效订阅。请访问 {0} 获取可用选项列表。"
+msgstr ""
+"至少有一个远程节点没有有效的订阅。请访问 <a target=\"_blank\" href=\"https://"
+"www.proxmox.com\">www.proxmox.com</a> 以获取可用选项列表。"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:60
msgid ""
"At least one remote has mixed levels of subscription. These remotes fall "
"back to the lowest one."
-msgstr ""
+msgstr "至少有一个远程具有混合级别的订阅。这些远程将回退到最低级别。"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:504
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:902
@@ -1336,12 +1288,11 @@ msgstr "至少有一个规则不匹配"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:185
msgid "At least one zone needs to be configured on a remote"
-msgstr ""
+msgstr "至少需要在远程上配置一个区域"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:187
-#, fuzzy
msgid "At least one zone needs to be selected"
-msgstr "至少有一个不匹配"
+msgstr "至少需要选择一个区域"
#: pmg-gui/js/Utils.js:579
msgid "Attach orig. Mail"
@@ -1388,9 +1339,8 @@ msgid "Auth-Provider Default"
msgstr "身份验证提供程序默认值"
#: proxmox-datacenter-manager/ui/src/remotes/config.rs:336
-#, fuzzy
msgid "AuthId"
-msgstr "验证 ID"
+msgstr "认证 ID"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:106
msgid "Authenticate"
@@ -1403,7 +1353,7 @@ msgstr "身份验证模式"
#: proxmox-widget-toolkit/src/panel/SendmailEditPanel.js:58
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:166
msgid "Author"
-msgstr "发起人"
+msgstr "作者"
#: pmg-gui/js/TFAView.js:60 pve-manager/www/manager6/dc/OptionView.js:301
#: proxmox-backup/www/config/WebauthnView.js:115
@@ -1488,13 +1438,12 @@ msgstr "可用对象"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:87
msgid "Available recovery keys: {0}"
-msgstr "可用的还原密钥: {0}"
+msgstr "可用的恢复密钥:{0}"
#: proxmox-widget-toolkit/src/form/RRDTypeSelector.js:95
#: proxmox-yew-comp/src/rrd_timeframe_selector.rs:229
-#, fuzzy
msgid "Average"
-msgstr "平均"
+msgstr "平均值"
#: pmg-gui/js/GeneralMailStatistics.js:119
#: pmg-gui/js/dashboard/MailProcessing.js:50
@@ -1568,9 +1517,8 @@ msgid "Backup Details"
msgstr "备份详情"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:100
-#, fuzzy
msgid "Backup Dir"
-msgstr "备份时间"
+msgstr "备份目录"
#: proxmox-backup/www/datastore/Content.js:972
msgid "Backup Group"
@@ -1614,14 +1562,12 @@ msgid "Backup Server"
msgstr "备份服务器"
#: proxmox-datacenter-manager/ui/src/dashboard/pbs_datastores_panel.rs:175
-#, fuzzy
msgid "Backup Server Datastores"
-msgstr "备份服务器"
+msgstr "备份服务器数据存储"
#: proxmox-datacenter-manager/ui/src/dashboard/node_status_panel.rs:166
-#, fuzzy
msgid "Backup Server Nodes"
-msgstr "备份服务器"
+msgstr "备份服务器节点"
#: pve-manager/www/manager6/window/Prune.js:169
#: proxmox-backup/www/datastore/Content.js:1138
@@ -1646,7 +1592,7 @@ msgstr "立即备份"
#: pmg-gui/js/PBSSnapshotView.js:250
msgid "Backup snapshots on '{0}'"
-msgstr "在 {0} 上备份快照"
+msgstr "在'{0}'上备份快照"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:218
msgid ""
@@ -1663,9 +1609,8 @@ msgid "Backups"
msgstr "备份"
#: proxmox-datacenter-manager/ui/src/tasks.rs:173
-#, fuzzy
msgid "Backups and Backup Jobs"
-msgstr "磁带备份作业"
+msgstr "备份和备份作业"
#: proxmox-backup/www/datastore/DataStoreListSummary.js:210
#: proxmox-backup/www/datastore/Summary.js:214
@@ -1716,7 +1661,7 @@ msgstr "群组的基本域名"
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:16
#: proxmox-yew-comp/src/auth_edit_ldap.rs:303
msgid "Base Domain Name"
-msgstr "基本域名"
+msgstr "基础域名"
#: pve-manager/www/manager6/storage/LVMEdit.js:155
msgid "Base storage"
@@ -1732,16 +1677,15 @@ msgstr "基本"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:99
msgid "Basis for \"Speculative Store Bypass\" protection for AMD models"
-msgstr ""
+msgstr "为 AMD 型号提供\"推测性存储绕过\"保护的基础"
#: proxmox-backup/www/window/InfluxDbEdit.js:98
msgid "Batch Size (b)"
msgstr "批次大小 (b)"
#: pve-manager/www/manager6/dc/MetricServerView.js:372
-#, fuzzy
msgid "Batch Size (bytes)"
-msgstr "批次大小 (b)"
+msgstr "批次大小(字节)"
#: pmg-gui/js/MailProxyOptions.js:96
msgid "Before Queue Filtering"
@@ -1781,9 +1725,8 @@ msgstr "阻止加密的档案和文档"
#: pmg-gui/js/UserBlockWelcomeList.js:207
#: pmg-yew-quarantine-gui/src/spam_list.rs:288
#: pmg-yew-quarantine-gui/src/page_mail_view.rs:140
-#, fuzzy
msgid "Blocklist"
-msgstr "黑名单"
+msgstr "阻止列表"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:80
#: pmg-gui/js/Utils.js:574
@@ -1793,7 +1736,7 @@ msgstr "正文"
#: proxmox-widget-toolkit/src/node/NetworkView.js:355
#: proxmox-yew-comp/src/configuration/network_view.rs:481
msgid "Bond Mode"
-msgstr "Bond 模式"
+msgstr "绑定模式"
#: pmg-gui/js/dashboard/NodeInfo.js:105
#: pve-manager/www/manager6/node/StatusView.js:120
@@ -1837,21 +1780,19 @@ msgid "Bridge"
msgstr "桥接"
#: pve-manager/www/manager6/sdn/ZoneBridgesPanel.js:16
-#, fuzzy
msgid "Bridge Ports"
-msgstr "桥接端口"
+msgstr "网桥端口"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:135
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:150
#: proxmox-yew-comp/src/configuration/network_edit.rs:154
msgid "Bridge ports"
-msgstr "桥接端口"
+msgstr "网桥端口"
#: pve-manager/www/manager6/sdn/NetworkBrowser.js:120
#: pve-manager/www/manager6/sdn/ZoneBridgesPanel.js:5
-#, fuzzy
msgid "Bridges"
-msgstr "桥接"
+msgstr "网桥"
#: proxmox-backup/www/datastore/Content.js:1114
msgid "Browse"
@@ -1864,9 +1805,8 @@ msgid "Bucket"
msgstr "插槽"
#: proxmox-backup/www/form/S3BucketSelector.js:13
-#, fuzzy
msgid "Bucket Name"
-msgstr "插槽"
+msgstr "存储桶名称"
#: pmg-gui/js/ClamAVDatabase.js:88
msgid "Build time"
@@ -1960,9 +1900,8 @@ msgstr "批量启动虚拟机和容器"
#: proxmox-yew-comp/src/form/pve/firewall_property/log_ratelimit_property.rs:38
#: proxmox-yew-comp/src/firewall/log_ratelimit_field.rs:186
-#, fuzzy
msgid "Burst"
-msgstr "突发下载"
+msgstr "突发"
#: proxmox-backup/www/config/TrafficControlView.js:171
#: proxmox-backup/www/window/S3ClientEdit.js:157
@@ -2003,7 +1942,7 @@ msgid ""
"CD-ROM images cannot get imported, if required you can reconfigure the '{0}' "
"drive in the 'Advanced' tab."
msgstr ""
-"无法导入 CD-ROM 映像,如果需要,可以在 “高级” 选项卡中重新配置 '{0}' 驱动器。"
+"无法导入 CD-ROM 映像,如果需要,可以在\"高级\"选项卡中重新配置'{0}'驱动器。"
#: pve-manager/www/manager6/qemu/HardwareView.js:260
#: pve-manager/www/manager6/qemu/HardwareView.js:746
@@ -2016,15 +1955,13 @@ msgid "CD/DVD Drives"
msgstr "CD/DVD 驱动器"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/desktop.rs:328
-#, fuzzy
msgid "CD/DVD drive"
msgstr "CD/DVD 驱动器"
#: pve-manager/www/manager6/qemu/TdxEdit.js:86
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_intel_tdx_property.rs:44
-#, fuzzy
msgid "CID"
-msgstr "CIDR"
+msgstr "CID"
#: proxmox-widget-toolkit/src/form/NetworkSelector.js:98
#: proxmox-widget-toolkit/src/node/NetworkView.js:381
@@ -2060,12 +1997,12 @@ msgstr "CPU 绑定"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:257
msgid "CPU Cores assigned"
-msgstr ""
+msgstr "已分配的 CPU 核心"
#: pve-manager/www/manager6/node/Summary.js:269
#: pve-manager/www/manager6/panel/GuestSummary.js:137
msgid "CPU Pressure Stall"
-msgstr ""
+msgstr "CPU 压力停滞"
#: pve-manager/www/manager6/window/GuestImport.js:547
msgid "CPU Type"
@@ -2079,12 +2016,11 @@ msgstr "CPU 类型"
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:349
#: proxmox-yew-comp/src/node_info.rs:163
msgid "CPU Usage"
-msgstr "CPU利用率"
+msgstr "CPU 利用率"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:218
-#, fuzzy
msgid "CPU flags"
-msgstr "CPU利用率"
+msgstr "CPU 标志"
#: pve-manager/www/manager6/lxc/ResourceEdit.js:78
#: pve-manager/www/manager6/qemu/ProcessorEdit.js:193
@@ -2137,7 +2073,7 @@ msgstr "CRM 状态"
#. https://datatracker.ietf.org/doc/html/draft-ietf-lsr-distoptflood#name-flooding-failures
#: pve-manager/www/manager6/sdn/fabrics/openfabric/FabricEdit.js:61
msgid "CSNP Interval"
-msgstr "CSNP间隔"
+msgstr "CSNP 间隔"
#: pve-manager/www/manager6/window/BulkAction.js:399
#: proxmox-backup/www/datastore/Summary.js:169
@@ -2154,9 +2090,8 @@ msgid "CT Volumes"
msgstr "CT 卷"
#: proxmox-datacenter-manager/ui/src/pve/lxc/mod.rs:66
-#, fuzzy
msgid "CT {0}"
-msgstr "ID {0}"
+msgstr "CT {0}"
#: pve-manager/www/manager6/qemu/HDEdit.js:309
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:51
@@ -2174,20 +2109,18 @@ msgstr "可以在通知匹配器中使用来匹配这项工作。"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:197
msgid "Can only create the VNet once per remote!"
-msgstr ""
+msgstr "每个远程只能创建一次 VNet!"
#: proxmox-yew-widget-toolkit/src/touch/fab_menu.rs:264
#: proxmox-yew-widget-toolkit/src/widget/message_box.rs:128
-#, fuzzy
msgid "Cancel"
-msgstr "取消编辑"
+msgstr "取消"
#: pve-manager/www/manager6/form/TagEdit.js:351
msgid "Cancel Edit"
msgstr "取消编辑"
#: proxmox-datacenter-manager/ui/src/dashboard/status_row.rs:229
-#, fuzzy
msgid "Cancel Editing"
msgstr "取消编辑"
@@ -2212,33 +2145,30 @@ msgid "Cannot migrate VM with local resources: {0}"
msgstr "无法使用本地资源迁移虚拟机: {0}"
#: pve-manager/www/manager6/window/Migrate.js:445
-#, fuzzy
msgid "Cannot migrate VM, because {0}."
-msgstr "无法使用本地资源迁移虚拟机: {0}"
+msgstr "无法迁移虚拟机,因为 {0}。"
#: pve-manager/www/manager6/window/Migrate.js:397
msgid "Cannot migrate conntrack state, source node is lacking support."
-msgstr ""
+msgstr "无法迁移 conntrack 状态,源节点缺少支持。"
#: pve-manager/www/manager6/window/Migrate.js:406
msgid ""
"Cannot migrate conntrack state, target node is lacking support. Active "
"network connections might get dropped."
-msgstr ""
+msgstr "无法迁移 conntrack 状态,目标节点缺少支持。活动的网络连接可能会断开。"
#: pve-manager/www/manager6/window/Migrate.js:535
-#, fuzzy
msgid "Cannot migrate container, because {0}."
-msgstr "无法使用本地资源迁移虚拟机: {0}"
+msgstr "无法迁移容器,因为 {0}。"
#: pve-manager/www/manager6/window/Migrate.js:347
msgid "Cannot migrate running VM with mapped resources: {0}"
msgstr "无法迁移具有映射资源的正在运行的虚拟机: {0}"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:343
-#, fuzzy
msgid "Cannot migrate with local resource: {0}"
-msgstr "无法使用本地资源迁移虚拟机: {0}"
+msgstr "无法使用本地资源迁移:{0}"
#: pve-manager/www/manager6/storage/ImageView.js:56
msgid "Cannot remove disk image."
@@ -2246,7 +2176,7 @@ msgstr "无法删除磁盘映像。"
#: pve-manager/www/manager6/storage/ImageView.js:48
msgid "Cannot remove image, a guest with VMID '{0}' exists!"
-msgstr "无法删除映像,存在虚拟机 ID 为 '{0}' 的主机!"
+msgstr "无法删除映像,存在虚拟机 ID 为'{0}'的主机!"
#: pve-manager/www/manager6/node/ZFS.js:53
msgid "Cannot use reserved pool name"
@@ -2288,8 +2218,8 @@ msgid ""
"Caution: 'What Objects' match each mail part separately, so be careful with "
"any option besides 'Any matches'."
msgstr ""
-"警告:“哪些对象” 分别匹配每个邮件部分,因此要小心除 “任何匹配” 之外的任何选"
-"项。"
+"注意:“内容对象”会分别匹配邮件的每个部分,因此请谨慎使用除“任意匹配”外的其他"
+"选项。"
#: pve-manager/www/manager6/ceph/Pool.js:269
msgid "Ceph Pool"
@@ -2309,16 +2239,15 @@ msgstr "集群中的 Ceph"
#: pve-manager/www/manager6/window/CephInstall.js:38
msgid "Ceph is not initialized."
-msgstr "Ceph未初始化。"
+msgstr "Ceph 未初始化。"
#: pve-manager/www/manager6/window/CephInstall.js:43
msgid "Ceph is not installed on this node."
-msgstr "此节点上未安装Ceph。"
+msgstr "此节点上未安装 Ceph。"
#: proxmox-datacenter-manager/ui/src/tasks.rs:171
-#, fuzzy
msgid "Ceph related Tasks"
-msgstr "显示所有任务"
+msgstr "Ceph 相关任务"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:27
msgid "Ceph version to install"
@@ -2334,13 +2263,13 @@ msgstr "CephFS"
#: proxmox-yew-comp/src/acme/certificate_list.rs:338
#: proxmox-yew-comp/src/acme/certificate_list.rs:369
msgid "Certificate"
-msgstr "凭证"
+msgstr "证书"
#: proxmox-widget-toolkit/src/window/Certificates.js:168
#: pve-manager/www/manager6/node/Certificates.js:206
#: proxmox-yew-comp/src/acme/certificate_list.rs:272
msgid "Certificate Chain"
-msgstr "凭证链"
+msgstr "证书链"
#: pmg-gui/js/Certificates.js:5 pmg-gui/js/Certificates.js:30
#: pmg-gui/js/NavigationTree.js:96 pve-manager/www/manager6/node/Config.js:203
@@ -2350,7 +2279,7 @@ msgstr "凭证链"
#: proxmox-datacenter-manager/ui/src/certificates.rs:21
#: proxmox-datacenter-manager/ui/src/main_menu.rs:264
msgid "Certificates"
-msgstr "凭证"
+msgstr "证书"
#: proxmox-widget-toolkit/src/panel/ACMEPlugin.js:5
#: proxmox-datacenter-manager/ui/src/certificates.rs:58
@@ -2392,18 +2321,18 @@ msgstr "变更所有者"
#: proxmox-backup/www/datastore/Content.js:1060
msgid "Change owner of '{0}'"
-msgstr "变更所有者为 '{0}'"
+msgstr "变更所有者为'{0}'"
#: proxmox-backup/www/datastore/Content.js:1073
msgid "Change protection of '{0}'"
-msgstr "变更 '{0}' 的保护"
+msgstr "变更'{0}'的保护"
#: proxmox-widget-toolkit/src/node/APT.js:140
#: proxmox-widget-toolkit/src/node/APT.js:168
#: proxmox-yew-comp/src/apt_package_manager.rs:296
#: proxmox-yew-comp/src/apt_package_manager.rs:393
msgid "Changelog"
-msgstr "变更日志"
+msgstr "更新日志"
#: proxmox-backup/www/tape/ChangerStatus.js:682
#: proxmox-backup/www/tape/window/ChangerEdit.js:8
@@ -2425,7 +2354,7 @@ msgstr "更改依赖方可能会破坏现有的 WebauthnTFA 条目。"
#: pve-manager/www/manager6/lxc/Options.js:178
msgid "Changing the entrypoint command can lead to start failure!"
-msgstr ""
+msgstr "更改入口点命令可能导致启动失败!"
#: pmg-gui/js/SpamDetectorStatus.js:24
msgid "Channel"
@@ -2433,7 +2362,7 @@ msgstr "渠道"
#: proxmox-widget-toolkit/src/Schema.js:91
msgid "Character Device"
-msgstr "角色设备"
+msgstr "字符设备"
#: pmg-gui/js/Subscription.js:173
#: pve-manager/www/manager6/node/Subscription.js:167
@@ -2525,19 +2454,17 @@ msgid "Cleanup Storage Configuration"
msgstr "清理存储配置"
#: proxmox-datacenter-manager/ui/src/remotes/node_url_list.rs:284
-#, fuzzy
msgid "Clear"
-msgstr "清理"
+msgstr "清除"
#: proxmox-widget-toolkit/src/node/Tasks.js:198
#: proxmox-widget-toolkit/src/node/Tasks.js:252
msgid "Clear Filter"
-msgstr "清除筛选器"
+msgstr "清除过滤器"
#: proxmox-yew-comp/src/tasks.rs:385
-#, fuzzy
msgid "Clear Filter ({})"
-msgstr "清除筛选器"
+msgstr "清除筛选器({})"
#: pve-manager/www/manager6/window/BulkAction.js:496
msgid "Clear Filters"
@@ -2549,13 +2476,12 @@ msgid "Clear Status"
msgstr "清除状态"
#: proxmox-yew-widget-toolkit/src/widget/form/selector.rs:444
-#, fuzzy
msgid "Clear Value"
-msgstr "筛选值"
+msgstr "清除值"
#: proxmox-yew-comp/src/tfa/webauthn.rs:255
msgid "Click the button to start the authentication"
-msgstr ""
+msgstr "单击按钮开始身份验证"
#: pmg-gui/js/MailTracker.js:424
msgid "Client"
@@ -2581,7 +2507,7 @@ msgstr "客户端 ID"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:37
#: proxmox-yew-comp/src/auth_edit_openid.rs:131
msgid "Client Key"
-msgstr "客户端秘钥"
+msgstr "客户端密钥"
#: pmg-gui/js/MailProxyOptions.js:80
msgid "Client Message Rate Limit"
@@ -2634,9 +2560,8 @@ msgid "Cluster Administration"
msgstr "集群管理"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/ui_helpers.rs:69
-#, fuzzy
msgid "Cluster Firewall - {}"
-msgstr "启用防火墙"
+msgstr "集群防火墙 - {}"
#: pve-manager/www/manager6/dc/Cluster.js:53
msgid "Cluster Information"
@@ -2668,7 +2593,7 @@ msgstr "集群节点"
#: pve-manager/www/manager6/dc/OptionView.js:183
msgid "Cluster Resource Scheduling"
-msgstr "群集资源调度"
+msgstr "集群资源调度"
#: pmg-gui/js/Dashboard.js:497
msgid "Cluster Resources (average)"
@@ -2678,7 +2603,7 @@ msgstr "集群资源(平均)"
msgid ""
"Cluster has active subscriptions and would be eligible for using the "
"enterprise repository."
-msgstr "集群具有有效的订阅,并且有资格使用企业存储库。"
+msgstr "集群拥有有效订阅,可访问企业版软件源。"
#: pve-manager/www/manager6/dc/ClusterEdit.js:292
msgid ""
@@ -2703,21 +2628,19 @@ msgstr "颜色覆盖"
#: pmg-gui/js/QuarantineView.js:301 pve-manager/www/manager6/Workspace.js:434
#: proxmox-backup/www/MainView.js:271
msgid "Color Theme"
-msgstr "主题颜色"
+msgstr "主题配色"
#: proxmox-yew-widget-toolkit/src/widget/data_table/header_widget.rs:646
-#, fuzzy
msgid "Columns"
-msgstr "CT 卷"
+msgstr "列"
#: pve-manager/www/manager6/ha/Fencing.js:33
msgid "Command"
msgstr "命令"
#: pve-yew-mobile-gui/src/main.rs:33
-#, fuzzy
msgid "Command failed"
-msgstr "登录失败:"
+msgstr "命令失败"
#: proxmox-widget-toolkit/src/form/NetworkSelector.js:126
#: proxmox-widget-toolkit/src/form/UserSelector.js:41
@@ -2865,7 +2788,6 @@ msgstr "压缩"
#: proxmox-datacenter-manager/ui/src/pve/lxc/mod.rs:112
#: proxmox-datacenter-manager/ui/src/pve/qemu/mod.rs:111
-#, fuzzy
msgid "Config"
msgstr "配置"
@@ -2901,7 +2823,7 @@ msgstr "配置数据库"
#: proxmox-widget-toolkit/src/Utils.js:1420
msgid "Configuration Unsupported"
-msgstr "配置不支持"
+msgstr "配置不受支持"
#: proxmox-backup/www/datastore/OptionView.js:19
msgid "Configuration change only, no data will be deleted."
@@ -2933,7 +2855,7 @@ msgstr "在fabric中配置IP,而不是/etc/network/interface"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:48
#: proxmox-yew-comp/src/apt_repositories.rs:707
msgid "Configured"
-msgstr "配置"
+msgstr "已配置"
#: proxmox-widget-toolkit/src/button/Button.js:49
#: proxmox-widget-toolkit/src/window/ConfirmRemoveDialog.js:8
@@ -2979,7 +2901,7 @@ msgstr "确认二次验证"
#: proxmox-widget-toolkit/src/window/TfaEdit.js:99
msgid "Confirm TFA Removal"
-msgstr "确认移除 TFA"
+msgstr "确认移除双因素认证"
#: pmg-gui/js/UserEdit.js:89 pve-manager/www/manager6/dc/UserEdit.js:28
#: pve-manager/www/manager6/lxc/CreateWizard.js:120
@@ -2991,9 +2913,8 @@ msgstr "确认密码"
#. A message that conveys what will be confirmed.
#: proxmox-yew-widget-toolkit/src/widget/confirm_dialog.rs:26
-#, fuzzy
msgid "Confirm this action?"
-msgstr "配置"
+msgstr "确认此操作?"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:123
#: proxmox-widget-toolkit/src/window/AddTotp.js:270
@@ -3001,23 +2922,20 @@ msgstr "配置"
#: proxmox-widget-toolkit/src/window/AddYubico.js:123
#: proxmox-widget-toolkit/src/window/TfaEdit.js:224
msgid "Confirm your ({0}) password"
-msgstr "确认您的({0})密码"
+msgstr "确认您的 ({0}) 密码"
#: proxmox-yew-comp/src/tfa/mod.rs:45
-#, fuzzy
msgid "Confirm your ({}) password"
-msgstr "确认您的({0})密码"
+msgstr "确认您的({})密码"
#: proxmox-datacenter-manager/ui/src/remotes/add_wizard.rs:102
-#, fuzzy
msgid "Connection"
-msgstr "连接错误"
+msgstr "连接"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_connect.rs:85
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_nodes.rs:57
-#, fuzzy
msgid "Connection Certificate"
-msgstr "更新凭证"
+msgstr "连接证书"
#: proxmox-backup/www/window/DatastoreRepoInfo.js:6
msgid "Connection Information"
@@ -3025,9 +2943,8 @@ msgstr "连接信息"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:181
#: proxmox-yew-comp/src/firewall/options_edit.rs:423
-#, fuzzy
msgid "Connection Tracking Max"
-msgstr "连接信息"
+msgstr "连接跟踪最大值"
#: proxmox-widget-toolkit/src/Utils.js:411
#: proxmox-widget-toolkit/src/Utils.js:547
@@ -3043,20 +2960,19 @@ msgid "Connection failure. Network error or Proxmox VE services not running?"
msgstr "连接失败。 网络错误或 Proxmox VE 服务未运行?"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_summary.rs:132
-#, fuzzy
msgid "Connections"
-msgstr "连接错误"
+msgstr "连接"
#. TRANSLATORS: See https://www.kernel.org/doc/html/next/networking/netlink_spec/conntrack.html
#: pve-manager/www/manager6/window/Migrate.js:649
msgid "Conntrack state"
-msgstr ""
+msgstr "Conntrack 状态"
#: pve-manager/www/manager6/window/Migrate.js:415
msgid ""
"Conntrack state migration disabled. Active network connections might get "
"dropped."
-msgstr ""
+msgstr "Conntrack 状态迁移已禁用。活动的网络连接可能会断开。"
#: proxmox-widget-toolkit/src/window/ConsentModal.js:15
#: pve-yew-mobile-gui/src/pages/page_login.rs:75
@@ -3087,9 +3003,8 @@ msgid "Console"
msgstr "控制台"
#: proxmox-yew-comp/src/utils/mod.rs:243
-#, fuzzy
msgid "Console (xterm.js)"
-msgstr "控制台(JS)"
+msgstr "控制台(xterm.js)"
#: pve-manager/www/manager6/dc/OptionView.js:88
msgid "Console Viewer"
@@ -3116,9 +3031,8 @@ msgid "Container"
msgstr "容器"
#: proxmox-datacenter-manager/ui/src/tasks.rs:170
-#, fuzzy
msgid "Container related Tasks"
-msgstr "容器模板"
+msgstr "容器相关任务"
#: pve-manager/www/manager6/Utils.js:695
#: proxmox-datacenter-manager/ui/src/pve/utils.rs:296
@@ -3127,7 +3041,7 @@ msgstr "容器模板"
#: pve-manager/www/manager6/lxc/Config.js:229
msgid "Container {0} on node '{1}'"
-msgstr "节点 {1} 上的容器 {0}"
+msgstr "节点'{1}'上的容器 {0}"
#: pve-manager/www/manager6/dc/StorageView.js:119
#: pve-manager/www/manager6/sdn/Browser.js:36
@@ -3160,7 +3074,7 @@ msgstr "内容类型"
#: pmg-gui/js/Utils.js:400
msgid "Content Type Filter"
-msgstr "内容类型筛选"
+msgstr "内容类型筛选条件"
#: proxmox-backup/www/tape/form/AllocationSelector.js:7
#: proxmox-yew-widget-toolkit/src/widget/message_box.rs:115
@@ -3177,7 +3091,7 @@ msgstr "控制器"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:143
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:202
msgid "Controller of EVPN zone {} does not exist"
-msgstr ""
+msgstr "EVPN 区域 {} 的控制器不存在"
#: pve-manager/www/manager6/sdn/OptionsPanel.js:17
msgid "Controllers"
@@ -3214,12 +3128,12 @@ msgstr "复制密钥"
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:346
msgid "Copy Layout from"
-msgstr ""
+msgstr "从以下位置复制布局"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:179
#: proxmox-yew-comp/src/tfa/tfa_add_recovery.rs:146
msgid "Copy Recovery Keys"
-msgstr "复制还原密钥"
+msgstr "复制恢复密钥"
#: pve-manager/www/manager6/dc/TokenEdit.js:163
#: proxmox-backup/www/window/TokenEdit.js:213
@@ -3251,15 +3165,13 @@ msgstr "复制到剪贴板"
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:78
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:139
-#, fuzzy
msgid "Copy to clipboard"
msgstr "复制到剪贴板"
#: proxmox-yew-comp/src/node_status_panel.rs:124
#: proxmox-yew-comp/src/token_panel.rs:366
-#, fuzzy
msgid "Copy token secret to clipboard."
-msgstr "将名称复制到剪贴板"
+msgstr "复制令牌密钥到剪贴板。"
#: pve-manager/www/manager6/lxc/ResourceEdit.js:113
#: pve-manager/www/manager6/lxc/Resources.js:75
@@ -3275,24 +3187,24 @@ msgstr "核心"
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:235
msgid "Could not delete '{0}': '{1}'"
-msgstr ""
+msgstr "无法删除'{0}':'{1}'"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:81
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:114
msgid "Could not detect a ceph installation in the cluster"
-msgstr "无法在群集中检测到 ceph 安装"
+msgstr "无法在集群中检测到 ceph 安装"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:584
msgid "Could not fetch update status: {0}"
-msgstr ""
+msgstr "无法获取更新状态:{0}"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:179
msgid "Could not find Controller for EVPN zone {}"
-msgstr ""
+msgstr "找不到 EVPN 区域 {} 的控制器"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/ui_helpers.rs:47
msgid "Could not load status"
-msgstr ""
+msgstr "无法加载状态"
#: pmg-gui/js/DKIMSettings.js:41
msgid "Could not read private key - please create a selector first!"
@@ -3300,11 +3212,11 @@ msgstr "无法读取私钥-请先创建一个选择器!"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:434
msgid "Could not refresh update status."
-msgstr ""
+msgstr "无法刷新更新状态。"
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:82
msgid "Could reach all remotes."
-msgstr ""
+msgstr "可以访问所有远程。"
#: pmg-gui/js/ContactStatistics.js:168 pmg-gui/js/Dashboard.js:488
#: pmg-gui/js/DomainStatistics.js:94 pmg-gui/js/DomainStatistics.js:137
@@ -3401,19 +3313,16 @@ msgid "Create Device Nodes"
msgstr "创建设备节点"
#: proxmox-datacenter-manager/ui/src/tasks.rs:35
-#, fuzzy
msgid "Create EVPN VNet"
-msgstr "创建虚拟机"
+msgstr "创建 EVPN 虚拟网络"
#: proxmox-datacenter-manager/ui/src/tasks.rs:34
-#, fuzzy
msgid "Create EVPN Zone"
-msgstr "创建 CT"
+msgstr "创建 EVPN 区域"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_summary.rs:109
-#, fuzzy
msgid "Create Token"
-msgstr "创建 CT"
+msgstr "创建令牌"
#: pve-manager/www/manager6/Workspace.js:287
#: pve-manager/www/manager6/node/CmdMenu.js:9
@@ -3436,7 +3345,7 @@ msgstr "创建: OSD"
#: proxmox-yew-comp/src/tfa/tfa_view.rs:406
#: proxmox-yew-comp/src/tfa/tfa_confirm_remove.rs:56
msgid "Created"
-msgstr "已创建"
+msgstr "创建时间"
#: pve-manager/www/manager6/ceph/OSDDetails.js:266
msgid "Creation time"
@@ -3481,9 +3390,8 @@ msgid "Custom"
msgstr "自定义"
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:151
-#, fuzzy
msgid "Custom Layout"
-msgstr "当前布局"
+msgstr "自定义布局"
#: pmg-gui/js/SpamDetectorCustom.js:118 pmg-gui/js/SpamDetectorCustom.js:165
msgid "Custom Rule Score"
@@ -3586,21 +3494,18 @@ msgstr "DNS 服务器"
#: proxmox-yew-comp/src/configuration/dns.rs:32
#: proxmox-yew-comp/src/configuration/dns.rs:64
-#, fuzzy
msgid "DNS server 1"
-msgstr "DNS 服务器"
+msgstr "DNS 服务器 1"
#: proxmox-yew-comp/src/configuration/dns.rs:40
#: proxmox-yew-comp/src/configuration/dns.rs:67
-#, fuzzy
msgid "DNS server 2"
-msgstr "DNS 服务器"
+msgstr "DNS 服务器 2"
#: proxmox-yew-comp/src/configuration/dns.rs:48
#: proxmox-yew-comp/src/configuration/dns.rs:68
-#, fuzzy
msgid "DNS server 3"
-msgstr "DNS 服务器"
+msgstr "DNS 服务器 3"
#: pve-manager/www/manager6/lxc/DNS.js:43
#: pve-manager/www/manager6/qemu/CloudInit.js:230
@@ -3649,9 +3554,8 @@ msgid "Dashboard Options"
msgstr "仪表板选项"
#: proxmox-datacenter-manager/ui/src/dashboard/status_row.rs:238
-#, fuzzy
msgid "Dashboard Settings"
-msgstr "仪表板选项"
+msgstr "仪表板设置"
#: pve-manager/www/manager6/window/Settings.js:179
msgid "Dashboard Storages"
@@ -3702,9 +3606,8 @@ msgid "Datastore"
msgstr "数据存储"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:317
-#, fuzzy
msgid "Datastore (Proxmox Backup Server)"
-msgstr "Proxmox Backup Server 登录"
+msgstr "数据存储(Proxmox 备份服务器)"
#: proxmox-backup/www/tape/window/TapeRestore.js:517
msgid "Datastore Mapping"
@@ -3715,9 +3618,8 @@ msgid "Datastore Options"
msgstr "数据存储选项"
#: proxmox-backup/www/window/DataStoreEdit.js:58
-#, fuzzy
msgid "Datastore Type"
-msgstr "数据存储"
+msgstr "数据存储类型"
#: proxmox-backup/www/dashboard/DataStoreStatistics.js:56
msgid "Datastore Usage"
@@ -3738,9 +3640,8 @@ msgid "Datastore is not mounted"
msgstr "数据存储未挂载"
#: proxmox-datacenter-manager/ui/src/pbs/datastore.rs:51
-#, fuzzy
msgid "Datastore {0}"
-msgstr "数据存储"
+msgstr "数据存储 {0}"
#: proxmox-backup/www/datastore/DataStoreList.js:194
#: proxmox-datacenter-manager/ui/src/pbs/tree.rs:239
@@ -3782,7 +3683,7 @@ msgstr "停用 {0} 帐户"
#: proxmox-yew-comp/src/rrd_timeframe_selector.rs:160
msgid "Decade"
-msgstr ""
+msgstr "十年"
#: pmg-gui/js/ViewMailHeaders.js:106
msgid "Decode"
@@ -3857,14 +3758,12 @@ msgid "Default"
msgstr "默认"
#: proxmox-backup/www/datastore/OptionView.js:316
-#, fuzzy
msgid "Default # of Verification Readers"
-msgstr "上次验证"
+msgstr "默认验证读取器数量"
#: proxmox-backup/www/datastore/OptionView.js:326
-#, fuzzy
msgid "Default # of Verification Workers"
-msgstr "上次验证"
+msgstr "默认验证工作器数量"
#: pve-manager/www/manager6/node/NodeOptionsView.js:80
msgid "Default (80%)"
@@ -3928,17 +3827,15 @@ msgstr "可以通过编辑领域来设置默认同步选项。"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:401
msgid "Default user classes: inetorgperson, posixaccount, person, user"
-msgstr "默认用户类别:inetorgperson、posixaccount、person、user"
+msgstr "默认用户类:inetorgperson、posixaccount、person、user"
#: proxmox-backup/www/Utils.js:927
-#, fuzzy
msgid "Default verification readers"
-msgstr "验证码"
+msgstr "默认验证读取器"
#: proxmox-backup/www/Utils.js:921
-#, fuzzy
msgid "Default verification workers"
-msgstr "验证作业"
+msgstr "默认验证工作器"
#: proxmox-widget-toolkit/src/panel/SendmailEditPanel.js:71
msgid "Defaults to datacenter configuration, or root@$hostname"
@@ -3966,6 +3863,8 @@ msgid ""
"the cluster or single node. Fingerprints are only required for untrusted "
"certificates."
msgstr ""
+"定义一组地址,供 Proxmox 数据中心管理器用于连接集群或单个节点。仅当证书不受信"
+"任时才需要提供指纹。"
#: pmg-gui/js/PBSSnapshotView.js:182
msgid "Delay"
@@ -3989,7 +3888,7 @@ msgstr "删除"
#: pve-manager/www/manager6/node/Certificates.js:279
#: proxmox-yew-comp/src/acme/certificate_list.rs:126
msgid "Delete Custom Certificate"
-msgstr "删除自定义凭证"
+msgstr "删除自定义证书"
#: pve-manager/www/manager6/Utils.js:2128
#: pve-manager/www/manager6/Utils.js:2157
@@ -4000,7 +3899,6 @@ msgid "Delete Snapshot"
msgstr "删除快照"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:432
-#, fuzzy
msgid "Delete Source"
msgstr "删除源"
@@ -4014,17 +3912,15 @@ msgstr "删除所有信息"
#: pve-manager/www/manager6/node/Certificates.js:286
msgid "Delete custom certificate and switch to generated one?"
-msgstr "删除自定义凭证并切换到生成的凭证?"
+msgstr "删除自定义证书并切换到生成的证书?"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/mobile.rs:228
-#, fuzzy
msgid "Delete device"
-msgstr "删除源"
+msgstr "删除设备"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/mobile.rs:447
-#, fuzzy
msgid "Delete disk"
-msgstr "删除源"
+msgstr "删除磁盘"
#: pve-manager/www/manager6/storage/PBSEdit.js:310
msgid "Delete existing encryption key"
@@ -4032,7 +3928,7 @@ msgstr "删除现有加密密钥"
#: proxmox-yew-comp/src/pending_property_view/mod.rs:303
msgid "Delete property failed"
-msgstr ""
+msgstr "删除属性失败"
#: pve-manager/www/manager6/qemu/HDMove.js:84
#: proxmox-yew-comp/src/configuration/pve/move_disk_dialog.rs:98
@@ -4041,20 +3937,18 @@ msgstr "删除源"
#: proxmox-yew-comp/src/configuration/pve/lxc_resources_panel/mobile.rs:258
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/mobile.rs:395
-#, fuzzy
msgid "Delete volume"
-msgstr "删除源"
+msgstr "删除卷"
#: pmg-gui/js/PostfixMailQueue.js:100
-#, fuzzy
msgid "Delete {0} selected mails?"
-msgstr "未选择 {0}"
+msgstr "删除选定的 {0} 封邮件?"
#: pve-manager/www/manager6/storage/PBSEdit.js:441
msgid ""
"Deleting or replacing the encryption key will break restoring backups "
"created with it!"
-msgstr "删除或替换加密密钥将破坏用它创建的备份的还原!"
+msgstr "删除或替换加密密钥将导致用它创建的备份无法恢复!"
#: pmg-gui/js/AttachmentQuarantine.js:147
#: pmg-gui/js/QuarantineContextMenu.js:19 pmg-gui/js/SpamContextMenu.js:6
@@ -4069,9 +3963,8 @@ msgid "Deliver to"
msgstr "传送到"
#: pmg-gui/js/PostfixMailQueue.js:96
-#, fuzzy
msgid "Deliver {0} selected mails?"
-msgstr "未选择 {0}"
+msgstr "投递选定的 {0} 封邮件?"
#: pve-manager/www/manager6/UIOptions.js:75
msgid "Dense"
@@ -4079,9 +3972,8 @@ msgstr "密集"
#: pve-yew-mobile-gui/src/pages/page_settings.rs:41
#: proxmox-yew-comp/src/theme_dialog.rs:55
-#, fuzzy
msgid "Density"
-msgstr "磁带密度"
+msgstr "密度"
#: proxmox-widget-toolkit/src/node/APT.js:49
#: proxmox-widget-toolkit/src/node/APTRepositories.js:36
@@ -4120,7 +4012,7 @@ msgstr "磁带密度"
#: proxmox-yew-comp/src/tfa/tfa_confirm_remove.rs:60
#: proxmox-yew-comp/src/tasks.rs:151
msgid "Description"
-msgstr "说明"
+msgstr "描述"
#: pve-manager/www/manager6/dc/Backup.js:330
#: pve-manager/www/manager6/dc/RealmSyncJob.js:397
@@ -4172,7 +4064,7 @@ msgstr "销毁"
#: pve-manager/www/manager6/storage/ImageView.js:64
msgid "Destroy '{0}'"
-msgstr "销毁 '{0}'"
+msgstr "销毁'{0}'"
#: pve-manager/www/manager6/ceph/ServiceList.js:396
msgid "Destroy MON"
@@ -4180,7 +4072,7 @@ msgstr "销毁 MON"
#: proxmox-backup/www/window/NamespaceEdit.js:102
msgid "Destroy Namespace '{0}'"
-msgstr "销毁命名空间 '{0}'"
+msgstr "销毁命名空间'{0}'"
#: proxmox-backup/www/datastore/OptionView.js:24
msgid "Destroy all data (dangerous!)"
@@ -4210,9 +4102,8 @@ msgid "Detail"
msgstr "详情"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:453
-#, fuzzy
msgid "Detailed Mapping"
-msgstr "数据存储映射"
+msgstr "详细映射"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:65
#: pve-manager/www/manager6/ceph/OSD.js:898
@@ -4413,18 +4304,16 @@ msgstr "磁盘操作"
#: proxmox-datacenter-manager/ui/src/pbs/datastore/overview.rs:245
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:379
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:388
-#, fuzzy
msgid "Disk I/O"
-msgstr "磁盘 IO"
+msgstr "磁盘 I/O"
#: pve-manager/www/manager6/panel/GuestSummary.js:129
msgid "Disk IO"
msgstr "磁盘 IO"
#: proxmox-datacenter-manager/ui/src/pve/utils.rs:291
-#, fuzzy
msgid "Disk Image"
-msgstr "磁盘映像"
+msgstr "磁盘镜像"
#: pve-manager/www/manager6/dc/OptionView.js:374
msgid "Disk Move"
@@ -4433,16 +4322,14 @@ msgstr "磁盘移动"
#: proxmox-datacenter-manager/ui/src/pbs/datastore/overview.rs:141
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:182
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:180
-#, fuzzy
msgid "Disk Read"
-msgstr "磁盘读取总额"
+msgstr "磁盘读取"
#: proxmox-datacenter-manager/ui/src/pbs/datastore/overview.rs:142
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:183
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:181
-#, fuzzy
msgid "Disk Write"
-msgstr "磁盘写入总额"
+msgstr "磁盘写入"
#: pve-manager/www/manager6/Utils.js:693
#: pve-manager/www/manager6/form/DiskStorageSelector.js:154
@@ -4494,29 +4381,27 @@ msgid "Do not use any media"
msgstr "不使用任何介质"
#: proxmox-yew-comp/src/token_panel.rs:209
-#, fuzzy
msgid ""
"Do you want to regenerate the secret of the selected API token? All existing "
"users of the token will lose access!"
msgstr ""
-"是否重新生成API令牌'{0}'的机密?之前令牌密钥的所有用户都将失去访问权限!"
+"是否重新生成 API 令牌'{0}'的密钥?之前令牌密钥的所有用户都将失去访问权限!"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:14
msgid "Do you want to reset {0} to its default settings?"
-msgstr "您想将 {0} 重置为其默认设置吗?"
+msgstr "是否要将 {0} 重置为默认设置?"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:120
msgid "Do you want to send a test notification to '{0}'?"
msgstr "是否要向'{0}'发送测试通知?"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_connect.rs:96
-#, fuzzy
msgid "Do you want to trust the certificate and save its fingerprint?"
-msgstr "您想将 {0} 重置为其默认设置吗?"
+msgstr "要信任该证书并保存其指纹吗?"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_nodes.rs:68
msgid "Do you want to trust them by saving their fingerprint?"
-msgstr ""
+msgstr "您想通过保存其指纹来信任它们吗?"
#: pmg-gui/js/MainView.js:195 pve-manager/www/manager6/Workspace.js:380
#: proxmox-backup/www/MainView.js:245
@@ -4526,7 +4411,7 @@ msgstr "文档"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:455
msgid "Does not look like a valid recovery key"
-msgstr "看起来不像是有效的还原密钥"
+msgstr "看起来不是有效的恢复密钥"
#: pve-manager/www/manager6/dc/ClusterEdit.js:334
msgid "Does not seem like a valid encoded Cluster Information!"
@@ -4582,7 +4467,7 @@ msgstr "下载"
#: proxmox-backup/www/datastore/Content.js:1106
msgid "Download '{0}'"
-msgstr "下载 '{0}'"
+msgstr "下载'{0}'"
#: proxmox-widget-toolkit/src/window/FileBrowser.js:322
msgid "Download as"
@@ -4642,7 +4527,7 @@ msgstr "驱动器"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:19
msgid "Drop"
-msgstr ""
+msgstr "丢弃"
#: proxmox-backup/www/panel/PrunePanel.js:65
msgid "Dry Run"
@@ -4697,7 +4582,7 @@ msgstr "动态"
#: proxmox-backup/www/window/UserEdit.js:162
#: proxmox-yew-comp/src/acme/acme_register_account.rs:111
msgid "E-Mail"
-msgstr "E-Mail"
+msgstr "电子邮件"
#: pmg-gui/js/Dashboard.js:423
msgid "E-Mail Processing"
@@ -4713,13 +4598,13 @@ msgstr "E-Mail 地址"
#: pmg-gui/js/LDAPConfig.js:318
msgid "E-Mail addresses of '{0}'"
-msgstr "'{0}' 的 E-Mail 地址"
+msgstr "'{0}'的 E-Mail 地址"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:351
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:246
#: proxmox-yew-comp/src/auth_edit_ldap.rs:220
msgid "E-Mail attribute"
-msgstr "E-Mail 属性"
+msgstr "电子邮件属性"
#: pve-manager/www/manager6/node/ACME.js:220
msgid "EAB Key"
@@ -4771,39 +4656,39 @@ msgstr "邮件属性名"
#: proxmox-datacenter-manager/ui/src/main_menu.rs:326
msgid "EVPN"
-msgstr ""
+msgstr "EVPN"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:225
msgid "EVPN Zone has no VRF VNI configured!"
-msgstr ""
+msgstr "EVPN 区域未配置 VRF VNI!"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:280
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:160
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:219
msgid "EVPN Zone {} has no VRF VNI"
-msgstr ""
+msgstr "EVPN 区域 {} 没有 VRF VNI"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:192
msgid "EVPN Zone {} has no VXLAN ID defined!"
-msgstr ""
+msgstr "EVPN 区域 {} 未定义 VXLAN ID!"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:233
msgid "EVPN controller {} has no ASN"
-msgstr ""
+msgstr "EVPN 控制器 {} 没有 ASN"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:187
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:270
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:150
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:209
msgid "EVPN controller {} has no ASN defined!"
-msgstr ""
+msgstr "EVPN 控制器 {} 未定义 ASN!"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:166
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:250
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:130
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:189
msgid "EVPN zone {} has no controller defined!"
-msgstr ""
+msgstr "EVPN 区域 {} 未定义控制器!"
#: proxmox-widget-toolkit/src/Utils.js:697
#: proxmox-widget-toolkit/src/node/DNSView.js:50
@@ -4919,27 +4804,24 @@ msgid "Edit"
msgstr "编辑"
#: proxmox-yew-comp/src/firewall/options_edit.rs:170
-#, fuzzy
msgid "Edit Cluster Firewall"
-msgstr "启用防火墙"
+msgstr "编辑集群防火墙"
#: proxmox-yew-comp/src/firewall/options_edit.rs:240
-#, fuzzy
msgid "Edit Guest Firewall"
-msgstr "VNet 防火墙"
+msgstr "编辑客户机防火墙"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:357
msgid "Edit Mapping '{0}'"
-msgstr "编辑映射 '{0}'"
+msgstr "编辑映射'{0}'"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:359
msgid "Edit Mapping '{0}' for '{1}'"
-msgstr "编辑 '{1}' 的映射 '{0}'"
+msgstr "编辑'{1}'的映射'{0}'"
#: proxmox-yew-comp/src/firewall/options_edit.rs:221
-#, fuzzy
msgid "Edit Node Firewall"
-msgstr "VNet 防火墙"
+msgstr "编辑节点防火墙"
#: pve-manager/www/manager6/grid/BackupView.js:268
#: pve-manager/www/manager6/storage/BackupView.js:151
@@ -4952,9 +4834,8 @@ msgstr "编辑标记"
#: proxmox-yew-comp/src/acme/acme_domains.rs:244
#: proxmox-yew-comp/src/acme/acme_domains.rs:434
-#, fuzzy
msgid "Edit account settings"
-msgstr "编辑仪表板设置"
+msgstr "编辑账户设置"
#: proxmox-backup/www/Dashboard.js:243
msgid "Edit dashboard settings"
@@ -4966,7 +4847,7 @@ msgstr "编辑现有的加密密钥(危险!)"
#: proxmox-widget-toolkit/src/panel/NotesView.js:145
msgid "Edit notes"
-msgstr "编辑注释"
+msgstr "编辑备注"
#: pmg-gui/js/ActionList.js:147
#: pve-manager/www/manager6/form/CalendarEvent.js:6
@@ -4984,12 +4865,12 @@ msgstr "EiB"
#: proxmox-widget-toolkit/src/panel/EmailRecipientPanel.js:12
#: proxmox-widget-toolkit/src/panel/SendmailEditPanel.js:14
msgid "Either mailto or mailto-user must be set"
-msgstr "必须设置 mailto 或 mailto 用户"
+msgstr "必须设置 mailto 或 mailto-user"
#: proxmox-widget-toolkit/src/node/NetworkView.js:434
msgid ""
"Either reboot or use 'Apply Configuration' (needs ifupdown2) to activate"
-msgstr "重新启动或使用“应用配置”(需要 ifupdown2 )激活"
+msgstr "重启或使用“应用配置”(需安装 ifupdown2)以激活"
#: proxmox-backup/www/tape/BackupJobs.js:230
#: proxmox-backup/www/tape/DriveStatus.js:227
@@ -5016,9 +4897,8 @@ msgid "Email from address"
msgstr "来自地址的电子邮件"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:91
-#, fuzzy
msgid "Email to"
-msgstr "Email"
+msgstr "发送邮件至"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:197
#: proxmox-widget-toolkit/src/node/APTRepositories.js:571
@@ -5046,9 +4926,8 @@ msgstr "启用"
#: pve-manager/www/manager6/qemu/TdxEdit.js:73
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_intel_tdx_property.rs:37
-#, fuzzy
msgid "Enable Attestation"
-msgstr "启用配额"
+msgstr "启用认证"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:63
#: proxmox-yew-comp/src/firewall/options_edit.rs:339
@@ -5102,17 +4981,16 @@ msgstr "启用 TLS 日志"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:59
#: proxmox-yew-comp/src/firewall/options_edit.rs:283
-#, fuzzy
msgid "Enable ebtables"
-msgstr "启用配额"
+msgstr "启用 ebtables"
#: pve-manager/www/manager6/ha/ResourceEdit.js:120
msgid "Enable if HA resource should automatically adjust to HA rules."
-msgstr ""
+msgstr "如果 HA 资源应自动调整到 HA 规则,请启用。"
#: pve-manager/www/manager6/ha/rules/NodeAffinityRuleEdit.js:133
msgid "Enable if the HA Resources must be restricted to the nodes."
-msgstr ""
+msgstr "如果 HA 资源必须限制在这些节点上,请启用。"
#: pve-manager/www/manager6/storage/LVMEdit.js:235
msgid "Enable if the LVM is located on a shared LUN."
@@ -5200,7 +5078,7 @@ msgstr "为 Windows 启用"
#: pve-manager/www/manager6/window/Migrate.js:653
msgid "Enables live migration of conntrack entries for this VM."
-msgstr ""
+msgstr "为此虚拟机启用 conntrack 条目的实时迁移。"
#: pve-manager/www/manager6/ceph/OSD.js:101
msgid "Encrypt OSD"
@@ -5257,9 +5135,8 @@ msgstr "结束时间"
#: proxmox-backup/www/config/S3ClientView.js:115
#: proxmox-backup/www/form/S3ClientSelector.js:26
#: proxmox-backup/www/window/S3ClientEdit.js:46
-#, fuzzy
msgid "Endpoint"
-msgstr "端点名称"
+msgstr "端点"
#: proxmox-widget-toolkit/src/panel/GotifyEditPanel.js:17
#: proxmox-widget-toolkit/src/panel/SendmailEditPanel.js:28
@@ -5270,9 +5147,8 @@ msgstr "端点名称"
#: proxmox-datacenter-manager/ui/src/remotes/add_wizard.rs:125
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:128
-#, fuzzy
msgid "Endpoints"
-msgstr "端点名称"
+msgstr "端点"
#: proxmox-widget-toolkit/src/Utils.js:72 proxmox-yew-comp/src/lib.rs:302
msgid "English"
@@ -5284,26 +5160,24 @@ msgstr "确保底层存储支持访问时间更新"
#: pve-manager/www/manager6/window/DownloadUrlToStorage.js:141
msgid "Enter URL to download"
-msgstr "输入 URL 下载"
+msgstr "输入下载URL"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:351
msgid "Enterprise (recommended)"
msgstr "企业(推荐)"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:717
-#, fuzzy
msgid "Enterprise repository configured, but missing subscription"
-msgstr "企业存储库需要有效订阅"
+msgstr "已配置企业仓库,但缺少订阅"
#: proxmox-widget-toolkit/src/Utils.js:1396
msgid "Enterprise repository needs valid subscription"
-msgstr "企业存储库需要有效订阅"
+msgstr "企业版软件源需要有效订阅"
#: proxmox-yew-comp/src/auth_view.rs:453
#: proxmox-yew-comp/src/auth_edit_ldap.rs:247
-#, fuzzy
msgid "Entries"
-msgstr "入口"
+msgstr "条目"
#: pve-manager/www/manager6/qemu/RNGEdit.js:47
msgid "Entropy source"
@@ -5315,17 +5189,16 @@ msgstr "熵源"
#: pve-manager/www/manager6/dc/RealmSyncJob.js:374
#: pve-manager/www/manager6/dc/SyncWindow.js:138
msgid "Entry"
-msgstr "入口"
+msgstr "条目"
#: pve-manager/www/manager6/lxc/Options.js:157
#: proxmox-yew-comp/src/form/pve/lxc_property/mod.rs:123
-#, fuzzy
msgid "Entrypoint"
-msgstr "端点名称"
+msgstr "入口点"
#: pve-manager/www/manager6/lxc/Options.js:163
msgid "Entrypoint Init Command"
-msgstr ""
+msgstr "入口点初始化命令"
#: pmg-gui/js/DKIMSettings.js:124
msgid "Envelope"
@@ -5335,7 +5208,7 @@ msgstr "信封"
#: pve-manager/www/manager6/lxc/Options.js:186
#: proxmox-yew-comp/src/form/pve/lxc_property/mod.rs:127
msgid "Environment"
-msgstr ""
+msgstr "环境变量"
#: pve-manager/www/manager6/Utils.js:2115
#: proxmox-datacenter-manager/ui/src/tasks.rs:44
@@ -5578,7 +5451,7 @@ msgstr "每 {0} 分钟"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1303
msgid "Exact"
-msgstr "准确的"
+msgstr "精确匹配"
#: proxmox-widget-toolkit/src/Toolkit.js:11
#: proxmox-widget-toolkit/src/Toolkit.js:21
@@ -5657,7 +5530,7 @@ msgstr "实验性"
#: proxmox-yew-comp/src/token_panel.rs:454
#: proxmox-yew-comp/src/token_panel.rs:511
msgid "Expire"
-msgstr "有效期至"
+msgstr "过期时间"
#: proxmox-widget-toolkit/src/panel/Certificates.js:46
#: proxmox-widget-toolkit/src/window/Certificates.js:52
@@ -5667,7 +5540,7 @@ msgstr "有效期至"
#: proxmox-yew-comp/src/acme/certificate_list.rs:359
#: proxmox-yew-comp/src/acme/certificate_list.rs:410
msgid "Expires"
-msgstr "有效期至"
+msgstr "过期时间"
#: proxmox-backup/www/tape/BackupJobs.js:237
msgid "Export"
@@ -5679,18 +5552,16 @@ msgid "Export Media-Set"
msgstr "导出媒体集"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:395
-#, fuzzy
msgid "External"
-msgstr "外部 SMTP 端口"
+msgstr "外部"
#: pmg-gui/js/MailProxyPorts.js:42
msgid "External SMTP Port"
msgstr "外部 SMTP 端口"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:155
-#, fuzzy
msgid "Extra CPU Flags"
-msgstr "CPU利用率"
+msgstr "CPU 扩展标志"
#: pmg-gui/js/SpamDetectorOptions.js:26
msgid "Extract Text from Attachments"
@@ -5709,11 +5580,11 @@ msgstr "FS 名称"
#: pve-manager/www/manager6/sdn/controllers/EvpnEdit.js:44
#: pve-manager/www/manager6/sdn/zones/VxlanEdit.js:66
msgid "Fabric"
-msgstr ""
+msgstr "网络结构"
#: pve-manager/www/manager6/dc/Config.js:310
msgid "Fabrics"
-msgstr ""
+msgstr "网络结构"
#: pmg-gui/js/RuleConfiguration.js:180
msgid "Factory Defaults"
@@ -5721,9 +5592,8 @@ msgstr "出厂默认值"
#: pve-manager/www/manager6/ha/ResourceEdit.js:116
#: pve-manager/www/manager6/ha/Resources.js:148
-#, fuzzy
msgid "Failback"
-msgstr "回退"
+msgstr "故障回退"
#: pve-manager/www/manager6/Utils.js:295
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:440
@@ -5732,20 +5602,20 @@ msgstr "失败"
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:87
msgid "Failed to reach all remotes"
-msgstr ""
+msgstr "无法访问所有远程"
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:102
msgid "Failed to reach one of {0} remotes."
msgid_plural "Failed to reach {n} of {0} remotes."
-msgstr[0] ""
+msgstr[0] "无法访问 {0} 个远程中的 {n} 个。"
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:93
msgid "Failed to reach {0} out of {1} remotes"
-msgstr ""
+msgstr "无法访问 {1} 个远程中的 {0} 个"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:669
msgid "Failed to retrieve update status: {0}"
-msgstr ""
+msgstr "无法检索更新状态:{0}"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:70
msgid "Failing"
@@ -5762,7 +5632,7 @@ msgstr "回退"
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:38
#: proxmox-yew-comp/src/auth_edit_ldap.rs:298
msgid "Fallback Server"
-msgstr "后备服务器"
+msgstr "备用服务器"
#: pve-manager/www/manager6/dc/Backup.js:809
msgid "Fallback from storage config"
@@ -5776,7 +5646,7 @@ msgstr "系列"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:541
#: proxmox-yew-comp/src/apt_repositories.rs:294
msgid "Fatal parsing error for at least one repository"
-msgstr "至少一个存储库的致命解析错误"
+msgstr "至少一个软件源存在致命解析错误"
#: pve-manager/www/manager6/lxc/FeaturesEdit.js:125
#: pve-manager/www/manager6/lxc/Options.js:148
@@ -5802,9 +5672,8 @@ msgstr "字段名称"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:333
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:449
#: proxmox-yew-widget-toolkit/src/widget/form/textarea.rs:142
-#, fuzzy
msgid "Field may not be empty."
-msgstr "标签不能为空。"
+msgstr "字段不能为空。"
#: proxmox-widget-toolkit/src/node/Tasks.js:194
msgid "Fields"
@@ -5846,7 +5715,7 @@ msgstr "文件名"
msgid ""
"File of type {0} cannot be downloaded directly, download a parent directory "
"instead."
-msgstr "{0} 类型的文件无法直接下载,请下载父目录。"
+msgstr "无法直接下载 {0} 类型的文件,请下载其父目录。"
#: pve-manager/www/manager6/window/DownloadUrlToStorage.js:174
#: pve-manager/www/manager6/window/UploadToStorage.js:226
@@ -5878,7 +5747,7 @@ msgstr "文件类型"
#: proxmox-datacenter-manager/ui/src/pbs/tree.rs:254
#: proxmox-datacenter-manager/ui/src/pve/tree.rs:502
msgid "Filter"
-msgstr "筛选器"
+msgstr "过滤器"
#: proxmox-backup/www/form/GroupFilter.js:460
msgid "Filter Type"
@@ -5945,14 +5814,12 @@ msgid "Finish Edit"
msgstr "完成编辑"
#: proxmox-datacenter-manager/ui/src/dashboard/status_row.rs:215
-#, fuzzy
msgid "Finish Editing"
msgstr "完成编辑"
#: pve-yew-mobile-gui/src/widgets/task_list_button.rs:148
-#, fuzzy
msgid "Finished"
-msgstr "完成"
+msgstr "已完成"
#: pve-manager/www/manager6/dc/Config.js:330
#: pve-manager/www/manager6/grid/FirewallOptions.js:66
@@ -5981,7 +5848,7 @@ msgstr "固件"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:549
msgid "First Ceph monitor"
-msgstr "第一个 Ceph 监视器"
+msgstr "第一个 Ceph monitor"
#: pmg-gui/js/UserEdit.js:150 pve-manager/www/manager6/dc/UserEdit.js:83
#: proxmox-backup/www/window/UserEdit.js:146
@@ -5991,7 +5858,7 @@ msgstr "名字"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:333
#: proxmox-yew-comp/src/auth_edit_ldap.rs:211
msgid "First Name attribute"
-msgstr "姓氏属性"
+msgstr "名字属性"
#: pve-manager/www/manager6/form/CalendarEvent.js:39
msgid "First Saturday each month"
@@ -6005,9 +5872,8 @@ msgstr "每年的第一天"
#: proxmox-yew-comp/src/user_panel.rs:538
#: proxmox-yew-comp/src/user_panel.rs:557
-#, fuzzy
msgid "First name"
-msgstr "名字"
+msgstr "名"
#: proxmox-backup/www/tape/DriveStatus.js:338
msgid "Fixed"
@@ -6023,7 +5889,7 @@ msgstr "所有自动创建的用户的固定角色"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:66
msgid "Flags"
-msgstr "标记"
+msgstr "标志位"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:210
msgid "Fleecing"
@@ -6035,7 +5901,7 @@ msgstr "急速存储"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_element.rs:88
msgid "Flex"
-msgstr ""
+msgstr "弹性"
#: pve-manager/www/manager6/qemu/Options.js:137
msgid "Floppy"
@@ -6051,9 +5917,8 @@ msgstr "刷新队列"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs:49
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs:82
-#, fuzzy
msgid "Folder Sharing"
-msgstr "文件夹视图"
+msgstr "文件夹共享"
#: pve-manager/www/manager6/form/ViewSelector.js:26
msgid "Folder View"
@@ -6070,18 +5935,16 @@ msgid "Font-Size"
msgstr "字体大小"
#: proxmox-yew-comp/src/configuration/network_edit.rs:209
-#, fuzzy
msgid "For example, bond0, bond0.100, bond1, ..."
-msgstr "例如:vmbr0.100, vmbr0, vlan0.100, vlan0"
+msgstr "例如:bond0、bond0.100、bond1 等"
#: proxmox-yew-comp/src/configuration/network_edit.rs:134
-#, fuzzy
msgid "For example, vmbr0, vmbr0.100, vmbr1, ..."
-msgstr "例如:vmbr0.100, vmbr0, vlan0.100, vlan0"
+msgstr "例如:vmbr0、vmbr0.100、vmbr1 等"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:334
msgid "For example, vmbr0.100, vmbr0, vlan0.100, vlan0"
-msgstr "例如:vmbr0.100, vmbr0, vlan0.100, vlan0"
+msgstr "例如:vmbr0.100、vmbr0、vlan0.100、vlan0"
#: proxmox-widget-toolkit/src/window/AddTotp.js:163
#: proxmox-widget-toolkit/src/window/AddWebauthn.js:197
@@ -6089,7 +5952,7 @@ msgstr "例如:vmbr0.100, vmbr0, vlan0.100, vlan0"
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:102
#: proxmox-yew-comp/src/tfa/tfa_add_webauthn.rs:73
msgid "For example: TFA device ID, required to identify multiple factors."
-msgstr "例如:TFA设备ID,用于识别多个因素。"
+msgstr "例如:双因素认证设备 ID,用于识别多个验证因子。"
#: pve-manager/www/manager6/dc/UserView.js:74
msgid "For the PAM realm, this applies only to the connected node."
@@ -6166,19 +6029,18 @@ msgid "Forward Policy"
msgstr "转发策略"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:130
-#, fuzzy
msgid "Forward log level"
-msgstr "转发策略"
+msgstr "转发日志级别"
#: pve-manager/www/manager6/grid/FirewallRules.js:247
msgid ""
"Forward rules only take effect when the nftables firewall is activated in "
"the host options"
-msgstr "转发规则仅在主机选项中激活nftables防火墙时生效"
+msgstr "转发规则仅在主机选项中激活 nftables 防火墙时生效"
#: proxmox-widget-toolkit/src/Utils.js:733
msgid "Forwarded mails to the local root user"
-msgstr "将邮件转发给本地 root 用户"
+msgstr "转发给本地 root 用户的邮件"
#: pve-manager/www/manager6/node/ZFS.js:250 proxmox-backup/www/ZFSList.js:86
msgid "Fragmentation"
@@ -6196,7 +6058,6 @@ msgid "Freeze CPU at startup"
msgstr "启动时冻结 CPU"
#: proxmox-yew-comp/src/form/pve/qemu_property/mod.rs:144
-#, fuzzy
msgid "Freeze CPU on startup"
msgstr "启动时冻结 CPU"
@@ -6205,12 +6066,12 @@ msgstr "启动时冻结 CPU"
msgid ""
"Freeze/thaw for guest filesystems disabled. This can lead to inconsistent "
"disk backups."
-msgstr "已禁用来宾文件系统的冻结/解冻。这可能导致磁盘备份不一致。"
+msgstr "已禁用客户机文件系统的冻结/解冻。这可能导致磁盘备份不一致。"
#: pve-manager/www/manager6/form/AgentFeatureSelector.js:26
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_agent_property.rs:92
msgid "Freeze/thaw guest filesystems on backup for consistency"
-msgstr "在备份时冻结/解冻来宾文件系统以实现一致性"
+msgstr "在备份时冻结/解冻客户机文件系统以实现一致性"
#: proxmox-widget-toolkit/src/Utils.js:76 proxmox-yew-comp/src/lib.rs:307
msgid "French"
@@ -6229,7 +6090,7 @@ msgstr "从"
#: proxmox-widget-toolkit/src/panel/SendmailEditPanel.js:68
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:141
msgid "From Address"
-msgstr "发件人地址"
+msgstr "发件地址"
#: pve-manager/www/manager6/window/Restore.js:279
msgid "From Backup"
@@ -6254,7 +6115,7 @@ msgstr "从设备"
#: proxmox-yew-comp/src/acme/certificate_list.rs:255
#: proxmox-yew-comp/src/acme/certificate_list.rs:281
msgid "From File"
-msgstr "从文件"
+msgstr "从文件导入"
#: proxmox-backup/www/tape/ChangerStatus.js:83
#: proxmox-backup/www/tape/ChangerStatus.js:122
@@ -6266,9 +6127,8 @@ msgid "From backup configuration"
msgstr "从备份配置"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:86
-#, fuzzy
msgid "From:"
-msgstr "从"
+msgstr "发件人:"
#: pve-manager/www/manager6/ceph/OSDDetails.js:186
msgid "Front Address"
@@ -6299,11 +6159,11 @@ msgstr "GC访问时间截止(分钟)"
#: proxmox-backup/www/Utils.js:902
#: proxmox-backup/www/datastore/OptionView.js:281
msgid "GC Access-Time Support Check"
-msgstr "GC访问时间支持检查"
+msgstr "GC 访问时间支持检查"
#: proxmox-backup/www/datastore/OptionView.js:305
msgid "GC Cache Capacity (# chunks)"
-msgstr "GC缓存容量(块数)"
+msgstr "GC 缓存容量(块数)"
#: proxmox-backup/www/window/DataStoreEdit.js:148
#: proxmox-backup/www/window/GCJobEdit.js:25
@@ -6312,7 +6172,7 @@ msgstr "GC 时间表"
#: proxmox-backup/www/Utils.js:915
msgid "GC cache capacity"
-msgstr "GC缓存容量"
+msgstr "GC 缓存容量"
#: proxmox-backup/www/Utils.js:438
msgid "Garbage Collect"
@@ -6416,14 +6276,14 @@ msgstr "限制Ceph自我修复的全局标志已启用。"
#: proxmox-yew-widget-toolkit/src/widget/form/tristate_boolean.rs:117
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:444
msgid "Got wrong data type!"
-msgstr ""
+msgstr "获得了错误的数据类型!"
#: proxmox-widget-toolkit/src/panel/PermissionView.js:152
#: pve-manager/www/manager6/dc/PermissionView.js:148
#: proxmox-yew-comp/src/user_panel.rs:318
#: proxmox-yew-comp/src/token_panel.rs:317
msgid "Granted Permissions"
-msgstr "授予的权限"
+msgstr "已授予权限"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:50
#: pve-manager/www/manager6/qemu/SystemEdit.js:81
@@ -6454,7 +6314,7 @@ msgstr "群组"
#: proxmox-backup/www/tape/window/TapeBackupJob.js:213
#: proxmox-backup/www/window/SyncJobEdit.js:555
msgid "Group Filter"
-msgstr "群组筛选器"
+msgstr "组筛选条件"
#: pve-manager/www/manager6/window/TreeSettingsEdit.js:48
msgid "Group Guest Types"
@@ -6502,7 +6362,7 @@ msgstr "群组声明"
#: pmg-gui/js/LDAPConfig.js:449
msgid "Groups of '{0}'"
-msgstr "'{0}' 的组"
+msgstr "'{0}'的组"
#: pve-manager/www/manager6/form/IPRefSelector.js:72
#: pve-manager/www/manager6/grid/Replication.js:298
@@ -6516,21 +6376,19 @@ msgstr "Guest Agent 未运行"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/ui_helpers.rs:102
msgid "Guest Firewall - {0}/{1}/{2} {3}"
-msgstr ""
+msgstr "虚拟机防火墙 - {0}/{1}/{2} {3}"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:29
msgid "Guest Image"
msgstr "客户机镜像"
#: proxmox-datacenter-manager/ui/src/tasks.rs:168
-#, fuzzy
msgid "Guest Migrations"
-msgstr "迁移"
+msgstr "客户机迁移"
#: pve-manager/www/manager6/sdn/ZoneBridgesPanel.js:79
-#, fuzzy
msgid "Guest Network Device"
-msgstr "网络设备"
+msgstr "客户机网络设备"
#: pve-manager/www/manager6/window/Settings.js:283
msgid "Guest Notes"
@@ -6541,13 +6399,12 @@ msgid "Guest OS"
msgstr "客户机操作系统"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:567
-#, fuzzy
msgid "Guest Panels"
-msgstr "客户机镜像"
+msgstr "客户机面板"
#: pve-manager/www/manager6/storage/CIFSEdit.js:163
msgid "Guest user"
-msgstr "访客用户"
+msgstr "客户机用户"
#: pve-manager/www/manager6/dc/Guests.js:5
#: proxmox-datacenter-manager/ui/src/dashboard/guest_panel.rs:226
@@ -6557,7 +6414,7 @@ msgstr "客户"
#: proxmox-datacenter-manager/ui/src/dashboard/top_entities.rs:343
msgid "Guests With the Highest CPU Usage"
-msgstr ""
+msgstr "CPU 使用率最高的虚拟机"
#: pve-manager/www/manager6/dc/Backup.js:665
#: pve-manager/www/manager6/dc/Backup.js:677
@@ -6566,39 +6423,37 @@ msgstr "没有备份工作的客户机"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:601
msgid "Guests with Highest CPU Usage"
-msgstr ""
+msgstr "CPU 使用率最高的虚拟机"
#: pve-manager/www/manager6/ha/rules/NodeAffinityRules.js:6
-#, fuzzy
msgid "HA Node Affinity"
-msgstr "CPU 绑定"
+msgstr "高可用节点亲和性"
#: pve-manager/www/manager6/ha/Rules.js:208
msgid "HA Node Affinity Rules"
-msgstr ""
+msgstr "HA 节点亲和性规则"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRules.js:6
msgid "HA Resource Affinity"
-msgstr ""
+msgstr "HA 资源亲和性"
#: pve-manager/www/manager6/ha/Rules.js:219
msgid "HA Resource Affinity Rules"
-msgstr ""
+msgstr "HA 资源亲和性规则"
#: pve-manager/www/manager6/ha/RuleEdit.js:81
#: pve-manager/www/manager6/ha/rules/NodeAffinityRules.js:20
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRules.js:20
-#, fuzzy
msgid "HA Resources"
-msgstr "资源"
+msgstr "高可用资源"
#: pve-manager/www/manager6/ha/Rules.js:146
msgid "HA Rule has conflicts and/or errors."
-msgstr ""
+msgstr "HA 规则存在冲突或错误。"
#: pve-manager/www/manager6/ha/Rules.js:147
msgid "HA Rule is OK."
-msgstr ""
+msgstr "HA 规则正常。"
#: pve-manager/www/manager6/dc/OptionView.js:193
msgid "HA Scheduling"
@@ -6619,41 +6474,36 @@ msgid "HA State: {0}"
msgstr "高可用状态: {0}"
#: proxmox-datacenter-manager/ui/src/tasks.rs:172
-#, fuzzy
msgid "HA related Tasks"
-msgstr "相对路径"
+msgstr "高可用相关任务"
#: pve-manager/www/manager6/window/Migrate.js:431
-#, fuzzy
msgid "HA resource {0} with negative affinity to VM on selected target node"
-msgstr "所选目标上的映射资源 ({0}) 不可用。"
+msgstr "高可用资源 {0} 对选定目标节点上的虚拟机具有负亲和性"
#: pve-manager/www/manager6/window/Migrate.js:521
-#, fuzzy
msgid ""
"HA resource {0} with negative affinity to container on selected target node"
-msgstr "所选目标上的映射资源 ({0}) 不可用。"
+msgstr "HA 资源 {0} 与所选目标节点上的容器具有负亲和性"
#: pve-manager/www/manager6/window/Migrate.js:457
msgid ""
"HA resource {0} with positive affinity to VM is also migrated to selected "
"target node."
-msgstr ""
+msgstr "与虚拟机具有正亲和性的 HA 资源 {0} 也将迁移到所选目标节点。"
#: pve-manager/www/manager6/window/Migrate.js:547
msgid ""
"HA resource {0} with positive affinity to container is also migrated to "
"selected target node."
-msgstr ""
+msgstr "与容器具有正亲和性的 HA 资源 {0} 也将迁移到所选目标节点。"
#: pve-manager/www/manager6/ha/RuleErrorsModal.js:10
-#, fuzzy
msgid "HA rule errors"
-msgstr "任意规则匹配"
+msgstr "高可用规则错误"
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:286
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:295
-#, fuzzy
msgid "HA state"
msgstr "高可用状态"
@@ -6668,13 +6518,12 @@ msgid "HD space"
msgstr "硬盘空间"
#: proxmox-yew-comp/src/node_info.rs:200
-#, fuzzy
msgid "HD space (root)"
-msgstr "硬盘空间"
+msgstr "硬盘空间(根目录)"
#: pve-manager/www/manager6/dc/MetricServerView.js:682
msgid "HTTP Headers (JSON)"
-msgstr ""
+msgstr "HTTP 头部 (JSON)"
#: pmg-gui/js/SystemOptions.js:94 pve-manager/www/manager6/dc/OptionView.js:82
#: proxmox-backup/www/config/NodeOptionView.js:42
@@ -6693,7 +6542,7 @@ msgstr "硬盘"
#: proxmox-widget-toolkit/src/Schema.js:94
msgid "Hardlink"
-msgstr "硬连接"
+msgstr "硬链接"
#: pve-manager/www/manager6/qemu/Config.js:319
#: proxmox-datacenter-manager/ui/src/pve/qemu/mod.rs:125
@@ -6703,7 +6552,7 @@ msgstr "硬件"
#: proxmox-widget-toolkit/src/node/NetworkView.js:360
msgid "Hash Policy"
-msgstr "Hash 策略"
+msgstr "哈希策略"
#: pve-manager/www/manager6/window/DownloadUrlToStorage.js:194
#: pve-manager/www/manager6/window/UploadToStorage.js:242
@@ -6714,7 +6563,7 @@ msgstr "哈希算法"
#: proxmox-yew-comp/src/configuration/network_view.rs:485
#: proxmox-yew-comp/src/configuration/network_edit.rs:244
msgid "Hash policy"
-msgstr "Hash 策略"
+msgstr "哈希策略"
#: pmg-gui/js/DKIMSettings.js:125 pmg-gui/js/ViewMailHeaders.js:100
#: pve-manager/www/manager6/Workspace.js:333
@@ -6728,7 +6577,7 @@ msgstr "标题属性"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:70
#: pmg-gui/js/PostfixMailQueue.js:140
msgid "Headers"
-msgstr "标题"
+msgstr "头部信息"
#: proxmox-widget-toolkit/src/window/ZFSDetail.js:82
#: proxmox-widget-toolkit/src/window/ZFSDetail.js:136
@@ -6736,7 +6585,7 @@ msgstr "标题"
#: pve-manager/www/manager6/dc/Health.js:5
#: pve-manager/www/manager6/node/ZFS.js:257 proxmox-backup/www/ZFSList.js:93
msgid "Health"
-msgstr "健康"
+msgstr "健康状态"
#: pve-manager/www/manager6/ceph/OSDDetails.js:204
msgid "Heartbeat Back Address"
@@ -6753,11 +6602,11 @@ msgstr "希伯来语"
#. TRANSLATORS: See https://en.wikipedia.org/wiki/IS-IS#Packet_types
#: pve-manager/www/manager6/sdn/fabrics/openfabric/FabricEdit.js:47
msgid "Hello Interval"
-msgstr ""
+msgstr "Hello 间隔"
#: pve-manager/www/manager6/sdn/fabrics/openfabric/InterfacePanel.js:19
msgid "Hello Multiplier"
-msgstr ""
+msgstr "Hello 乘数"
#: proxmox-widget-toolkit/src/button/HelpButton.js:8
#: proxmox-widget-toolkit/src/button/HelpButton.js:73
@@ -6792,18 +6641,16 @@ msgid "Hide Internal Hosts"
msgstr "隐藏内部主机"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:488
-#, fuzzy
msgid "Hide Password"
-msgstr "绑定密码"
+msgstr "隐藏密码"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/tree.rs:301
msgid "Hide tree panel"
-msgstr ""
+msgstr "隐藏树面板"
#: proxmox-datacenter-manager/ui/src/dashboard/pbs_datastores_panel.rs:113
-#, fuzzy
msgid "High usage"
-msgstr "磁盘使用率"
+msgstr "高使用率"
#: proxmox-widget-toolkit/src/window/ACMEPluginEdit.js:218
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:255
@@ -6842,12 +6689,10 @@ msgid "Host CPU usage"
msgstr "主机 CPU 利用率"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:209
-#, fuzzy
msgid "Host CPU usage (avg.)"
-msgstr "主机 CPU 利用率"
+msgstr "主机 CPU 使用率(平均)"
#: pve-manager/www/manager6/panel/GuestSummary.js:45
-#, fuzzy
msgid "Host Memory Usage"
msgstr "主机内存使用率"
@@ -6857,33 +6702,29 @@ msgid "Host Memory usage"
msgstr "主机内存使用率"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:217
-#, fuzzy
msgid "Host Memory used"
-msgstr "主机内存使用率"
+msgstr "主机内存已用"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:233
-#, fuzzy
msgid "Host Storage used"
-msgstr "存储使用"
+msgstr "主机存储已用"
#: pve-manager/www/manager6/storage/ZFSEdit.js:118
msgid "Host group"
msgstr "主机组"
#: pve-manager/www/manager6/panel/GuestStatusView.js:122
-#, fuzzy
msgid "Host memory usage"
msgstr "主机内存使用率"
#: pve-manager/www/manager6/lxc/Network.js:306
#: proxmox-yew-comp/src/form/pve/lxc_property/lxc_network_property.rs:105
-#, fuzzy
msgid "Host-Managed"
-msgstr "主机名"
+msgstr "主机管理"
#: proxmox-widget-toolkit/src/Toolkit.js:179
msgid "Host/IP address or optional port is invalid"
-msgstr "主机/IP地址或可选端口无效"
+msgstr "主机/IP 地址或可选端口无效"
#: proxmox-widget-toolkit/src/Utils.js:719
#: pve-manager/www/manager6/ceph/OSDDetails.js:148
@@ -6899,9 +6740,8 @@ msgid "Hostname"
msgstr "主机名"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_summary.rs:156
-#, fuzzy
msgid "Hostname/Address"
-msgstr "主机名/IP"
+msgstr "主机名/地址"
#: proxmox-backup/www/window/DatastoreRepoInfo.js:49
#: proxmox-datacenter-manager/ui/src/remotes/node_url_list.rs:248
@@ -6938,12 +6778,12 @@ msgstr "要显示的时间"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:201
msgid "I/O workers in the QEMU process (VMs only)."
-msgstr "QEMU 进程中的 I/O 工作程序(仅限虚拟机)。"
+msgstr "QEMU 进程中的 I/O 工作线程(仅限虚拟机)。"
#: pve-manager/www/manager6/grid/FirewallRules.js:415
#: pve-manager/www/manager6/grid/FirewallRules.js:427
msgid "ICMP type"
-msgstr "ICMP类型"
+msgstr "ICMP 类型"
#: pmg-gui/js/ClusterAdministration.js:250 pmg-gui/js/PBSRemoteEdit.js:31
#: pve-manager/www/manager6/dc/Backup.js:762
@@ -6996,7 +6836,7 @@ msgstr "IO 延迟(毫秒)"
#: pve-manager/www/manager6/node/Summary.js:278
#: pve-manager/www/manager6/panel/GuestSummary.js:147
msgid "IO Pressure Stall"
-msgstr ""
+msgstr "IO 压力停滞"
#: pmg-gui/js/ServerStatus.js:124 pmg-gui/js/dashboard/NodeInfo.js:32
#: pve-manager/www/manager6/node/StatusView.js:35
@@ -7008,7 +6848,7 @@ msgstr "IO 延迟"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_disk_property.rs:255
msgid "IO thread"
-msgstr ""
+msgstr "IO 线程"
#: proxmox-backup/www/ServerStatus.js:217
msgid "IO wait"
@@ -7068,7 +6908,7 @@ msgstr "IP 筛选"
#: proxmox-backup/www/window/S3ClientEdit.js:52
msgid "IP or FQDN S3 endpoint (allows {{bucket}} or {{region}} templating)"
-msgstr ""
+msgstr "IP 或 FQDN S3 端点(允许 {{bucket}} 或 {{region}} 模板)"
#: pve-manager/www/manager6/dc/ClusterEdit.js:261
msgid "IP resolved by node's hostname"
@@ -7079,11 +6919,11 @@ msgstr "IP 由节点的主机名解析"
#: pve-manager/www/manager6/sdn/NetworkBrowser.js:130
#: pve-manager/www/manager6/sdn/ZoneBridgesPanel.js:59
msgid "IP-VRF"
-msgstr ""
+msgstr "IP-VRF"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/evpn_panel.rs:251
msgid "IP-VRFs"
-msgstr ""
+msgstr "IP-VRF"
#: pve-manager/www/manager6/grid/FirewallAliases.js:35
#: pve-manager/www/manager6/grid/FirewallAliases.js:183
@@ -7113,7 +6953,7 @@ msgstr "IPv4"
#: pve-manager/www/manager6/sdn/fabrics/FabricEdit.js:29
msgid "IPv4 Prefix"
-msgstr "IPv4前缀"
+msgstr "IPv4 前缀"
#: pve-manager/www/manager6/qemu/IPConfigEdit.js:111
#: proxmox-yew-comp/src/configuration/network_edit.rs:145
@@ -7158,9 +6998,8 @@ msgstr "ISO 镜像"
#: proxmox-yew-comp/src/form/pve/pve_guest_selector.rs:214
#: proxmox-yew-comp/src/form/pve/pve_guest_selector.rs:244
-#, fuzzy
msgid "Id"
-msgstr "空闲"
+msgstr "ID"
#: proxmox-backup/www/Utils.js:770
msgid "Idle"
@@ -7170,7 +7009,7 @@ msgstr "空闲"
msgid ""
"If a response from a remote is older than 'Max Age', it will be updated on "
"the next refresh."
-msgstr ""
+msgstr "如果来自远程的响应早于\"最大期限\",则将在下次刷新时更新。"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:127
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_display_property.rs:131
@@ -7200,11 +7039,11 @@ msgstr "导入"
#: pve-manager/www/manager6/window/GuestImport.js:5
msgid "Import Guest"
-msgstr "导入访客"
+msgstr "导入客户机"
#: pve-manager/www/manager6/window/GuestImport.js:996
msgid "Import Guest - {0}"
-msgstr "导入访客 - {0}"
+msgstr "导入客户机 - {0}"
#: pve-manager/www/manager6/qemu/HDEdit.js:587
#: pve-manager/www/manager6/qemu/HardwareView.js:740
@@ -7233,37 +7072,37 @@ msgid "Important: Save your Encryption Key"
msgstr "重要提示:保存加密密钥"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:403
-#, fuzzy
msgid "Imported"
-msgstr "导入"
+msgstr "已导入"
#: pve-manager/www/manager6/window/GuestImport.js:1027
msgid ""
"Importing an OVA temporarily requires extra space on the working storage "
"while extracting the contained disks for further processing."
msgstr ""
-"导入 OVA 临时需要工作存储上的额外空间,同时提取包含的磁盘以进行进一步处理。"
+"导入 OVA 文件时,需在工作存储上准备额外空间,用于临时解压内含的虚拟磁盘以供后"
+"续处理。"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:104
msgid ""
"Improve performance for nested virtualization. Only supported on Intel CPUs."
-msgstr ""
+msgstr "提高嵌套虚拟化的性能。仅在 Intel CPU 上支持。"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:103
msgid ""
"Improve performance in overcommitted Windows guests. May lead to guest "
"bluescreens on old CPUs."
-msgstr ""
+msgstr "提高过度分配的 Windows 客户机的性能。可能导致旧 CPU 上的客户机蓝屏。"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:100
msgid ""
"Improves Spectre mitigation performance with AMD CPUs, best used with \"virt-"
"ssbd\""
-msgstr ""
+msgstr "改进 AMD CPU 的 Spectre 缓解性能,最好与\"virt-ssbd\"一起使用"
#: pmg-gui/js/Utils.js:113 pve-manager/www/manager6/ceph/StatusDetail.js:39
msgid "In"
-msgstr "进入"
+msgstr "已加入"
#: pmg-gui/js/Utils.js:115
msgid "In & Out"
@@ -7275,9 +7114,8 @@ msgid "Include"
msgstr "包括"
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:360
-#, fuzzy
msgid "Include All"
-msgstr "包括内存"
+msgstr "包含全部"
#: pmg-gui/js/MailTracker.js:145
msgid "Include Empty Senders"
@@ -7305,7 +7143,7 @@ msgstr "包括所有组"
#: proxmox-datacenter-manager/ui/src/configuration/views.rs:363
msgid "Include all remotes and their resources."
-msgstr ""
+msgstr "包括所有远程及其资源。"
#: pmg-gui/js/PBSRemoteEdit.js:109
msgid "Include in Backup"
@@ -7363,9 +7201,8 @@ msgstr "信息"
#: proxmox-datacenter-manager/ui/src/configuration/subscription_panel.rs:194
#: proxmox-yew-comp/src/subscription_panel.rs:221
-#, fuzzy
msgid "Info URL"
-msgstr "信息"
+msgstr "信息 URL"
#: pmg-gui/js/ClusterAdministration.js:84
#: pve-manager/www/manager6/dc/ClusterEdit.js:328
@@ -7398,16 +7235,15 @@ msgstr "输入策略"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:457
msgid "Input invalid: {}"
-msgstr ""
+msgstr "输入无效: {}"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:122
-#, fuzzy
msgid "Input log level"
-msgstr "日志级别"
+msgstr "输入日志级别"
#: proxmox-backup/www/datastore/Summary.js:351
msgid "Input/Output Operations per Second (IOPS)"
-msgstr "每秒输入/输出操作数(IOPS)"
+msgstr "每秒 I/O 操作数(IOPS)"
#: pve-manager/www/manager6/grid/FirewallRules.js:828
msgid "Insert"
@@ -7429,32 +7265,31 @@ msgstr "Intel(AMD兼容)"
#: pve-manager/www/manager6/qemu/Options.js:390
msgid "Intel TDX"
-msgstr ""
+msgstr "Intel TDX"
#: pve-manager/www/manager6/qemu/TdxEdit.js:35
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_intel_tdx_property.rs:31
-#, fuzzy
msgid "Intel TDX Type"
-msgstr "内容类型"
+msgstr "Intel TDX 类型"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_intel_tdx_property.rs:102
msgid "Intel Trust Domain Extension (TDX)"
-msgstr ""
+msgstr "Intel 信任域扩展 (TDX)"
#: proxmox-widget-toolkit/src/form/NetworkSelector.js:109
#: pve-manager/www/manager6/grid/FirewallRules.js:284
#: pve-manager/www/manager6/grid/FirewallRules.js:571
#: pve-manager/www/manager6/grid/FirewallRules.js:947
msgid "Interface"
-msgstr "接口"
+msgstr "网络接口"
#: pve-manager/www/manager6/sdn/fabrics/InterfacePanel.js:32
msgid "Interface already has an address configured in /etc/network/interfaces"
-msgstr "接口已在/etc/network/Interface中配置了地址"
+msgstr "接口已在 /etc/network/Interface 中配置了地址"
#: pve-manager/www/manager6/sdn/fabrics/InterfacePanel.js:26
msgid "Interface does not exist on node"
-msgstr "节点上不存在接口"
+msgstr "节点上不存在该接口"
#: pmg-gui/js/SystemConfiguration.js:40
#: pve-manager/www/manager6/sdn/FabricsView.js:80
@@ -7474,11 +7309,11 @@ msgstr "间隔"
#: pve-manager/www/manager6/dc/MetricServerView.js:697
#: pve-manager/www/manager6/dc/MetricServerView.js:719
msgid "Invalid JSON format"
-msgstr ""
+msgstr "无效的 JSON 格式"
#: pve-manager/www/manager6/storage/TemplateView.js:290
msgid "Invalid OCI Registry Reference"
-msgstr ""
+msgstr "无效的 OCI 注册表引用"
#: proxmox-widget-toolkit/src/form/ComboGrid.js:397
#: proxmox-widget-toolkit/src/form/ComboGrid.js:476
@@ -7488,7 +7323,7 @@ msgstr "无效值"
#: pve-manager/www/manager6/node/ZFS.js:56
msgid "Invalid characters in pool name"
-msgstr "池名称中的字符无效"
+msgstr "存储池名称包含无效字符"
#: pve-manager/www/manager6/Utils.js:1613
msgid "Invalid file size"
@@ -7497,7 +7332,7 @@ msgstr "无效的文件大小"
#: proxmox-widget-toolkit/src/Utils.js:1176
#: pve-manager/www/manager6/Utils.js:1625
msgid "Invalid file size: "
-msgstr "无效的文件大小: "
+msgstr "无效的文件大小:"
#: proxmox-backup/www/form/PermissionPathSelector.js:136
msgid "Invalid permission path."
@@ -7522,7 +7357,7 @@ msgstr "Ipam"
#: proxmox-widget-toolkit/src/window/AddWebauthn.js:104
msgid "Is this token already registered?"
-msgstr "这个令牌已经注册了吗?"
+msgstr "此令牌是否已注册?"
#: pve-manager/www/manager6/sdn/VnetEdit.js:81
msgid "Isolate Ports"
@@ -7537,31 +7372,31 @@ msgstr "隔离端口"
#: proxmox-yew-comp/src/acme/certificate_list.rs:354
#: proxmox-yew-comp/src/acme/certificate_list.rs:384
msgid "Issuer"
-msgstr "发行者"
+msgstr "签发者"
#: proxmox-widget-toolkit/src/window/AddTotp.js:222
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:106
msgid "Issuer Name"
-msgstr "发行者名称"
+msgstr "签发者名称"
#: proxmox-widget-toolkit/src/window/AuthEditOpenId.js:24
#: pmg-gui/js/AuthEditOIDC.js:72
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:23
#: proxmox-yew-comp/src/auth_edit_openid.rs:98
msgid "Issuer URL"
-msgstr "发行人URL"
+msgstr "签发者 URL"
#: proxmox-yew-comp/src/acme/acme_domains.rs:338
msgid "It is not possible to configure more that 5 ACME domain."
-msgstr ""
+msgstr "无法配置超过 5 个 ACME 域。"
#: pve-manager/www/manager6/window/Snapshot.js:103
msgid ""
"It is recommended to either include the RAM or use the QEMU Guest Agent when "
"taking a snapshot of a running VM to avoid inconsistencies."
msgstr ""
-"建议在为运行中的虚拟机拍摄快照时包括 RAM 或使用 QEMU Guest Agent,以避免不一"
-"致。"
+"为避免数据不一致,建议对运行中的虚拟机创建快照时,选择包含内存状态或使用 "
+"QEMU Guest Agent。"
#: pve-manager/www/manager6/panel/BackupJobPrune.js:108
msgid ""
@@ -7639,7 +7474,7 @@ msgstr "加入任务已完成"
#: pve-manager/www/manager6/dc/ClusterEdit.js:165
msgid "Join {0}"
-msgstr "加入{0}"
+msgstr "加入 {0}"
#: pmg-gui/js/GeneralMailStatistics.js:30
#: pmg-gui/js/GeneralMailStatistics.js:181
@@ -7675,7 +7510,7 @@ msgstr "保留全部"
#: pve-manager/www/manager6/window/Backup.js:93
#: proxmox-backup/www/panel/PrunePanel.js:49
msgid "Keep Daily"
-msgstr "保留每天"
+msgstr "保留每日"
#: proxmox-widget-toolkit/src/panel/PruneKeepPanel.js:47
#: pmg-gui/js/PBSRemoteEdit.js:158
@@ -7691,7 +7526,7 @@ msgstr "保留每小时"
#: pve-manager/www/manager6/window/Backup.js:91
#: proxmox-backup/www/panel/PrunePanel.js:41
msgid "Keep Last"
-msgstr "保留上次"
+msgstr "保留最近"
#: proxmox-widget-toolkit/src/panel/PruneKeepPanel.js:38
#: pmg-gui/js/PBSRemoteEdit.js:150
@@ -7702,19 +7537,16 @@ msgid "Keep Monthly"
msgstr "保留每月"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRuleEdit.js:17
-#, fuzzy
msgid "Keep Separate"
-msgstr "保留每年"
+msgstr "保持分离"
#: pve-manager/www/manager6/storage/Base.js:99
-#, fuzzy
msgid "Keep Snapshots as Volume-Chain enabled if qcow2 images exist!"
-msgstr "存储管理快照是一种技术预览。"
+msgstr "如果存在 qcow2 镜像,请保持 Snapshots as Volume-Chain 启用!"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRuleEdit.js:16
-#, fuzzy
msgid "Keep Together"
-msgstr "保留每月"
+msgstr "保持在一起"
#: proxmox-widget-toolkit/src/panel/PruneKeepPanel.js:56
#: pmg-gui/js/PBSRemoteEdit.js:164
@@ -7761,9 +7593,8 @@ msgid "Kernel Version"
msgstr "内核版本"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:314
-#, fuzzy
msgid "Kernel scheduler settings"
-msgstr "内核版本"
+msgstr "内核调度器设置"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:364
#: pve-manager/www/manager6/storage/PBSEdit.js:33
@@ -7773,7 +7604,7 @@ msgstr "内核版本"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/desktop.rs:797
#: proxmox-yew-comp/src/property_view/property_grid.rs:245
msgid "Key"
-msgstr "公钥"
+msgstr "密钥"
#: pmg-gui/js/UserEdit.js:187 pve-manager/www/manager6/dc/UserEdit.js:133
msgid "Key IDs"
@@ -7799,15 +7630,15 @@ msgstr "韩语"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:390
msgid "L2VNI"
-msgstr ""
+msgstr "L2VNI"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:385
msgid "L3VNI"
-msgstr ""
+msgstr "L3VNI"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:139
msgid "LDAP DN syntax can be used as well, e.g. cn=user,dc=company,dc=net"
-msgstr "也可以使用 LDAP DN 语法,例如 cn=user,dc=company,dc=net"
+msgstr "也可以使用 LDAP DN 语法,例如:cn=user,dc=company,dc=net"
#: pmg-gui/js/Utils.js:192
msgid "LDAP Group"
@@ -7918,7 +7749,7 @@ msgstr "姓氏"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:342
#: proxmox-yew-comp/src/auth_edit_ldap.rs:218
msgid "Last Name attribute"
-msgstr "名称属性"
+msgstr "姓氏属性"
#: proxmox-backup/www/config/PruneView.js:257
msgid "Last Prune"
@@ -7950,21 +7781,20 @@ msgstr "上次校验"
#: proxmox-yew-comp/src/user_panel.rs:539
#: proxmox-yew-comp/src/user_panel.rs:564
-#, fuzzy
msgid "Last name"
-msgstr "姓氏"
+msgstr "姓"
#: proxmox-datacenter-manager/ui/src/dashboard/status_row.rs:175
msgid "Last refresh: {0}"
-msgstr ""
+msgstr "上次刷新:{0}"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:451
msgid "Last verify task over 30 days ago: {0}"
-msgstr ""
+msgstr "上次验证任务超过 30 天前:{0}"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:456
msgid "Last verify task started on {0}"
-msgstr ""
+msgstr "上次验证任务开始于 {0}"
#: pve-manager/www/manager6/qemu/MachineEdit.js:117
#: pve-manager/www/manager6/qemu/MachineEdit.js:136
@@ -7986,18 +7816,17 @@ msgid "Layout"
msgstr "布局"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:598
-#, fuzzy
msgid "Leaderboards"
-msgstr "标题"
+msgstr "排行榜"
#: proxmox-yew-comp/src/node_info.rs:256
msgid "Legacy BIOS"
-msgstr ""
+msgstr "传统 BIOS"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:434
msgid ""
"Less than {0} recovery keys available. Please generate a new set after login!"
-msgstr "少于 {0} 个可用的还原密钥。 登录后请生成一个新的集合!"
+msgstr "可用恢复密钥少于 {0} 个。请在登录后生成新的一组!"
#: pmg-gui/js/Settings.js:258 pve-manager/www/manager6/window/Settings.js:354
#: proxmox-backup/www/window/Settings.js:258
@@ -8028,6 +7857,8 @@ msgid ""
"it'll only apply if the users request comes from one of the specified "
"networks."
msgstr ""
+"该限制仅对通过身份验证的用户请求生效。若同时匹配IP规则,本规则将优先于纯IP限"
+"制。若本规则还指定了网络范围,则仅当用户请求来自指定网络之一时方可生效。"
#: pmg-gui/js/Settings.js:266 pve-manager/www/manager6/window/Settings.js:362
#: proxmox-backup/www/window/Settings.js:266
@@ -8052,41 +7883,38 @@ msgstr "链接克隆"
#: proxmox-yew-comp/src/configuration/network_view.rs:212
#: proxmox-yew-comp/src/configuration/mod.rs:32
msgid "Linux Bond"
-msgstr ""
+msgstr "Linux 绑定"
#: proxmox-yew-comp/src/configuration/network_view.rs:206
#: proxmox-yew-comp/src/configuration/mod.rs:31
-#, fuzzy
msgid "Linux Bridge"
-msgstr "桥接"
+msgstr "Linux 网桥"
#: proxmox-datacenter-manager/ui/src/dashboard/guest_panel.rs:225
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:581
-#, fuzzy
msgid "Linux Container"
-msgstr "LXC 容器"
+msgstr "Linux 容器"
#: proxmox-yew-comp/src/configuration/mod.rs:33
-#, fuzzy
msgid "Linux VLAN"
-msgstr "无 VLAN"
+msgstr "Linux VLAN"
#: proxmox-yew-widget-toolkit/src/widget/form/selector.rs:410
msgid "List does not contain any items."
-msgstr ""
+msgstr "列表不包含任何项。"
#: pve-yew-mobile-gui/src/widgets/tasks_panel.rs:146
#: pve-yew-mobile-gui/src/widgets/storage_content_panel.rs:283
#: pve-yew-mobile-gui/src/pages/page_node_status/updates_panel.rs:122
msgid "List is empty."
-msgstr ""
+msgstr "列表为空。"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:76
msgid ""
"List of VLAN IDs and ranges, useful for NICs with restricted VLAN offloading "
"support. For example: '2 4 100-200'"
msgstr ""
-"VLAN ID 和范围列表,适用于具有受限VLAN卸载支持的 NIC。例如:“2 4 100-200”"
+"VLAN ID 和范围列表,适用于支持有限 VLAN 卸载功能的网卡。例如:'2 4 100-200'"
#: pve-manager/www/manager6/window/GuestImport.js:616
msgid "Live Import"
@@ -8108,16 +7936,15 @@ msgstr "实时还原"
#: pve-manager/www/manager6/window/Migrate.js:356
msgid "Live-migrating running VM with mapped resources (Experimental): {0}"
-msgstr "使用映射资源实时迁移正在运行的虚拟机(实验): {0}"
+msgstr "正在实时迁移带有映射资源的虚拟机(实验性功能):{0}"
#: proxmox-backup/www/tape/ChangerStatus.js:779
msgid "Load"
msgstr "加载"
#: proxmox-yew-comp/src/node_info.rs:193
-#, fuzzy
msgid "Load Average"
-msgstr "平均负荷"
+msgstr "平均负载"
#: proxmox-backup/www/Utils.js:443
msgid "Load Media"
@@ -8130,7 +7957,7 @@ msgstr "将媒体加载到驱动器"
#: pve-manager/www/manager6/lxc/CreateWizard.js:174
#: pve-manager/www/manager6/qemu/SSHKey.js:33
msgid "Load SSH Key File"
-msgstr "加载SSH密钥文件"
+msgstr "加载 SSH 密钥文件"
#: pmg-gui/js/ClusterAdministration.js:295 pmg-gui/js/ServerStatus.js:131
#: pmg-gui/js/dashboard/NodeInfo.js:51
@@ -8143,25 +7970,22 @@ msgstr "平均负荷"
#: proxmox-datacenter-manager/ui/src/pve/mod.rs:186
#: proxmox-yew-comp/src/loadable_component.rs:483
-#, fuzzy
msgid "Load failed"
-msgstr "登录失败:"
+msgstr "加载失败"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:79
#: pve-manager/www/manager6/node/ACME.js:143 proxmox-backup/www/Utils.js:742
#: proxmox-yew-comp/src/acme/acme_register_account.rs:158
msgid "Loading"
-msgstr "载入中"
+msgstr "正在加载"
#: proxmox-yew-comp/src/acme/acme_register_account.rs:145
-#, fuzzy
msgid "Loading TOS failed: {0}"
-msgstr "登录失败:"
+msgstr "加载服务条款失败:{0}"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/columns.rs:40
-#, fuzzy
msgid "Loading {}..."
-msgstr "载入中..."
+msgstr "正在加载 {}..."
#: proxmox-widget-toolkit/src/Utils.js:403
#: pve-manager/www/manager6/ceph/OSD.js:502
@@ -8170,7 +7994,7 @@ msgstr "载入中..."
#: proxmox-yew-comp/src/syslog.rs:93
#: proxmox-yew-widget-toolkit/src/state/loader.rs:154
msgid "Loading..."
-msgstr "载入中..."
+msgstr "正在加载..."
#: pmg-gui/js/UserManagement.js:13 proxmox-backup/www/Utils.js:868
#: proxmox-backup/www/window/DataStoreEdit.js:62
@@ -8182,9 +8006,8 @@ msgid "Local Backup/Restore"
msgstr "本地备份/还原"
#: proxmox-backup/www/window/DataStoreEdit.js:107
-#, fuzzy
msgid "Local Cache"
-msgstr "本地命名空间"
+msgstr "本地缓存"
#: proxmox-backup/www/tape/window/TapeBackupJob.js:87
#: proxmox-backup/www/window/SyncJobEdit.js:141
@@ -8231,7 +8054,7 @@ msgstr "锁定"
#: proxmox-backup/www/config/UserView.js:260
#: proxmox-yew-comp/src/tfa/tfa_view.rs:379
msgid "Locked"
-msgstr "锁定"
+msgstr "已锁定"
#: pmg-gui/js/UserView.js:106 pve-manager/www/manager6/dc/UserView.js:122
#: proxmox-backup/www/config/UserView.js:125
@@ -8249,24 +8072,20 @@ msgid "Log"
msgstr "日志"
#: proxmox-yew-comp/src/firewall/options_edit.rs:461
-#, fuzzy
msgid "Log Level Forward"
-msgstr "日志级别"
+msgstr "日志级别转发"
#: proxmox-yew-comp/src/firewall/options_edit.rs:362
#: proxmox-yew-comp/src/firewall/options_edit.rs:441
-#, fuzzy
msgid "Log Level In"
-msgstr "日志级别"
+msgstr "日志级别入站"
#: proxmox-yew-comp/src/firewall/options_edit.rs:372
#: proxmox-yew-comp/src/firewall/options_edit.rs:451
-#, fuzzy
msgid "Log Level Out"
-msgstr "日志级别"
+msgstr "日志级别出站"
#: proxmox-yew-comp/src/firewall/options_edit.rs:316
-#, fuzzy
msgid "Log Rate Limiting"
msgstr "日志速率限制"
@@ -8295,7 +8114,6 @@ msgid "Log rate limit"
msgstr "日志速率限制"
#: proxmox-yew-comp/src/form/pve/firewall_property/log_ratelimit_property.rs:56
-#, fuzzy
msgid "Log rate limiting"
msgstr "日志速率限制"
@@ -8317,7 +8135,7 @@ msgstr "登录(OpenID 重定向)"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_info.rs:309
msgid "Login and create Token"
-msgstr ""
+msgstr "登录并创建令牌"
#: pmg-gui/js/LoginView.js:137
#: pve-manager/www/manager6/window/LoginWindow.js:159
@@ -8327,13 +8145,12 @@ msgstr "登录失败,请重试"
#: proxmox-yew-comp/src/login_panel.rs:359
#: proxmox-yew-comp/src/login_panel.rs:488
-#, fuzzy
msgid "Login failed. Please try again ({0})"
-msgstr "登录失败,请重试"
+msgstr "登录失败。请重试({0})"
#: pve-manager/www/manager6/window/LoginWindow.js:163
msgid "Login failed:"
-msgstr "登录失败:"
+msgstr "登录失败:"
#: pmg-gui/js/MainView.js:237 pmg-gui/js/QuarantineView.js:317
#: pve-manager/www/manager6/Workspace.js:449 proxmox-backup/www/MainView.js:291
@@ -8353,9 +8170,8 @@ msgid "Longest Tasks"
msgstr "最长的任务"
#: proxmox-yew-comp/src/configuration/mod.rs:29
-#, fuzzy
msgid "Loopback"
-msgstr "回滚"
+msgstr "回环"
#: pve-manager/www/manager6/sdn/controllers/BgpEdit.js:59
#: pve-manager/www/manager6/sdn/controllers/IsisEdit.js:55
@@ -8367,7 +8183,6 @@ msgid "Lower"
msgstr "起始值"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vnet_status.rs:91
-#, fuzzy
msgid "MAC Address"
msgstr "MAC 地址"
@@ -8384,7 +8199,7 @@ msgstr "MAC 地址"
#: pve-manager/www/manager6/node/NodeOptionsView.js:66
msgid "MAC address for Wake on LAN"
-msgstr "局域网唤醒的 MAC 地址"
+msgstr "用于网络唤醒的 MAC 地址"
#: pve-manager/www/manager6/dc/OptionView.js:99
msgid "MAC address prefix"
@@ -8397,18 +8212,17 @@ msgid "MAC filter"
msgstr "MAC 筛选"
#: pve-manager/www/manager6/sdn/EvpnZoneMacVrfPanel.js:69
-#, fuzzy
msgid "MAC-Address"
-msgstr "MAC地址"
+msgstr "MAC 地址"
#: pve-manager/www/manager6/sdn/EvpnZoneMacVrfPanel.js:56
msgid "MAC-VRF"
-msgstr ""
+msgstr "MAC-VRF"
#: pve-manager/www/manager6/sdn/Browser.js:65
#: pve-manager/www/manager6/sdn/NetworkBrowser.js:139
msgid "MAC-VRFs"
-msgstr ""
+msgstr "MAC-VRF"
#: proxmox-widget-toolkit/src/Utils.js:790
msgid "MB"
@@ -8483,7 +8297,6 @@ msgid "Mails / min"
msgstr "邮件数/分钟"
#: proxmox-datacenter-manager/ui/src/pbs/datastore/overview.rs:209
-#, fuzzy
msgid "Maintenance Mode"
msgstr "维护模式"
@@ -8501,7 +8314,7 @@ msgstr "维护模式"
msgid ""
"Make sure that the correct tape is inserted in the selected drive and type "
"in the label written on the tape."
-msgstr "确保在所选驱动器中插入了正确的磁带,并键入写在磁带上的标签。"
+msgstr "确保在所选驱动器中插入了正确的磁带,并输入写在磁带上的标签。"
#: pve-manager/www/manager6/form/AgentFeatureSelector.js:49
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_agent_property.rs:65
@@ -8523,7 +8336,7 @@ msgstr "管理全局标志"
#: pve-manager/www/manager6/ceph/OSD.js:241
msgid "Manage Global OSD Flags"
-msgstr "管理全局OSD标志"
+msgstr "管理全局 OSD 标志"
#: pve-manager/www/manager6/lxc/Config.js:153
#: pve-manager/www/manager6/qemu/Config.js:120
@@ -8532,19 +8345,19 @@ msgstr "管理 HA"
#: pve-manager/www/manager6/ceph/Monitor.js:43
msgid "Manager"
-msgstr "管理员"
+msgstr "Manager"
#: pve-manager/www/manager6/node/StatusView.js:137
msgid "Manager Version"
-msgstr "管理器版本"
+msgstr "Manager 版本"
#: pve-manager/www/manager6/ceph/Services.js:29
msgid "Managers"
-msgstr "管理员"
+msgstr "Managers"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:354
msgid "Manual"
-msgstr ""
+msgstr "手动"
#: pve-manager/www/manager6/form/USBSelector.js:86
#: pve-manager/www/manager6/qemu/Smbios1Edit.js:36
@@ -8582,8 +8395,8 @@ msgid ""
"Maps SCSI disks to SATA and changes the SCSI Controller. Useful for a "
"quicker switch to VirtIO-SCSI attached disks"
msgstr ""
-"将 SCSI 磁盘映射到 SATA 并更改 SCSI 控制器。有助于更快地切换到 VirtIO-SCSI 连"
-"接磁盘"
+"此操作将SCSI磁盘映射为SATA并更换控制器,可帮助您更快地切换至使用VirtIO-SCSI连"
+"接的磁盘"
#: pmg-gui/js/LDAPGroupEditor.js:74
msgid "Match"
@@ -8620,7 +8433,7 @@ msgstr "匹配类型"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:494
msgid "Match calendar: {0}"
-msgstr "匹配日历: {0}"
+msgstr "匹配日历:{0}"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:484
msgid "Match field: {0}={1}"
@@ -8629,7 +8442,7 @@ msgstr "匹配字段:{0}={1}"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:893
#: pmg-gui/js/ObjectGroup.js:256 pmg-gui/js/RuleInfo.js:351
msgid "Match if"
-msgstr "如果匹配"
+msgstr "匹配条件"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:473
msgid "Match severity: {0}"
@@ -8642,12 +8455,11 @@ msgstr "匹配器名称"
#: proxmox-datacenter-manager/ui/src/dashboard/refresh_config_edit.rs:86
msgid "Max Age (seconds)"
-msgstr ""
+msgstr "最大期限(秒)"
#: pve-manager/www/manager6/dc/MetricServerView.js:654
-#, fuzzy
msgid "Max Body Size (bytes)"
-msgstr "最大垃圾邮件大小(字节)"
+msgstr "最大主体大小(字节)"
#: proxmox-backup/www/tape/window/TapeBackup.js:50
msgid "Max Depth"
@@ -8704,9 +8516,8 @@ msgstr "最大工作数/批量动作"
#: proxmox-widget-toolkit/src/form/RRDTypeSelector.js:83
#: proxmox-yew-comp/src/rrd_timeframe_selector.rs:223
-#, fuzzy
msgid "Maximum"
-msgstr "最大"
+msgstr "最大值"
#: pve-manager/www/manager6/panel/BackupJobPrune.js:114
msgid "Maximum Protected"
@@ -8754,7 +8565,7 @@ msgstr "中介设备"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:95
msgid ""
"Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs"
-msgstr ""
+msgstr "在 Westmere、Sandy- 和 IvyBridge Intel CPU 上降低 Meltdown 修复成本"
#: pve-manager/www/manager6/pool/Config.js:26
msgid "Members"
@@ -8791,20 +8602,18 @@ msgstr "内存"
#: pve-manager/www/manager6/node/Summary.js:287
#: pve-manager/www/manager6/panel/GuestSummary.js:157
msgid "Memory Pressure Stall"
-msgstr ""
+msgstr "内存压力停滞"
#: pve-manager/www/manager6/panel/GuestSummary.js:104
#: proxmox-datacenter-manager/ui/src/widget/pve_node_selector.rs:157
#: proxmox-datacenter-manager/ui/src/pbs/node/overview.rs:258
#: proxmox-datacenter-manager/ui/src/pve/node/overview.rs:262
-#, fuzzy
msgid "Memory Usage"
msgstr "内存使用率"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:273
-#, fuzzy
msgid "Memory assigned"
-msgstr "内存大小"
+msgstr "已分配内存"
#: pve-manager/www/manager6/data/ResourceStore.js:206
msgid "Memory size"
@@ -8846,7 +8655,7 @@ msgstr "元数据池"
#: pve-manager/www/manager6/ceph/FS.js:182
#: pve-manager/www/manager6/ceph/Services.js:35
msgid "Metadata Servers"
-msgstr "元数据服务器"
+msgstr "MDS"
#: pve-manager/www/manager6/node/LVMThin.js:152
msgid "Metadata Size"
@@ -8862,13 +8671,12 @@ msgstr "已使用的元数据"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:38
msgid "Method/URL"
-msgstr "Method/URL"
+msgstr "方法/URL"
#: pve-manager/www/manager6/sdn/EvpnZoneIpVrfPanel.js:41
#: proxmox-datacenter-manager/ui/src/sdn/evpn/zone_status.rs:102
-#, fuzzy
msgid "Metric"
-msgstr "受限制的"
+msgstr "指标"
#: pve-manager/www/manager6/dc/Config.js:374
#: proxmox-backup/www/SystemConfiguration.js:51
@@ -8909,7 +8717,7 @@ msgid ""
"Migrating VM with local resources: {0}. This might fail if the resources are "
"not available on the target node."
msgstr ""
-"正在使用本地资源迁移虚拟机: {0}。如果目标节点上的资源不可用,则此操作可能会失"
+"正在迁移使用了本地资源的虚拟机:{0}。若目标节点上无相应资源,此操作可能会失"
"败。"
#: pve-manager/www/manager6/dc/OptionView.js:360
@@ -8922,9 +8730,8 @@ msgid "Migration Settings"
msgstr "迁移设置"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:329
-#, fuzzy
msgid "Migration with local disk might take long: {0} ({1})"
-msgstr "使用本地磁盘迁移可能需要很长时间: {0} {1}"
+msgstr "使用本地磁盘的迁移可能需要较长时间:{0}({1})"
#: pve-manager/www/manager6/window/Migrate.js:380
msgid "Migration with local disk might take long: {0} {1}"
@@ -8932,7 +8739,7 @@ msgstr "使用本地磁盘迁移可能需要很长时间: {0} {1}"
#: pve-manager/www/manager6/ceph/Pool.js:362
msgid "Min. # of PGs"
-msgstr "最小值# PG"
+msgstr "最少 PG 个数"
#: pve-manager/www/manager6/ceph/Pool.js:42
#: pve-manager/www/manager6/ceph/Pool.js:44
@@ -8982,8 +8789,8 @@ msgid ""
"Mode to detect file changes and switch archive encoding format for container "
"backups to Proxmox Backup Server. Not available for VM backups."
msgstr ""
-"检测文件更改并将容器备份的存档编码格式切换到Proxmox Backup Server的模式。不适"
-"用于虚拟机备份。"
+"此模式用于检测文件更改,并将容器备份的存档编码格式切换为适用于 Proxmox "
+"Backup Server 的格式。注意:此功能不适用于虚拟机备份。"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:294
msgid ""
@@ -9011,21 +8818,21 @@ msgstr "模式:{0}"
#: proxmox-backup/www/tape/form/TapeDevicePathSelector.js:29
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_network_property.rs:73
msgid "Model"
-msgstr "模型"
+msgstr "型号"
#: proxmox-widget-toolkit/src/window/FileBrowser.js:293
msgid "Modified"
-msgstr "调整"
+msgstr "修改时间"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:240
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:397
msgid "Modify"
-msgstr "调整"
+msgstr "修改"
#: proxmox-widget-toolkit/src/window/TfaEdit.js:10
#: proxmox-yew-comp/src/tfa/tfa_edit.rs:97
msgid "Modify a TFA entry's description"
-msgstr "修改TFA条目的描述"
+msgstr "修改双因素认证条目的描述"
#: proxmox-backup/www/window/TrafficControlEdit.js:366
msgid "Mon"
@@ -9049,11 +8856,11 @@ msgstr "监视器"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:553
msgid "Monitor node"
-msgstr "监控节点"
+msgstr "Monitor 节点"
#: pve-manager/www/manager6/ceph/Services.js:23
msgid "Monitors"
-msgstr "监视器"
+msgstr "Monitors"
#: proxmox-widget-toolkit/src/form/RRDTypeSelector.js:64
#: proxmox-yew-comp/src/rrd_timeframe_selector.rs:158
@@ -9111,9 +8918,8 @@ msgstr "挂载选项"
#: proxmox-yew-comp/src/form/pve/lxc_property/lxc_mount_point_property.rs:92
#: proxmox-yew-comp/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs:118
-#, fuzzy
msgid "Mount point is already in use."
-msgstr "挂载点卷也被删除。"
+msgstr "挂载点已被使用。"
#: pve-manager/www/manager6/window/Restore.js:101
msgid "Mount point volumes are also erased."
@@ -9125,12 +8931,11 @@ msgstr "已挂载"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:497
msgid "Move Row down"
-msgstr ""
+msgstr "向下移动行"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:507
-#, fuzzy
msgid "Move Row up"
-msgstr "移动卷"
+msgstr "向上移动行"
#: pve-manager/www/manager6/lxc/Resources.js:275
#: pve-manager/www/manager6/qemu/HardwareView.js:446
@@ -9179,7 +8984,7 @@ msgstr "多个收件人必须用空格、逗号或分号分隔"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_network_property.rs:49
msgid "Multiqueue"
-msgstr ""
+msgstr "多队列"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:62
msgid "Must be a valid URL"
@@ -9187,7 +8992,7 @@ msgstr "必须是有效的 URL"
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:190
msgid "Must be base32 [A-Z2-7=]"
-msgstr ""
+msgstr "必须是 base32 [A-Z2-7=]"
#: pve-manager/www/manager6/form/MultiPCISelector.js:42
msgid "Must choose at least one device"
@@ -9201,7 +9006,7 @@ msgstr "必须以……结尾"
#: proxmox-widget-toolkit/src/Toolkit.js:120
#: proxmox-widget-toolkit/src/Toolkit.js:133
msgid "Must start with"
-msgstr "必须以……开始"
+msgstr "必须以……开头"
#: pmg-gui/js/MainView.js:216 pmg-gui/js/Settings.js:5
#: pve-manager/www/manager6/Workspace.js:400
@@ -9215,7 +9020,7 @@ msgstr "我的设置"
#: proxmox-backup/www/Utils.js:322 proxmox-yew-comp/src/node_info.rs:71
#: proxmox-yew-comp/src/node_info.rs:222
msgid "N/A"
-msgstr "N/A"
+msgstr "不适用"
#: pve-manager/www/manager6/storage/NFSEdit.js:148
msgid "NFS Version"
@@ -9239,7 +9044,7 @@ msgstr "现在"
#: pve-manager/www/manager6/window/GuestImport.js:1009
msgid "NVMe disks are currently not supported, '{0}' will get attached as SCSI"
-msgstr "NVMe 磁盘目前不受支持,'{0}' 将作为 SCSI 连接"
+msgstr "NVMe 磁盘目前不受支持,'{0}'将作为 SCSI 连接"
#: proxmox-widget-toolkit/src/form/UserSelector.js:33
#: proxmox-widget-toolkit/src/grid/ObjectGrid.js:391
@@ -9395,9 +9200,8 @@ msgid "Name, Format, Notes"
msgstr "命名,格式,备注"
#: pve-manager/www/manager6/grid/PoolMembers.js:72
-#, fuzzy
msgid "Name, Node, VMID"
-msgstr "名称/VMID"
+msgstr "名称、节点、VMID"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:256
msgid "Name/value must not be empty."
@@ -9423,16 +9227,15 @@ msgstr "命名空间"
#: proxmox-backup/www/datastore/Content.js:360
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:109
msgid "Namespace '{0}'"
-msgstr "命名空间 '{0}'"
+msgstr "命名空间'{0}'"
#: proxmox-backup/www/window/NamespaceEdit.js:44
msgid "Namespace Name"
msgstr "命名空间名称"
#: pmg-gui/js/QuarantineView.js:240
-#, fuzzy
msgid "Narrow viewport detected"
-msgstr "未选择端点"
+msgstr "检测到窄屏显示"
#: proxmox-backup/www/tape/window/TapeRestore.js:630
msgid "Need at least one mapping"
@@ -9444,11 +9247,11 @@ msgstr "至少需要一个快照"
#: pve-manager/www/manager6/sdn/FabricsContentView.js:33
msgid "Neighbor"
-msgstr ""
+msgstr "邻居"
#: pve-manager/www/manager6/sdn/NetworkBrowser.js:56
msgid "Neighbors"
-msgstr ""
+msgstr "邻居"
#: pve-manager/www/manager6/lxc/CreateWizard.js:83
#: pve-manager/www/manager6/lxc/FeaturesEdit.js:38
@@ -9460,14 +9263,13 @@ msgstr "嵌套"
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:180
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:177
msgid "Net In"
-msgstr ""
+msgstr "网络入站"
#. TRANSLATORS: As in amount of outgoing network traffic
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:181
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:179
-#, fuzzy
msgid "Net Out"
-msgstr "出口速率"
+msgstr "网络出站"
#: pmg-gui/js/MailProxyOptions.js:44
msgid "Netmask for Greylisting IPv4"
@@ -9497,9 +9299,8 @@ msgid "Network"
msgstr "网络"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:315
-#, fuzzy
msgid "Network (Proxmox VE)"
-msgstr "Proxmox VE"
+msgstr "网络(Proxmox VE)"
#: pve-manager/www/manager6/qemu/IPConfigEdit.js:222
msgid "Network Config"
@@ -9518,9 +9319,8 @@ msgid "Network Device"
msgstr "网络设备"
#: pve-manager/www/manager6/panel/IPView.js:4
-#, fuzzy
msgid "Network Information"
-msgstr "无网络信息"
+msgstr "网络信息"
#: pve-manager/www/manager6/window/GuestImport.js:856
#: proxmox-backup/www/SystemConfiguration.js:40
@@ -9532,14 +9332,12 @@ msgstr "网络接口"
#: pve-manager/www/manager6/panel/GuestSummary.js:121
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:365
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:374
-#, fuzzy
msgid "Network Traffic"
msgstr "网络流量"
#: proxmox-yew-comp/src/configuration/pve/qemu_hardware_panel/desktop.rs:342
-#, fuzzy
msgid "Network card"
-msgstr "IP 网络"
+msgstr "网卡"
#: pmg-gui/js/ServerStatus.js:152 proxmox-backup/www/ServerStatus.js:247
msgid "Network traffic"
@@ -9582,11 +9380,11 @@ msgstr "新密码"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:118
msgid "Newest ceph version in cluster is {0}"
-msgstr "群集中最新的Ceph版本是 {0}"
+msgstr "集群中最新的Ceph版本是 {0}"
#: proxmox-yew-comp/src/subscription_info.rs:19
msgid "Newly set subscription, not yet checked"
-msgstr ""
+msgstr "新设置的订阅,尚未检查"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:383
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:500
@@ -9628,14 +9426,12 @@ msgstr "下一个到期日期"
#: pve-manager/www/manager6/sdn/EvpnZoneIpVrfPanel.js:24
#: pve-manager/www/manager6/sdn/EvpnZoneMacVrfPanel.js:75
-#, fuzzy
msgid "Nexthop"
-msgstr "下一步"
+msgstr "下一跳"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/zone_status.rs:88
-#, fuzzy
msgid "Nexthops"
-msgstr "下一步"
+msgstr "下一跳"
#: proxmox-widget-toolkit/src/Utils.js:45
#: proxmox-widget-toolkit/src/window/ConfirmRemoveDialog.js:24
@@ -9669,11 +9465,11 @@ msgstr "否"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:313
#: pve-manager/www/manager6/node/ACME.js:682
msgid "No Account available."
-msgstr "没有可用的帐户。"
+msgstr "没有可用的账户。"
#: proxmox-widget-toolkit/src/panel/ACMEAccount.js:60
msgid "No Accounts configured"
-msgstr "未配置帐户"
+msgstr "未配置账户"
#: proxmox-backup/www/Utils.js:740
msgid "No Activity"
@@ -9696,7 +9492,7 @@ msgstr "未找到 CloudInit 驱动器"
#: pve-manager/www/manager6/node/Summary.js:218
#: proxmox-backup/www/dashboard/DataStoreStatistics.js:59
msgid "No Data"
-msgstr "没有数据"
+msgstr "暂无数据"
#: proxmox-backup/www/datastore/DataStoreList.js:130
msgid "No Datastores configured"
@@ -9712,7 +9508,7 @@ msgstr "未找到设备"
#: proxmox-widget-toolkit/src/form/MultiDiskSelector.js:69
msgid "No Disk selected"
-msgstr "没有选中磁盘"
+msgstr "未选择磁盘"
#: pve-manager/www/manager6/panel/MultiDiskEdit.js:239
msgid "No Disks"
@@ -9731,7 +9527,7 @@ msgstr "没有未使用的磁盘"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:15
#: pve-manager/www/manager6/node/ACME.js:405
msgid "No Domains configured"
-msgstr "未配置域"
+msgstr "未配置域名"
#: pmg-gui/js/QuarantineList.js:5
msgid "No E-Mail address selected"
@@ -9747,13 +9543,13 @@ msgstr "未配置 Guest Agent"
#: proxmox-widget-toolkit/src/button/HelpButton.js:73
msgid "No Help available"
-msgstr "没有可用的帮助"
+msgstr "无可用帮助"
#: pve-manager/www/manager6/window/PCIMapEdit.js:179
msgid ""
"No IOMMU detected, please activate it. See Documentation for further "
"information."
-msgstr "未检测到 IOMMU,请将其激活。有关详细信息,请参阅文档。"
+msgstr "未检测到 IOMMU 功能,请先启用。更多信息请查阅文档。"
#: pve-manager/www/manager6/dc/RealmSyncJob.js:296
msgid "No LDAP/AD Realm found"
@@ -9794,12 +9590,11 @@ msgstr "没有报告"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:24
msgid "No S.M.A.R.T. Values"
-msgstr "没有 S.M.A.R.T. 值"
+msgstr "无 S.M.A.R.T. 值"
#: pmg-gui/js/DNSBLSitesField.js:17
-#, fuzzy
msgid "No Sites defined"
-msgstr "未定义标记"
+msgstr "未定义站点"
#: proxmox-backup/www/tape/window/TapeRestore.js:837
msgid "No Snapshots"
@@ -9845,16 +9640,15 @@ msgstr "没有警告/错误"
#: proxmox-backup/www/datastore/Content.js:394
msgid "No accessible snapshots found in namespace {0}"
-msgstr "在命名空间{0}中找不到可访问的快照"
+msgstr "在命名空间 {0} 中找不到可访问的快照"
#: pmg-gui/js/PBSSnapshotView.js:197
msgid "No backups on remote"
msgstr "远程没有备份"
#: proxmox-yew-comp/src/form/pve/qemu_property/mod.rs:252
-#, fuzzy
msgid "No boot device selected"
-msgstr "(没有选中启动设备)"
+msgstr "未选择启动设备"
#: pve-manager/www/manager6/form/CacheTypeSelector.js:5
#: pve-manager/www/manager6/form/CacheTypeSelector.js:10
@@ -9876,9 +9670,8 @@ msgstr "无更改"
#: proxmox-datacenter-manager/ui/src/dashboard/top_entities.rs:264
#: proxmox-datacenter-manager/ui/src/widget/resource_tree.rs:346
-#, fuzzy
msgid "No data"
-msgstr "复制数据"
+msgstr "无数据"
#: pmg-gui/js/AttachmentQuarantine.js:52 pmg-gui/js/ContactStatistics.js:115
#: pmg-gui/js/Dashboard.js:468 pmg-gui/js/DomainStatistics.js:75
@@ -9898,23 +9691,20 @@ msgid "No default available"
msgstr "没有默认可用"
#: proxmox-yew-comp/src/apt_repositories.rs:714
-#, fuzzy
msgid "No description available"
-msgstr "没有可用的帮助"
+msgstr "无可用描述"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/ui_helpers.rs:114
-#, fuzzy
msgid "No entry selected"
-msgstr "未选择目标"
+msgstr "未选择条目"
#: pve-manager/www/manager6/grid/FirewallRules.js:623
msgid "No firewall rule configured here."
msgstr "此处未配置防火墙规则。"
#: proxmox-yew-comp/src/firewall/rules.rs:258
-#, fuzzy
msgid "No firewall rules configured"
-msgstr "此处未配置防火墙规则。"
+msgstr "未配置防火墙规则"
#: pmg-gui/js/QuarantineList.js:264
msgid "No match found"
@@ -9922,7 +9712,7 @@ msgstr "找不到匹配项"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:421
msgid "No more recovery keys left! Please generate a new set!"
-msgstr "没有剩余的恢复密钥了!请生成一个新集合!"
+msgstr "没有剩余的恢复密钥了!请生成新的一组!"
#: proxmox-backup/www/form/NamespaceSelector.js:38
msgid "No namespaces accessible."
@@ -9939,9 +9729,8 @@ msgid "No network information"
msgstr "无网络信息"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:599
-#, fuzzy
msgid "No node selected"
-msgstr "没有选中虚拟机"
+msgstr "未选择节点"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:327
msgid "No notification matchers configured"
@@ -9952,9 +9741,8 @@ msgid "No notification targets configured"
msgstr "未配置通知目标"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:713
-#, fuzzy
msgid "No product repository configured"
-msgstr "未配置 VNet。"
+msgstr "未配置产品仓库"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:237
msgid "No recipients configured"
@@ -9962,12 +9750,11 @@ msgstr "未配置收件人"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:78
msgid "No remotes configured or could not fetch status."
-msgstr ""
+msgstr "未配置远程或无法获取状态。"
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:77
-#, fuzzy
msgid "No remotes configured."
-msgstr "未配置 VNet。"
+msgstr "未配置远程。"
#: pve-manager/www/manager6/sdn/zones/Base.js:45
#: pve-manager/www/manager6/storage/Base.js:42
@@ -9977,7 +9764,7 @@ msgstr "无限制"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:510
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:903
msgid "No rule matches"
-msgstr "没有规则匹配"
+msgstr "无规则匹配"
#: proxmox-backup/www/dashboard/RunningTasks.js:6
#: proxmox-yew-comp/src/running_tasks.rs:164
@@ -9990,7 +9777,7 @@ msgstr "没有计划设置。"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:408
msgid "No second factor left! Please contact an administrator!"
-msgstr "没有第二个因素了!请联系管理员!"
+msgstr "没有可用的二次验证因子!请联系管理员!"
#: pve-manager/www/manager6/window/ScheduleSimulator.js:12
msgid "No simulation done"
@@ -10006,7 +9793,7 @@ msgstr "未选择目标"
#: proxmox-widget-toolkit/src/node/APT.js:199
msgid "No updates available."
-msgstr "没有可用的更新。"
+msgstr "没有可用更新。"
#: proxmox-widget-toolkit/src/Utils.js:616 proxmox-backup/www/Dashboard.js:348
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:58
@@ -10017,7 +9804,6 @@ msgid "No valid subscription"
msgstr "无有效订阅"
#: proxmox-datacenter-manager/ui/src/lib.rs:289
-#, fuzzy
msgid "No valid subscriptions"
msgstr "无有效订阅"
@@ -10039,17 +9825,16 @@ msgstr "未找到 {0}"
#: proxmox-widget-toolkit/src/Utils.js:1377
msgid "No {0} repository enabled!"
-msgstr "未启用 {0} 存储库!"
+msgstr "未启用 {0} 软件源!"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:475
#: proxmox-yew-comp/src/apt_repositories.rs:167
msgid "No {0} repository is enabled, you do not get any updates!"
-msgstr "没有启用 {0} 存储库,没有得到任何更新!"
+msgstr "未启用任何 {0} 软件源,您将无法获取更新!"
#: pve-manager/www/manager6/ha/Rules.js:92
-#, fuzzy
msgid "No {0} rules configured."
-msgstr "未配置 {0}"
+msgstr "未配置 {0} 规则。"
#: pve-manager/www/manager6/node/Directory.js:174
#: pve-manager/www/manager6/node/LVM.js:174
@@ -10109,25 +9894,21 @@ msgstr "节点"
#: proxmox-datacenter-manager/ui/src/pve/node/mod.rs:66
#: pve-yew-mobile-gui/src/pages/page_node_tasks.rs:32
-#, fuzzy
msgid "Node '{0}'"
-msgstr "移除 '{0}'"
+msgstr "节点 '{0}'"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/ui_helpers.rs:78
-#, fuzzy
msgid "Node Firewall - {0}/{1}"
-msgstr "VNet 防火墙"
+msgstr "节点防火墙 - {0}/{1}"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:548
-#, fuzzy
msgid "Node Panels"
-msgstr "设定状态"
+msgstr "节点面板"
#: proxmox-datacenter-manager/ui/src/administration/mod.rs:77
#: proxmox-yew-comp/src/node_status_panel.rs:219
-#, fuzzy
msgid "Node Status"
-msgstr "设定状态"
+msgstr "节点状态"
#: pve-manager/www/manager6/Utils.js:2186
msgid "Node fencing notifications"
@@ -10168,29 +9949,27 @@ msgstr "节点"
#: proxmox-datacenter-manager/ui/src/dashboard/top_entities.rs:350
msgid "Nodes With the Highest CPU Usage"
-msgstr ""
+msgstr "CPU 使用率最高的节点"
#: proxmox-datacenter-manager/ui/src/dashboard/top_entities.rs:357
msgid "Nodes With the Highest Memory Usage"
-msgstr ""
+msgstr "内存使用率最高的节点"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:608
msgid "Nodes with Highest CPU Usage"
-msgstr ""
+msgstr "CPU 使用率最高的节点"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:615
-#, fuzzy
msgid "Nodes with Highest Memory Usage"
-msgstr "主机内存使用率"
+msgstr "内存使用率最高的节点"
#: proxmox-widget-toolkit/src/Utils.js:1405
msgid "Non production-ready repository enabled!"
-msgstr "非生产就绪存储库已启用!"
+msgstr "已启用非生产环境适用的软件源!"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:722
-#, fuzzy
msgid "Non-production-ready repositories enabled"
-msgstr "非生产就绪存储库已启用!"
+msgstr "已启用非生产就绪仓库"
#: proxmox-widget-toolkit/src/Utils.js:49 pmg-gui/js/PBSSnapshotView.js:179
#: pve-manager/www/manager6/Utils.js:292
@@ -10216,9 +9995,8 @@ msgid "None"
msgstr "无"
#: proxmox-backup/www/window/S3ClientEdit.js:145
-#, fuzzy
msgid "None (default)"
-msgstr "默认"
+msgstr "无(默认)"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:79
msgid "None (insecure)"
@@ -10230,7 +10008,7 @@ msgstr "无匹配"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:48
msgid "Normalized"
-msgstr "标准化"
+msgstr "标准化值"
#: proxmox-widget-toolkit/src/Utils.js:83 proxmox-yew-comp/src/lib.rs:314
msgid "Norwegian (Bokmal)"
@@ -10238,7 +10016,7 @@ msgstr "挪威语(博克马尔语)"
#: proxmox-widget-toolkit/src/Utils.js:85 proxmox-yew-comp/src/lib.rs:316
msgid "Norwegian (Nynorsk)"
-msgstr "挪威语(尼诺尔斯克语)"
+msgstr "挪威语(尼诺斯克语)"
#: proxmox-backup/www/tape/ChangerStatus.js:646
msgid "Not Labeled"
@@ -10246,7 +10024,7 @@ msgstr "未标记"
#: proxmox-widget-toolkit/src/Toolkit.js:170
msgid "Not a valid DNS name or IP address."
-msgstr "不是有效的DNS名称或IP地址。"
+msgstr "不是有效的 DNS 名称或 IP 地址。"
#: pve-manager/www/manager6/form/TagColorGrid.js:168
msgid "Not a valid color."
@@ -10264,7 +10042,9 @@ msgstr "不是一个卷"
msgid ""
"Not all nodes have an active subscription, which is required for cluster-"
"wide enterprise repo access"
-msgstr "并非所有节点都有活动订阅,这是集群范围的企业源库访问所必需的"
+msgstr ""
+"集群范围内启用企业软件源访问需要所有节点均具备有效订阅,但当前部分节点不符合"
+"条件"
#: proxmox-backup/www/config/WebauthnView.js:13
#: proxmox-backup/www/config/WebauthnView.js:19
@@ -10280,9 +10060,8 @@ msgid "Not enough data"
msgstr "数据不足"
#: pmg-yew-quarantine-gui/src/page_not_found.rs:8
-#, fuzzy
msgid "Not found"
-msgstr "未找到任何内容"
+msgstr "未找到"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:44
#: proxmox-yew-comp/src/apt_repositories.rs:709
@@ -10306,7 +10085,7 @@ msgstr "备注模板"
#: pve-manager/www/manager6/dc/OptionView.js:322
#: proxmox-backup/www/config/WebauthnView.js:129
msgid "Note:"
-msgstr "备注:"
+msgstr "备注:"
#: pve-manager/www/manager6/window/GuestImport.js:334
#: pve-manager/www/manager6/window/GuestImport.js:628
@@ -10323,16 +10102,16 @@ msgstr "注意:如果实时恢复期间出现任何问题,虚拟机写入的
#: pve-manager/www/manager6/qemu/TdxEdit.js:62
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_intel_tdx_property.rs:65
-#, fuzzy
msgid ""
"Note: Intel TDX is only supported by specific recent CPU models and requires "
"host kernel version 6.16 or higher."
-msgstr "注意:SEV-SNP需要主机内核版本6.11或更高版本。"
+msgstr ""
+"注意:Intel TDX 仅支持特定的新款 CPU 型号,且需要主机内核 6.16 或更高版本。"
#: pve-manager/www/manager6/qemu/SevEdit.js:82
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_amd_sev_property.rs:84
msgid "Note: SEV-SNP requires host kernel version 6.11 or higher."
-msgstr "注意:SEV-SNP需要主机内核版本6.11或更高版本。"
+msgstr "注意:SEV-SNP 需要主机内核的版本为6.11或更高。"
#: proxmox-widget-toolkit/src/panel/NotesView.js:6
#: proxmox-widget-toolkit/src/window/NotesEdit.js:4
@@ -10359,7 +10138,7 @@ msgstr "未找到任何内容"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1083
msgid "Notice"
-msgstr "通知"
+msgstr "注意"
#: pmg-gui/js/Utils.js:530 pve-manager/www/manager6/dc/BackupJobDetail.js:211
#: pve-manager/www/manager6/window/Backup.js:47
@@ -10406,7 +10185,7 @@ msgstr "通知"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:101
msgid "Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs"
-msgstr ""
+msgstr "通知客户操作系统主机在 AMD CPU 上不易受 Spectre 攻击"
#: pmg-gui/js/PBSRemoteEdit.js:85
msgid "Notify"
@@ -10418,9 +10197,8 @@ msgid "Notify User"
msgstr "通知用户"
#: proxmox-datacenter-manager/ui/src/dashboard/status_row.rs:177
-#, fuzzy
msgid "Now refreshing"
-msgstr "刷新"
+msgstr "现正刷新"
#: pve-manager/www/manager6/form/IPProtocolSelector.js:16
msgid "Number"
@@ -10451,7 +10229,7 @@ msgstr "节点数"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:232
#: proxmox-yew-comp/src/node_status_panel.rs:132
msgid "OK"
-msgstr "OK"
+msgstr "确定"
#: pve-manager/www/manager6/qemu/CreateWizard.js:192
msgid "OS"
@@ -10479,7 +10257,7 @@ msgstr "没有元数据的 OSD,可能是移除后遗留下来的"
#: pve-manager/www/manager6/window/GuestImport.js:1012
msgid "OVMF is built without LSI drivers, scsi hardware was set to '{1}'"
-msgstr "OVMF 构建时未使用 LSI 驱动程序,scsi 硬件设置为 '{1}'"
+msgstr "OVMF 构建时未使用 LSI 驱动程序,scsi 硬件设置为'{1}'"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:161
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:181
@@ -10489,12 +10267,11 @@ msgstr "OVS 选项"
#: pve-manager/www/manager6/ceph/OSD.js:197
msgid "Objects are degraded. Consider waiting until the cluster is healthy."
-msgstr "对象已降级。请考虑等待群集恢复正常。"
+msgstr "对象已降级。请考虑等待集群恢复正常。"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:172
-#, fuzzy
msgid "Off"
-msgstr "离线"
+msgstr "关闭"
#: pve-manager/www/manager6/dc/Health.js:114
#: pve-manager/www/manager6/window/Migrate.js:45
@@ -10546,30 +10323,26 @@ msgstr "站内"
#: proxmox-yew-comp/src/apt_package_manager.rs:481
msgid "One item"
msgid_plural "{} items"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "{}个项目"
#: proxmox-datacenter-manager/ui/src/dashboard/node_status_panel.rs:146
-#, fuzzy
msgid "One of {0} nodes online"
msgid_plural "{n} of {0} nodes online"
-msgstr[0] "节点已下线"
+msgstr[0] "{0} 个节点中有 {n} 个在线"
#: pve-yew-mobile-gui/src/pages/page_node_status/services_panel.rs:78
msgid "One or more required services is not running"
-msgstr ""
+msgstr "一个或多个必需的服务未运行"
#: proxmox-yew-comp/src/apt_repositories.rs:867
-#, fuzzy
msgid "One repository"
msgid_plural "{n} repositories"
-msgstr[0] "存储库"
-msgstr[1] "存储库"
+msgstr[0] "{n}个仓库"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:676
msgid "One update pending"
msgid_plural "{n} updates pending"
-msgstr[0] ""
+msgstr[0] "{n} 个待处理更新"
#: pve-manager/www/manager6/data/ResourceStore.js:105
#: pve-manager/www/manager6/dc/Health.js:108
@@ -10584,11 +10357,11 @@ msgstr "在线"
#: proxmox-widget-toolkit/src/window/ACMEDomains.js:122
#: pve-manager/www/manager6/node/ACME.js:325
msgid "Only 5 Domains with type DNS can be configured"
-msgstr "只能配置5个DNS类型的域"
+msgstr "最多只能配置 5 个 DNS 类型的域名"
#: proxmox-backup/www/window/NamespaceEdit.js:49
msgid "Only alpha numerical, '_' and '-' (if not at start) allowed"
-msgstr "只允许使用字母数字、“_”和“-”(如果不是在开始时)"
+msgstr "名称只能包含字母、数字、下划线,以及非首位的连字符(-)"
#: pmg-gui/js/Utils.js:389
msgid "Only top level headers"
@@ -10596,12 +10369,11 @@ msgstr "仅顶层标题"
#: proxmox-widget-toolkit/src/panel/NodeInfoRepoStatus.js:50
msgid "Open Repositories Panel"
-msgstr "打开存储库面板"
+msgstr "打开软件源面板"
#: proxmox-datacenter-manager/ui/src/pbs/mod.rs:160
-#, fuzzy
msgid "Open Shell"
-msgstr "Shell"
+msgstr "打开 Shell"
#: proxmox-datacenter-manager/ui/src/dashboard/filtered_tasks.rs:286
#: proxmox-yew-comp/src/running_tasks.rs:122
@@ -10614,7 +10386,7 @@ msgstr "打开任务"
#: proxmox-datacenter-manager/ui/src/pve/qemu/mod.rs:74
#: proxmox-datacenter-manager/ui/src/pve/mod.rs:257
msgid "Open Web UI"
-msgstr ""
+msgstr "打开 Web UI"
#: pve-manager/www/manager6/window/Settings.js:297
msgid "Open editor on double-click"
@@ -10622,11 +10394,11 @@ msgstr "双击打开编辑器"
#: proxmox-datacenter-manager/ui/src/pbs/tree.rs:319
msgid "Open in PBS UI"
-msgstr ""
+msgstr "在 PBS UI 中打开"
#: proxmox-datacenter-manager/ui/src/pve/tree.rs:734
msgid "Open in PVE UI"
-msgstr ""
+msgstr "在 PVE UI 中打开"
#: proxmox-backup/www/tape/BackupOverview.js:365
msgid "Open restore wizard for {0}"
@@ -10634,23 +10406,23 @@ msgstr "打开 {0} 的还原向导"
#: proxmox-datacenter-manager/ui/src/top_nav_bar.rs:197
msgid "Open the Beta documentation in a new tab."
-msgstr ""
+msgstr "在新标签页中打开 Beta 文档。"
#: proxmox-datacenter-manager/ui/src/pve/qemu/mod.rs:76
#: proxmox-datacenter-manager/ui/src/pve/qemu/mod.rs:92
msgid "Open the web UI of VM {0}."
-msgstr ""
+msgstr "打开虚拟机 {0} 的 Web UI。"
#: proxmox-datacenter-manager/ui/src/pve/lxc/mod.rs:77
#: proxmox-datacenter-manager/ui/src/pve/lxc/mod.rs:93
msgid "Open the web UI of container {0}."
-msgstr ""
+msgstr "打开容器 {0} 的 Web UI。"
#: proxmox-widget-toolkit/src/Schema.js:17
#: pve-manager/www/manager6/Utils.js:742
#: proxmox-yew-comp/src/auth_edit_openid.rs:173
msgid "OpenID Connect Server"
-msgstr "OpenID Connect服务器"
+msgstr "OpenID Connect 服务器"
#: pmg-gui/js/LoginView.js:248
msgid "OpenID Connect login - please wait..."
@@ -10683,18 +10455,16 @@ msgid "OpenID redirect failed."
msgstr "OpenID 重定向失败。"
#: proxmox-yew-comp/src/auth_view.rs:315
-#, fuzzy
msgid "OpenId Connect Server"
-msgstr "OpenID Connect服务器"
+msgstr "OpenId Connect 服务器"
#: pve-manager/www/manager6/dc/MetricServerView.js:529
-#, fuzzy
msgid "OpenTelemetry Server"
-msgstr "OpenID Connect服务器"
+msgstr "OpenTelemetry 服务器"
#: pve-manager/www/manager6/ceph/Pool.js:348
msgid "Optimal # of PGs"
-msgstr "最优置放值"
+msgstr "最优 PG 个数"
#: pve-manager/www/manager6/dc/OptionView.js:490
msgid "Option"
@@ -10729,24 +10499,23 @@ msgstr "选项"
#: proxmox-widget-toolkit/src/form/MultiDiskSelector.js:118
#: proxmox-yew-comp/src/form/pve/qemu_property/mod.rs:210
msgid "Order"
-msgstr "预定"
+msgstr "顺序"
#: pve-manager/www/manager6/Utils.js:2079 proxmox-backup/www/Utils.js:424
#: proxmox-datacenter-manager/ui/src/tasks.rs:10
#: proxmox-yew-comp/src/utils/mod.rs:355
msgid "Order Certificate"
-msgstr "预定凭证"
+msgstr "预定证书"
#: proxmox-yew-comp/src/acme/acme_domains.rs:251
-#, fuzzy
msgid "Order Certificate Now"
-msgstr "立即预定凭证"
+msgstr "立即订购证书"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:474
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:484
#: pve-manager/www/manager6/node/ACME.js:638
msgid "Order Certificates Now"
-msgstr "立即预定凭证"
+msgstr "立即订购证书"
#: pve-manager/www/manager6/dc/OptionView.js:522
msgid "Ordering"
@@ -10772,7 +10541,7 @@ msgstr "组织"
#: proxmox-yew-comp/src/apt_package_manager.rs:477
#: proxmox-yew-comp/src/apt_repositories.rs:830
msgid "Origin"
-msgstr "源"
+msgstr "来源"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:347
#: proxmox-backup/www/SystemConfiguration.js:58
@@ -10799,11 +10568,11 @@ msgstr "其它集群成员使用此服务的较新版本,请升级并重启"
#: pmg-gui/js/Utils.js:114 pve-manager/www/manager6/ceph/StatusDetail.js:42
msgid "Out"
-msgstr "输出"
+msgstr "已移出"
#: pve-manager/www/manager6/ceph/StatusDetail.js:65
msgid "Outdated OSDs"
-msgstr "过时的 OSDs"
+msgstr "旧版的 OSDs"
#: pmg-gui/js/ContactStatistics.js:109 pmg-gui/js/DomainStatistics.js:114
#: pmg-gui/js/SenderStatistics.js:102
@@ -10840,9 +10609,8 @@ msgid "Output Policy"
msgstr "输出策略"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:126
-#, fuzzy
msgid "Output log level"
-msgstr "日志级别"
+msgstr "输出日志级别"
#: pve-manager/www/manager6/window/Restore.js:326
msgid "Override Settings"
@@ -10857,9 +10625,8 @@ msgstr "停止执行关闭任务"
#: proxmox-datacenter-manager/ui/src/pve/lxc/mod.rs:98
#: proxmox-datacenter-manager/ui/src/pve/node/mod.rs:77
#: proxmox-datacenter-manager/ui/src/pve/qemu/mod.rs:97
-#, fuzzy
msgid "Overview"
-msgstr "覆写"
+msgstr "概览"
#: pve-manager/www/manager6/window/Restore.js:389
#: proxmox-backup/www/tape/form/RetentionSelector.js:7
@@ -10875,9 +10642,8 @@ msgid "Overwrite existing file"
msgstr "改写现有文件"
#: proxmox-backup/www/window/DataStoreEdit.js:215
-#, fuzzy
msgid "Overwrite in-use marker"
-msgstr "改写组"
+msgstr "覆盖使用中标记"
#: pve-manager/www/manager6/window/Migrate.js:632
msgid "Overwrite local resources unavailable check"
@@ -10893,14 +10659,12 @@ msgid "PB"
msgstr "PB"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:594
-#, fuzzy
msgid "PBS Datastores"
-msgstr "数据存储"
+msgstr "PBS 数据存储"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:554
-#, fuzzy
msgid "PBS Nodes"
-msgstr "节点"
+msgstr "PBS 节点"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:280
#: pve-manager/www/manager6/window/Backup.js:72
@@ -10935,9 +10699,8 @@ msgid "POSIX ACLs"
msgstr "POSIX ACLs"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:559
-#, fuzzy
msgid "PVE Nodes"
-msgstr "退出节点"
+msgstr "PVE 节点"
#: proxmox-widget-toolkit/src/node/APT.js:26
#: pve-manager/www/manager6/storage/TemplateView.js:76
@@ -10947,7 +10710,6 @@ msgstr "软件包"
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:92
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:200
-#, fuzzy
msgid "Package Versions"
msgstr "软件包版本"
@@ -11020,9 +10782,8 @@ msgid "Password"
msgstr "密码"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:110
-#, fuzzy
msgid "Password/Secret"
-msgstr "密码"
+msgstr "密码/密钥"
#: proxmox-widget-toolkit/src/Toolkit.js:210
#: pve-manager/www/manager6/dc/UserEdit.js:22
@@ -11030,13 +10791,12 @@ msgid "Passwords do not match"
msgstr "密码不匹配"
#: proxmox-yew-comp/src/user_panel.rs:268
-#, fuzzy
msgid "Passwords do not match!"
-msgstr "密码不匹配"
+msgstr "密码不匹配!"
#: pve-manager/www/manager6/dc/ClusterEdit.js:329
msgid "Paste encoded Cluster Information here"
-msgstr "在此处粘贴编码了的群集信息"
+msgstr "在此处粘贴编码了的集群信息"
#: proxmox-widget-toolkit/src/panel/PermissionView.js:29
#: pve-manager/www/manager6/dc/ACLView.js:21
@@ -11072,7 +10832,7 @@ msgstr "路径"
#: proxmox-backup/www/window/S3ClientEdit.js:68
msgid "Path Style"
-msgstr ""
+msgstr "路径样式"
#: pve-manager/www/manager6/lxc/DeviceEdit.js:59
msgid "Path has to start with /dev/"
@@ -11115,23 +10875,22 @@ msgstr "对端"
#: pve-manager/www/manager6/Utils.js:217
msgid "Pending Changes"
-msgstr "待更改"
+msgstr "待应用的更改"
#: proxmox-backup/www/config/GCView.js:225
msgid "Pending Data"
-msgstr "待处理数据"
+msgstr "待处理的数据"
#: proxmox-widget-toolkit/src/node/NetworkView.js:431
#: pmg-gui/js/SpamDetectorCustom.js:310
msgid "Pending changes"
-msgstr "待更改"
+msgstr "待应用的更改"
#: proxmox-yew-comp/src/configuration/network_view.rs:276
-#, fuzzy
msgid ""
"Pending changes (Either reboot or use 'Apply Configuration' (needs "
"ifupdown2) to activate)"
-msgstr "重新启动或使用“应用配置”(需要 ifupdown2 )激活"
+msgstr "待应用的更改(重启或使用“应用配置”来激活,后者需要 ifupdown2)"
#: pmg-gui/js/SpamScoreDistribution.js:44
msgid "Percentage"
@@ -11147,11 +10906,11 @@ msgstr "周期"
#: proxmox-backup/www/datastore/Content.js:1092
msgid "Permanently forget group '{0}'"
-msgstr "永久删除组 '{0}'"
+msgstr "永久删除组'{0}'"
#: proxmox-backup/www/datastore/Content.js:1090
msgid "Permanently forget snapshot '{0}'"
-msgstr "永久删除快照 {0}"
+msgstr "永久删除快照'{0}'"
#: proxmox-widget-toolkit/src/panel/PermissionView.js:29
#: pve-manager/www/manager6/dc/PermissionView.js:28
@@ -11191,29 +10950,27 @@ msgstr "PiB"
#: proxmox-widget-toolkit/src/Schema.js:96
msgid "Pipe/Fifo"
-msgstr "管道/命名管道"
+msgstr "管道/FIFO"
#: pve-manager/www/manager6/window/DownloadUrlToStorage.js:167
msgid "Please (re-)query URL to get meta information"
msgstr "请(重新)查询 URL 以获取元信息"
#: proxmox-yew-comp/src/acme/certificate_list.rs:316
-#, fuzzy
msgid "Please Reload"
-msgstr "磁带读取"
+msgstr "请重新加载"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:447
msgid "Please enter one of your single-use recovery keys"
-msgstr "请输入您的一次性还原密钥"
+msgstr "请输入您的一个一次性恢复密钥"
#: proxmox-widget-toolkit/src/window/ConfirmRemoveDialog.js:164
msgid "Please enter the ID to confirm"
msgstr "请输入 ID 以确认"
#: proxmox-yew-comp/src/safe_confirm_dialog.rs:133
-#, fuzzy
msgid "Please enter the ID to confirm ({0})"
-msgstr "请输入 ID 以确认"
+msgstr "请输入 ID 以确认({0})"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:379
msgid "Please enter your TOTP verification code"
@@ -11230,7 +10987,7 @@ msgstr "请输入搜索参数,然后按“搜索”。"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:346
#: proxmox-widget-toolkit/src/window/TfaWindow.js:477
msgid "Please insert your authentication device and press its button"
-msgstr "请插入您的身份验证设备,然后按其按钮"
+msgstr "请插入您的身份验证设备并按设备上的按钮"
#: pve-manager/www/manager6/window/LoginWindow.js:205
msgid "Please press the button on your U2F Device"
@@ -11238,12 +10995,12 @@ msgstr "请按 U2F 设备上的按钮"
#: proxmox-widget-toolkit/src/window/AddWebauthn.js:94
msgid "Please press the button on your Webauthn Device"
-msgstr "请按你的 WebAuthn 设备上的按钮"
+msgstr "请按您的 WebAuthn 设备上的按钮"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:167
#: proxmox-yew-comp/src/tfa/tfa_add_recovery.rs:138
msgid "Please record recovery keys - they will only be displayed now"
-msgstr "请记录还原密钥-它们仅在现在显示"
+msgstr "请记录恢复密钥 - 它们现在只显示一次"
#: pve-manager/www/manager6/dc/TokenEdit.js:154
#: proxmox-backup/www/window/TokenEdit.js:204
@@ -11251,9 +11008,8 @@ msgid "Please record the API token secret - it will only be displayed now"
msgstr "请记录 API 令牌密钥-仅在现在显示"
#: proxmox-yew-comp/src/token_panel.rs:379
-#, fuzzy
msgid "Please record the API token secret - it will only be displayed now."
-msgstr "请记录 API 令牌密钥-仅在现在显示"
+msgstr "请记录 API 令牌密钥 - 它只会显示一次。"
#: pve-manager/www/manager6/storage/PBSEdit.js:138
msgid ""
@@ -11279,9 +11035,8 @@ msgid "Please select a sender."
msgstr "请选择一个发件人。"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:186
-#, fuzzy
msgid "Please select a target storage."
-msgstr "请选择一个规则。"
+msgstr "请选择目标存储。"
#: pmg-gui/js/ObjectGroup.js:15
msgid "Please select an object."
@@ -11355,11 +11110,11 @@ msgstr "资源池"
#: pve-manager/www/manager6/ceph/Pool.js:302
msgid "Pool #"
-msgstr "资源池 #"
+msgstr "存储池序号"
#: pve-manager/www/manager6/form/ViewSelector.js:30
msgid "Pool View"
-msgstr "资源池视图"
+msgstr "池视图"
#: pve-manager/www/manager6/dc/Backup.js:261
#: pve-manager/www/manager6/dc/BackupJobDetail.js:414
@@ -11411,7 +11166,7 @@ msgstr "端口"
#: proxmox-widget-toolkit/src/node/NetworkView.js:339
#: proxmox-yew-comp/src/configuration/network_view.rs:477
msgid "Ports/Slaves"
-msgstr "端口/从属"
+msgstr "端口/从属设备"
#: proxmox-widget-toolkit/src/Utils.js:87 proxmox-yew-comp/src/lib.rs:321
msgid "Portuguese (Brazil)"
@@ -11451,7 +11206,9 @@ msgstr "预定义标记"
msgid ""
"Prefer a fast and local storage, ideally with support for discard and thin-"
"provisioning or sparse files."
-msgstr "更喜欢快速和本地存储,最好支持丢弃和精简配置或稀疏文件。"
+msgstr ""
+"建议选择快速的本地存储,最好支持 discard、精简配置(thin-provisioning)或稀疏"
+"文件。"
#: pve-manager/www/manager6/Utils.js:32
msgid "Premium"
@@ -11469,9 +11226,8 @@ msgid "Preview"
msgstr "预览"
#: proxmox-yew-comp/src/auth_view.rs:432
-#, fuzzy
msgid "Preview Only"
-msgstr "预览"
+msgstr "仅预览"
#: pmg-gui/js/LDAPConfig.js:263
msgid "Primary E-Mail"
@@ -11486,9 +11242,8 @@ msgid "Primary GPU"
msgstr "主 GPU"
#: pve-manager/www/manager6/sdn/ZoneBridgesPanel.js:85
-#, fuzzy
msgid "Primary VLAN"
-msgstr "主 GPU"
+msgstr "主 VLAN"
#: pve-manager/www/manager6/storage/PBSEdit.js:119
msgid "Print Key"
@@ -11497,7 +11252,7 @@ msgstr "打印密钥"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:187
#: proxmox-yew-comp/src/tfa/tfa_add_recovery.rs:152
msgid "Print Recovery Keys"
-msgstr "打印还原密钥"
+msgstr "打印恢复密钥"
#: pve-manager/www/manager6/storage/PBSEdit.js:114
msgid "Print as paperkey, laminated and placed in secure vault."
@@ -11532,13 +11287,12 @@ msgstr "特权"
#: pve-manager/www/manager6/dc/RoleView.js:65
#: proxmox-yew-comp/src/role_selector.rs:29
msgid "Privileges"
-msgstr "特权"
+msgstr "权限"
#. TRANSLATORS: Probe is a verb here
#: proxmox-datacenter-manager/ui/src/remotes/add_wizard.rs:100
-#, fuzzy
msgid "Probe Remote"
-msgstr "源远程"
+msgstr "探测远程"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:152
#: pve-manager/www/manager6/ceph/OSDDetails.js:169
@@ -11551,7 +11305,6 @@ msgid "Processing..."
msgstr "处理中..."
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:178
-#, fuzzy
msgid "Processor"
msgstr "处理器"
@@ -11570,12 +11323,11 @@ msgstr "产品"
#: proxmox-widget-toolkit/src/Utils.js:1384
#: proxmox-widget-toolkit/src/Utils.js:1391
msgid "Production-ready Enterprise repository enabled"
-msgstr "已启用生产就绪的企业存储库"
+msgstr "已启用适用于生产环境的企业版软件源"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:709
-#, fuzzy
msgid "Production-ready enterprise repository enabled"
-msgstr "已启用生产就绪的企业存储库"
+msgstr "已启用生产就绪企业仓库"
#: pmg-gui/js/LDAPGroupEditor.js:80 pmg-gui/js/LDAPProfileSelector.js:28
#: pmg-gui/js/LDAPUserEditor.js:36
@@ -11640,7 +11392,7 @@ msgstr "保护"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:97
msgid "Protection for \"Speculative Store Bypass\" for Intel models"
-msgstr ""
+msgstr "为 Intel 型号提供\"推测性存储绕过\"保护"
#: pmg-gui/js/FetchmailEdit.js:41 pmg-gui/js/FetchmailView.js:113
#: pmg-gui/js/LDAPConfig.js:70 pmg-gui/js/LDAPConfig.js:591
@@ -11659,12 +11411,11 @@ msgstr "协议"
#: proxmox-backup/www/window/S3ClientEdit.js:141
msgid "Provider Quirks"
-msgstr ""
+msgstr "提供商特性"
#: proxmox-yew-comp/src/proxmox_product.rs:60
-#, fuzzy
msgid "Proxmox Backup Server"
-msgstr "Proxmox Backup Server 登录"
+msgstr "Proxmox 备份服务器"
#: proxmox-backup/www/LoginView.js:274
msgid "Proxmox Backup Server Login"
@@ -11672,12 +11423,11 @@ msgstr "Proxmox Backup Server 登录"
#: proxmox-yew-comp/src/proxmox_product.rs:62
msgid "Proxmox Datacenter Manager"
-msgstr ""
+msgstr "Proxmox 数据中心管理器"
#: proxmox-yew-comp/src/proxmox_product.rs:59
-#, fuzzy
msgid "Proxmox Mail Gateway"
-msgstr "Proxmox Mail Gateway 登录"
+msgstr "Proxmox 邮件网关"
#: pmg-gui/js/LoginView.js:332
msgid "Proxmox Mail Gateway Login"
@@ -11689,7 +11439,7 @@ msgstr "Proxmox Mail Gateway 隔离帮助"
#: proxmox-yew-comp/src/proxmox_product.rs:61
msgid "Proxmox Offline Mirror"
-msgstr ""
+msgstr "Proxmox 离线镜像"
#: pve-manager/www/manager6/window/LoginWindow.js:351
msgid "Proxmox VE Login"
@@ -11697,7 +11447,7 @@ msgstr "Proxmox VE 登录"
#: proxmox-yew-comp/src/proxmox_product.rs:58
msgid "Proxmox Virtual Environment"
-msgstr ""
+msgstr "Proxmox 虚拟环境"
#: pve-manager/www/manager6/window/Backup.js:112
#: pve-manager/www/manager6/window/Prune.js:212 proxmox-backup/www/Utils.js:450
@@ -11711,7 +11461,7 @@ msgstr "精简 & GC 作业"
#: proxmox-backup/www/datastore/Content.js:1065
msgid "Prune '{0}'"
-msgstr "精简 '{0}'"
+msgstr "精简'{0}'"
#: proxmox-backup/www/datastore/Content.js:1348
msgid "Prune All"
@@ -11719,7 +11469,7 @@ msgstr "全部精简"
#: pve-manager/www/manager6/window/Prune.js:238
msgid "Prune Backups for '{0}' on Storage '{1}'"
-msgstr "删除存储 '{1}' 上 '{0}' 的备份"
+msgstr "删除存储'{1}'上'{0}'的备份"
#: proxmox-backup/www/Utils.js:451 proxmox-backup/www/window/PruneJobEdit.js:12
msgid "Prune Job"
@@ -11794,11 +11544,11 @@ msgstr "拉取文件"
#: pve-manager/www/manager6/storage/TemplateView.js:188
#: pve-manager/www/manager6/storage/TemplateView.js:375
msgid "Pull from OCI Registry"
-msgstr ""
+msgstr "从 OCI 注册表拉取"
#: proxmox-backup/www/config/SyncView.js:367
msgid "Pull: The local owner."
-msgstr "拉取: 本地所有者。"
+msgstr "拉取: 本地所有者。"
#: pve-manager/www/manager6/window/SafeDestroyGuest.js:13
msgid "Purge from job configurations"
@@ -11806,7 +11556,7 @@ msgstr "从作业配置中清除"
#: pve-manager/www/manager6/window/ConfirmRemoveResource.js:13
msgid "Purge resource from referenced HA rules"
-msgstr ""
+msgstr "从引用的 HA 规则中清除资源"
#: proxmox-backup/www/config/SyncView.js:316
msgid "Push"
@@ -11820,16 +11570,15 @@ msgstr "推送文件"
#: proxmox-backup/www/config/SyncView.js:368
msgid "Push: The local user used for access control."
-msgstr "推送:用于访问控制的本地用户。"
+msgstr "推送: 用于访问控制的本地用户。"
#: pve-manager/www/manager6/qemu/PCIEdit.js:43
msgid "Q35 only"
msgstr "仅 Q35"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_agent_property.rs:112
-#, fuzzy
msgid "QEMU Guest Agent"
-msgstr "Qemu 代理"
+msgstr "QEMU 客户机代理"
#: pve-manager/www/manager6/form/DiskFormatSelector.js:6
#: proxmox-yew-comp/src/form/pve/qemu_disk_format_selector.rs:80
@@ -11860,9 +11609,8 @@ msgid "Quarantine port"
msgstr "隔离端口"
#: pve-manager/www/manager6/storage/TemplateView.js:296
-#, fuzzy
msgid "Query Tags"
-msgstr "排除标记"
+msgstr "查询标签"
#: pve-manager/www/manager6/node/ACME.js:127
#: pve-manager/www/manager6/window/DownloadUrlToStorage.js:151
@@ -11876,7 +11624,7 @@ msgstr "查询用户信息端点"
#: proxmox-datacenter-manager/ui/src/pbs/tree.rs:287
#: proxmox-datacenter-manager/ui/src/pve/tree.rs:598
msgid "Querying Remote..."
-msgstr ""
+msgstr "正在查询远程..."
#: pmg-gui/js/QueueAdministration.js:5
msgid "Queue Administration"
@@ -11892,7 +11640,7 @@ msgstr "具有法定数目的"
#: pve-manager/www/manager6/ceph/Monitor.js:27
msgid "Quorum"
-msgstr "法定数目"
+msgstr "仲裁有效"
#: pve-manager/www/manager6/node/ZFS.js:71
#: proxmox-backup/www/window/ZFSCreate.js:40
@@ -11904,9 +11652,8 @@ msgid "RAM"
msgstr "内存"
#: proxmox-yew-comp/src/node_info.rs:179
-#, fuzzy
msgid "RAM Usage"
-msgstr "内存使用率"
+msgstr "RAM 使用率"
#: pmg-gui/js/ClusterAdministration.js:313 pmg-gui/js/dashboard/NodeInfo.js:43
#: pve-manager/www/manager6/node/StatusView.js:54
@@ -11919,11 +11666,11 @@ msgstr "内存使用率"
#: pve-manager/www/manager6/node/NodeOptionsView.js:75
msgid "RAM usage target for ballooning"
-msgstr ""
+msgstr "内存气球的 RAM 使用目标"
#: pve-manager/www/manager6/storage/RBDEdit.js:250
msgid "RBD namespaces must be created manually!"
-msgstr "必须手动创建RBD命名空间!"
+msgstr "必须手动创建 RBD 命名空间!"
#: pve-manager/www/manager6/qemu/Options.js:271
#: pve-manager/www/manager6/qemu/Options.js:276
@@ -11942,9 +11689,8 @@ msgid "Randomize"
msgstr "随机化"
#: proxmox-yew-comp/src/firewall/log_ratelimit_field.rs:179
-#, fuzzy
msgid "Rate"
-msgstr "入口速率"
+msgstr "速率"
#: proxmox-backup/www/config/TrafficControlView.js:134
#: proxmox-backup/www/window/S3ClientEdit.js:127
@@ -11983,7 +11729,7 @@ msgstr "速率限制"
#: pve-manager/www/manager6/node/Certificates.js:99
msgid "Raw Certificate"
-msgstr "原始凭证"
+msgstr "原始证书"
#: pve-manager/www/manager6/qemu/PCIEdit.js:214
msgid "Raw Device"
@@ -12170,9 +11916,8 @@ msgid "Reboot"
msgstr "重启"
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:215
-#, fuzzy
msgid "Reboot Datacenter Manager"
-msgstr "Proxmox Backup Server 登录"
+msgstr "重启数据中心管理器"
#: proxmox-backup/www/ServerStatus.js:146
msgid "Reboot backup server?"
@@ -12181,7 +11926,7 @@ msgstr "重新启动备份服务器?"
#: pve-manager/www/manager6/node/Config.js:105
#: pve-yew-mobile-gui/src/pages/page_node_status/dashboard_panel.rs:136
msgid "Reboot node '{0}'?"
-msgstr "重启节点 '{0}'?"
+msgstr "重启节点'{0}'?"
#: pve-manager/www/manager6/lxc/CmdMenu.js:84
#: pve-manager/www/manager6/lxc/Config.js:76
@@ -12201,9 +11946,8 @@ msgid "Receiver"
msgstr "接收者"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:215
-#, fuzzy
msgid "Recent backups"
-msgstr "保留所有备份"
+msgstr "最近的备份"
#: proxmox-backup/www/tape/window/TapeBackupJob.js:275
#: proxmox-backup/www/window/NotifyOptions.js:107
@@ -12234,9 +11978,8 @@ msgid "Recovery Keys"
msgstr "还原密钥"
#: proxmox-yew-comp/src/tfa/tfa_add_recovery.rs:119
-#, fuzzy
msgid "Recovery Keys for user '{}'"
-msgstr "还原密钥"
+msgstr "用户 '{}' 的恢复密钥"
#: proxmox-backup/www/panel/PrunePanel.js:100
msgid "Recursive"
@@ -12244,7 +11987,7 @@ msgstr "递归的"
#: pve-manager/www/manager6/storage/TemplateView.js:273
msgid "Reference"
-msgstr ""
+msgstr "引用"
#: pve-manager/www/manager6/window/SafeDestroyGuest.js:35
msgid "Referenced disks will always be destroyed."
@@ -12259,32 +12002,29 @@ msgid "Refresh"
msgstr "刷新"
#: proxmox-datacenter-manager/ui/src/dashboard/refresh_config_edit.rs:55
-#, fuzzy
msgid "Refresh Configuration"
-msgstr "保留配置"
+msgstr "刷新配置"
#: proxmox-datacenter-manager/ui/src/dashboard/refresh_config_edit.rs:78
msgid "Refresh Interval (seconds)"
-msgstr ""
+msgstr "刷新间隔(秒)"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:464
-#, fuzzy
msgid "Refresh all"
-msgstr "刷新"
+msgstr "全部刷新"
#: proxmox-backup/www/datastore/Content.js:1332
msgid "Refresh contents from S3 bucket"
-msgstr ""
+msgstr "从 S3 存储桶刷新内容"
#: proxmox-datacenter-manager/ui/src/dashboard/status_row.rs:170
-#, fuzzy
msgid "Refresh now"
-msgstr "刷新"
+msgstr "立即刷新"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:484
msgid ""
"Refresh the status of the repository and pending updates for all remotes"
-msgstr ""
+msgstr "刷新所有远程的仓库状态和待处理更新"
#: pve-manager/www/manager6/qemu/CloudInit.js:79
msgid "Regenerate Image"
@@ -12300,7 +12040,7 @@ msgid ""
"Regenerate the secret of the API token '{0}'? All users of the previous "
"token secret will lose access!"
msgstr ""
-"是否重新生成API令牌'{0}'的机密?之前令牌密钥的所有用户都将失去访问权限!"
+"是否重新生成 API 令牌'{0}'的密钥?之前令牌密钥的所有用户都将失去访问权限!"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1304
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1374
@@ -12312,7 +12052,7 @@ msgstr "正则表达式"
#: proxmox-backup/www/config/S3ClientView.js:128
#: proxmox-backup/www/window/S3ClientEdit.js:82
msgid "Region"
-msgstr ""
+msgstr "区域"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:12
#: pve-manager/www/manager6/Utils.js:2081
@@ -12347,7 +12087,6 @@ msgid "Regular Expression"
msgstr "正则表达式"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:21
-#, fuzzy
msgid "Reject"
msgstr "拒绝"
@@ -12410,13 +12149,12 @@ msgid "Reload"
msgstr "重载"
#: proxmox-datacenter-manager/ui/src/tasks.rs:77
-#, fuzzy
msgid "Reload network configuration"
-msgstr "重新加载所有节点上的网络配置"
+msgstr "重新加载网络配置"
#: pve-manager/www/manager6/Utils.js:2145
msgid "Reload network configuration on all nodes"
-msgstr "重新加载所有节点上的网络配置"
+msgstr "重新读取所有节点上的网络配置"
#: pmg-gui/js/TFAView.js:27 proxmox-backup/www/config/WebauthnView.js:11
#: proxmox-backup/www/config/WebauthnView.js:82
@@ -12443,9 +12181,8 @@ msgstr "远程"
#: proxmox-datacenter-manager/ui/src/pbs/mod.rs:128
#: proxmox-datacenter-manager/ui/src/pve/remote/mod.rs:48
#: proxmox-datacenter-manager/ui/src/pve/mod.rs:242
-#, fuzzy
msgid "Remote '{0}'"
-msgstr "移除 '{0}'"
+msgstr "远程 '{0}'"
#: proxmox-backup/www/config/RemoteView.js:129
#: proxmox-backup/www/config/SyncView.js:340
@@ -12459,41 +12196,36 @@ msgid "Remote ID"
msgstr "远程 ID"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:424
-#, fuzzy
msgid "Remote Migration Settings"
-msgstr "迁移设置"
+msgstr "远程迁移设置"
#: proxmox-backup/www/config/SyncView.js:353
msgid "Remote Namespace"
msgstr "远程命名空间"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:544
-#, fuzzy
msgid "Remote Panel"
-msgstr "远程同步"
+msgstr "远程面板"
#: proxmox-backup/www/config/SyncView.js:347
msgid "Remote Store"
msgstr "远程存储"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:163
-#, fuzzy
msgid "Remote Subscription Status"
-msgstr "订阅"
+msgstr "远程订阅状态"
#: proxmox-backup/www/Utils.js:455 proxmox-backup/www/Utils.js:456
msgid "Remote Sync"
msgstr "远程同步"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:477
-#, fuzzy
msgid "Remote System Updates"
-msgstr "远程存储"
+msgstr "远程系统更新"
#: proxmox-datacenter-manager/ui/src/pve/remote/mod.rs:58
-#, fuzzy
msgid "Remote Tasks"
-msgstr "显示所有任务"
+msgstr "远程任务"
#: proxmox-backup/www/NavigationTree.js:54
#: proxmox-backup/www/config/RemoteView.js:39
@@ -12504,9 +12236,8 @@ msgid "Remotes"
msgstr "远程"
#: proxmox-backup/www/window/DataStoreEdit.js:63
-#, fuzzy
msgid "Removable"
-msgstr "移除"
+msgstr "可移除"
#: proxmox-backup/www/window/CreateDirectory.js:59
msgid "Removable datastore"
@@ -12519,7 +12250,7 @@ msgstr "未挂载可移动数据存储"
#: pve-manager/www/manager6/grid/Replication.js:343
#: pve-manager/www/manager6/grid/Replication.js:346
msgid "Removal Scheduled"
-msgstr "移除已安排"
+msgstr "已计划移除"
#: proxmox-widget-toolkit/src/button/Button.js:103
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:11
@@ -12578,12 +12309,11 @@ msgstr "移除"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:372
msgid "Remove '{0}'"
-msgstr "移除 '{0}'"
+msgstr "移除'{0}'"
#: proxmox-yew-comp/src/acl/acl_view.rs:214
-#, fuzzy
msgid "Remove ACL Entry"
-msgstr "移除条目?"
+msgstr "删除 ACL 条目"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:424
msgid "Remove ACLs of vanished users"
@@ -12598,9 +12328,8 @@ msgstr "移除消失的用户和组的 ACL。"
#: proxmox-yew-comp/src/auth_view.rs:450
#: proxmox-yew-comp/src/auth_edit_ldap.rs:244
-#, fuzzy
msgid "Remove ACLs of vanished users."
-msgstr "删除已消失用户的 ACL"
+msgstr "删除已消失用户的 ACL。"
#: pmg-gui/js/Utils.js:652
msgid "Remove Attachments"
@@ -12624,9 +12353,8 @@ msgid "Remove Namespace"
msgstr "移除命名空间"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:481
-#, fuzzy
msgid "Remove Row"
-msgstr "移除"
+msgstr "删除行"
#: pmg-gui/js/PBSSnapshotView.js:146
msgid "Remove Schedule"
@@ -12659,7 +12387,7 @@ msgstr "移除所有的附件"
#: proxmox-backup/www/datastore/OptionView.js:23
msgid "Remove data from S3 bucket and local cache (dangerous!)"
-msgstr ""
+msgstr "从 S3 存储桶和本地缓存中删除数据(危险!)"
#: proxmox-backup/www/config/PruneView.js:177
#: proxmox-backup/www/config/SyncView.js:248
@@ -12674,20 +12402,19 @@ msgstr "从复制和备份作业中移除"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:375
msgid "Remove mapping '{0}'"
-msgstr "移除映射 '{0}'"
+msgstr "移除映射'{0}'"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:374
msgid "Remove mapping for '{0}'"
-msgstr "删除 '{0}' 的映射"
+msgstr "删除'{0}'的映射"
#: proxmox-backup/www/datastore/Content.js:1088
msgid "Remove namespace '{0}'"
-msgstr "移除命名空间 '{0}'"
+msgstr "移除命名空间'{0}'"
#: proxmox-yew-comp/src/configuration/pve/lxc_network_panel.rs:193
-#, fuzzy
msgid "Remove network failed"
-msgstr "无网络设备"
+msgstr "删除网络失败"
#: proxmox-backup/www/window/SyncJobEdit.js:406
msgid ""
@@ -12697,9 +12424,8 @@ msgstr "如果快照从源数据存储中消失,是否从同步目标数据存
#: proxmox-yew-comp/src/auth_view.rs:462
#: proxmox-yew-comp/src/auth_edit_ldap.rs:256
-#, fuzzy
msgid "Remove vanished properties"
-msgstr "删除消失的用户"
+msgstr "删除已消失的属性"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:436
#: proxmox-widget-toolkit/src/window/SyncWindow.js:125
@@ -12713,14 +12439,14 @@ msgstr "从同步用户中移除已消失的属性。"
#: proxmox-yew-comp/src/auth_view.rs:456
#: proxmox-yew-comp/src/auth_edit_ldap.rs:250
msgid "Remove vanished user"
-msgstr "删除消失的用户"
+msgstr "移除已消失的用户"
#: proxmox-widget-toolkit/src/window/SyncWindow.js:118
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:342
#: pve-manager/www/manager6/dc/RealmSyncJob.js:377
#: pve-manager/www/manager6/dc/SyncWindow.js:140
msgid "Remove vanished user and group entries."
-msgstr "移除消失的用户和组条目。"
+msgstr "移除已消失的用户和组条目。"
#: proxmox-backup/www/config/GCView.js:217
msgid "Removed Data"
@@ -12730,7 +12456,7 @@ msgstr "已删除的数据"
#: proxmox-datacenter-manager/ui/src/tasks.rs:13
#: proxmox-yew-comp/src/utils/mod.rs:358
msgid "Renew Certificate"
-msgstr "更新凭证"
+msgstr "更新证书"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:260
msgid "Repeat missed"
@@ -12752,9 +12478,8 @@ msgid "Replication Log"
msgstr "复制日志"
#: pve-manager/www/manager6/dc/OptionView.js:132
-#, fuzzy
msgid "Replication Settings"
-msgstr "迁移设置"
+msgstr "复制设置"
#: pve-manager/www/manager6/Utils.js:2185
msgid "Replication job notifications"
@@ -12769,7 +12494,7 @@ msgstr "复制至少需要两个节点"
#: proxmox-backup/www/ServerAdministration.js:58
#: proxmox-datacenter-manager/ui/src/administration/mod.rs:102
msgid "Repositories"
-msgstr "存储库"
+msgstr "软件源"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:25
#: proxmox-widget-toolkit/src/node/APTRepositories.js:58
@@ -12778,12 +12503,12 @@ msgstr "存储库"
#: proxmox-yew-comp/src/apt_repositories.rs:747
#: proxmox-yew-comp/src/apt_repositories.rs:777
msgid "Repository"
-msgstr "存储库"
+msgstr "软件源"
#: proxmox-widget-toolkit/src/panel/NodeInfoRepoStatus.js:5
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:196
msgid "Repository Status"
-msgstr "存储库状态"
+msgstr "软件源状态"
#: proxmox-backup/www/window/DatastoreRepoInfo.js:65
msgid "Repository for CLI and API"
@@ -12804,12 +12529,12 @@ msgstr "需要 TFA"
#: proxmox-yew-comp/src/form/pve/qemu_cpu_flags_list.rs:94
msgid "Required to let the guest OS know if MDS is mitigated correctly"
-msgstr ""
+msgstr "用于告知客户机操作系统 MDS 缓解措施是否已正确启用"
#: pve-manager/www/manager6/panel/IPView.js:233
#: pve-manager/www/manager6/panel/IPView.js:296
msgid "Requires '{0}' Privileges"
-msgstr "需要 '{0}' 权限"
+msgstr "需要'{0}'权限"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:11
#: pmg-gui/js/Settings.js:160 pmg-gui/js/Settings.js:181
@@ -12843,9 +12568,8 @@ msgid "Reset rule database to factory defaults?"
msgstr "将规则数据库重置为出厂默认值?"
#: pve-manager/www/manager6/qemu/CmdMenu.js:118
-#, fuzzy
msgid "Reset {0}"
-msgstr "使用 {0}"
+msgstr "重置 {0}"
#: pve-manager/www/manager6/qemu/Config.js:219
msgid "Reset {0} immediately"
@@ -12864,7 +12588,6 @@ msgid "Resize"
msgstr "调整大小"
#: proxmox-yew-comp/src/configuration/pve/resize_disk_dialog.rs:16
-#, fuzzy
msgid "Resize Disk"
msgstr "调整磁盘大小"
@@ -12880,14 +12603,12 @@ msgid "Resource"
msgstr "资源"
#: pve-manager/www/manager6/dc/MetricServerView.js:704
-#, fuzzy
msgid "Resource Attributes (JSON)"
-msgstr "用户属性名称"
+msgstr "资源属性(JSON)"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:271
-#, fuzzy
msgid "Resource ID"
-msgstr "资源"
+msgstr "资源 ID"
#: pve-manager/www/manager6/dc/Config.js:391
msgid "Resource Mappings"
@@ -12903,14 +12624,12 @@ msgid "Resource Pool"
msgstr "资源池"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:642
-#, fuzzy
msgid "Resource Tree"
-msgstr "资源"
+msgstr "资源树"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:269
-#, fuzzy
msgid "Resource Type"
-msgstr "资源"
+msgstr "资源类型"
#: pve-manager/www/manager6/dc/Summary.js:26
#: pve-manager/www/manager6/ha/Status.js:38
@@ -12941,7 +12660,7 @@ msgstr "重启模式"
#: pmg-gui/js/SpamDetectorCustom.js:96
msgid "Restart pmg-smtp-filter to activate changes."
-msgstr "重新启动 pmg-smtp-filter 以激活更改。"
+msgstr "重新启动 pmg-smtp-filter 以启用更改。"
#: pmg-gui/js/BackupRestore.js:21 pmg-gui/js/BackupRestore.js:24
#: pmg-gui/js/BackupRestore.js:100 pmg-gui/js/BackupRestore.js:140
@@ -13040,7 +12759,7 @@ msgstr "还原"
#: proxmox-datacenter-manager/ui/src/tasks.rs:14
#: proxmox-yew-comp/src/utils/mod.rs:359
msgid "Revoke Certificate"
-msgstr "撤销凭证"
+msgstr "撤销证书"
#: proxmox-backup/www/Utils.js:453
msgid "Rewind Media"
@@ -13103,7 +12822,7 @@ msgstr "根磁盘IO延迟(毫秒)"
#: proxmox-backup/www/ServerStatus.js:267
msgid "Root Disk Input/Output Operations per Second (IOPS)"
-msgstr "每秒根磁盘输入/输出操作(IOPS)"
+msgstr "根磁盘每秒 I/O 操作数(IOPS)"
#: proxmox-backup/www/ServerStatus.js:260
msgid "Root Disk Transfer Rate (bytes/second)"
@@ -13114,9 +12833,8 @@ msgid "Root Disk usage"
msgstr "根磁盘使用率"
#: pve-yew-mobile-gui/src/pages/page_node_status/dashboard_panel.rs:110
-#, fuzzy
msgid "Root Filesystem"
-msgstr "文件系统"
+msgstr "根文件系统"
#: proxmox-backup/www/datastore/Content.js:359
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:107
@@ -13125,7 +12843,7 @@ msgstr "根命名空间"
#: pve-manager/www/manager6/sdn/FabricsContentView.js:7
msgid "Route"
-msgstr ""
+msgstr "路由"
#: pve-manager/www/manager6/sdn/zones/EvpnEdit.js:87
msgid "Route Target Import"
@@ -13139,7 +12857,7 @@ msgstr "路由器广播"
#: pve-manager/www/manager6/sdn/NetworkBrowser.js:34
msgid "Routes"
-msgstr ""
+msgstr "路由"
#: pve-manager/www/manager6/grid/FirewallRules.js:498
#: pve-manager/www/manager6/grid/FirewallRules.js:598
@@ -13185,14 +12903,12 @@ msgid "Run now"
msgstr "现在运行"
#: proxmox-backup/www/window/SyncJobEdit.js:496
-#, fuzzy
msgid "Run on Mount"
-msgstr "现在运行"
+msgstr "挂载时运行"
#: proxmox-backup/www/window/SyncJobEdit.js:500
-#, fuzzy
msgid "Run this job when a relevant removable datastore gets mounted."
-msgstr "未挂载可移动数据存储"
+msgstr "在相关的可移除数据存储挂载时运行此作业。"
#: pve-manager/www/manager6/dc/Guests.js:42
#: pve-manager/www/manager6/dc/Guests.js:87
@@ -13217,39 +12933,33 @@ msgid "S.Port"
msgstr "来源端口"
#: proxmox-backup/www/window/DataStoreEdit.js:64
-#, fuzzy
msgid "S3 (tech preview)"
-msgstr "nftables(技术预览)"
+msgstr "S3(技术预览)"
#: proxmox-backup/www/window/S3ClientEdit.js:10
-#, fuzzy
msgid "S3 Endpoint"
-msgstr "端点名称"
+msgstr "S3 端点"
#: proxmox-backup/www/config/S3ClientView.js:108
#: proxmox-backup/www/form/S3ClientSelector.js:19
#: proxmox-backup/www/window/DataStoreEdit.js:130
#: proxmox-backup/www/window/S3ClientEdit.js:35
-#, fuzzy
msgid "S3 Endpoint ID"
-msgstr "端点名称"
+msgstr "S3 端点 ID"
#: proxmox-backup/www/NavigationTree.js:60
#: proxmox-backup/www/config/S3ClientView.js:15
-#, fuzzy
msgid "S3 Endpoints"
-msgstr "端点名称"
+msgstr "S3 端点"
#: proxmox-backup/www/Utils.js:454
#: proxmox-backup/www/window/MaintenanceOptions.js:99
-#, fuzzy
msgid "S3 Refresh"
-msgstr "刷新"
+msgstr "S3 刷新"
#: proxmox-backup/www/Utils.js:853
-#, fuzzy
msgid "S3 refresh"
-msgstr "刷新"
+msgstr "S3 刷新"
#: pve-manager/www/manager6/qemu/HDEdit.js:204
#: pve-manager/www/manager6/qemu/HardwareView.js:200
@@ -13272,14 +12982,12 @@ msgid "SDN"
msgstr "SDN"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:640
-#, fuzzy
msgid "SDN Panel"
-msgstr "DNS 域"
+msgstr "SDN 面板"
#: proxmox-datacenter-manager/ui/src/dashboard/sdn_zone_panel.rs:179
-#, fuzzy
msgid "SDN Zones"
-msgstr "DNS 域"
+msgstr "SDN 区域"
#: pve-manager/www/manager6/qemu/IPConfigEdit.js:163
msgid "SLAAC"
@@ -13301,9 +13009,8 @@ msgstr "SMTPD 横幅"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:138
#: proxmox-yew-comp/src/firewall/options_edit.rs:481
-#, fuzzy
msgid "SMURF Log Level"
-msgstr "日志级别"
+msgstr "SMURF 日志级别"
#: pve-manager/www/manager6/grid/FirewallOptions.js:73
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:87
@@ -13398,7 +13105,7 @@ msgstr "扫描"
#: proxmox-widget-toolkit/src/window/AddTotp.js:254
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:136
msgid "Scan QR code in a TOTP app and enter an auth. code here"
-msgstr "在 TOTP 应用中扫描 QR 码,然后输入验证码。 在这里输验证码"
+msgstr "在 TOTP 应用中扫描二维码,并在此处输入验证码"
#: pve-manager/www/manager6/window/SafeDestroyGuest.js:29
msgid "Scan all enabled storages for unreferenced disks and delete them."
@@ -13448,7 +13155,7 @@ msgstr "立即安排"
#: pmg-gui/js/PBSSnapshotView.js:171
msgid "Schedule on '{0}'"
-msgstr "'{0}' 上的计划"
+msgstr "'{0}'上的计划"
#: proxmox-backup/www/Utils.js:464
msgid "Scheduled Verification"
@@ -13472,7 +13179,7 @@ msgstr "范围"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:46
#: proxmox-yew-comp/src/auth_edit_openid.rs:126
msgid "Scopes"
-msgstr "范围"
+msgstr "作用域"
#: pmg-gui/js/ReceiverStatistics.js:93 pmg-gui/js/SpamDetectorCustom.js:131
#: pmg-gui/js/SpamDetectorCustom.js:177 pmg-gui/js/SpamDetectorCustom.js:261
@@ -13482,9 +13189,8 @@ msgid "Score"
msgstr "得分"
#: pmg-yew-quarantine-gui/src/spam_list.rs:243
-#, fuzzy
msgid "Score: {0}"
-msgstr "模式:{0}"
+msgstr "得分:{0}"
#: pve-manager/www/manager6/ceph/OSD.js:967
msgid "Scrub"
@@ -13511,7 +13217,7 @@ msgstr "搜索"
#: proxmox-datacenter-manager/ui/src/widget/search_box.rs:151
msgid "Search (Ctrl+Space / Ctrl+Shift+F)"
-msgstr ""
+msgstr "搜索 (Ctrl+Space / Ctrl+Shift+F)"
#: proxmox-widget-toolkit/src/node/DNSEdit.js:19
#: proxmox-widget-toolkit/src/node/DNSView.js:30
@@ -13526,11 +13232,11 @@ msgstr "二次验证"
#: proxmox-widget-toolkit/src/panel/TfaView.js:22
msgid "Second Factors"
-msgstr "二次验证"
+msgstr "二次验证因子"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:6
msgid "Second login factor required"
-msgstr "需要二次登录验证"
+msgstr "需要二次登录验证因子"
#: pve-manager/www/manager6/node/NodeOptionsView.js:59
msgid "Seconds"
@@ -13572,14 +13278,12 @@ msgid "Security Group"
msgstr "安全群组"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:229
-#, fuzzy
msgid "Select"
-msgstr "选择器"
+msgstr "选择"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:219
-#, fuzzy
msgid "Select Date"
-msgstr "选择镜像"
+msgstr "选择日期"
#: pve-manager/www/manager6/window/UploadToStorage.js:200
msgid "Select File"
@@ -13590,9 +13294,8 @@ msgid "Select Image"
msgstr "选择镜像"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:240
-#, fuzzy
msgid "Select Language"
-msgstr "默认语言"
+msgstr "选择语言"
#: proxmox-backup/www/tape/window/TapeRestore.js:316
msgid "Select Media-Set to restore"
@@ -13605,21 +13308,20 @@ msgid "Select Timespan"
msgstr "选择时间范围"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:403
-#, fuzzy
msgid "Select Type first"
-msgstr "选择时间范围"
+msgstr "请先选择类型"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/evpn_panel.rs:342
msgid "Select a Zone or VNet for more details."
-msgstr ""
+msgstr "选择区域或 VNet 以获取更多详细信息。"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/ui_helpers.rs:115
msgid "Select a firewall entry to show its rules."
-msgstr ""
+msgstr "选择防火墙条目以显示其规则。"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:600
msgid "Select a node to show available updates."
-msgstr ""
+msgstr "选择一个节点以显示可用更新。"
#: pve-manager/www/manager6/dc/ClusterEdit.js:316
msgid ""
@@ -13643,7 +13345,7 @@ msgstr "已选的邮件"
#: pve-manager/www/manager6/grid/PoolMembers.js:160
msgid ""
"Selected guests who are already part of a pool will be removed from it first."
-msgstr "已成为池中一部分的选定客人将首先从池中移除。"
+msgstr "已成为池中一部分的选定客户机将首先从池中移除。"
#: pve-manager/www/manager6/dc/Backup.js:813
#: pve-yew-mobile-gui/src/widgets/volume_action_dialog.rs:74
@@ -13695,7 +13397,7 @@ msgstr "发件人/主题"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:136
msgid "Sent test notification to '{0}'."
-msgstr "已向 '{0}' 发送测试通知。"
+msgstr "已向'{0}'发送测试通知。"
#: proxmox-backup/www/tape/BackupOverview.js:378
msgid "Seq. Nr."
@@ -13715,7 +13417,7 @@ msgstr "序号."
#: proxmox-backup/www/tape/form/TapeDevicePathSelector.js:36
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_smbios1_property.rs:61
msgid "Serial"
-msgstr "串行"
+msgstr "序列号"
#: pve-manager/www/manager6/qemu/HardwareView.js:327
#: pve-manager/www/manager6/qemu/HardwareView.js:783
@@ -13726,11 +13428,11 @@ msgstr "串行端口"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:56
msgid "Serial interface '{0}' is not correctly configured."
-msgstr "串行接口 '{0}' 未正确配置。"
+msgstr "串行接口'{0}'未正确配置。"
#: pve-manager/www/manager6/window/GuestImport.js:1015
msgid "Serial socket '{0}' will be mapped to a socket"
-msgstr "串行 socket '{0}' 将映射到 socket"
+msgstr "串行 socket'{0}'将映射到 socket"
#: pve-manager/www/manager6/Utils.js:610 pve-manager/www/manager6/Utils.js:611
#: pve-manager/www/manager6/Utils.js:612 pve-manager/www/manager6/Utils.js:613
@@ -13783,7 +13485,6 @@ msgstr "服务器 ID"
#: proxmox-datacenter-manager/ui/src/pbs/node/overview.rs:246
#: proxmox-datacenter-manager/ui/src/pve/node/overview.rs:152
#: proxmox-datacenter-manager/ui/src/pve/node/overview.rs:250
-#, fuzzy
msgid "Server Load"
msgstr "服务器负载"
@@ -13804,7 +13505,7 @@ msgstr "服务器视图"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_connect.rs:251
msgid ""
"Server certificate SHA-256 fingerprint, required for self-signed certificates"
-msgstr "服务器凭证 SHA-256 指纹,对于自签名凭证是必需的"
+msgstr "服务器证书 SHA-256 指纹,自签名证书必须提供"
#: proxmox-backup/www/window/RemoteEdit.js:116
#: proxmox-backup/www/window/S3ClientEdit.js:115
@@ -13876,7 +13577,7 @@ msgstr "设定状态"
#: proxmox-widget-toolkit/src/window/AuthEditSimple.js:25
#: pmg-gui/js/AuthEditOIDC.js:98
msgid "Set realm as default for login"
-msgstr "将域设置为登录的默认值"
+msgstr "设置此领域为登录默认值"
#: pmg-gui/js/MailProxyDKIMPanel.js:30 pmg-gui/js/MailProxyTLSPanel.js:21
#: pve-manager/www/manager6/window/Snapshot.js:110
@@ -13892,11 +13593,11 @@ msgstr "设置保存在浏览器的本地存储中"
#: proxmox-widget-toolkit/src/window/AddWebauthn.js:93
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:196
msgid "Setup"
-msgstr "设定"
+msgstr "设置"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1068
msgid "Severities to match"
-msgstr "匹配的严重性"
+msgstr "匹配的严重性级别"
#: pve-manager/www/manager6/ceph/Status.js:138
#: pve-manager/www/manager6/dc/Log.js:73
@@ -13932,14 +13633,12 @@ msgid "Shell"
msgstr "Shell"
#: proxmox-yew-comp/src/utils/mod.rs:241
-#, fuzzy
msgid "Shell (Spice)"
-msgstr "Shell(JS)"
+msgstr "Shell (Spice)"
#: proxmox-yew-comp/src/utils/mod.rs:242
-#, fuzzy
msgid "Shell (VNC)"
-msgstr "Shell(JS)"
+msgstr "Shell(VNC)"
#: pmg-gui/js/SpamQuarantineOptions.js:15
msgid "Short"
@@ -13978,9 +13677,8 @@ msgid "Show Fingerprint"
msgstr "显示指纹"
#: proxmox-datacenter-manager/ui/src/top_nav_bar.rs:208
-#, fuzzy
msgid "Show Local Tasks"
-msgstr "显示所有任务"
+msgstr "显示本地任务"
#: proxmox-backup/www/config/GCView.js:156
#: proxmox-backup/www/config/PruneView.js:183
@@ -13991,9 +13689,8 @@ msgid "Show Log"
msgstr "显示日志"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:486
-#, fuzzy
msgid "Show Password"
-msgstr "新密码"
+msgstr "显示密码"
#: pve-manager/www/manager6/dc/TokenView.js:109
#: proxmox-backup/www/config/TokenView.js:225
@@ -14004,9 +13701,8 @@ msgid "Show Permissions"
msgstr "显示权限"
#: proxmox-datacenter-manager/ui/src/top_nav_bar.rs:213
-#, fuzzy
msgid "Show Remote Tasks"
-msgstr "显示所有任务"
+msgstr "显示远程任务"
#: proxmox-widget-toolkit/src/panel/DiskList.js:393
msgid "Show S.M.A.R.T. values"
@@ -14018,7 +13714,7 @@ msgstr "显示用户"
#: proxmox-widget-toolkit/src/node/APT.js:176
msgid "Show details"
-msgstr "显示详细信息"
+msgstr "显示详情"
#: pve-manager/www/manager6/dc/Backup.js:658
msgid ""
@@ -14031,12 +13727,11 @@ msgstr "仅显示已安装的服务"
#: proxmox-datacenter-manager/ui/src/remotes/firewall/tree.rs:343
msgid "Show tree panel"
-msgstr ""
+msgstr "显示树面板"
#: proxmox-datacenter-manager/ui/src/dashboard/tasks.rs:158
-#, fuzzy
msgid "Show: {0} - {1}"
-msgstr "{0} 的 {1}"
+msgstr "显示:{0} - {1}"
#: pmg-gui/js/ServerStatus.js:74 pmg-gui/js/ServerStatus.js:76
#: pve-manager/www/manager6/Utils.js:2111
@@ -14068,9 +13763,8 @@ msgid "Shutdown"
msgstr "关机"
#: proxmox-datacenter-manager/ui/src/administration/node_status.rs:226
-#, fuzzy
msgid "Shutdown Datacenter Manager"
-msgstr "Proxmox Backup Server 登录"
+msgstr "关闭数据中心管理器"
#: pve-manager/www/manager6/dc/OptionView.js:169
msgid "Shutdown Policy"
@@ -14083,7 +13777,7 @@ msgstr "关闭备份服务器?"
#: pve-manager/www/manager6/node/Config.js:116
#: pve-yew-mobile-gui/src/pages/page_node_status/dashboard_panel.rs:141
msgid "Shutdown node '{0}'?"
-msgstr "关闭节点 '{0}' ?"
+msgstr "关闭节点'{0}' ?"
#: pve-manager/www/manager6/qemu/CreateWizard.js:149
#: pve-manager/www/manager6/window/StartupEdit.js:49
@@ -14093,7 +13787,7 @@ msgstr "关机超时"
#: pve-manager/www/manager6/qemu/Config.js:167
msgid "Shutdown, apply pending changes and reboot {0}"
-msgstr "关闭,应用挂起的更改并重新启动{0}"
+msgstr "关闭,应用挂起的更改并重新启动 {0}"
#: pmg-gui/js/MailProxyDKIMPanel.js:6
msgid "Sign Domain"
@@ -14138,7 +13832,7 @@ msgstr "模拟"
#: proxmox-widget-toolkit/src/panel/LogView.js:324
#: pmg-gui/js/QuarantineList.js:320 proxmox-yew-comp/src/tasks.rs:417
msgid "Since"
-msgstr "有效期自"
+msgstr "自"
#: pve-manager/www/manager6/node/ZFS.js:75
#: proxmox-backup/www/window/ZFSCreate.js:44
@@ -14147,12 +13841,11 @@ msgstr "单磁盘"
#: pmg-gui/js/DNSBLSitesField.js:149
msgid "Site"
-msgstr ""
+msgstr "站点"
#: pmg-gui/js/DNSBLSitesField.js:72
-#, fuzzy
msgid "Site must not be empty."
-msgstr "标签不能为空。"
+msgstr "站点不能为空。"
#: proxmox-widget-toolkit/src/form/DiskSelector.js:30
#: proxmox-widget-toolkit/src/form/MultiDiskSelector.js:112
@@ -14195,7 +13888,7 @@ msgstr "跳过证书验证"
#: proxmox-backup/www/window/S3ClientEdit.js:146
msgid "Skip If-None-Match header"
-msgstr ""
+msgstr "跳过 If-None-Match 头部"
#: proxmox-backup/www/config/VerifyView.js:233
#: proxmox-backup/www/window/VerifyAll.js:80
@@ -14214,7 +13907,7 @@ msgstr "跳过复制"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:389
#: proxmox-yew-comp/src/configuration/network_edit.rs:223
msgid "Slaves"
-msgstr "从属"
+msgstr "从属设备"
#: pve-manager/www/manager6/window/GuestImport.js:819
msgid "Slot"
@@ -14260,20 +13953,19 @@ msgid "Snapshots"
msgstr "快照"
#: pve-manager/www/manager6/storage/Base.js:106
-#, fuzzy
msgid "Snapshots as Volume-Chain are a technology preview."
-msgstr "存储管理快照是一种技术预览。"
+msgstr "Snapshots as Volume-Chain 是技术预览功能。"
#: pve-manager/www/manager6/Utils.js:698
#: pve-manager/www/manager6/storage/Browser.js:125
#: proxmox-datacenter-manager/ui/src/pve/utils.rs:295
msgid "Snippets"
-msgstr "片段"
+msgstr "配置片段"
#: proxmox-widget-toolkit/src/Schema.js:97
#: proxmox-widget-toolkit/src/Utils.js:1160
msgid "Socket"
-msgstr "插槽"
+msgstr "套接字"
#: proxmox-widget-toolkit/src/Utils.js:1160 pmg-gui/js/Subscription.js:138
#: pve-manager/www/manager6/node/Subscription.js:136
@@ -14283,7 +13975,7 @@ msgstr "插槽"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:82
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_processor_property.rs:179
msgid "Sockets"
-msgstr "插槽"
+msgstr "CPU 插槽数"
#: proxmox-widget-toolkit/src/Schema.js:95
msgid "Softlink"
@@ -14300,11 +13992,11 @@ msgstr "部分套件配置错误"
#: proxmox-yew-widget-toolkit/src/widget/data_table/header_widget.rs:630
msgid "Sort Ascending"
-msgstr ""
+msgstr "升序排序"
#: proxmox-yew-widget-toolkit/src/widget/data_table/header_widget.rs:638
msgid "Sort Descending"
-msgstr ""
+msgstr "降序排序"
#: pve-manager/www/manager6/window/TreeSettingsEdit.js:22
msgid "Sort Key"
@@ -14359,7 +14051,7 @@ msgstr "源端口"
#: proxmox-yew-comp/src/configuration/network_edit.rs:156
#: proxmox-yew-comp/src/configuration/network_edit.rs:225
msgid "Space-separated list of interfaces, for example: enp0s0 enp1s0"
-msgstr "以空格分隔的接口列表,例如:enp0s0 enp1s0"
+msgstr "以空格分隔的网络接口列表,例如:enp0s0 enp1s0"
#: pmg-gui/js/DomainStatistics.js:105 pmg-gui/js/ReceiverStatistics.js:179
msgid "Spam"
@@ -14509,14 +14201,12 @@ msgid "Start at boot"
msgstr "开机自启动"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:101
-#, fuzzy
msgid "Start backup now"
-msgstr "立即备份"
+msgstr "立即开始备份"
#: proxmox-yew-comp/src/form/pve/qemu_property/mod.rs:128
-#, fuzzy
msgid "Start on boot"
-msgstr "开机自启动"
+msgstr "开机启动"
#: pve-manager/www/manager6/node/NodeOptionsView.js:48
msgid "Start on boot delay"
@@ -14730,7 +14420,7 @@ msgstr "停止 OSD"
#: pve-manager/www/manager6/qemu/CmdMenu.js:98
#: pve-manager/www/manager6/qemu/Config.js:206
msgid "Stop {0} immediately"
-msgstr "立即停止{0}"
+msgstr "立即停止 {0}"
#: pve-manager/www/manager6/ceph/Services.js:178
#: pve-manager/www/manager6/dc/Guests.js:58
@@ -14770,14 +14460,12 @@ msgid "Storage"
msgstr "存储"
#: proxmox-datacenter-manager/ui/src/pve/storage.rs:234
-#, fuzzy
msgid "Storage '{0}'"
-msgstr "存储"
+msgstr "存储 '{0}'"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:314
-#, fuzzy
msgid "Storage (Proxmox VE)"
-msgstr "Proxmox VE"
+msgstr "存储 (Proxmox VE)"
#: proxmox-backup/www/NavigationTree.js:105
#: proxmox-backup/www/panel/StorageAndDisks.js:6
@@ -14790,9 +14478,8 @@ msgstr "存储保留配置"
#: pve-yew-mobile-gui/src/widgets/mod.rs:53
#: proxmox-yew-comp/src/form/pve/pve_storage_selector.rs:244
-#, fuzzy
msgid "Storage size/usage unknown"
-msgstr "存储使用"
+msgstr "存储大小/使用情况未知"
#: proxmox-backup/www/datastore/Summary.js:341
msgid "Storage usage"
@@ -14811,22 +14498,21 @@ msgid ""
"Storage(s) ({0}) not available on selected target. Start VM to use live "
"storage migration or select other target node."
msgstr ""
-"所选目标上的存储({0}) 不可用。启动虚拟机以使用实时存储迁移或选择其他目标节"
+"所选目标上的存储 ({0}) 不可用。启动虚拟机以使用实时存储迁移或选择其他目标节"
"点。"
#: pve-manager/www/manager6/ha/rules/NodeAffinityRuleEdit.js:129
#: pve-manager/www/manager6/ha/rules/NodeAffinityRules.js:15
-#, fuzzy
msgid "Strict"
-msgstr "受限制的"
+msgstr "严格"
#: pve-manager/www/manager6/qemu/PCIEdit.js:332
msgid "Sub-Device ID"
-msgstr "设备"
+msgstr "子设备 SD"
#: pve-manager/www/manager6/qemu/PCIEdit.js:323
msgid "Sub-Vendor ID"
-msgstr "子供应商"
+msgstr "子供应商 ID"
#: pve-manager/www/manager6/storage/CIFSEdit.js:226
msgid "Subdirectory"
@@ -14854,7 +14540,7 @@ msgstr "主题"
#: proxmox-yew-comp/src/acme/certificate_list.rs:360
#: proxmox-yew-comp/src/acme/certificate_list.rs:417
msgid "Subject Alternative Names"
-msgstr "主题替代名称"
+msgstr "主题备用名称"
#: pmg-gui/js/QuarantineList.js:378
msgid "Subject, Sender"
@@ -14862,7 +14548,7 @@ msgstr "主题,发送者"
#: proxmox-yew-widget-toolkit/src/widget/form/submit_button.rs:162
msgid "Submit"
-msgstr ""
+msgstr "提交"
#: pve-manager/www/manager6/sdn/SubnetEdit.js:26
#: pve-manager/www/manager6/sdn/SubnetEdit.js:241
@@ -14900,30 +14586,28 @@ msgid "Subscription Key"
msgstr "订阅密钥"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:590
-#, fuzzy
msgid "Subscription Panel"
-msgstr "订阅密钥"
+msgstr "订阅面板"
#: proxmox-datacenter-manager/ui/src/configuration/subscription_panel.rs:184
msgid "Subscription Ratio (Basic or Higher): {0} ({1} {2})"
-msgstr ""
+msgstr "订阅比率(基础或更高):{0} ({1} {2})"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:176
-#, fuzzy
msgid "Subscription Status"
-msgstr "订阅"
+msgstr "订阅状态"
#: proxmox-yew-comp/src/subscription_info.rs:24
msgid "Subscription got (recently) suspended"
-msgstr ""
+msgstr "订阅(最近)被暂停"
#: proxmox-yew-comp/src/subscription_info.rs:23
msgid "Subscription set but expired for this server."
-msgstr ""
+msgstr "订阅已设置但对此服务器已过期。"
#: proxmox-yew-comp/src/subscription_info.rs:22
msgid "Subscription set but invalid for this server."
-msgstr ""
+msgstr "订阅已设置但对此服务器无效。"
#: pve-manager/www/manager6/dc/Summary.js:58
msgid "Subscriptions"
@@ -14989,7 +14673,7 @@ msgstr "支持"
#: proxmox-widget-toolkit/src/panel/EOLNotice.js:41
msgid "Support for {0} {1} ends on {2}"
-msgstr "对 {0} {1} 的支持将于 {2} 结束"
+msgstr "对 {0} {1} 的支持将于 {2} 终止"
#: pve-manager/www/manager6/Utils.js:2171
#: pve-manager/www/manager6/dc/BackupJobDetail.js:256
@@ -15033,15 +14717,15 @@ msgstr "瑞典语"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:301
msgid "Switch to Desktop View"
-msgstr ""
+msgstr "切换到桌面视图"
#: pmg-gui/js/QuarantineView.js:310
msgid "Switch to Mobile View"
-msgstr ""
+msgstr "切换到移动视图"
#: pmg-gui/js/QuarantineView.js:245
msgid "Switch to mobile view"
-msgstr ""
+msgstr "切换到移动视图"
#: proxmox-widget-toolkit/src/panel/AuthView.js:160
#: proxmox-widget-toolkit/src/window/SyncWindow.js:150
@@ -15054,9 +14738,8 @@ msgid "Sync"
msgstr "同步"
#: proxmox-yew-comp/src/auth_view.rs:132
-#, fuzzy
msgid "Sync Failed"
-msgstr "失败"
+msgstr "同步失败"
#: proxmox-backup/www/Utils.js:456
msgid "Sync Job"
@@ -15158,7 +14841,7 @@ msgstr "TB"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:134
#: proxmox-yew-comp/src/firewall/options_edit.rs:471
msgid "TCP Flags Log Level"
-msgstr ""
+msgstr "TCP 标志日志级别"
#: pve-manager/www/manager6/dc/MetricServerView.js:512
msgid "TCP Timeout"
@@ -15166,9 +14849,8 @@ msgstr "TCP 超时"
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:208
#: proxmox-yew-comp/src/firewall/options_edit.rs:432
-#, fuzzy
msgid "TCP Timeout Established"
-msgstr "TCP 超时"
+msgstr "TCP 超时已建立"
#: pve-manager/www/manager6/grid/FirewallOptions.js:74
#: proxmox-yew-comp/src/form/pve/firewall_property/mod.rs:83
@@ -15185,19 +14867,18 @@ msgid "TFA Lock"
msgstr "TFA 锁定"
#: proxmox-yew-comp/src/tfa/tfa_confirm_remove.rs:97
-#, fuzzy
msgid "TFA Removal"
-msgstr "确认移除 TFA"
+msgstr "删除双因素认证"
#: proxmox-widget-toolkit/src/panel/TfaView.js:232
#: proxmox-yew-comp/src/tfa/tfa_view.rs:395
msgid "TFA Type"
-msgstr "TFA 类型"
+msgstr "双因素认证类型"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:9
#: proxmox-yew-comp/src/tfa/tfa_add_recovery.rs:223
msgid "TFA recovery keys"
-msgstr "TFA 还原密钥"
+msgstr "双因素认证恢复密钥"
#: pmg-gui/js/MailProxyConfiguration.js:43
msgid "TLS"
@@ -15226,7 +14907,7 @@ msgstr "TOTP"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:370
msgid "TOTP App"
-msgstr "TOTP App"
+msgstr "TOTP 应用"
#: pmg-gui/js/UserView.js:226 pve-manager/www/manager6/dc/UserView.js:231
#: proxmox-backup/www/config/UserView.js:265
@@ -15235,11 +14916,11 @@ msgstr "TOTP 锁定"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:522
msgid "TOTP codes consist of six decimal digits"
-msgstr "TOTP 码由六位十进制数字组成"
+msgstr "TOTP 验证码由六位数字组成"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:386
msgid "TOTP codes usually consist of six decimal digits"
-msgstr "TOTP 代码通常由六位十进制数字组成"
+msgstr "TOTP 验证码通常为六位数字"
#: pve-manager/www/manager6/qemu/HDTPM.js:81
#: pve-manager/www/manager6/qemu/HardwareView.js:289
@@ -15387,9 +15068,8 @@ msgid "Target Datastore"
msgstr "目标数据存储"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:390
-#, fuzzy
msgid "Target Endpoint"
-msgstr "端点名称"
+msgstr "目标端点"
#: pve-manager/www/manager6/qemu/HDEdit.js:645
#: pve-manager/www/manager6/window/GuestDiskReassign.js:138
@@ -15410,12 +15090,10 @@ msgid "Target Namespace"
msgstr "目标命名空间"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:478
-#, fuzzy
msgid "Target Network"
-msgstr "信任网络"
+msgstr "目标网络"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:379
-#, fuzzy
msgid "Target Node"
msgstr "目标节点"
@@ -15447,9 +15125,8 @@ msgid "Target Storage"
msgstr "目标存储"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:442
-#, fuzzy
msgid "Target VMID"
-msgstr "目标"
+msgstr "目标 VMID"
#: pve-manager/www/manager6/storage/ZFSEdit.js:82
msgid "Target group"
@@ -15471,7 +15148,7 @@ msgstr "目标存储"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:128
msgid "Targets to notify"
-msgstr "要通知的目标"
+msgstr "待通知目标"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:61
#: proxmox-backup/www/dashboard/LongestTasks.js:80
@@ -15494,16 +15171,14 @@ msgid "Task ID"
msgstr "任务 ID"
#: pve-yew-mobile-gui/src/widgets/task_list_button.rs:173
-#, fuzzy
msgid "Task List"
-msgstr "任务历史"
+msgstr "任务列表"
#: proxmox-widget-toolkit/src/node/Tasks.js:352
msgid "Task Result"
msgstr "任务结果"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:624
-#, fuzzy
msgid "Task Summaries"
msgstr "任务摘要"
@@ -15514,29 +15189,24 @@ msgid "Task Summary"
msgstr "任务摘要"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:632
-#, fuzzy
msgid "Task Summary Sorted by Failed Tasks"
-msgstr "任务摘要(上个月)"
+msgstr "按照失败任务排序的任务摘要"
#: proxmox-datacenter-manager/ui/src/dashboard/tasks.rs:315
-#, fuzzy
msgid "Task Summary Sorted by Failed Tasks (Last {0}h)"
-msgstr "任务摘要(上个月)"
+msgstr "按照失败任务(最近{0}小时)排序的任务摘要"
#: proxmox-datacenter-manager/ui/src/dashboard/refresh_config_edit.rs:99
-#, fuzzy
msgid "Task Summary Time Range (last hours)"
-msgstr "任务摘要(上个月)"
+msgstr "任务摘要的时间区间(最近小时数)"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:626
-#, fuzzy
msgid "Task Summary by Category"
-msgstr "任务摘要(上个月)"
+msgstr "按类别显示的任务摘要"
#: proxmox-datacenter-manager/ui/src/dashboard/tasks.rs:316
-#, fuzzy
msgid "Task Summary by Category (Last {0}h)"
-msgstr "任务摘要(上个月)"
+msgstr "按照类型陈列的任务摘要(最近{0}小时)"
#: proxmox-widget-toolkit/src/node/Tasks.js:344
#: proxmox-yew-comp/src/tasks.rs:423
@@ -15544,9 +15214,8 @@ msgid "Task Type"
msgstr "任务类型"
#: proxmox-yew-comp/src/task_viewer.rs:162
-#, fuzzy
msgid "Task Viewer"
-msgstr "标签视图"
+msgstr "任务查看器"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:125
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:142
@@ -15579,7 +15248,6 @@ msgid "Templates"
msgstr "模板"
#: proxmox-yew-comp/src/acme/acme_register_account.rs:128
-#, fuzzy
msgid "Terms Of Service"
msgstr "服务条款"
@@ -15612,46 +15280,46 @@ msgstr "文本替换"
#: pve-manager/www/manager6/ha/RuleErrorsModal.js:17
msgid "The HA rule has no errors."
-msgstr ""
+msgstr "该 HA 规则没有错误。"
#: pve-manager/www/manager6/ha/RuleErrorsModal.js:29
msgid "The HA rule has the following errors:"
-msgstr ""
+msgstr "该 HA 规则存在以下错误:"
#: pve-manager/www/manager6/ceph/Pool.js:215
msgid ""
"The amount of data eventually stored in this pool. Used for auto-scaling."
-msgstr "最终存储在该池中的数据量。用于自动缩放。"
+msgstr "最终存储在该池中的数据规模。用于规划自动缩放。"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_connect.rs:93
-#, fuzzy
msgid "The certificate of the remote server is not trusted."
-msgstr "验证服务器的TLS证书"
+msgstr "远程服务器的证书不受信任。"
#: pve-manager/www/manager6/tree/SnapshotTree.js:312
msgid "The current guest configuration does not support taking new snapshots"
-msgstr "当前的来宾配置不支持拍摄新快照"
+msgstr "当前客户机配置不支持创建新快照"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:164
msgid ""
"The enterprise repository is enabled, but there is no active subscription!"
-msgstr "企业仓库已启用,但没有激活订阅!"
+msgstr "已启用企业版软件源,但没有有效的订阅!"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_nodes.rs:65
msgid "The following certificates of remote servers are not trusted."
-msgstr ""
+msgstr "以下远程服务器的证书不受信任。"
#: proxmox-datacenter-manager/ui/src/dashboard/view/row_view.rs:342
msgid ""
"The layout is empty. To add widgets, enable editing by clicking the {0} icon "
"above."
-msgstr ""
+msgstr "布局为空。要添加小部件,请单击上方的 {0} 图标启用编辑。"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:182
msgid ""
"The manual repository option expects that the repository is already "
"configured. For example, in combination with the Proxmox Offline Mirror."
msgstr ""
+"手动软件源选项要求软件源已经配置完成。例如,可与 Proxmox 离线镜像结合使用。"
#: proxmox-backup/www/window/SyncJobEdit.js:444
msgid "The maximum amount of snapshots to be transferred (per group)"
@@ -15659,24 +15327,25 @@ msgstr "要传输的快照的最大数量(每组)"
#: pve-manager/www/manager6/ceph/Status.js:66
msgid "The newest version installed in the Cluster."
-msgstr "群集中安装的是最新版本。"
+msgstr "集群中已安装最新版本。"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:305
#: proxmox-yew-comp/src/apt_repositories.rs:937
msgid "The no-subscription repository is NOT production-ready"
-msgstr "无订阅存储库未做好为生产准备"
+msgstr "无订阅软件源不适合生产环境"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:178
msgid ""
"The no-subscription repository is not the best choice for production setups."
-msgstr "无订阅存储库不是生产设置的最佳选择。"
+msgstr "无订阅的软件源并非生产环境的上选。"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:302
msgid ""
"The node-specific 'vzdump.conf' or, if this is not set, the default from the "
"config schema is used to determine fallback values."
msgstr ""
-"如果未设置,则使用节点特定的 'vzdump.conf' 或配置模式的默认值来确定后备值。"
+"如果未设置,则使用节点特定的 'vzdump.conf' 或配置模式的默认值来确定后备值。如"
+"果未设置,则使用节点特定的 'vzdump.conf' 或配置模式的默认值来确定后备值。"
#: pve-manager/www/manager6/dc/Backup.js:405
msgid "The notes are added to each backup created by this job."
@@ -15684,13 +15353,13 @@ msgstr "注释将添加到此作业创建的每个备份中。"
#: proxmox-widget-toolkit/src/panel/EmailRecipientPanel.js:43
msgid "The notification will be sent to the user's configured mail address"
-msgstr "通知将发送到用户配置的邮件地址"
+msgstr "通知将发送至用户配置的邮箱"
#: pve-manager/www/manager6/ceph/Pool.js:198
msgid ""
"The ratio of storage amount this pool will consume compared to other pools "
"with ratios. Used for auto-scaling."
-msgstr "与其他具有比率的池相比,该池将消耗的存储量的比率。 用于自动缩放。"
+msgstr "存储池预期占用集群总容量的比例,用于规划自动扩展。"
#: pve-manager/www/manager6/qemu/HardwareView.js:211
msgid "The saved VM state will be permanently lost."
@@ -15703,32 +15372,32 @@ msgid ""
"Enterprise Repository is not yet available."
msgstr ""
"所选版本目前被视为技术预览版。虽然我们没有发现任何重大问题,但可能存在一些错"
-"误,企业存储库尚未可用。"
+"误,对应的企业版软件源尚不可用。"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:306
#: proxmox-yew-comp/src/apt_repositories.rs:941
msgid "The test repository may contain unstable updates"
-msgstr "测试存储库可能包含不稳定的更新"
+msgstr "测试软件源可能包含不稳定的更新"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:186
msgid ""
"The test repository should only be used for test setups or after consulting "
"the official Proxmox support!"
-msgstr "测试存储库只能用于测试设置或在咨询官方Proxmox支持后使用!"
+msgstr "测试软件源只能用于测试环境或在咨询官方Proxmox支持后使用!"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:505
#: proxmox-yew-comp/src/apt_repositories.rs:249
#: proxmox-yew-comp/src/apt_repositories.rs:272
msgid ""
"The {0}enterprise repository is enabled, but there is no active subscription!"
-msgstr "{0}企业存储库已启用,但没有活动订阅!"
+msgstr "已启用 {0}企业版软件源,但无有效订阅!"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:516
#: proxmox-yew-comp/src/apt_repositories.rs:256
#: proxmox-yew-comp/src/apt_repositories.rs:279
msgid ""
"The {0}no-subscription{1} repository is not recommended for production use!"
-msgstr "不建议将无订阅存储库 {0}no-subscription{1} 用于生产!"
+msgstr "不建议在生产环境中使用 {0}无订阅{1} 软件源!"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:528
#: proxmox-yew-comp/src/apt_repositories.rs:264
@@ -15736,7 +15405,7 @@ msgstr "不建议将无订阅存储库 {0}no-subscription{1} 用于生产!"
msgid ""
"The {0}test repository may pull in unstable updates and is not recommended "
"for production use!"
-msgstr "{0} 测试存储库可能会引入不稳定的更新,不建议用于生产!"
+msgstr "{0}测试软件源可能引入不稳定的更新,不建议用于生产!"
#: proxmox-datacenter-manager/ui/src/top_nav_bar.rs:166
#: pve-yew-mobile-gui/src/pages/page_settings.rs:40
@@ -15745,14 +15414,12 @@ msgid "Theme"
msgstr "主题"
#: proxmox-yew-comp/src/theme_dialog.rs:57
-#, fuzzy
msgid "Theme mode"
-msgstr "NAT模式"
+msgstr "主题模式"
#: proxmox-yew-comp/src/theme_dialog.rs:53
-#, fuzzy
msgid "Theme name"
-msgstr "令牌名称"
+msgstr "主题名称"
#: pve-manager/www/manager6/storage/LvmThinEdit.js:167
msgid "Thin Pool"
@@ -15761,16 +15428,16 @@ msgstr "精简池"
#: pve-manager/www/manager6/storage/ZFSEdit.js:101
#: pve-manager/www/manager6/storage/ZFSPoolEdit.js:101
msgid "Thin provision"
-msgstr "精简配置"
+msgstr "精简制备"
#: proxmox-widget-toolkit/src/Toolkit.js:145
msgid "This is not a valid CpuSet"
-msgstr "这不是有效的CpuSet"
+msgstr "无效的 CpuSet"
#: proxmox-widget-toolkit/src/Toolkit.js:150
#: proxmox-widget-toolkit/src/Toolkit.js:155
msgid "This is not a valid hostname"
-msgstr "这不是有效的主机名"
+msgstr "该主机名无效"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:124
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_display_property.rs:128
@@ -15785,14 +15452,12 @@ msgid "This will permanently erase all data."
msgstr "这将永久删除所有数据。"
#: pve-manager/www/manager6/window/Restore.js:100
-#, fuzzy
msgid "This will permanently erase current CT data."
-msgstr "这将永久删除当前的{0}数据。"
+msgstr "这将永久删除当前容器数据。"
#: pve-manager/www/manager6/window/Restore.js:103
-#, fuzzy
msgid "This will permanently erase current VM data."
-msgstr "这将永久删除当前的{0}数据。"
+msgstr "这将永久删除当前虚拟机数据。"
#: proxmox-backup/www/window/NamespaceEdit.js:92
msgid ""
@@ -15852,7 +15517,7 @@ msgstr "时间步长"
#: proxmox-widget-toolkit/src/window/AddTotp.js:201
msgid "Time period"
-msgstr "时区段"
+msgstr "时间周期"
#: proxmox-widget-toolkit/src/node/TimeEdit.js:5
#: proxmox-widget-toolkit/src/node/TimeEdit.js:17
@@ -15883,7 +15548,7 @@ msgstr "超时(秒)"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:995
msgid "Timespan to match"
-msgstr "要匹配的时间跨度"
+msgstr "要匹配的时间范围"
#: pve-manager/www/manager6/window/Snapshot.js:77
msgid "Timestamp"
@@ -15891,7 +15556,7 @@ msgstr "时间戳"
#: proxmox-widget-toolkit/src/window/AddYubico.js:131
msgid "Tip:"
-msgstr "提示:"
+msgstr "提示:"
#: pmg-gui/js/MailTracker.js:379 pmg-gui/js/ObjectGroupSelector.js:26
#: pmg-gui/js/RuleInfo.js:456 pmg-gui/js/Utils.js:59
@@ -15912,9 +15577,8 @@ msgid ""
msgstr "要使用这些功能,请在虚拟机的硬件设置中将显示设置为SPICE。"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:93
-#, fuzzy
msgid "To:"
-msgstr "到"
+msgstr "收件人:"
#: pmg-gui/js/AttachmentQuarantine.js:116 pmg-gui/js/SpamQuarantine.js:226
#: pmg-gui/js/VirusQuarantine.js:129
@@ -15951,9 +15615,8 @@ msgid "Token Name"
msgstr "令牌名称"
#: proxmox-datacenter-manager/ui/src/configuration/mod.rs:123
-#, fuzzy
msgid "Token Permission"
-msgstr "API 令牌权限"
+msgstr "令牌权限"
#: pve-manager/www/manager6/dc/TokenEdit.js:116
#: proxmox-backup/www/window/TokenEdit.js:166
@@ -15969,7 +15632,7 @@ msgstr "令牌名称"
#: pve-manager/www/manager6/grid/FirewallRules.js:309
#: pve-manager/www/manager6/grid/FirewallRules.js:319
msgid "Too long, consider using IP sets."
-msgstr "太长了,请考虑使用IP集。"
+msgstr "长度超长,请考虑使用IP集。"
#: pve-manager/www/manager6/window/GuestImport.js:179
msgid "Too many disks, could not map to SATA."
@@ -15979,14 +15642,14 @@ msgstr "磁盘太多,无法映射到 SATA。"
msgid ""
"Too many remote nodes without active basic or higher subscription. Please "
"visit {0} for more details."
-msgstr ""
+msgstr "太多远程节点没有激活的基础版或更高级别订阅。请访问 {0} 了解更多详情。"
#. only get here if there are remotes and PDM-subscription failed.
#: proxmox-datacenter-manager/ui/src/dashboard/status_row.rs:262
msgid ""
"Too many remote nodes without basic or higher subscriptions! No access to "
"Enterprise-Repository or Enterprise Support."
-msgstr ""
+msgstr "太多远程节点没有基础版或更高级别的订阅!无法访问企业软件源或企业支持。"
#: pmg-gui/js/Dashboard.js:454
msgid "Top Receivers"
@@ -16009,15 +15672,15 @@ msgstr "最受好评"
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:175
#: proxmox-datacenter-manager/ui/src/pve/storage.rs:191
msgid "Total"
-msgstr "总额"
+msgstr "总计"
#: pve-manager/www/manager6/data/ResourceStore.js:228
msgid "Total Disk Read"
-msgstr "磁盘读取总额"
+msgstr "磁盘读取总数据量"
#: pve-manager/www/manager6/data/ResourceStore.js:236
msgid "Total Disk Write"
-msgstr "磁盘写入总额"
+msgstr "磁盘写入总数据量"
#: pmg-gui/js/GeneralMailStatistics.js:159
#: pmg-gui/js/GeneralMailStatistics.js:163
@@ -16030,17 +15693,16 @@ msgstr "邮件总额"
#: proxmox-datacenter-manager/ui/src/pbs/node/overview.rs:149
#: proxmox-datacenter-manager/ui/src/pve/node/overview.rs:154
-#, fuzzy
msgid "Total Memory"
-msgstr "核心总数"
+msgstr "总内存"
#: pve-manager/www/manager6/data/ResourceStore.js:244
msgid "Total NetIn"
-msgstr "流入总额"
+msgstr "流入总数据量"
#: pve-manager/www/manager6/data/ResourceStore.js:252
msgid "Total NetOut"
-msgstr "流出总额"
+msgstr "流出总数据量"
#: pve-manager/www/manager6/qemu/ProcessorEdit.js:147
#: pve-manager/www/manager6/window/GuestImport.js:551
@@ -16081,9 +15743,8 @@ msgid "Transfer Rate (bytes/second)"
msgstr "传输速率(字节/秒)"
#: proxmox-yew-widget-toolkit/src/widget/language_selector.rs:204
-#, fuzzy
msgid "Translated"
-msgstr "转移"
+msgstr "已翻译"
#: pmg-gui/js/Transport.js:154
msgid "Transport"
@@ -16203,17 +15864,16 @@ msgstr "二次验证"
#: proxmox-yew-comp/src/subscription_panel.rs:196
#: proxmox-yew-comp/src/tfa/tfa_confirm_remove.rs:52
msgid "Type"
-msgstr "类别"
+msgstr "类型"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:285
-#, fuzzy
msgid "Type / Name"
-msgstr "测试名"
+msgstr "类型 / 名称"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:249
#: proxmox-yew-comp/src/apt_repositories.rs:814
msgid "Types"
-msgstr "类别"
+msgstr "类型"
#: pve-manager/www/manager6/dc/OptionView.js:224
msgid "U2F AppID URL"
@@ -16233,16 +15893,16 @@ msgstr "U2F已弃用,请使用WebAuthn"
#: proxmox-yew-comp/src/node_info.rs:258
msgid "UEFI"
-msgstr ""
+msgstr "UEFI"
#: proxmox-yew-comp/src/node_info.rs:257
msgid "UEFI (Secure Boot Enabled)"
-msgstr ""
+msgstr "UEFI(已启用安全启动)"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:257
#: proxmox-yew-comp/src/apt_repositories.rs:818
msgid "URIs"
-msgstr "URIs"
+msgstr "URI"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:59
#: pve-manager/www/manager6/node/ACME.js:75
@@ -16275,24 +15935,22 @@ msgstr "乌克兰语"
#: proxmox-yew-comp/src/configuration/network_view.rs:184
msgid "Unable to apply changes"
-msgstr ""
+msgstr "无法应用更改"
#: proxmox-datacenter-manager/ui/src/remotes/config.rs:164
#: proxmox-yew-comp/src/auth_view.rs:234
#: proxmox-yew-comp/src/configuration/network_view.rs:158
#: proxmox-yew-comp/src/tfa/tfa_view.rs:233
msgid "Unable to delete item"
-msgstr ""
+msgstr "无法删除项目"
#: proxmox-yew-comp/src/user_panel.rs:167
-#, fuzzy
msgid "Unable to delete user"
-msgstr "启用新用户"
+msgstr "无法删除用户"
#: proxmox-yew-comp/src/subscription_info.rs:27
-#, fuzzy
msgid "Unable to get the subscription status (API problems)."
-msgstr "无法加载订阅状态"
+msgstr "无法获取订阅状态(API 问题)。"
#: pve-manager/www/manager6/dc/Support.js:67
msgid "Unable to load subscription status"
@@ -16303,9 +15961,8 @@ msgid "Unable to parse network configuration"
msgstr "无法解析网络配置"
#: proxmox-yew-comp/src/configuration/network_view.rs:173
-#, fuzzy
msgid "Unable to revert changes"
-msgstr "无法解析驱动器选项"
+msgstr "无法恢复更改"
#: proxmox-widget-toolkit/src/panel/GotifyEditPanel.js:39
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:40
@@ -16320,16 +15977,15 @@ msgstr "无法解析驱动器选项"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:113
#: proxmox-yew-comp/src/auth_edit_ldap.rs:367
msgid "Unchanged"
-msgstr "未更改"
+msgstr "保持不变"
#: proxmox-datacenter-manager/ui/src/dashboard/pbs_datastores_panel.rs:119
-#, fuzzy
msgid "Under Maintenance"
-msgstr "维护模式"
+msgstr "维护中"
#: proxmox-widget-toolkit/src/panel/RRDChart.js:288
msgid "Undo Zoom"
-msgstr "撤消缩放"
+msgstr "撤销缩放"
#: pve-manager/www/manager6/window/Restore.js:226
msgid "Unique"
@@ -16372,9 +16028,8 @@ msgid "Unknown"
msgstr "未知"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:442
-#, fuzzy
msgid "Unknown ({0})"
-msgstr "未知"
+msgstr "未知({0})"
#: pmg-gui/js/LDAPGroupEditor.js:71 pmg-gui/js/LDAPGroupEditor.js:72
msgid "Unknown LDAP address"
@@ -16391,9 +16046,8 @@ msgstr "未知错误"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:64
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:77
-#, fuzzy
msgid "Unknown subscriptions"
-msgstr "没有订阅"
+msgstr "未知订阅"
#: pve-manager/www/manager6/window/GuestImport.js:1032
msgid "Unknown warning"
@@ -16442,14 +16096,12 @@ msgid "Unmount Device"
msgstr "卸载设备"
#: proxmox-backup/www/window/SyncJobEdit.js:524
-#, fuzzy
msgid "Unmount relevant removable datastore once sync job finishes."
-msgstr "未挂载可移动数据存储"
+msgstr "一旦同步完成即卸载相关的可移除数据存储。"
#: proxmox-backup/www/window/SyncJobEdit.js:520
-#, fuzzy
msgid "Unmount when done"
-msgstr "卸载设备"
+msgstr "完成后卸载"
#: proxmox-backup/www/Utils.js:850
#: proxmox-backup/www/window/MaintenanceOptions.js:96
@@ -16476,13 +16128,12 @@ msgstr "无特权的容器"
#: proxmox-widget-toolkit/src/panel/LogView.js:343
#: pmg-gui/js/QuarantineList.js:327
msgid "Until"
-msgstr "至"
+msgstr "截止时间"
#. second row
#: proxmox-yew-comp/src/tasks.rs:431
-#, fuzzy
msgid "Until:"
-msgstr "至"
+msgstr "直到:"
#: pve-manager/www/manager6/window/GuestDiskReassign.js:205
msgid "Unused"
@@ -16497,18 +16148,16 @@ msgid "Unused Disk"
msgstr "未使用的磁盘"
#: proxmox-yew-comp/src/form/pve/lxc_property/lxc_mount_point_property.rs:530
-#, fuzzy
msgid "Unused Volume"
-msgstr "移动卷"
+msgstr "未使用卷"
#: pve-manager/www/manager6/ceph/StatusDetail.js:47
msgid "Up"
msgstr "在线"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:679
-#, fuzzy
msgid "Up-to-date"
-msgstr "更新"
+msgstr "最新"
#: pmg-gui/js/DKIMSettings.js:154 pve-manager/www/manager6/Utils.js:2084
#: proxmox-datacenter-manager/ui/src/tasks.rs:15
@@ -16523,25 +16172,22 @@ msgid "Update Available"
msgstr "有可用的更新"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:596
-#, fuzzy
msgid "Update List"
-msgstr "更新"
+msgstr "更新列表"
#. TRANSLATORS: The first parameter is the name of the remote, the second one
#. the name of the node.
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:523
-#, fuzzy
msgid "Update List - {0} ({1})"
-msgstr "更新"
+msgstr "更新列表 - {0}({1})"
#: pmg-gui/js/SpamDetectorStatus.js:65
msgid "Update Now"
msgstr "现在更新"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:188
-#, fuzzy
msgid "Update Status"
-msgstr "设定状态"
+msgstr "更新状态"
#: pmg-gui/js/ClamAVDatabase.js:170
msgid "Update now"
@@ -16604,7 +16250,7 @@ msgstr "上传"
#: proxmox-yew-comp/src/acme/certificate_list.rs:120
#: proxmox-yew-comp/src/acme/certificate_list.rs:238
msgid "Upload Custom Certificate"
-msgstr "上传自定义凭证"
+msgstr "上传自定义证书"
#: pmg-gui/js/Subscription.js:4 pmg-gui/js/Subscription.js:154
#: pve-manager/www/manager6/node/Subscription.js:4
@@ -16723,9 +16369,8 @@ msgid "Use Proxmox VE managed hyper-converged cephFS"
msgstr "使用 Proxmox VE 管理超融合 cephFS"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_agent_property.rs:77
-#, fuzzy
msgid "Use QEMU Guest Agent"
-msgstr "Qemu 代理"
+msgstr "使用 QEMU Guest Agent"
#: pmg-gui/js/SpamDetectorOptions.js:18
msgid "Use RBL checks"
@@ -16762,18 +16407,16 @@ msgid "Use advanced statistic filters"
msgstr "使用高级统计过滤器"
#: pmg-gui/js/SpamDetectorOptions.js:10
-#, fuzzy
msgid "Use auto-welcomelists"
-msgstr "使用自动白名单"
+msgstr "使用 auto-welcomelists"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_info.rs:356
-#, fuzzy
msgid "Use existing Token"
-msgstr "复用现有数据存储"
+msgstr "使用现有令牌"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:121
msgid "Use first endpoint."
-msgstr ""
+msgstr "使用第一个端点。"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:219
#: pve-manager/www/manager6/panel/BackupNotificationOptions.js:64
@@ -16801,7 +16444,7 @@ msgstr "中介设备"
#: proxmox-backup/www/window/S3ClientEdit.js:71
msgid "Use path style over vhost style bucket addressing."
-msgstr ""
+msgstr "使用路径样式而非虚拟主机样式的存储桶寻址。"
#: pve-manager/www/manager6/qemu/CDEdit.js:108
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_disk_property.rs:596
@@ -16834,9 +16477,8 @@ msgstr "使用特殊值 '1' 从基础网桥继承 MTU 值"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_summary.rs:173
#: proxmox-datacenter-manager/ui/src/remotes/node_url_list.rs:276
-#, fuzzy
msgid "Use trusted certificate"
-msgstr "验证凭证"
+msgstr "使用受信任的证书"
#: pve-manager/www/manager6/ha/Fencing.js:23
msgid "Use watchdog based fencing."
@@ -16870,9 +16512,8 @@ msgstr "已用"
#: proxmox-datacenter-manager/ui/src/pbs/node/overview.rs:148
#: proxmox-datacenter-manager/ui/src/pve/node/overview.rs:153
-#, fuzzy
msgid "Used Memory"
-msgstr "内存"
+msgstr "已用内存"
#: pmg-gui/js/RuleInfo.js:313
msgid "Used Objects"
@@ -16921,18 +16562,17 @@ msgstr "用户"
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:24
#: proxmox-yew-comp/src/auth_edit_ldap.rs:310
msgid "User Attribute Name"
-msgstr "用户属性名称"
+msgstr "用户属性名"
#: pmg-gui/js/NavigationTree.js:134
-#, fuzzy
msgid "User Blocklist"
-msgstr "用户黑名单"
+msgstr "用户阻止列表"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:408
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:292
#: proxmox-yew-comp/src/auth_edit_ldap.rs:219
msgid "User Filter"
-msgstr "用户筛选"
+msgstr "用户过滤器"
#: pmg-gui/js/PBSConfig.js:162
msgid "User ID"
@@ -16969,19 +16609,18 @@ msgid "User Tag Access"
msgstr "用户标记访问"
#: pmg-gui/js/NavigationTree.js:128
-#, fuzzy
msgid "User Welcomelist"
-msgstr "用户白名单"
+msgstr "用户 welcomelist"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:108
msgid "User already has recovery keys."
-msgstr "用户已经具有还原密钥。"
+msgstr "用户已拥有恢复密钥。"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:393
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:278
#: proxmox-yew-comp/src/auth_edit_ldap.rs:213
msgid "User classes"
-msgstr "用户类别"
+msgstr "用户类"
#: proxmox-widget-toolkit/src/node/Tasks.js:430
#: proxmox-widget-toolkit/src/node/Tasks.js:515
@@ -17020,9 +16659,8 @@ msgid "User/Group/API Token"
msgstr "用户/组/API 令牌"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:103
-#, fuzzy
msgid "User/Token"
-msgstr "用户/组/API 令牌"
+msgstr "用户/令牌"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:114
#: pmg-gui/js/FetchmailEdit.js:64 pmg-gui/js/PBSRemoteEdit.js:61
@@ -17060,7 +16698,7 @@ msgstr "用户和组"
#: pmg-gui/js/LDAPConfig.js:289 pmg-gui/js/LDAPConfig.js:472
msgid "Users of '{0}'"
-msgstr "'{0}' 的用户"
+msgstr "'{0}'的用户"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:274
#: pve-manager/www/manager6/node/ACME.js:647
@@ -17079,15 +16717,15 @@ msgstr "VG 名称"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:101
msgid "VID range includes not-a-number: {0}"
-msgstr "VID 范围包括非数字:{0}"
+msgstr "VID 范围包含非数字:{0}"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:106
msgid "VID range must go from lower to higher tag: {0}"
-msgstr "VID 范围必须从较低标签到较高标签:{0}"
+msgstr "VID 范围必须从低到高排列:{0}"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:112
msgid "VID range outside of allowed 2 and 4094 limit: {0}"
-msgstr "VID 范围超出允许的 2 到 4094 限制:{0}"
+msgstr "VID 范围超出允许的 2 至 4094 限制:{0}"
#: pve-manager/www/manager6/sdn/VnetACLView.js:173
msgid "VLAN"
@@ -17104,7 +16742,7 @@ msgstr "VLAN ID"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:69
msgid "VLAN IDs"
-msgstr "VLAN IDs"
+msgstr "VLAN ID"
#: proxmox-widget-toolkit/src/form/VlanField.js:9
#: pve-manager/www/manager6/form/VLanField.js:9
@@ -17128,12 +16766,10 @@ msgid "VLAN raw device"
msgstr "VLAN 原始设备"
#: pve-manager/www/manager6/sdn/ZoneBridgeView.js:27
-#, fuzzy
msgid "VLAN-aware"
msgstr "VLAN 感知"
#: pve-manager/www/manager6/sdn/ZoneBridgesPanel.js:91
-#, fuzzy
msgid "VLANs"
msgstr "VLAN"
@@ -17144,9 +16780,8 @@ msgid "VM"
msgstr "VM"
#: proxmox-datacenter-manager/ui/src/pve/qemu/mod.rs:65
-#, fuzzy
msgid "VM '{0}'"
-msgstr "验证 '{0}'"
+msgstr "虚拟机 '{0}'"
#: pve-manager/www/manager6/storage/Browser.js:80
msgid "VM Disks"
@@ -17179,9 +16814,8 @@ msgid "VNC clipboard requires spice-tools installed in the Guest-VM."
msgstr "VNC 剪贴板需要在 Guest-VM 中安装 spice-tools。"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:312
-#, fuzzy
msgid "VNI"
-msgstr "VLAN ID"
+msgstr "VNI"
#: pve-manager/www/manager6/form/SDNVnetSelector.js:28
#: pve-manager/www/manager6/sdn/VnetEdit.js:123
@@ -17195,9 +16829,8 @@ msgid "VNet Firewall"
msgstr "VNet 防火墙"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:75
-#, fuzzy
msgid "VNet ID"
-msgstr "VNet"
+msgstr "虚拟网络 ID"
#: pve-manager/www/manager6/sdn/zones/EvpnEdit.js:38
msgid "VNet MAC Address"
@@ -17205,7 +16838,7 @@ msgstr "VNet MAC 地址"
#: pve-manager/www/manager6/sdn/EvpnZoneMacVrfPanel.js:13
msgid "VNet MAC-VRF"
-msgstr ""
+msgstr "VNet MAC-VRF"
#: pve-manager/www/manager6/sdn/ZoneContentPanel.js:13
msgid "VNet Permissions"
@@ -17214,38 +16847,35 @@ msgstr "VNet 权限"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:287
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:226
msgid "VNet {} has no VNI"
-msgstr ""
+msgstr "VNet {} 没有 VNI"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/remote_tree.rs:238
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:177
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vrf_tree.rs:256
msgid "VNet {} has no zone defined!"
-msgstr ""
+msgstr "VNet {} 未定义区域!"
#: pve-manager/www/manager6/sdn/EvpnZoneMacVrfPanel.js:19
#: pve-manager/www/manager6/sdn/ZoneBridgesPanel.js:22
-#, fuzzy
msgid "VNets"
-msgstr "VNet"
+msgstr "虚拟网络"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:300
msgid "VRF VNI"
-msgstr ""
+msgstr "VRF VNI"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:82
-#, fuzzy
msgid "VRF VXLAN VNI"
-msgstr "VLAN ID"
+msgstr "VRF VXLAN VNI"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_vnet.rs:82
-#, fuzzy
msgid "VXLAN VNI"
-msgstr "VLAN ID"
+msgstr "VXLAN VNI"
#: proxmox-widget-toolkit/src/Toolkit.js:21
#: proxmox-widget-toolkit/src/Toolkit.js:37
msgid "Valid CIDR Range"
-msgstr "有效的 CIDR 范围"
+msgstr "有效 CIDR 范围"
#: proxmox-widget-toolkit/src/panel/Certificates.js:40
#: proxmox-widget-toolkit/src/window/Certificates.js:46
@@ -17255,7 +16885,7 @@ msgstr "有效的 CIDR 范围"
#: proxmox-yew-comp/src/acme/certificate_list.rs:358
#: proxmox-yew-comp/src/acme/certificate_list.rs:403
msgid "Valid Since"
-msgstr "有效期自"
+msgstr "生效时间"
#: proxmox-widget-toolkit/src/window/ACMEPluginEdit.js:188
#: proxmox-yew-comp/src/acme/acme_plugins.rs:411
@@ -17282,9 +16912,8 @@ msgid "Value"
msgstr "值"
#: proxmox-yew-comp/src/safe_confirm_dialog.rs:101
-#, fuzzy
msgid "Value does not match!"
-msgstr "至少有一个不匹配"
+msgstr "值不匹配!"
#: pve-manager/www/manager6/ceph/OSDDetails.js:133
msgid "Various information about the OSD"
@@ -17353,7 +16982,7 @@ msgstr "验证"
#: proxmox-backup/www/datastore/Content.js:1049
msgid "Verify '{0}'"
-msgstr "验证 '{0}'"
+msgstr "验证'{0}'"
#: proxmox-backup/www/datastore/Content.js:1342
msgid "Verify All"
@@ -17365,7 +16994,7 @@ msgstr "全部验证"
#: pve-manager/www/manager6/dc/MetricServerView.js:361
#: proxmox-yew-comp/src/auth_edit_ldap.rs:337
msgid "Verify Certificate"
-msgstr "验证凭证"
+msgstr "验证证书"
#: proxmox-widget-toolkit/src/window/AddTotp.js:246
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:134
@@ -17400,9 +17029,8 @@ msgid "Verify Receivers"
msgstr "验证收件者"
#: pve-manager/www/manager6/dc/MetricServerView.js:641
-#, fuzzy
msgid "Verify SSL"
-msgstr "验证"
+msgstr "验证 SSL"
#. TRANSLATORS: The state of the verification task
#: pve-manager/www/manager6/grid/BackupView.js:380
@@ -17416,11 +17044,11 @@ msgstr "验证状态"
#: pve-manager/www/manager6/dc/AuthEditAD.js:85
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:85
msgid "Verify TLS certificate of the server"
-msgstr "验证服务器的TLS证书"
+msgstr "验证服务器的 TLS 证书"
#: pve-manager/www/manager6/window/DownloadUrlToStorage.js:216
msgid "Verify certificates"
-msgstr "验证凭证"
+msgstr "验证证书"
#: pve-manager/www/manager6/dc/AuthEditAD.js:100
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:100
@@ -17453,15 +17081,13 @@ msgid "Version"
msgstr "版本"
#: pve-manager/www/manager6/sdn/FabricsContentView.js:13
-#, fuzzy
msgid "Via"
-msgstr "虚拟"
+msgstr "经由"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs:53
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs:85
-#, fuzzy
msgid "Video Streaming"
-msgstr "测试字符串"
+msgstr "视频流"
#: proxmox-widget-toolkit/src/panel/ACMEAccount.js:105
#: pve-manager/www/manager6/tree/SnapshotTree.js:27
@@ -17476,7 +17102,7 @@ msgstr "查看"
#: pve-manager/www/manager6/node/Certificates.js:303
#: proxmox-yew-comp/src/acme/certificate_list.rs:152
msgid "View Certificate"
-msgstr "查看凭证"
+msgstr "查看证书"
#: pmg-gui/js/DKIMSettings.js:212
msgid "View DNS Record"
@@ -17497,15 +17123,13 @@ msgid "View images"
msgstr "查看映像"
#: proxmox-datacenter-manager/ui/src/main_menu.rs:210
-#, fuzzy
msgid "Views"
-msgstr "查看"
+msgstr "视图"
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_machine_property.rs:142
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_machine_property.rs:156
-#, fuzzy
msgid "VirtIO"
-msgstr "VirtIO RNG"
+msgstr "VirtIO"
#: pve-manager/www/manager6/qemu/HardwareView.js:356
#: pve-manager/www/manager6/qemu/HardwareView.js:806
@@ -17520,7 +17144,7 @@ msgstr "Virtiofs"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:97
msgid "Virtiofs Filesystem Passthrough"
-msgstr "Virtiofs文件系统直通"
+msgstr "Virtiofs 文件系统直通"
#: proxmox-widget-toolkit/src/Schema.js:98
msgid "Virtual"
@@ -17528,7 +17152,7 @@ msgstr "虚拟"
#: proxmox-datacenter-manager/ui/src/dashboard/node_status_panel.rs:165
msgid "Virtual Environment Nodes"
-msgstr ""
+msgstr "虚拟环境节点"
#: pve-manager/www/manager6/storage/Browser.js:160
msgid "Virtual Guests"
@@ -17549,13 +17173,12 @@ msgid "Virtual Machine"
msgstr "虚拟机"
#: proxmox-datacenter-manager/ui/src/tasks.rs:169
-#, fuzzy
msgid "Virtual Machine related Tasks"
-msgstr "虚拟机"
+msgstr "虚拟机相关任务"
#: pve-manager/www/manager6/qemu/Config.js:277
msgid "Virtual Machine {0} on node '{1}'"
-msgstr "虚拟机 {0} 在节点 '{1}' 上"
+msgstr "虚拟机 {0} 在节点'{1}'上"
#: pve-manager/www/manager6/dc/Guests.js:38
#: proxmox-datacenter-manager/ui/src/dashboard/guest_panel.rs:224
@@ -17601,7 +17224,7 @@ msgstr "病毒爆发"
#: pmg-gui/js/NavigationTree.js:116 pmg-gui/js/VirusQuarantine.js:52
msgid "Virus Quarantine"
-msgstr "病毒爆发"
+msgstr "病毒隔离"
#: pmg-gui/js/ReceiverStatistics.js:89
msgid "Virus info"
@@ -17648,14 +17271,13 @@ msgstr "WAL 大小"
#: pve-manager/www/manager6/qemu/TdxEdit.js:53
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_intel_tdx_property.rs:60
-#, fuzzy
msgid "WARNING: When using Intel TDX no EFI disk is loaded as pflash."
-msgstr "警告:使用SEV-SNP时,没有EFI磁盘作为pflash加载。"
+msgstr "警告:使用 Intel TDX 时,不会将 EFI 磁盘作为 pflash 加载。"
#: pve-manager/www/manager6/qemu/SevEdit.js:74
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_amd_sev_property.rs:79
msgid "WARNING: When using SEV-SNP no EFI disk is loaded as pflash."
-msgstr "警告:使用SEV-SNP时,没有EFI磁盘作为pflash加载。"
+msgstr "警告:使用 SEV-SNP 时,没有 EFI 磁盘作为 pflash 加载。"
#: pve-manager/www/manager6/qemu/ProcessorEdit.js:161
msgid ""
@@ -17666,11 +17288,11 @@ msgstr "警告:您无权配置自定义 CPU 类型,如果更改类型,将
#: proxmox-widget-toolkit/src/window/TfaWindow.js:352
#: proxmox-widget-toolkit/src/window/TfaWindow.js:483
msgid "Waiting for second factor."
-msgstr "等待二次验证。"
+msgstr "等待第二验证因素。"
#: pve-manager/www/manager6/node/CmdMenu.js:114
msgid "Wake on LAN packet send for '{0}': '{1}'"
-msgstr "为 '{0}' 发送的唤醒局域网数据包:'{1}'"
+msgstr "为'{0}'发送的唤醒局域网数据包:'{1}'"
#: pve-manager/www/manager6/node/CmdMenu.js:99
msgid "Wake-on-LAN"
@@ -17689,11 +17311,9 @@ msgstr "网络唤醒"
#: proxmox-datacenter-manager/ui/src/dashboard/filtered_tasks.rs:193
#: proxmox-datacenter-manager/ui/src/dashboard/tasks.rs:154
#: proxmox-yew-comp/src/apt_repositories.rs:922
-#, fuzzy
msgid "Warning"
msgid_plural "Warnings"
msgstr[0] "警告"
-msgstr[1] "警告"
#: pve-manager/www/manager6/window/FirewallEnableEdit.js:28
msgid "Warning: Firewall still disabled at datacenter level!"
@@ -17735,7 +17355,7 @@ msgstr "磨损"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:118
msgid "Web UI URL"
-msgstr ""
+msgstr "Web UI URL"
#: proxmox-widget-toolkit/src/panel/TfaView.js:268 pmg-gui/js/TFAView.js:97
#: proxmox-yew-comp/src/tfa/tfa_view.rs:259
@@ -17754,16 +17374,15 @@ msgstr "Webauthn TFA"
#: pmg-gui/js/TFAView.js:75 pve-manager/www/manager6/dc/OptionView.js:323
#: proxmox-backup/www/config/WebauthnView.js:130
msgid "WebAuthn requires using a trusted certificate."
-msgstr "WebAuthn 需要使用受信任的凭证。"
+msgstr "WebAuthn 需要使用受信任的证书。"
#: pmg-gui/js/TFAView.js:6 proxmox-backup/www/config/WebauthnView.js:61
msgid "Webauthn"
msgstr "WebAuthn"
#: proxmox-yew-comp/src/tfa/tfa_add_webauthn.rs:109
-#, fuzzy
msgid "Webauthn Device"
-msgstr "注册 Webauthn 设备"
+msgstr "Webauthn 设备"
#: pmg-gui/js/Settings.js:133 pve-manager/www/manager6/window/Settings.js:166
#: proxmox-backup/www/window/Settings.js:133
@@ -17785,16 +17404,15 @@ msgstr "每周"
#: pmg-gui/js/DNSBLSitesField.js:178
msgid "Weight"
-msgstr ""
+msgstr "权重"
#: pmg-gui/js/MailProxyConfiguration.js:53 pmg-gui/js/QuarantineView.js:22
#: pmg-gui/js/SpamContextMenu.js:19 pmg-gui/js/SpamQuarantine.js:265
#: pmg-gui/js/UserBlockWelcomeList.js:57 pmg-gui/js/UserBlockWelcomeList.js:247
#: pmg-yew-quarantine-gui/src/spam_list.rs:278
#: pmg-yew-quarantine-gui/src/page_mail_view.rs:135
-#, fuzzy
msgid "Welcomelist"
-msgstr "白名单"
+msgstr "欢迎列表"
#: pmg-gui/js/ObjectGroupSelector.js:32 pmg-gui/js/RuleInfo.js:464
msgid "What"
@@ -17821,7 +17439,7 @@ msgstr "当选择了多个设备时,将在客户端启动时选择第一个自
#: pmg-gui/js/NavigationTree.js:28 pmg-gui/js/Utils.js:54
msgid "Who Objects"
-msgstr "操作对象"
+msgstr "身份对象"
#: pmg-gui/js/StatTimeSelector.js:158
msgid "Whole month"
@@ -17868,14 +17486,14 @@ msgstr "使用此功能,可以手动将来自某些域或地址的电子邮件
#: pve-manager/www/manager6/node/Summary.js:227
msgid "Without ZFS ARC"
-msgstr ""
+msgstr "不含 ZFS ARC"
#: pve-manager/www/manager6/storage/Base.js:163
msgid ""
"Without any keep option, the node's vzdump.conf or `keep-all` is used as "
"fallback for backup jobs"
msgstr ""
-"如果没有任何保留选项,节点的 vzdump.conf 或 “keep all” 将用作备份作业的回退"
+"如果没有任何保留选项,节点的 vzdump.conf 或 `keep-all` 将用作备份作业的回退"
#: pve-manager/www/manager6/dc/Backup.js:366
msgid ""
@@ -17884,9 +17502,8 @@ msgid ""
msgstr "没有任何保留选项,存储的配置或节点的 vzdump.conf 用作回退"
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:144
-#, fuzzy
msgid "Worker ID"
-msgstr "服务器 ID"
+msgstr "工作器 ID"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:60
msgid "Worst"
@@ -18004,12 +17621,12 @@ msgstr "您可以在此处拖放密钥文件。"
#: proxmox-widget-toolkit/src/form/TextAreaField.js:13
#: proxmox-widget-toolkit/src/window/NotesEdit.js:32
msgid "You can use Markdown for rich text formatting."
-msgstr "您可以使用 Markdown 进行富文本格式设置。"
+msgstr "您可以使用 Markdown 进行富文本格式化。"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:114
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_display_property.rs:123
msgid "You cannot live-migrate while using the VNC clipboard."
-msgstr "使用VNC剪贴板时无法实时迁移。"
+msgstr "使用 VNC 剪贴板时无法实时迁移。"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:102
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_display_property.rs:116
@@ -18022,17 +17639,17 @@ msgstr "如果选择了 VNC 剪贴板,则不能使用默认的 SPICE 剪贴板
msgid ""
"You do not have a valid subscription for this server. Please visit {0} to "
"get a list of available options."
-msgstr "您没有此服务器的有效订阅。请访问 {0} 获取可用选项列表。"
+msgstr "此服务器无有效订阅。请访问 {0} 获取可用选项列表。"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:484
#: proxmox-yew-comp/src/apt_repositories.rs:179
msgid "You get supported updates for {0}"
-msgstr "您获得 {0} 的受支持更新"
+msgstr "您将获得 {0} 的受支持更新"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:489
#: proxmox-yew-comp/src/apt_repositories.rs:174
msgid "You get updates for {0}"
-msgstr "您会收到 {0} 的更新"
+msgstr "您将获得 {0} 的更新"
#: pmg-gui/js/dashboard/SubscriptionInfo.js:29
#: pve-manager/www/manager6/dc/Summary.js:273
@@ -18059,7 +17676,7 @@ msgstr "您需要创建一次初始配置。"
msgid ""
"You won't get any security fixes after the End-Of-Life date. Please consider "
"upgrading."
-msgstr "在生命周期结束日期之后,将不会获得任何安全修复程序。请考虑升级。"
+msgstr "生命周期结束后,您将不会收到任何安全修复。请考虑升级。"
#: proxmox-widget-toolkit/src/window/PasswordEdit.js:28
msgid "Your Current Password"
@@ -18070,9 +17687,8 @@ msgid "Your E-Mail"
msgstr "您的 E-Mail"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:144
-#, fuzzy
msgid "Your Subscriptions"
-msgstr "没有订阅"
+msgstr "您的订阅"
#: pmg-gui/js/dashboard/SubscriptionInfo.js:21
#: pve-manager/www/manager6/dc/Summary.js:287
@@ -18084,7 +17700,7 @@ msgstr "您的订阅状态有效。"
#: proxmox-widget-toolkit/src/window/AddYubico.js:133
msgid "YubiKeys also support WebAuthn, which is often a better alternative."
-msgstr "YubiKeys 还支持 WebAuthn,这通常是更好的选择。"
+msgstr "YubiKey 也支持 WebAuthn,这通常是更好的选择。"
#: proxmox-widget-toolkit/src/panel/TfaView.js:280
#: proxmox-widget-toolkit/src/window/TfaWindow.js:501
@@ -18101,7 +17717,7 @@ msgstr "ZB"
#: pve-manager/www/manager6/node/Summary.js:252
msgid "ZFS ARC"
-msgstr ""
+msgstr "ZFS ARC"
#: pve-manager/www/manager6/storage/ZFSPoolEdit.js:17
#: pve-manager/www/manager6/storage/ZFSPoolEdit.js:71
@@ -18129,13 +17745,12 @@ msgid "Zone"
msgstr "区"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:75
-#, fuzzy
msgid "Zone ID"
-msgstr "区"
+msgstr "区域 ID"
#: pve-manager/www/manager6/sdn/Browser.js:23
msgid "Zone {0} on node {1}"
-msgstr "区域{0}在节点{1}上"
+msgstr "区域 {0} 在节点 {1} 上"
#: pve-manager/www/manager6/dc/Config.js:270
msgid "Zones"
@@ -18143,7 +17758,7 @@ msgstr "区域"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:166
msgid "Zstd Threads"
-msgstr "Zstd线程"
+msgstr "Zstd 线程"
#: pve-manager/www/manager6/ceph/Pool.js:159
msgid "a min_size of 1 is not recommended and can lead to data loss"
@@ -18154,9 +17769,8 @@ msgid "all"
msgstr "全部"
#: proxmox-yew-comp/src/form/pve/qemu_property/mod.rs:209
-#, fuzzy
msgid "any"
-msgstr "天"
+msgstr "任意"
#: pve-manager/www/manager6/qemu/Options.js:139
#: proxmox-yew-comp/src/form/pve/qemu_property/mod.rs:246
@@ -18175,11 +17789,11 @@ msgstr "ashift"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:192
msgid "at least one EVPN controller needs to be selected"
-msgstr ""
+msgstr "至少需要选择一个 EVPN 控制器"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:189
msgid "at least one remote needs to have an EVPN controller configured"
-msgstr ""
+msgstr "至少需要一个远程配置 EVPN 控制器"
#: pve-manager/www/manager6/ceph/OSD.js:117
msgid "auto detect"
@@ -18192,25 +17806,25 @@ msgstr "自动 DHCP"
#: pve-manager/www/manager6/window/Migrate.js:437
#: pve-manager/www/manager6/window/Migrate.js:527
msgid "blocking HA resource {0} on selected target node"
-msgstr ""
+msgstr "在所选目标节点上阻止 HA 资源 {0}"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/add_zone.rs:202
msgid "can only create the zone once per remote!"
-msgstr ""
+msgstr "每个远程只能创建一次区域!"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:53
msgid "cannot represent number as f64"
-msgstr ""
+msgstr "无法将数字表示为 f64"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:110
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:119
msgid "cannot represent number as signed integer"
-msgstr ""
+msgstr "无法将数字表示为有符号整数"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:189
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:198
msgid "cannot represent number as unsigned integer"
-msgstr ""
+msgstr "无法将数字表示为无符号整数"
#: proxmox-widget-toolkit/src/node/APT.js:35
#: proxmox-yew-comp/src/apt_package_manager.rs:428
@@ -18249,19 +17863,16 @@ msgid "default"
msgstr "默认"
#: proxmox-backup/www/window/S3ClientEdit.js:60
-#, fuzzy
msgid "default (443)"
-msgstr "默认"
+msgstr "默认(443)"
#: proxmox-backup/www/window/S3ClientEdit.js:83
-#, fuzzy
msgid "default (us-west-1)"
-msgstr "默认(总是)"
+msgstr "默认(us-west-1)"
#: proxmox-yew-comp/src/form/pve/qemu_controller_selector.rs:49
-#, fuzzy
msgid "device '{0}' name is already in use."
-msgstr "该 {0} ID 已被使用"
+msgstr "设备 '{0}' 名称已被使用。"
#: pve-manager/www/manager6/node/Directory.js:174
#: proxmox-backup/www/DirectoryList.js:96
@@ -18280,26 +17891,24 @@ msgstr "dns"
#: proxmox-backup/www/window/S3ClientEdit.js:48
msgid "e.g. {{bucket}}.s3.{{region}}.amazonaws.com"
-msgstr ""
+msgstr "例如 {{bucket}}.s3.{{region}}.amazonaws.com"
#: proxmox-yew-comp/src/auth_edit_openid.rs:129
-#, fuzzy
msgid "email profile"
-msgstr "失败时发送电子邮件"
+msgstr "邮件配置文件"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:49
#: proxmox-yew-comp/src/apt_repositories.rs:703
msgid "enabled"
-msgstr "启用"
+msgstr "已启用"
#: proxmox-yew-comp/src/form/pve/lxc_property/lxc_features_property.rs:123
-#, fuzzy
msgid "experimental"
msgstr "实验性"
#: proxmox-yew-comp/src/tfa/tfa_add_webauthn.rs:147
msgid "failed to parse webauthn registration challenge"
-msgstr ""
+msgstr "无法解析 webauthn 注册质询"
#: pve-manager/www/manager6/form/BackupCompressionSelector.js:6
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:72
@@ -18312,9 +17921,8 @@ msgid "fast and good"
msgstr "又快又好"
#: proxmox-yew-comp/src/form/pve/qemu_property/mod.rs:245
-#, fuzzy
msgid "first Disk"
-msgstr "首个磁盘"
+msgstr "第一块磁盘"
#: pve-manager/www/manager6/qemu/Options.js:132
msgid "first disk"
@@ -18322,7 +17930,7 @@ msgstr "首个磁盘"
#: pve-manager/www/manager6/storage/TemplateView.js:308
msgid "for example 'latest'"
-msgstr ""
+msgstr "例如 'latest'"
#: pve-manager/www/manager6/form/BackupCompressionSelector.js:7
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:71
@@ -18331,21 +17939,20 @@ msgid "good"
msgstr "很好"
#: proxmox-yew-widget-toolkit/src/widget/form/checkbox.rs:174
-#, fuzzy
msgid "got invalid value."
-msgstr "无效值"
+msgstr "获得无效值。"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:61
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:131
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:210
msgid "got wrong data type"
-msgstr ""
+msgstr "获得了错误的数据类型"
#: proxmox-yew-widget-toolkit/src/widget/form/radio_button.rs:149
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:328
#: proxmox-yew-widget-toolkit/src/widget/form/selector.rs:214
msgid "got wrong data type."
-msgstr ""
+msgstr "获得了错误的数据类型。"
#: proxmox-backup/www/datastore/Content.js:1378
msgid "group, date or owner"
@@ -18370,35 +17977,31 @@ msgid "in {0}"
msgstr "在 {0}"
#: proxmox-yew-comp/src/form/pve/lxc_property/lxc_network_property.rs:67
-#, fuzzy
msgid "interface name already in use"
-msgstr "该 {0} ID 已被使用"
+msgstr "接口名称已经被占用"
#: proxmox-datacenter-manager/ui/src/configuration/subscription_panel.rs:160
-#, fuzzy
msgid "invalid data"
-msgstr "无效的文件大小"
+msgstr "无效数据"
#. do not allow "inf", "nan", ...
#: proxmox-yew-widget-toolkit/src/dom/number_format.rs:112
#: proxmox-yew-widget-toolkit/src/dom/number_format.rs:117
-#, fuzzy
msgid "invalid float literal"
-msgstr "无效的文件大小"
+msgstr "无效的浮点数字面量"
#: proxmox-yew-widget-toolkit/src/dom/number_format.rs:101
msgid "invalid float literal (wrong decimal separator)"
-msgstr ""
+msgstr "无效的浮点数字面量(错误的小数分隔符)"
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:274
#: proxmox-datacenter-manager/ui/src/widget/view_filter_selector.rs:319
msgid "invalid type: {0}"
-msgstr ""
+msgstr "无效类型:{0}"
#: proxmox-yew-comp/src/login_panel.rs:300
-#, fuzzy
msgid "invalid username"
-msgstr "无效值"
+msgstr "无效的用户名"
#: pve-manager/www/manager6/window/Prune.js:135
#: proxmox-backup/www/datastore/Prune.js:167
@@ -18437,7 +18040,7 @@ msgstr "按键"
#: proxmox-widget-toolkit/src/Toolkit.js:135
msgid "letter"
-msgstr "信件"
+msgstr "字母"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:71
msgid "mail.example.com"
@@ -18445,7 +18048,7 @@ msgstr "mail.example.com"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:741
msgid "major difference"
-msgstr ""
+msgstr "主要差异"
#: pve-manager/www/manager6/data/ResourceStore.js:221
msgid "maxcpu"
@@ -18454,7 +18057,7 @@ msgstr "最大 CPU"
#: pve-manager/www/manager6/ceph/Pool.js:149
msgid ""
"min_size < size/2 can lead to data loss, incomplete PGs or unfound objects."
-msgstr "最小大小<大小/2可能导致数据丢失、PGs不完整或找不到对象。"
+msgstr "min_size < size/2 可能导致数据丢失、PGs不完整或对象丢失。"
#: proxmox-backup/www/Utils.js:8
msgid "missing"
@@ -18466,7 +18069,7 @@ msgstr "丢失"
#: proxmox-yew-comp/src/token_panel.rs:457
#: proxmox-yew-comp/src/token_panel.rs:514
msgid "never"
-msgstr "永不过期"
+msgstr "从不"
#: proxmox-widget-toolkit/src/node/APT.js:41
#: proxmox-yew-comp/src/apt_package_manager.rs:438
@@ -18487,11 +18090,11 @@ msgstr "无 VLAN"
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:186
msgid "no data loaded"
-msgstr ""
+msgstr "未加载数据"
#: proxmox-yew-widget-toolkit/src/widget/form/combobox.rs:227
msgid "no such item"
-msgstr ""
+msgstr "没有此项"
#: pve-manager/www/manager6/window/Settings.js:394
msgid "noVNC Settings"
@@ -18523,7 +18126,7 @@ msgstr "无(禁用)"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:92
msgid "not a valid bridge VLAN ID entry: {0}"
-msgstr "无效的网桥 VLAN ID条目:{0}"
+msgstr "无效的网桥 VLAN ID 条目:{0}"
#: proxmox-widget-toolkit/src/node/ServiceView.js:213
msgid "not installed"
@@ -18534,14 +18137,14 @@ msgstr "未安装"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:175
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:203
msgid "number too large (n > {})"
-msgstr ""
+msgstr "数字太大 (n > {})"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:102
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:127
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:181
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:206
msgid "number too small (n < {})"
-msgstr ""
+msgstr "数字太小 (n < {})"
#: pve-manager/www/manager6/dc/Summary.js:212
msgid "of {0} CPU(s)"
@@ -18549,11 +18152,11 @@ msgstr "的 {0} 个CPU"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:394
msgid "old"
-msgstr ""
+msgstr "旧"
#: proxmox-widget-toolkit/src/Toolkit.js:79
msgid "only unicast addresses are allowed"
-msgstr "只允许单播地址"
+msgstr "仅允许单播地址"
#: pve-manager/www/manager6/node/ACME.js:23
msgid "optional"
@@ -18561,13 +18164,12 @@ msgstr "可选"
#. TRANSLATORS: otel-collector is an OpenTelemetry endpoint.
#: pve-manager/www/manager6/dc/MetricServerView.js:589
-#, fuzzy
msgid "otel-collector.example.com"
-msgstr "mail.example.com"
+msgstr "otel-collector.example.com"
#: pmg-yew-quarantine-gui/src/page_not_found.rs:9
msgid "page not found"
-msgstr ""
+msgstr "页面未找到"
#: pve-manager/www/manager6/form/NetworkCardSelector.js:7
#: proxmox-yew-comp/src/form/pve/qemu_property/qemu_network_property.rs:79
@@ -18598,9 +18200,8 @@ msgid "protected"
msgstr "受保护"
#: proxmox-datacenter-manager/ui/src/pve/node/mod.rs:161
-#, fuzzy
msgid "pve-manager version too old"
-msgstr "管理器版本"
+msgstr "pve-manager 版本过旧"
#: pve-manager/www/manager6/node/ACME.js:588
msgid ""
@@ -18626,7 +18227,7 @@ msgstr "运行中..."
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:745
msgid "small difference"
-msgstr ""
+msgstr "小差异"
#: proxmox-widget-toolkit/src/Utils.js:57
#: proxmox-datacenter-manager/ui/src/dashboard/guest_panel.rs:130
@@ -18641,31 +18242,28 @@ msgstr "子(主题)"
#: proxmox-datacenter-manager/ui/src/remotes/updates.rs:743
msgid "substantial difference"
-msgstr ""
+msgstr "重大差异"
#: proxmox-backup/www/Utils.js:448
msgid "sync jobs handler triggered by mount"
-msgstr ""
+msgstr "挂载触发的同步作业处理程序"
#: pve-manager/www/manager6/grid/Replication.js:373
msgid "syncing"
msgstr "同步中"
#: proxmox-yew-comp/src/bandwidth_selector.rs:98
-#, fuzzy
msgid "unable to parse number"
-msgstr "无法解析驱动器选项"
+msgstr "无法解析数字"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:342
-#, fuzzy
msgid "unable to parse number: {}"
-msgstr "无法解析驱动器选项"
+msgstr "无法解析数字:{}"
#: proxmox-yew-comp/src/bandwidth_selector.rs:104
#: proxmox-yew-comp/src/bandwidth_selector.rs:113
-#, fuzzy
msgid "unable to parse value: {}"
-msgstr "无法解析驱动器选项"
+msgstr "无法解析: {}"
#: pve-manager/www/manager6/dc/MetricServerView.js:207
#: proxmox-backup/www/window/InfluxDbEdit.js:12
@@ -18675,17 +18273,16 @@ msgstr "未更改"
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:130
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:136
#: proxmox-yew-comp/src/subscription_panel.rs:192
-#, fuzzy
msgid "unknown"
msgstr "未知"
#: proxmox-datacenter-manager/ui/src/pve/utils.rs:298
msgid "unknown content type ({0})"
-msgstr ""
+msgstr "未知内容类型 ({0})"
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:135
msgid "unknown status '{0}'"
-msgstr ""
+msgstr "未知状态'{0}'"
#: pve-manager/www/manager6/grid/Replication.js:45
#: pve-manager/www/manager6/grid/Replication.js:415
@@ -18719,7 +18316,7 @@ msgstr "不安全"
#: pve-manager/www/manager6/ceph/OSD.js:78
msgid "use OSD disk"
-msgstr "使用OSD磁盘"
+msgstr "使用 OSD 磁盘"
#: pve-manager/www/manager6/ceph/OSD.js:132
msgid "use OSD/DB disk"
@@ -18753,28 +18350,27 @@ msgstr "vIOMMU"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:463
msgid "value must be greater than or equal to '{0}'"
-msgstr ""
+msgstr "值必须大于或等于'{0}'"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:347
msgid "value must be greater than or equal to '{}'"
-msgstr ""
+msgstr "值必须大于或等于'{}'"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:471
msgid "value must be less than or equal to '{0}'"
-msgstr ""
+msgstr "值必须小于或等于'{0}'"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:355
msgid "value must be less than or equal to '{}'"
-msgstr ""
+msgstr "值必须小于或等于'{}'"
#: proxmox-widget-toolkit/src/window/TfaEdit.js:80
msgid "verify current password"
msgstr "验证当前密码"
#: proxmox-datacenter-manager/ui/src/sdn/evpn/vnet_status.rs:94
-#, fuzzy
msgid "via"
-msgstr "虚拟"
+msgstr "通过"
#: pve-manager/www/manager6/qemu/CloudInit.js:253
msgid "with options"
@@ -18782,12 +18378,12 @@ msgstr "选项"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:65
msgid "xattr Support"
-msgstr "xattr支持"
+msgstr "xattr 支持"
#: pmg-gui/js/Settings.js:223 pve-manager/www/manager6/window/Settings.js:319
#: proxmox-backup/www/window/Settings.js:223
msgid "xterm.js Settings"
-msgstr "xterm.js设置"
+msgstr "xterm.js 设置"
#: pve-manager/www/manager6/dc/MetricServerView.js:686
msgid ""
@@ -18796,6 +18392,10 @@ msgid ""
" \"X-Custom-Header\": \"value\"\n"
"}"
msgstr ""
+"{\n"
+" \"Authorization\": \"Bearer token\",\n"
+" \"X-Custom-Header\": \"value\"\n"
+"}"
#: pve-manager/www/manager6/dc/MetricServerView.js:708
msgid ""
@@ -18805,6 +18405,11 @@ msgid ""
" \"region\": \"us-east-1\"\n"
"}"
msgstr ""
+"{\n"
+" \"environment\": \"production\",\n"
+" \"datacenter\": \"dc1\",\n"
+" \"region\": \"us-east-1\"\n"
+"}"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:376
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:314
@@ -18817,7 +18422,7 @@ msgstr "{0} ({1}/{2}) 成功"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:193
msgid "{0} / {1} (running / total)"
-msgstr ""
+msgstr "{0} / {1} (运行中 / 总计)"
#: pmg-gui/js/AttachmentGrid.js:75
msgid "{0} Attachments"
@@ -18834,9 +18439,8 @@ msgstr "{0} 项"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:409
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:414
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:417
-#, fuzzy
msgid "{0} OK"
-msgstr "{0} ID"
+msgstr "{0} OK"
#: proxmox-backup/www/Utils.js:829
msgid "{0} conflicting tasks still active."
@@ -18850,9 +18454,8 @@ msgstr "{0} 天"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:419
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:427
-#, fuzzy
msgid "{0} failed"
-msgstr "全部失败"
+msgstr "{0} 失败"
#: pmg-gui/js/Dashboard.js:339
#: proxmox-backup/www/tape/form/RetentionSelector.js:10
@@ -18878,12 +18481,11 @@ msgstr "{0} 月"
#: proxmox-datacenter-manager/ui/src/dashboard/node_status_panel.rs:135
msgid "{0} nodes have an unknown status"
-msgstr ""
+msgstr "{0} 个节点状态未知"
#: proxmox-datacenter-manager/ui/src/dashboard/node_status_panel.rs:151
-#, fuzzy
msgid "{0} nodes online"
-msgstr "节点已下线"
+msgstr "{0} 个节点在线"
#: pve-manager/www/manager6/Utils.js:1831
msgid "{0} not installed."
@@ -18893,11 +18495,11 @@ msgstr "{0} 没有安装。"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:411
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:421
msgid "{0} not verified yet"
-msgstr ""
+msgstr "{0} 尚未验证"
#: proxmox-datacenter-manager/ui/src/dashboard/node_status_panel.rs:141
msgid "{0} of an unknown number of nodes online"
-msgstr ""
+msgstr "未知数量的节点中有 {0} 个在线"
#: proxmox-widget-toolkit/src/Utils.js:1134
#: pve-manager/www/manager6/ceph/Status.js:362
@@ -18906,17 +18508,16 @@ msgstr ""
#: proxmox-backup/www/datastore/DataStoreListSummary.js:77
#: proxmox-backup/www/datastore/DataStoreListSummary.js:82
msgid "{0} of {1}"
-msgstr "{0} 的 {1}"
+msgstr "{1} 中的 {0}"
#: proxmox-datacenter-manager/ui/src/dashboard/node_status_panel.rs:125
msgid "{0} of {1} nodes are offline"
-msgstr ""
+msgstr "{1} 个节点中有 {0} 个离线"
#. TRANSLATORS: For example "resource on Remote 'HAL 9000'"
#: proxmox-datacenter-manager/ui/src/dashboard/top_entities.rs:249
-#, fuzzy
msgid "{0} on Remote '{1}'"
-msgstr "区域{0}在节点{1}上"
+msgstr "{0} 在远程 '{1}' 上"
#: pmg-gui/js/Utils.js:866
msgid "{0} on behalf of {1}"
@@ -18925,7 +18526,7 @@ msgstr "{0} 代表 {1}"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:263
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:279
msgid "{0} running / {1} physical ({2} total configured)"
-msgstr ""
+msgstr "{0} 运行中 / {1} 物理 ({2} 总配置)"
#: pmg-gui/js/GeneralMailStatistics.js:120
msgid "{0} seconds"
@@ -18945,7 +18546,7 @@ msgstr "{0} 到 {1}"
#: proxmox-widget-toolkit/src/Utils.js:1376
msgid "{0} updates"
-msgstr "{0} 更新"
+msgstr "{0} 个更新"
#: proxmox-backup/www/tape/form/RetentionSelector.js:12
msgid "{0} weeks"
@@ -18956,34 +18557,30 @@ msgid "{0} years"
msgstr "{0} 年"
#: pve-manager/www/manager6/sdn/NetworkBrowser.js:157
-#, fuzzy
msgid "{0} {1} on node {2}"
-msgstr "{0}%的{1}"
+msgstr "{0} {1} 在节点 {2} 上"
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:220
#: proxmox-datacenter-manager/ui/src/pve/remote_overview.rs:236
#: proxmox-datacenter-manager/ui/src/pve/storage.rs:288
#: proxmox-datacenter-manager/ui/src/renderer.rs:76
-#, fuzzy
msgid "{0}% ({1} of {2})"
-msgstr "{0}%的{1}"
+msgstr "{0}%({1} / {2})"
#: proxmox-widget-toolkit/src/Utils.js:1121
-#, fuzzy, javascript-format
+#, javascript-format
msgid "{0}% of {1}"
-msgstr "{0}%的{1}"
+msgstr "{0}% of {1}"
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:296
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:305
-#, fuzzy
msgid "{0}% of {1} CPU(s)"
-msgstr "的 {0} 个CPU"
+msgstr "{0}%/{1}个 CPU"
#: proxmox-datacenter-manager/ui/src/pve/lxc/overview.rs:281
#: proxmox-datacenter-manager/ui/src/pve/qemu/overview.rs:290
-#, fuzzy
msgid "{0}, Group: {1}"
-msgstr "{0} 的 {1}"
+msgstr "{0},组:{1}"
#~ msgid " Network/Time"
#~ msgstr "网络/时间"
@@ -19015,12 +18612,8 @@ msgstr "{0} 的 {1}"
#~ msgid "Are you sure you want to navigate away from this page?"
#~ msgstr "确定要离开此页?"
-#, fuzzy
-#~ msgid "Are you sure you want to remove entry {0}."
-#~ msgstr "确定要删除该项 {0} 吗?"
-
#~ msgid "Are you sure you want to remove {item.type} {item.id}?"
-#~ msgstr "确定要删除该项{item.type} {item.id}吗?"
+#~ msgstr "确定要删除该项 {item.type} {item.id}吗?"
#~ msgid ""
#~ "Are you sure you want to remove {item.type} {item.id}? This will "
@@ -19051,16 +18644,9 @@ msgstr "{0} 的 {1}"
#~ msgid "Barrier"
#~ msgstr "Barrier"
-#~ msgid "Blacklist"
-#~ msgstr "黑名单"
-
#~ msgid "Blocksize"
#~ msgstr "块尺寸"
-#, fuzzy
-#~ msgid "Boot Device"
-#~ msgstr "引导设备"
-
#~ msgid "Bootdisk Size"
#~ msgstr "引导磁盘大小"
@@ -19073,10 +18659,6 @@ msgstr "{0} 的 {1}"
#~ msgid "CD/DVD"
#~ msgstr "CD/DVD"
-#, fuzzy
-#~ msgid "CPU Model"
-#~ msgstr "模型"
-
#~ msgid "CPU usage %"
#~ msgstr "CPU使用率%"
@@ -19095,21 +18677,9 @@ msgstr "{0} 的 {1}"
#~ msgid "Clear User name"
#~ msgstr "清除用户名"
-#, fuzzy
-#~ msgid "Connection OK"
-#~ msgstr "连接错误"
-
#~ msgid ""
#~ "Custom 2nd factor configuration is not supported on realms with '{0}' TFA."
-#~ msgstr "具有'{0}' TFA的域不支持自定义二次验证配置。"
-
-#, fuzzy
-#~ msgid "DNS Domain"
-#~ msgstr "DNS 域"
-
-#, fuzzy
-#~ msgid "Dashboard Configuration"
-#~ msgstr "显示配置"
+#~ msgstr "具有 '{0}' TFA的域不支持自定义二次验证配置。"
#~ msgid "Datacenter Health"
#~ msgstr "数据中心健康"
@@ -19117,33 +18687,9 @@ msgstr "{0} 的 {1}"
#~ msgid "Day of week"
#~ msgstr "星期几"
-#, fuzzy
-#~ msgid "Default (any)"
-#~ msgstr "默认(总是)"
-
-#, fuzzy
-#~ msgid "Default (disabled)"
-#~ msgstr "无(禁用)"
-
-#, fuzzy
-#~ msgid "Default)"
-#~ msgstr "默认"
-
-#, fuzzy
-#~ msgid "Delete Device"
-#~ msgstr "删除源"
-
-#, fuzzy
-#~ msgid "Detach disk"
-#~ msgstr "分离"
-
#~ msgid "Disabling notifications is not recommended for production systems!"
#~ msgstr "不建议对生产系统禁用通知!"
-#, fuzzy
-#~ msgid "Disk Actions"
-#~ msgstr "磁盘操作"
-
#~ msgid "Disk Throttle"
#~ msgstr "磁盘节流"
@@ -19216,10 +18762,6 @@ msgstr "{0} 的 {1}"
#~ msgid "Download Files"
#~ msgstr "下载文件"
-#, fuzzy
-#~ msgid "Edit Options"
-#~ msgstr "选项"
-
#~ msgid "Eject media"
#~ msgstr "擦除数据"
@@ -19246,10 +18788,6 @@ msgstr "{0} 的 {1}"
#~ msgid "Failover Domain"
#~ msgstr "故障转移域"
-#, fuzzy
-#~ msgid "Firewall Rules"
-#~ msgstr "防火墙"
-
#~ msgid "Gateway Nodes"
#~ msgstr "网关节点"
@@ -19277,10 +18815,6 @@ msgstr "{0} 的 {1}"
#~ msgid "Host ifname"
#~ msgstr "主机ifname"
-#, fuzzy
-#~ msgid "Hostame"
-#~ msgstr "主机名"
-
#~ msgid "ID may only consist of alphanumeric characters"
#~ msgstr "ID只能由字母数字字符组成"
@@ -19314,10 +18848,6 @@ msgstr "{0} 的 {1}"
#~ msgid "MAC"
#~ msgstr "MAC"
-#, fuzzy
-#~ msgid "Machine Type"
-#~ msgstr "匹配类型"
-
#~ msgid "Manage {0}"
#~ msgstr "管理 {0}"
@@ -19342,26 +18872,6 @@ msgstr "{0} 的 {1}"
#~ msgid "Minimum replicas"
#~ msgstr "最小副本数"
-#, fuzzy
-#~ msgid "Mixed subscriptions"
-#~ msgstr "混合订阅"
-
-#, fuzzy
-#~ msgid "Move Disk"
-#~ msgstr "移动磁盘"
-
-#, fuzzy
-#~ msgid "Nameserver"
-#~ msgstr "DNS 服务器"
-
-#, fuzzy
-#~ msgid "Network Device Index"
-#~ msgstr "网络设备"
-
-#, fuzzy
-#~ msgid "Next due data"
-#~ msgstr "下一个到期日期"
-
#~ msgid "No Data in Database"
#~ msgstr "数据库中没有数据"
@@ -19371,31 +18881,15 @@ msgstr "{0} 的 {1}"
#~ msgid "No data in database."
#~ msgstr "数据库中没有数据。"
-#, fuzzy
-#~ msgid "No enhancements"
-#~ msgstr "Spice 增强"
-
-#, fuzzy
-#~ msgid "No remotes configured"
-#~ msgstr "未配置 VNet。"
-
#~ msgid "No target configured"
#~ msgstr "未配置目标"
-#, fuzzy
-#~ msgid "No valid Subscription"
-#~ msgstr "无有效订阅"
-
#~ msgid "Node Fencing"
#~ msgstr "节点围栏"
#~ msgid "Node Resources"
#~ msgstr "节点资源"
-#, fuzzy
-#~ msgid "Node/Error"
-#~ msgstr "错误"
-
#~ msgid "Note: Rollback stops CT"
#~ msgstr "注意:回滚会停止CT"
@@ -19503,10 +18997,6 @@ msgstr "{0} 的 {1}"
#~ msgid "Removed Bytes"
#~ msgstr "删除的字节"
-#, fuzzy
-#~ msgid "Respository"
-#~ msgstr "存储库"
-
#~ msgid "Restart pmg-smtp-filter"
#~ msgstr "重启pmg-smtp-filter"
@@ -19519,17 +19009,9 @@ msgstr "{0} 的 {1}"
#~ msgid "Ring 0 Address"
#~ msgstr "Ring 0地址"
-#, fuzzy
-#~ msgid "Root filesystem usage"
-#~ msgstr "根磁盘使用率"
-
#~ msgid "SMTP"
#~ msgstr "SMTP"
-#, fuzzy
-#~ msgid "Scan OK"
-#~ msgstr "扫描"
-
#~ msgid "Scan QR code and enter TOTP auth. code to verify"
#~ msgstr "扫描二维码,并输入TOTP验证码以用于验证"
@@ -19545,21 +19027,9 @@ msgstr "{0} 的 {1}"
#~ msgid "Service vlan"
#~ msgstr "服务vlan"
-#, fuzzy
-#~ msgid "Setrvice"
-#~ msgstr "服务"
-
-#, fuzzy
-#~ msgid "Size IncrementX"
-#~ msgstr "增量大小"
-
#~ msgid "Skip verified snapshots"
#~ msgstr "跳过已验证的快照"
-#, fuzzy
-#~ msgid "Some nodes unavailable"
-#~ msgstr "没有可用的更新。"
-
#~ msgid "Start All VMs"
#~ msgstr "启动所有虚拟机"
@@ -19593,7 +19063,7 @@ msgstr "{0} 的 {1}"
#~ msgid ""
#~ "To register a U2F device, connect the device, then click the button and "
#~ "follow the instructions."
-#~ msgstr "要注册U2F设备,请连接设备,然后单击按钮并按照说明进行操作。"
+#~ msgstr "要注册 U2F 设备,请连接设备,然后单击按钮并按照说明进行操作。"
#~ msgid "Toggle Theme"
#~ msgstr "切换主题"
@@ -19607,17 +19077,9 @@ msgstr "{0} 的 {1}"
#~ msgid "Unkown"
#~ msgstr "未知"
-#, fuzzy
-#~ msgid "Unpriviledged"
-#~ msgstr "无特权"
-
#~ msgid "Unused Mount Point"
#~ msgstr "未使用的挂载点"
-#, fuzzy
-#~ msgid "Update status unknown"
-#~ msgstr "现在更新"
-
#~ msgid "Uploading file..."
#~ msgstr "上传文件中..."
@@ -19627,10 +19089,6 @@ msgstr "{0} 的 {1}"
#~ msgid "Use fixed size memory"
#~ msgstr "使用固定大小的内存"
-#, fuzzy
-#~ msgid "Use host settings"
-#~ msgstr "使用主机设置"
-
#~ msgid "User quotas disabled."
#~ msgstr "用户配额已禁用。"
@@ -19646,11 +19104,7 @@ msgstr "{0} 的 {1}"
#~ "a decrease in security in practice."
#~ msgstr ""
#~ "不建议使用 /dev/random 作为熵源,因为它会导致主机熵不足。/dev/urandom 是首"
-#~ "选,并且在实践中不会导致安全性降低。"
-
-#, fuzzy
-#~ msgid "VM State Storage"
-#~ msgstr "VM 状态存储"
+#~ "选,并且在实践中不会降低安全性。"
#~ msgid "VM protection"
#~ msgstr "VM保护"
@@ -19658,10 +19112,6 @@ msgstr "{0} 的 {1}"
#~ msgid "VZDump backup file"
#~ msgstr "VZDump 备份文件"
-#, fuzzy
-#~ msgid "Valid subscriptions"
-#~ msgstr "无有效订阅"
-
#~ msgid "Verify SSL certificate of the server"
#~ msgstr "验证服务器的SSL凭证"
@@ -19683,9 +19133,6 @@ msgstr "{0} 的 {1}"
#~ msgid "WebAuthn "
#~ msgstr "WebAuthn"
-#~ msgid "Whitelist"
-#~ msgstr "白名单"
-
#~ msgid "Working"
#~ msgstr "工作中"
@@ -19695,25 +19142,9 @@ msgstr "{0} 的 {1}"
#~ msgid "You are logged in as '{0}'"
#~ msgstr "您的登录名是'{0}'"
-#, fuzzy
-#~ msgid "You have one new {}"
-#~ msgid_plural "You have {n} new {}s"
-#~ msgstr[0] "您的登录名是{0} "
-#~ msgstr[1] "您的登录名是{0} "
-
-#, fuzzy
-#~ msgctxt "context"
-#~ msgid "You have one new {}"
-#~ msgid_plural "You have {n} new {}s"
-#~ msgstr[0] "您的登录名是{0} "
-#~ msgstr[1] "您的登录名是{0} "
-
#~ msgid "api key"
#~ msgstr "api key"
-#~ msgid "average"
-#~ msgstr "平均"
-
#~ msgid "bond-primary"
#~ msgstr "主bond"
@@ -19723,29 +19154,9 @@ msgstr "{0} 的 {1}"
#~ msgid "gateway-external-peers"
#~ msgstr "网关外部对等"
-#~ msgid "maximum"
-#~ msgstr "最大"
-
#~ msgid "nofailback"
#~ msgstr "无故障回复"
-#, fuzzy
-#~ msgid "one"
-#~ msgid_plural "plural"
-#~ msgstr[0] "完成"
-#~ msgstr[1] "完成"
-
-#, fuzzy
-#~ msgctxt "context"
-#~ msgid "one"
-#~ msgid_plural "plural"
-#~ msgstr[0] "完成"
-#~ msgstr[1] "完成"
-
-#, fuzzy
-#~ msgid "paused"
-#~ msgstr "已暂停"
-
#~ msgid "peers address list"
#~ msgstr "对端地址列表"
@@ -19776,26 +19187,8 @@ msgstr "{0} 的 {1}"
#~ msgid "{0} (Auto)"
#~ msgstr "{0} (自动)"
-#, fuzzy
-#~ msgid "{0} ({1} sockets)"
-#~ msgstr "{0} ({1})"
-
-#, fuzzy
-#~ msgctxt "context"
-#~ msgid "{0} bar"
-#~ msgstr "{0} 年"
-
-#, fuzzy
-#~ msgid "{0} remotes failed"
-#~ msgstr "全部失败"
-
-#, fuzzy
-#~ msgid "{0} {1}"
-#~ msgstr "{0} ({1})"
-
#~ msgid "{1} ({2}), notify via target \\'{0}\\'"
#~ msgstr "{1} ({2}),通过目标\\'{0}\\'通知"
-#, fuzzy
-#~ msgid "{1} {0}"
-#~ msgstr "ID {0}"
+#~ msgid "以逗号分隔的网络列表,用于应用共享限制。"
+#~ msgstr "要应用(共享)限制的以逗号分隔的网络列表。"
--
2.47.3
^ permalink raw reply related [relevance 2%]
* [pve-devel] [PATCH proxmox-i18n] Polish translation update
@ 2025-07-31 20:10 2% Daniel Koć
0 siblings, 0 replies; 143+ results
From: Daniel Koć @ 2025-07-31 20:10 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Daniel Koć <daniel@xn--ko-wla.pl>
---
pl.po | 1833 ++++++++++++++++++++++++---------------------------------
1 file changed, 761 insertions(+), 1072 deletions(-)
diff --git a/pl.po b/pl.po
index 3426315..55b5574 100644
--- a/pl.po
+++ b/pl.po
@@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: proxmox translations\n"
"Report-Msgid-Bugs-To: <support@proxmox.com>\n"
"POT-Creation-Date: 2025-07-31 13:58+0200\n"
-"PO-Revision-Date: 2023-11-22 21:17+0100\n"
+"PO-Revision-Date: 2025-07-31 20:08+0200\n"
"Last-Translator: Daniel Koć <daniel@xn--ko-wla.pl>\n"
"Language-Team: Polish <support@proxmox.com>\n"
"Language: pl\n"
@@ -17,29 +17,28 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\n"
-"X-Generator: Poedit 3.4.1\n"
+"X-Generator: Poedit 3.6\n"
#: proxmox-backup/www/tape/window/TapeBackup.js:129
#: proxmox-backup/www/tape/window/TapeBackupJob.js:184
msgid "# of Worker Threads"
-msgstr ""
+msgstr "# wątków"
#: pmg-gui/js/SystemOptions.js:87
msgid "'From:' for Admin Mail"
-msgstr ""
+msgstr "Pole 'Od:' dla administratora"
#: pve-manager/www/manager6/qemu/Options.js:103
msgid "(No boot device selected)"
msgstr "(nie wybrano urządzenia startowego)"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:98
-#, fuzzy
msgid "(none)"
-msgstr "brak"
+msgstr "(brak)"
#: proxmox-backup/www/config/SyncView.js:273
msgid "(remote) store, remote, id, owner, direction"
-msgstr ""
+msgstr "(zdalne) magazyn, maszyna, id, właściciel, kierunek"
#: proxmox-widget-toolkit/src/window/FileBrowser.js:335
msgid ".tar.zst"
@@ -57,20 +56,19 @@ msgstr "/jakaś/ścieżka"
#: proxmox-backup/www/datastore/OptionView.js:307
msgid "1048576 (0 disables cache)"
-msgstr ""
+msgstr "1048576 (0 wyłącza buforowanie)"
#: proxmox-backup/www/datastore/OptionView.js:299
msgid "1445 (24 hours 5 minutes)"
-msgstr ""
+msgstr "1445 (24 godziny i 5 minut)"
#: pmg-gui/js/PBSConfig.js:39
msgid "5 Minutes"
msgstr "5 minut"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_connect.rs:193
-#, fuzzy
msgid "<IP/Hostname>:Port"
-msgstr "Nazwa hosta"
+msgstr "<IP/nazwa hosta>:port"
#: proxmox-backup/www/window/TrafficControlEdit.js:287
msgid "A comma-separated list of networks to apply the (shared) limit."
@@ -88,9 +86,8 @@ msgstr ""
"zrestartować"
#: proxmox-backup/www/window/DataStoreEdit.js:102
-#, fuzzy
msgid "A relative path"
-msgstr "ścieżka bezwzględna"
+msgstr "Ścieżka względna"
#: pve-manager/www/manager6/window/PCIMapEdit.js:202
msgid ""
@@ -120,7 +117,7 @@ msgstr "Konta i wtyczki ACME"
#: proxmox-yew-comp/src/acme/acme_plugins.rs:492
#: proxmox-yew-comp/src/acme/acme_plugins.rs:532
msgid "ACME DNS Plugin"
-msgstr ""
+msgstr "Wtyczka DNS ACME"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:40
#: pve-manager/www/manager6/node/ACME.js:52
@@ -129,20 +126,17 @@ msgstr "Katalog ACME"
#: proxmox-yew-comp/src/acme/acme_domains.rs:353
#: proxmox-yew-comp/src/acme/acme_domains.rs:374
-#, fuzzy
msgid "ACME Domain"
-msgstr "Domena"
+msgstr "Domena ACME"
#. TRANSLATORS: ACME Stands for Automatic Certificate Management Environment
#: proxmox-datacenter-manager/ui/src/certificates.rs:34
-#, fuzzy
msgid "ACME Domains"
-msgstr "Podpisz domeny"
+msgstr "Domeny ACME"
#: proxmox-backup/www/Utils.js:476
-#, fuzzy
msgid "ACME certificate renewal"
-msgstr "Łańcuch certyfikatów"
+msgstr "Odnowienie certyfikatu ACME"
#: pve-manager/www/manager6/qemu/Options.js:187
#: pve-manager/www/manager6/qemu/Options.js:193
@@ -159,17 +153,15 @@ msgstr "Wartości ACR"
#: pve-manager/www/manager6/qemu/Options.js:372
msgid "AMD SEV"
-msgstr ""
+msgstr "AMD SEV"
#: pve-manager/www/manager6/qemu/SevEdit.js:54
-#, fuzzy
msgid "AMD SEV Type"
-msgstr "Typ MDev"
+msgstr "Typ AMD SEV"
#: proxmox-yew-comp/src/acme/acme_plugins.rs:581
-#, fuzzy
msgid "API"
-msgstr "Klucz API"
+msgstr "API"
#: proxmox-widget-toolkit/src/window/ACMEPluginEdit.js:212
#: proxmox-yew-comp/src/acme/acme_plugins.rs:434
@@ -199,9 +191,8 @@ msgid "API Token"
msgstr "Klucz API"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_info.rs:280
-#, fuzzy
msgid "API Token Name"
-msgstr "Nazwa klucza"
+msgstr "Nazwa klucza API"
#: pve-manager/www/manager6/dc/ACLView.js:40
#: pve-manager/www/manager6/dc/ACLView.js:227
@@ -218,9 +209,8 @@ msgid "API Tokens"
msgstr "Klucze API"
#: proxmox-yew-comp/src/apt_repositories.rs:542
-#, fuzzy
msgid "API call failed"
-msgstr "wszystko błędne"
+msgstr "Wywołanie API nie powiodło się"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:222
#: proxmox-widget-toolkit/src/panel/Certificates.js:91
@@ -252,7 +242,7 @@ msgstr "Anuluj"
#: proxmox-yew-comp/src/acme/acme_register_account.rs:137
#: proxmox-yew-comp/src/acme/acme_register_account.rs:148
msgid "Accept TOS"
-msgstr "Zaakceptuj warunki"
+msgstr "Zaakceptuj warunki korzystania"
#: proxmox-backup/www/NavigationTree.js:48
#: proxmox-backup/www/panel/AccessControl.js:6
@@ -261,17 +251,16 @@ msgid "Access Control"
msgstr "Kontrola dostępu"
#: proxmox-backup/www/window/S3ClientEdit.js:91
-#, fuzzy
msgid "Access Key"
-msgstr "Sekretny klucz"
+msgstr "Klucz dostępu"
#: pve-manager/www/manager6/lxc/DeviceEdit.js:89
msgid "Access Mode in CT"
-msgstr ""
+msgstr "Tryb dostępu w CT"
#: pve-manager/www/manager6/lxc/DeviceEdit.js:96
msgid "Access mode has to be an octal number"
-msgstr ""
+msgstr "Tryb dostępu musi być liczbą ósemkową"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:151
#: pmg-gui/js/LDAPConfig.js:258 pmg-gui/js/LDAPUserEditor.js:42
@@ -303,23 +292,23 @@ msgstr "Konta"
#: pve-manager/www/manager6/sdn/FabricsView.js:100
#: proxmox-yew-comp/src/running_tasks.rs:109
msgid "Action"
-msgstr "Akcja"
+msgstr "Działanie"
#: pmg-gui/js/controller/QuarantineController.js:102
msgid "Action '{0}' for '{1}' items"
-msgstr "Akcja '{0}' na '{1}' elementach"
+msgstr "Działanie '{0}' na '{1}' elementach"
#: pmg-gui/js/Utils.js:803 pmg-gui/js/Utils.js:937
msgid "Action '{0}' for '{1}' items successful"
-msgstr "Akcja '{0}' na '{1}' elementach udana"
+msgstr "Działanie '{0}' na '{1}' elementach udana"
#: pmg-gui/js/Utils.js:804 pmg-gui/js/Utils.js:938
msgid "Action '{0}' successful"
-msgstr "Akcja '{0}' udana"
+msgstr "Działanie '{0}' udane"
#: pmg-gui/js/NavigationTree.js:22 pmg-gui/js/Utils.js:57
msgid "Action Objects"
-msgstr "Obiekty Akcja"
+msgstr "Obiekty Działanie"
#: proxmox-widget-toolkit/src/node/Tasks.js:457
#: pve-manager/www/manager6/ceph/Status.js:171
@@ -332,7 +321,7 @@ msgstr "Obiekty Akcja"
#: proxmox-backup/www/tape/ChangerStatus.js:989
#: proxmox-datacenter-manager/ui/src/pve/tree.rs:576
msgid "Actions"
-msgstr "Akcje"
+msgstr "Działania"
#: proxmox-widget-toolkit/src/form/NetworkSelector.js:114
#: proxmox-widget-toolkit/src/node/NetworkView.js:310
@@ -352,9 +341,8 @@ msgid "Active Directory Server"
msgstr "Serwer Active Directory"
#: proxmox-backup/www/tape/ChangerStatus.js:876
-#, fuzzy
msgid "Activity"
-msgstr "Aktywne"
+msgstr "Aktywność"
#: proxmox-widget-toolkit/src/Utils.js:693
#: proxmox-widget-toolkit/src/node/APTRepositories.js:162
@@ -448,64 +436,54 @@ msgid "Add Datastore"
msgstr "Dodaj magazyn"
#: pve-manager/www/manager6/window/DirMapEdit.js:26
-#, fuzzy
msgid "Add Directory Mapping"
-msgstr "Magazyn katalogów"
+msgstr "Dodaj mapowanie katalogu"
#: pve-manager/www/manager6/qemu/SystemEdit.js:117
msgid "Add EFI Disk"
msgstr "Dodaj dysk EFI"
#: pve-manager/www/manager6/sdn/FabricsView.js:187
-#, fuzzy
msgid "Add Fabric"
-msgstr "Dodaj jako"
+msgstr "Dodaj sieć"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:71
-#, fuzzy
msgid "Add Header"
-msgstr "Nagłówek"
+msgstr "Dodaj nagłówek"
#: proxmox-backup/www/datastore/Content.js:1357
-#, fuzzy
msgid "Add Namespace"
-msgstr "Przestrzeń nazw"
+msgstr "Dodaj przestrzeń"
#: pve-manager/www/manager6/sdn/FabricsView.js:107
#: pve-manager/www/manager6/sdn/FabricsView.js:168
#: pve-manager/www/manager6/sdn/fabrics/NodeEdit.js:188
-#, fuzzy
msgid "Add Node"
-msgstr "Dodaj NS"
+msgstr "Dodaj węzeł"
#: proxmox-datacenter-manager/ui/src/remotes/config.rs:176
-#, fuzzy
msgid "Add Proxmox VE"
-msgstr "Proxmox VE"
+msgstr "Dodaj Proxmox VE"
#: proxmox-backup/www/config/SyncView.js:226
-#, fuzzy
msgid "Add Pull Sync Job"
-msgstr "Synchronizacja"
+msgstr "Dodaj synchronizację pull"
#: proxmox-backup/www/config/SyncView.js:232
-#, fuzzy
msgid "Add Push Sync Job"
-msgstr "Zadanie synchronizacji"
+msgstr "Dodaj synchronizację push"
#: pmg-gui/js/PBSConfig.js:114
msgid "Add Remote"
msgstr "Dodaj zdalne konto"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:93
-#, fuzzy
msgid "Add Secret"
-msgstr "Sekret"
+msgstr "Dodaj sekret"
#: pmg-gui/js/Utils.js:726
-#, fuzzy
msgid "Add Separator"
-msgstr "Dodaj magazyn"
+msgstr "Dodaj separator"
#: pve-manager/www/manager6/node/Directory.js:53
#: pve-manager/www/manager6/node/LVM.js:42
@@ -567,11 +545,11 @@ msgstr "Dodaj jako magazyn"
#: proxmox-backup/www/form/GroupFilter.js:409
msgid "Add exclude"
-msgstr ""
+msgstr "Dodaj wykluczenia"
#: proxmox-backup/www/form/GroupFilter.js:353
msgid "Add include"
-msgstr ""
+msgstr "Dodaj uwzględniane"
#: pve-manager/www/manager6/tree/ResourceMapTree.js:348
msgid "Add new host mapping for '{0}'"
@@ -633,9 +611,8 @@ msgid "Advanced"
msgstr "Zaawansowane"
#: pve-manager/www/manager6/dc/MetricServerView.js:674
-#, fuzzy
msgid "Advanced JSON Configuration"
-msgstr "Pokaż konfigurację"
+msgstr "Zaawansowana konfiguracja JSON"
#: pve-manager/www/manager6/sdn/zones/EvpnEdit.js:73
msgid "Advertise Subnets"
@@ -643,14 +620,12 @@ msgstr "Ogłaszanie podsieci"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRuleEdit.js:13
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRules.js:18
-#, fuzzy
msgid "Affinity"
-msgstr "Afiniczność CPU"
+msgstr "Afiniczność"
#: pve-manager/www/manager6/dc/Config.js:173
-#, fuzzy
msgid "Affinity Rules"
-msgstr "Afiniczność CPU"
+msgstr "Reguły afiniczności"
#: proxmox-backup/www/tape/DriveStatus.js:402
msgid "Alert Flags"
@@ -719,11 +694,11 @@ msgstr "Wszystko w porządku, masz skonfigurowane repozytoria produkcyjne!"
#: pmg-gui/js/AuthEditOIDC.js:201
msgid "All auto-created users get audit role"
-msgstr ""
+msgstr "Wszyscy automatycznie utworzeni użytkownicy otrzymują rolę audytora"
#: pve-manager/www/manager6/sdn/fabrics/NodeEdit.js:189
msgid "All available nodes are already part of the fabric"
-msgstr ""
+msgstr "Wszystkie dostępne węzły należą już do sieci"
#: proxmox-backup/www/datastore/OptionView.js:18
msgid "All backup snapshots and their data will be permanently destroyed!"
@@ -739,16 +714,15 @@ msgstr "wszystkie za wyjątkiem {0}"
#: proxmox-backup/www/datastore/Content.js:1255
msgid "All failed"
-msgstr "wszystko błędne"
+msgstr "Wszystko błędne"
#: pmg-gui/js/form/MatchModeSelector.js:6
-#, fuzzy
msgid "All match"
-msgstr "wszystkie reguły pasują"
+msgstr "Wszystkie pasują"
#: pve-yew-mobile-gui/src/pages/page_node_status/services_panel.rs:75
msgid "All required services running"
-msgstr ""
+msgstr "Wszystkie wymagane usługi działają"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:506
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:900
@@ -760,9 +734,8 @@ msgid "Allocated"
msgstr "Zajęte"
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:250
-#, fuzzy
msgid "Allocation"
-msgstr "Wstępna alokacja"
+msgstr "Rozmieszczenie"
#: proxmox-backup/www/tape/PoolConfig.js:121
#: proxmox-backup/www/tape/form/PoolSelector.js:30
@@ -772,11 +745,11 @@ msgstr "Reguły rozmieszczania"
#: pve-manager/www/manager6/qemu/SevEdit.js:92
msgid "Allow Debugging"
-msgstr ""
+msgstr "Zezwalaj na debugowanie"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:84
msgid "Allow Direct IO"
-msgstr ""
+msgstr "Zezwalaj na Direct I/O"
#: pmg-gui/js/SpamQuarantineOptions.js:69
#: pmg-gui/js/VirusQuarantineOptions.js:20
@@ -785,17 +758,15 @@ msgstr "Zezwalaj na HREF"
#: pve-manager/www/manager6/qemu/SevEdit.js:103
msgid "Allow Key-Sharing"
-msgstr ""
+msgstr "Zezwalaj na współdzielenie kluczy"
#: pve-manager/www/manager6/qemu/SevEdit.js:114
-#, fuzzy
msgid "Allow SMT"
-msgstr "Zezwalaj na HREF"
+msgstr "Zezwalaj na SMT"
#: pve-manager/www/manager6/storage/Base.js:84
-#, fuzzy
msgid "Allow Snapshots as Volume-Chain"
-msgstr "nie znaleziono migawek"
+msgstr "Zezwalaj na migawki jako łańcuch woluminów"
#: pve-manager/www/manager6/window/BulkAction.js:90
msgid "Allow local disk migration"
@@ -813,15 +784,13 @@ msgid "Alphabetical"
msgstr "Alfabetycznie"
#: proxmox-yew-comp/src/apt_repositories.rs:511
-#, fuzzy
msgid "Already configured"
-msgstr "{0} jest już skonfigurowane"
+msgstr "Już skonfigurowane"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:373
#: proxmox-widget-toolkit/src/node/NetworkView.js:287
-#, fuzzy
msgid "Alternative Names"
-msgstr "Alternatywne nazwy podmiotu"
+msgstr "Alternatywne nazwy"
#: pmg-gui/js/PBSRemoteEdit.js:87
#: pve-manager/www/manager6/form/NotificationPolicySelector.js:5
@@ -832,9 +801,8 @@ msgid "Always"
msgstr "zawsze"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:221
-#, fuzzy
msgid "Always send email"
-msgstr "Wyślij e-mail"
+msgstr "Zawsze wysyłaj e-mail"
#: proxmox-backup/www/window/DataStoreEdit.js:105
#: proxmox-backup/www/window/DataStoreEdit.js:108
@@ -848,7 +816,7 @@ msgstr "Podczas rejestracji klucza wystąpił błąd."
#: pve-yew-mobile-gui/src/pages/page_dashboard.rs:165
msgid "Analytics"
-msgstr ""
+msgstr "Statystyki"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:120
#: proxmox-yew-comp/src/auth_edit_ldap.rs:201
@@ -856,9 +824,8 @@ msgid "Anonymous Search"
msgstr "Wyszukiwanie anonimowe"
#: pmg-gui/js/form/MatchModeSelector.js:7
-#, fuzzy
msgid "Any matches"
-msgstr "dowolna reguła pasuje"
+msgstr "Dowolna pasuje"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:512
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:901
@@ -866,9 +833,8 @@ msgid "Any rule matches"
msgstr "dowolna reguła pasuje"
#: pve-manager/www/manager6/ceph/Pool.js:325
-#, fuzzy
msgid "Application"
-msgstr "Replikacja"
+msgstr "Aplikacja"
#: pve-manager/www/manager6/dc/OptionView.js:529
msgid "Applies to new edits"
@@ -910,6 +876,8 @@ msgid ""
"Applying pending SDN changes will also apply any pending local node network "
"changes. Proceed?"
msgstr ""
+"Zastosowanie bieżących zmian w SDN spowoduje zastosowanie wszystkich "
+"oczekujących zmian w ustawieniach sieci lokalnego węzła. Kontynuować?"
#: proxmox-widget-toolkit/src/Utils.js:67 proxmox-yew-comp/src/lib.rs:276
msgid "Arabic"
@@ -939,7 +907,7 @@ msgstr "Na pewno chcesz usunąć kopię {0}?"
#: proxmox-backup/www/tape/window/Erase.js:14
msgid "Are you sure you want to format tape '{0}' ?"
-msgstr "Na pewno chcesz sformatować taśmę {0}?"
+msgstr "Na pewno chcesz sformatować taśmę '{0}'?"
#: proxmox-backup/www/tape/ChangerStatus.js:837
#: proxmox-backup/www/tape/DriveStatus.js:242
@@ -980,14 +948,12 @@ msgid "Are you sure you want to remove snapshot {0}"
msgstr "Na pewno chcesz usunąć migawkę {0}?"
#: proxmox-backup/www/tape/window/MediaRemoveWindow.js:13
-#, fuzzy
msgid "Are you sure you want to remove tape '{0}' ?"
-msgstr "Na pewno chcesz usunąć {0}?"
+msgstr "Na pewno chcesz usunąć taśmę '{0}'?"
#: proxmox-widget-toolkit/src/panel/Certificates.js:246
-#, fuzzy
msgid "Are you sure you want to remove the certificate"
-msgstr "Na pewno chcesz usunąć certyfikat używany do {0}?"
+msgstr "Na pewno chcesz usunąć certyfikat?"
#: proxmox-widget-toolkit/src/panel/Certificates.js:242
#: proxmox-yew-comp/src/acme/certificate_list.rs:120
@@ -995,19 +961,17 @@ msgid "Are you sure you want to remove the certificate used for {0}"
msgstr "Na pewno chcesz usunąć certyfikat używany do {0}?"
#: pve-manager/www/manager6/sdn/FabricsView.js:438
-#, fuzzy
msgid "Are you sure you want to remove the fabric \"{0}\"?"
-msgstr "Na pewno chcesz usunąć wpis {0}?"
+msgstr "Na pewno chcesz usunąć sieć \"{0}\"?"
#: pve-manager/www/manager6/sdn/FabricsView.js:448
-#, fuzzy
msgid ""
"Are you sure you want to remove the node \"{0}\" from the fabric \"{1}\"?"
-msgstr "Na pewno chcesz usunąć plan dla {0}?"
+msgstr "Na pewno chcesz usunąć węzeł \"{0}\" z sieci \"{1}\"?"
#: pmg-gui/js/PBSSnapshotView.js:152
msgid "Are you sure you want to remove the schedule for {0}"
-msgstr "Na pewno chcesz usunąć plan dla {0}?"
+msgstr "Na pewno chcesz usunąć harmonogram dla {0}?"
#: pve-manager/www/manager6/node/Subscription.js:182
#: proxmox-backup/www/Subscription.js:172
@@ -1016,9 +980,8 @@ msgid "Are you sure you want to remove the subscription key?"
msgstr "Na pewno chcesz usunąć klucz subskrypcji?"
#: proxmox-yew-comp/src/tfa/tfa_confirm_remove.rs:44
-#, fuzzy
msgid "Are you sure you want to remove this TFA entry?"
-msgstr "Na pewno chcesz usunąć ten wpis?"
+msgstr "Na pewno chcesz usunąć ten wpis TFA?"
#: pve-manager/www/manager6/dc/ACLView.js:163
#: pve-manager/www/manager6/sdn/VnetACLView.js:187
@@ -1026,18 +989,16 @@ msgid "Are you sure you want to remove this entry"
msgstr "Na pewno chcesz usunąć ten wpis?"
#: proxmox-yew-comp/src/confirm_button.rs:12
-#, fuzzy
msgid "Are you sure you want to remove this entry?"
msgstr "Na pewno chcesz usunąć ten wpis?"
#: proxmox-datacenter-manager/ui/src/remotes/config.rs:206
-#, fuzzy
msgid "Are you sure you want to remove this remote?"
-msgstr "Na pewno chcesz usunąć ten wpis?"
+msgstr "Na pewno chcesz usunąć tę maszynę?"
#: proxmox-widget-toolkit/src/window/TfaEdit.js:143
msgid "Are you sure you want to remove this {0} entry?"
-msgstr "Na pewno chcesz usunąć ten {0} wpis?"
+msgstr "Na pewno chcesz usunąć ten wpis {0}?"
#: pmg-gui/js/UserBlackWhiteList.js:176
msgid "Are you sure you want to remove {0} entries"
@@ -1049,7 +1010,7 @@ msgstr "Na pewno chcesz wyczyścić {0}?"
#: pve-manager/www/manager6/sdn/fabrics/ospf/FabricEdit.js:14
msgid "Area"
-msgstr ""
+msgstr "Obszar"
#: pve-manager/www/manager6/node/LVM.js:113
msgid "Assigned to LVs"
@@ -1059,23 +1020,23 @@ msgstr "Przypisane do woluminów logicznych"
msgid ""
"Assisted join: Paste encoded cluster join information and enter password."
msgstr ""
-"Asystowane dołączanie do klastra: wklej zakodowane dane klastra i podaj "
-"hasło."
+"Asystent dołączania do klastra: wklej zakodowane dane klastra i podaj hasło."
#: pve-manager/www/manager6/qemu/HDEdit.js:378
msgid "Async IO"
msgstr "Asynchroniczne IO"
#: pmg-gui/js/form/MatchModeSelector.js:8
-#, fuzzy
msgid "At least one does not match"
-msgstr "przynajmniej jedna reguła nie pasuje"
+msgstr "Przynajmniej jedna nie pasuje"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:70
msgid ""
"At least one remote could not be queried and has an unknown subscription "
"status."
msgstr ""
+"Przynajmniej jednej z maszyn nie można odpytać i ma nieznany stan "
+"subskrypcji."
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:58
msgid ""
@@ -1084,12 +1045,17 @@ msgid ""
"get\n"
"a list of available options. "
msgstr ""
+"Przynajmniej jedna z maszyn nie ma ważnej subskrypcji. Odwiedź stronę <a "
+"target=\"_blank\" href=\"https://www.proxmox.com\">www.proxmox.com</a>,\n"
+"aby zapoznać się z dostępnymi opcjami."
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:65
msgid ""
"At least one remote has mixed levels of subscription. These remotes fall "
"back to the lowest one."
msgstr ""
+"Przynajmniej jedna z maszyn ma inny poziom subskrypcji. Zostanie użyty "
+"najniższy z nich."
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:504
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:902
@@ -1141,9 +1107,8 @@ msgid "Auth-Provider Default"
msgstr "domyślne wystawcy"
#: proxmox-datacenter-manager/ui/src/remotes/config.rs:333
-#, fuzzy
msgid "AuthId"
-msgstr "Użytkownik"
+msgstr "AuthId"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:106
msgid "Authenticate"
@@ -1169,14 +1134,12 @@ msgid "Auto-generate a client encryption key"
msgstr "Wygeneruj klucz szyfrowania klienta"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:87
-#, fuzzy
msgid "Autocreate Groups"
-msgstr "Twórz użytkowników automatycznie"
+msgstr "Automatyczne tworzenie grup"
#: pmg-gui/js/AuthEditOIDC.js:177
-#, fuzzy
msgid "Autocreate Options"
-msgstr "Twórz użytkowników automatycznie"
+msgstr "Opcje automatycznego tworzenia"
#: proxmox-widget-toolkit/src/window/AuthEditOpenId.js:74
#: pmg-gui/js/AuthEditOIDC.js:181
@@ -1209,9 +1172,8 @@ msgid "Automatic (Storage used by the VM, or 'local')"
msgstr "automatycznie (magazyn używany przez maszynę lub 'local')"
#: pve-manager/www/manager6/ceph/Pool.js:396
-#, fuzzy
msgid "Autoscaler Mode"
-msgstr "Tryb automatycznego skalowania"
+msgstr "Tryb autoskalowania"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:58
#: proxmox-widget-toolkit/src/node/NetworkView.js:320
@@ -1309,9 +1271,8 @@ msgid "Backup Details"
msgstr "Szczegóły kopii"
#: proxmox-datacenter-manager/ui/src/pbs/snapshot_list.rs:124
-#, fuzzy
msgid "Backup Dir"
-msgstr "Czas wykonania"
+msgstr "Katalog kopii"
#: proxmox-backup/www/datastore/Content.js:972
msgid "Backup Group"
@@ -1365,9 +1326,8 @@ msgid "Backup content type not available for this storage."
msgstr "Typ zawartości kopii nie jest dostępny dla tego nośnika."
#: pve-manager/www/manager6/Utils.js:2166
-#, fuzzy
msgid "Backup notifications"
-msgstr "Wysyłanie powiadomień"
+msgstr "Powiadomienia o kopii"
#: pve-manager/www/manager6/grid/BackupView.js:158
msgid "Backup now"
@@ -1381,6 +1341,8 @@ msgstr "Kopie zapasowe na '{0}'"
msgid ""
"Backup write cache that can reduce IO pressure inside guests (VMs only)."
msgstr ""
+"Bufor zapisu dla kopii, który może zmniejszyć obciążenie dysku w maszynach "
+"(tylko VM)."
#: pmg-gui/js/NavigationTree.js:90
msgid "Backup/Restore"
@@ -1479,7 +1441,7 @@ msgstr "Użytkownik (bind)"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/hardware_panel.rs:83
msgid "Bios"
-msgstr ""
+msgstr "BIOS"
#: pmg-gui/js/QuarantineView.js:28 pmg-gui/js/SpamContextMenu.js:25
#: pmg-gui/js/SpamQuarantine.js:271 pmg-gui/js/UserBlackWhiteList.js:55
@@ -1515,7 +1477,6 @@ msgid "Bond Mode"
msgstr "Tryb agregacji"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:132
-#, fuzzy
msgid "Boot Device"
msgstr "Urządzenie startowe"
@@ -1586,7 +1547,7 @@ msgstr "Wbudowany (zmodyfikowany)"
#: proxmox-widget-toolkit/src/Utils.js:68 proxmox-yew-comp/src/lib.rs:277
msgid "Bulgarian"
-msgstr ""
+msgstr "bułgarski"
#: pve-manager/www/manager6/node/Config.js:35
msgid "Bulk Actions"
@@ -1657,24 +1618,24 @@ msgid "Busy"
msgstr "Zajęty"
#: pve-manager/www/manager6/ceph/ServiceList.js:80
-#, fuzzy
msgid ""
"By using different IDs, you can have multiple MDS per node, which increases "
"redundancy with more than one CephFS."
msgstr ""
-"Extra ID pozwala na tworzenie wielu MDS na węźle, co zwiększa redundancję "
-"przy więcej niż jednym CephFS."
+"Użycie różnych ID pozwala na tworzenie wielu MDS na węźle, co zwiększa "
+"redundancję przy więcej niż jednym CephFS."
#: proxmox-backup/www/tape/TapeInventory.js:335
-#, fuzzy
msgid "Bytes Used"
-msgstr "Używany ruch przychodzący"
+msgstr "Użyte bajty"
#: pve-manager/www/manager6/window/GuestImport.js:1006
msgid ""
"CD-ROM images cannot get imported, if required you can reconfigure the '{0}' "
"drive in the 'Advanced' tab."
msgstr ""
+"Nie można importować obrazów CD-ROM, jeżeli jest to niezbędne, to należy "
+"zmienić ustawienia '{0}' w zakłądce 'Zaawansowane'."
#: pve-manager/www/manager6/qemu/HardwareView.js:251
#: pve-manager/www/manager6/qemu/HardwareView.js:737
@@ -1683,9 +1644,8 @@ msgid "CD/DVD Drive"
msgstr "Napęd CD/DVD"
#: pve-manager/www/manager6/window/GuestImport.js:784
-#, fuzzy
msgid "CD/DVD Drives"
-msgstr "Napęd CD/DVD"
+msgstr "Napędy CD/DVD"
#: proxmox-widget-toolkit/src/form/NetworkSelector.js:98
#: proxmox-widget-toolkit/src/node/NetworkView.js:381
@@ -1713,31 +1673,28 @@ msgstr "Afiniczność CPU"
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:253
msgid "CPU Cores assigned"
-msgstr ""
+msgstr "Przypisane rdzenie CPU"
#: proxmox-datacenter-manager/ui/src/pve/node.rs:272
-#, fuzzy
msgid "CPU Model"
-msgstr "Model"
+msgstr "Model CPU"
#: pve-manager/www/manager6/node/Summary.js:202
#: pve-manager/www/manager6/panel/GuestSummary.js:139
msgid "CPU Pressure Stall"
-msgstr ""
+msgstr "Obciążenie CPU"
#: pve-manager/www/manager6/window/GuestImport.js:547
-#, fuzzy
msgid "CPU Type"
-msgstr "Typ systemu"
+msgstr "Typ CPU"
#: pve-manager/www/manager6/node/Summary.js:164
#: pve-manager/www/manager6/panel/GuestSummary.js:98
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:370
#: proxmox-datacenter-manager/ui/src/pve/node.rs:305
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:379
-#, fuzzy
msgid "CPU Usage"
-msgstr "wykorzystanie CPU"
+msgstr "Wykorzystanie CPU"
#: pve-manager/www/manager6/lxc/ResourceEdit.js:78
#: pve-manager/www/manager6/qemu/ProcessorEdit.js:193
@@ -1783,9 +1740,8 @@ msgid "CRM State"
msgstr "Stan CRM"
#: pve-manager/www/manager6/sdn/fabrics/openfabric/FabricEdit.js:58
-#, fuzzy
msgid "CSNP Interval"
-msgstr "Interwał"
+msgstr "Interwał CSNP"
#: pve-manager/www/manager6/window/BulkAction.js:350
#: proxmox-backup/www/datastore/Summary.js:169
@@ -1807,19 +1763,17 @@ msgid "Cache"
msgstr "Buforowanie"
#: proxmox-backup/www/Utils.js:748
-#, fuzzy
msgid "Calibrating"
-msgstr "Migracja"
+msgstr "Kalibracja"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:136
msgid "Can be used in notification matchers to match this job."
-msgstr ""
+msgstr "Można używać do identyfikacji tego zadania w regułach powiadomień."
#: proxmox-yew-widget-toolkit/src/touch/fab_menu.rs:264
#: proxmox-yew-widget-toolkit/src/widget/message_box.rs:132
-#, fuzzy
msgid "Cancel"
-msgstr "Anuluj edycję"
+msgstr "Anuluj"
#: pve-manager/www/manager6/form/TagEdit.js:351
msgid "Cancel Edit"
@@ -1839,39 +1793,43 @@ msgstr "Błąd pobierania informacji od agenta QEMU:<br>{0}"
#: pve-manager/www/manager6/window/Migrate.js:369
msgid "Cannot migrate VM with local CD/DVD"
-msgstr ""
+msgstr "Nie można zmigrować VM z lokalnym napędem CD/DVD"
#: pve-manager/www/manager6/window/Migrate.js:315
msgid "Cannot migrate VM with local resources: {0}"
-msgstr ""
+msgstr "Nie można zmigrować VM z lokalnymi zasobami: {0}"
#: pve-manager/www/manager6/window/Migrate.js:442
msgid "Cannot migrate VM, because {0}."
-msgstr ""
+msgstr "Nie można zmigrować VM: {0}"
#: pve-manager/www/manager6/window/Migrate.js:395
msgid ""
"Cannot migrate conntrack state, source node is lacking support. Active "
"network connections might get dropped."
msgstr ""
+"Nie można zmigrować stanów conntrack, węzeł źródłowy nie obsługuje tej "
+"funkcji. Aktywne połączenia sieciowe mogą zostać zerwane."
#: pve-manager/www/manager6/window/Migrate.js:403
msgid ""
"Cannot migrate conntrack state, target node is lacking support. Active "
"network connections might get dropped."
msgstr ""
+"Nie można zmigrować stanów conntrack, węzeł docelowy nie obsługuje tej "
+"funkcji. Aktywne połączenia sieciowe mogą zostać zerwane."
#: pve-manager/www/manager6/window/Migrate.js:529
msgid "Cannot migrate container, because {0}."
-msgstr ""
+msgstr "Nie można zmigrować kontenera: {0}"
#: pve-manager/www/manager6/window/Migrate.js:345
msgid "Cannot migrate running VM with mapped resources: {0}"
-msgstr ""
+msgstr "Nie można zmigrować działającej VM ze zmapowanymi zasobami: {0}"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:337
msgid "Cannot migrate with local resource: {0}"
-msgstr ""
+msgstr "Nie można zmigrować z lokalnym zasobem: {0}"
#: pve-manager/www/manager6/storage/ImageView.js:56
msgid "Cannot remove disk image."
@@ -1920,6 +1878,8 @@ msgid ""
"Caution: 'What Objects' match each mail part separately, so be careful with "
"any option besides 'Any matches'."
msgstr ""
+"Uwaga: 'Obiekty Co' są dopasowywane do każdej części e-maila z osobna, więc "
+"zachowaj ostrożność z wszystkimi opcjami poza 'Dowolna pasuje'."
#: pve-manager/www/manager6/ceph/Pool.js:269
msgid "Ceph Pool"
@@ -1938,14 +1898,12 @@ msgid "Ceph in the cluster"
msgstr "Ceph w tym klastrze"
#: pve-manager/www/manager6/window/CephInstall.js:38
-#, fuzzy
msgid "Ceph is not initialized."
-msgstr "{0} nie jest zainicjowany."
+msgstr "Ceph nie jest zainicjowany."
#: pve-manager/www/manager6/window/CephInstall.js:43
-#, fuzzy
msgid "Ceph is not installed on this node."
-msgstr "{0} nie jest zainstalowany na tym węźle."
+msgstr "Ceph nie jest zainstalowany na tym węźle."
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:27
msgid "Ceph version to install"
@@ -2014,7 +1972,6 @@ msgid "Change global Ceph flags"
msgstr "Zmień globalne flagi Cepha"
#: proxmox-backup/www/datastore/Content.js:1423
-#, fuzzy
msgid "Change owner"
msgstr "Zmień właściciela"
@@ -2103,7 +2060,6 @@ msgstr ""
"Wybierz czy chcesz zachować czy nadpisać poziom przywilejów dla kontenera."
#: proxmox-backup/www/datastore/OptionView.js:263
-#, fuzzy
msgid "Chunk Iteration Order"
msgstr "Kolejność części"
@@ -2137,9 +2093,8 @@ msgid "Clean Drive"
msgstr "Napęd czysty"
#: proxmox-backup/www/Utils.js:738
-#, fuzzy
msgid "Cleaning"
-msgstr "Wyczyść"
+msgstr "Czyszczenie"
#: pve-manager/www/manager6/ceph/OSD.js:184
#: pve-manager/www/manager6/window/SafeDestroyStorage.js:15
@@ -2156,9 +2111,8 @@ msgid "Clear Filter"
msgstr "Wyczyść filtr"
#: proxmox-yew-comp/src/tasks.rs:365
-#, fuzzy
msgid "Clear Filter ({})"
-msgstr "Wyczyść filtr"
+msgstr "Wyczyść filtr ({})"
#: pve-manager/www/manager6/window/BulkAction.js:447
msgid "Clear Filters"
@@ -2170,13 +2124,12 @@ msgid "Clear Status"
msgstr "Wyczyść stan"
#: proxmox-yew-widget-toolkit/src/widget/form/selector.rs:432
-#, fuzzy
msgid "Clear Value"
-msgstr "Filtruj wartości"
+msgstr "Wyczyść wartość"
#: proxmox-yew-comp/src/tfa/webauthn.rs:255
msgid "Click the button to start the authentication"
-msgstr ""
+msgstr "Wciśnij przycisk aby rozpocząć uwierzytelnienie"
#: pmg-gui/js/MailTracker.js:424
msgid "Client"
@@ -2209,9 +2162,8 @@ msgid "Client Message Rate Limit"
msgstr "Limit strumienia wiadomości klienta"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:86
-#, fuzzy
msgid "Clipboard"
-msgstr "Skopiuj do schowka"
+msgstr "Schowek"
#: pve-manager/www/manager6/Utils.js:2107
#: pve-manager/www/manager6/Utils.js:2137
@@ -2291,7 +2243,6 @@ msgid "Cluster Resources (average)"
msgstr "Zasoby klastra (średnio)"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:175
-#, fuzzy
msgid ""
"Cluster has active subscriptions and would be eligible for using the "
"enterprise repository."
@@ -2304,7 +2255,7 @@ msgid ""
"Cluster join task finished, node certificate may have changed, reload GUI!"
msgstr ""
"Dołączenie do klastra ukończone, certyfikat węzła może ulec zmianie, odśwież "
-"stronę panelu!"
+"stronę panela!"
#: pve-manager/www/manager6/panel/StatusPanel.js:38
msgid "Cluster log"
@@ -2328,7 +2279,7 @@ msgstr "Motyw"
#: proxmox-datacenter-manager/ui/src/top_nav_bar.rs:187
msgid "Coming soon"
-msgstr ""
+msgstr "Dostępne wkrótce"
#: pve-manager/www/manager6/ha/Fencing.js:33
msgid "Command"
@@ -2532,7 +2483,7 @@ msgstr "Konfiguruj plan wykonywania kopii"
#: pve-manager/www/manager6/sdn/fabrics/InterfacePanel.js:36
msgid "Configure the IP in the fabric, instead of /etc/network/interfaces"
-msgstr ""
+msgstr "Skonfiguruj IP w sieci, zamiast /etc/network/interfaces"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:48
#: proxmox-yew-comp/src/apt_repositories.rs:656
@@ -2568,9 +2519,8 @@ msgid "Confirm"
msgstr "Potwierdź"
#: proxmox-widget-toolkit/src/window/PasswordEdit.js:55
-#, fuzzy
msgid "Confirm New Password"
-msgstr "Potwierdź hasło"
+msgstr "Potwierdź nowe hasło"
#: proxmox-backup/www/tape/window/EncryptionEdit.js:45
msgid "Confirm Password"
@@ -2595,9 +2545,8 @@ msgstr "Potwierdź hasło"
#. A message that conveys what will be confirmed.
#: proxmox-yew-widget-toolkit/src/widget/confirm_dialog.rs:30
-#, fuzzy
msgid "Confirm this action?"
-msgstr "Konfiguracja"
+msgstr "Potwierdzić tę czynność?"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:123
#: proxmox-widget-toolkit/src/window/AddTotp.js:270
@@ -2608,24 +2557,20 @@ msgid "Confirm your ({0}) password"
msgstr "Potwierdź swoje hasło ({0})"
#: proxmox-yew-comp/src/tfa/mod.rs:45
-#, fuzzy
msgid "Confirm your ({}) password"
-msgstr "Potwierdź swoje hasło ({0})"
+msgstr "Potwierdź swoje hasło ({})"
#: proxmox-datacenter-manager/ui/src/remotes/add_wizard.rs:101
-#, fuzzy
msgid "Connection"
-msgstr "Błąd połączenia"
+msgstr "Połączenie"
#: proxmox-backup/www/window/DatastoreRepoInfo.js:6
-#, fuzzy
msgid "Connection Information"
-msgstr "Zaproszenie do klastra"
+msgstr "Informacje o połączeniu"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_connect.rs:221
-#, fuzzy
msgid "Connection OK"
-msgstr "Błąd połączenia"
+msgstr "Połączenie OK"
#: proxmox-widget-toolkit/src/Utils.js:412
#: proxmox-widget-toolkit/src/Utils.js:548
@@ -2643,30 +2588,29 @@ msgstr ""
"uruchomione?"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_summary.rs:132
-#, fuzzy
msgid "Connections"
-msgstr "Błąd połączenia"
+msgstr "Połączenia"
#: pve-manager/www/manager6/window/Migrate.js:642
msgid "Conntrack state"
-msgstr ""
+msgstr "Stan conntrack"
#: pve-manager/www/manager6/window/Migrate.js:412
msgid ""
"Conntrack state migration disabled. Active network connections might get "
"dropped."
msgstr ""
+"Migracja stanów conntrack wyłączona. Aktywne połączenia sieciowe mogą zostać "
+"zerwane."
#: proxmox-widget-toolkit/src/window/ConsentModal.js:15
-#, fuzzy
msgid "Consent"
-msgstr "Konsola"
+msgstr "Zgoda"
#: pve-manager/www/manager6/dc/OptionView.js:583
#: proxmox-backup/www/config/NodeOptionView.js:68
-#, fuzzy
msgid "Consent Text"
-msgstr "Typ zawartości"
+msgstr "Tekst zgody"
#: proxmox-widget-toolkit/src/Utils.js:756 pmg-gui/js/ServerStatus.js:60
#: pve-manager/www/manager6/Utils.js:2128
@@ -2688,9 +2632,8 @@ msgid "Console"
msgstr "Konsola"
#: proxmox-yew-comp/src/utils.rs:221
-#, fuzzy
msgid "Console (xterm.js)"
-msgstr "Konsola"
+msgstr "Konsola (xterm.js)"
#: pve-manager/www/manager6/dc/OptionView.js:87
msgid "Console Viewer"
@@ -2792,33 +2735,32 @@ msgstr "Skopiuj kod zaproszenia"
#: pve-manager/www/manager6/storage/PBSEdit.js:61
msgid "Copy Key"
-msgstr "Kopiuj klucz"
+msgstr "Skopiuj klucz"
#: proxmox-widget-toolkit/src/window/AddTfaRecovery.js:179
#: proxmox-yew-comp/src/tfa/tfa_add_recovery.rs:147
msgid "Copy Recovery Keys"
-msgstr "Kopiuj klucze odzyskiwania"
+msgstr "Skopiuj klucze odzyskiwania"
#: pve-manager/www/manager6/dc/TokenEdit.js:163
#: proxmox-backup/www/window/TokenEdit.js:213
msgid "Copy Secret Value"
-msgstr "Kopiuj wartość sekretu"
+msgstr "Skopiuj wartość sekretu"
#: pve-manager/www/manager6/Utils.js:2096
#: proxmox-datacenter-manager/ui/src/tasks.rs:38
#: proxmox-yew-comp/src/utils.rs:390
msgid "Copy data"
-msgstr "Kopiuj dane"
+msgstr "Skopiuj dane"
#: proxmox-backup/www/datastore/Content.js:1403
#: proxmox-backup/www/datastore/Content.js:1467
-#, fuzzy
msgid "Copy name to clipboard"
-msgstr "Skopiuj do schowka"
+msgstr "Skopiuj nazwę do schowka"
#: pmg-gui/js/Utils.js:683
msgid "Copy original mail to Attachment Quarantine"
-msgstr "Kopiuj oryginalną wiadomość do kwarantanny załączników"
+msgstr "Skopiuj oryginalną wiadomość do kwarantanny załączników"
#: pve-manager/www/manager6/dc/ClusterEdit.js:65
msgid "Copy the Join Information here and use it on the node you want to add."
@@ -2845,11 +2787,11 @@ msgstr "Nie znaleziono instalacji Cepha w tym klastrze"
#: pmg-gui/js/DKIMSettings.js:41
msgid "Could not read private key - please create a selector first!"
-msgstr ""
+msgstr "Nie można wczytać klucza prywatnego - utwórz najpierw selektor!"
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:69
msgid "Could reach all remotes."
-msgstr ""
+msgstr "Wszystkie maszyny dostępne."
#: pmg-gui/js/ContactStatistics.js:168 pmg-gui/js/Dashboard.js:488
#: pmg-gui/js/DomainStatistics.js:94 pmg-gui/js/DomainStatistics.js:137
@@ -2936,18 +2878,16 @@ msgid "Create Cluster"
msgstr "Utwórz klaster"
#: proxmox-backup/www/Utils.js:430
-#, fuzzy
msgid "Create Datastore"
-msgstr "Magazyn docelowy"
+msgstr "Utwórz magazyn"
#: pve-manager/www/manager6/lxc/FeaturesEdit.js:66
msgid "Create Device Nodes"
msgstr "Utwórz węzły urządzeń"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_summary.rs:109
-#, fuzzy
msgid "Create Token"
-msgstr "Utwórz CT"
+msgstr "Utwórz klucz"
#: pve-manager/www/manager6/Workspace.js:286
#: pve-manager/www/manager6/node/CmdMenu.js:9
@@ -2955,14 +2895,12 @@ msgid "Create VM"
msgstr "Utwórz VM"
#: pve-manager/www/manager6/sdn/fabrics/NodeEdit.js:64
-#, fuzzy
msgid "Create another"
-msgstr "Utwórz klaster"
+msgstr "Utwórz następne"
#: pve-manager/www/manager6/ceph/OSD.js:871
-#, fuzzy
msgid "Create: OSD"
-msgstr "Utwórz VM"
+msgstr "Utwórz: OSD"
#: proxmox-widget-toolkit/src/panel/TfaView.js:238
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:161
@@ -3026,7 +2964,7 @@ msgstr "Własna punktacja"
#: proxmox-widget-toolkit/src/Utils.js:70 proxmox-yew-comp/src/lib.rs:279
msgid "Czech"
-msgstr ""
+msgstr "czeski"
#: pve-manager/www/manager6/grid/FirewallRules.js:993
msgid "D.Port"
@@ -3076,7 +3014,6 @@ msgid "DNS API"
msgstr "API DNS"
#: pve-yew-mobile-gui/src/pages/page_lxc_status/resources_panel.rs:118
-#, fuzzy
msgid "DNS Domain"
msgstr "Domena DNS"
@@ -3118,21 +3055,18 @@ msgstr "Serwer DNS"
#: proxmox-yew-comp/src/configuration/dns.rs:30
#: proxmox-yew-comp/src/configuration/dns.rs:62
-#, fuzzy
msgid "DNS server 1"
-msgstr "Serwer DNS"
+msgstr "Serwer DNS 1"
#: proxmox-yew-comp/src/configuration/dns.rs:38
#: proxmox-yew-comp/src/configuration/dns.rs:65
-#, fuzzy
msgid "DNS server 2"
-msgstr "Serwer DNS"
+msgstr "Serwer DNS 2"
#: proxmox-yew-comp/src/configuration/dns.rs:46
#: proxmox-yew-comp/src/configuration/dns.rs:66
-#, fuzzy
msgid "DNS server 3"
-msgstr "Serwer DNS"
+msgstr "Serwer DNS 3"
#: pve-manager/www/manager6/lxc/DNS.js:43
#: pve-manager/www/manager6/qemu/CloudInit.js:230
@@ -3189,7 +3123,6 @@ msgid "Data Pool"
msgstr "Pula danych"
#: proxmox-backup/www/datastore/OptionView.js:272
-#, fuzzy
msgid "Data Sync Level"
msgstr "Poziom synchronizacji"
@@ -3232,9 +3165,8 @@ msgid "Datastore Options"
msgstr "Opcje magazynu"
#: proxmox-backup/www/window/DataStoreEdit.js:58
-#, fuzzy
msgid "Datastore Type"
-msgstr "Magazyny danych"
+msgstr "Typ magazynu"
#: proxmox-backup/www/dashboard/DataStoreStatistics.js:56
msgid "Datastore Usage"
@@ -3251,9 +3183,8 @@ msgstr "Magazyn niedostępny"
#: proxmox-backup/www/datastore/DataStoreListSummary.js:39
#: proxmox-backup/www/datastore/Summary.js:79
-#, fuzzy
msgid "Datastore is not mounted"
-msgstr "Magazyn niedostępny"
+msgstr "Magazyn nie jest zamontowany"
#: proxmox-backup/www/datastore/DataStoreList.js:194
msgid "Datastores"
@@ -3337,9 +3268,8 @@ msgid "Default"
msgstr "domyślnie"
#: pve-manager/www/manager6/node/NodeOptionsView.js:80
-#, fuzzy
msgid "Default (80%)"
-msgstr "domyślnie"
+msgstr "domyślnie (80%)"
#: proxmox-backup/www/window/NotifyOptions.js:6
msgid "Default (Always)"
@@ -3351,19 +3281,16 @@ msgstr "domyślnie (błędy)"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:118
#: pve-yew-mobile-gui/src/pages/page_lxc_status/config_panel.rs:104
-#, fuzzy
msgid "Default (any)"
-msgstr "domyślnie (zawsze)"
+msgstr "domyślnie (każde)"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:172
-#, fuzzy
msgid "Default (disabled)"
-msgstr "brak (wyłączone)"
+msgstr "domyślnie (wyłączone)"
#: pve-manager/www/manager6/window/GuestImport.js:593
-#, fuzzy
msgid "Default Bridge"
-msgstr "domyślnie: pochodzenie"
+msgstr "domyślny mostek"
#: proxmox-backup/www/tape/window/TapeRestore.js:40
msgid "Default Datastore"
@@ -3380,18 +3307,16 @@ msgstr "Domyślna przestrzeń nazw"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:85
#: proxmox-widget-toolkit/src/window/AuthEditOpenId.js:42
#: proxmox-widget-toolkit/src/window/AuthEditSimple.js:19
-#, fuzzy
msgid "Default Realm"
-msgstr "Serwer docelowy"
+msgstr "Domyślna domena"
#: pmg-gui/js/MailProxyRelaying.js:10
msgid "Default Relay"
msgstr "Serwer docelowy"
#: pve-manager/www/manager6/window/GuestImport.js:525
-#, fuzzy
msgid "Default Storage"
-msgstr "Domyślny magazyn"
+msgstr "domyślny magazyn"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:366
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:256
@@ -3400,9 +3325,8 @@ msgid "Default Sync Options"
msgstr "Domyślne opcje synchronizacji"
#: pmg-gui/js/AuthEditOIDC.js:90
-#, fuzzy
msgid "Default realm"
-msgstr "Serwer docelowy"
+msgstr "Domyślna domena"
#: proxmox-widget-toolkit/src/window/SyncWindow.js:133
#: pve-manager/www/manager6/dc/RealmSyncJob.js:403
@@ -3415,7 +3339,6 @@ msgid "Default user classes: inetorgperson, posixaccount, person, user"
msgstr "Domyślne klasy użytkownika: inetorgperson, posixaccount, person, user"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/hardware_panel.rs:82
-#, fuzzy
msgid "Default)"
msgstr "domyślnie"
@@ -3445,6 +3368,9 @@ msgid ""
"the cluster or single node. Fingerprints are required for self-signed "
"certificates."
msgstr ""
+"Wprowadź zestaw adresów pod którymi Proxmox Datacenter Manager może połączyć "
+"się z klastrem lub pojedynczym węzłem. Dla certyfikatów z podpisem własnym "
+"wymagane są odciski."
#: pmg-gui/js/PBSSnapshotView.js:182
msgid "Delay"
@@ -3480,7 +3406,6 @@ msgid "Delete Snapshot"
msgstr "Usuń migawkę"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:426
-#, fuzzy
msgid "Delete Source"
msgstr "Usuń źródło"
@@ -3531,9 +3456,8 @@ msgstr "Pasek"
#: pve-yew-mobile-gui/src/pages/page_settings.rs:41
#: proxmox-yew-comp/src/theme_dialog.rs:55
-#, fuzzy
msgid "Density"
-msgstr "Gęstość taśmy"
+msgstr "Gęstość"
#: proxmox-widget-toolkit/src/node/APT.js:49
#: proxmox-widget-toolkit/src/node/APTRepositories.js:36
@@ -3656,9 +3580,8 @@ msgid "Detail"
msgstr "Szczegóły"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:447
-#, fuzzy
msgid "Detailed Mapping"
-msgstr "Mapowanie magazynu"
+msgstr "Szczegóły mapowania"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:65
#: pve-manager/www/manager6/ceph/OSD.js:898
@@ -3697,32 +3620,28 @@ msgid "Device Class"
msgstr "Klasa urządzenia"
#: pve-manager/www/manager6/qemu/PCIEdit.js:305
-#, fuzzy
msgid "Device ID"
-msgstr "Urządzenie"
+msgstr "ID urządzenia"
#: proxmox-widget-toolkit/src/Utils.js:1422
msgid "Device Ineligible"
msgstr "Urządzenie nieprawidłowe"
#: pve-manager/www/manager6/lxc/Resources.js:399
-#, fuzzy
msgid "Device Passthrough"
-msgstr "Klasa urządzenia"
+msgstr "bezpośredni dostęp do urządzenia"
#: pve-manager/www/manager6/lxc/DeviceEdit.js:53
-#, fuzzy
msgid "Device Path"
-msgstr "Urządzenie"
+msgstr "Ścieżka do urządzenia"
#: pve-manager/www/manager6/ceph/OSDDetails.js:240
msgid "Device node"
msgstr "Węzeł urządzenia"
#: proxmox-backup/www/window/DataStoreEdit.js:165
-#, fuzzy
msgid "Device path"
-msgstr "Urządzenie"
+msgstr "Ścieżka do urządzenia"
#: proxmox-widget-toolkit/src/window/ZFSDetail.js:102
#: pve-manager/www/manager6/ceph/OSDDetails.js:211
@@ -3757,19 +3676,19 @@ msgstr "Katalog"
#: pve-manager/www/manager6/form/DirMapSelector.js:24
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:34
-#, fuzzy
msgid "Directory ID"
-msgstr "Katalog"
+msgstr "ID katalogu"
#: pve-manager/www/manager6/dc/Config.js:356
-#, fuzzy
msgid "Directory Mappings"
-msgstr "Magazyn katalogów"
+msgstr "Mapowanie katalogów"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:43
msgid ""
"Directory Mappings can be managed under Datacenter -> Directory Mappings"
msgstr ""
+"Mapowanie katalogów konfiguruje się przez Centrum danych -> Mapowanie "
+"katalogów"
#: pve-manager/www/manager6/Utils.js:2089 proxmox-backup/www/Utils.js:433
#: proxmox-datacenter-manager/ui/src/tasks.rs:31
@@ -3847,9 +3766,8 @@ msgstr "Operacje dyskowe"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:409
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:418
-#, fuzzy
msgid "Disk I/O"
-msgstr "Przepustowość dysku"
+msgstr "I/O dysku"
#: pve-manager/www/manager6/panel/GuestSummary.js:131
msgid "Disk IO"
@@ -3861,15 +3779,13 @@ msgstr "Przenoszenie dysku"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:206
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:206
-#, fuzzy
msgid "Disk Read"
-msgstr "Całkowity odczyt"
+msgstr "Odczyt"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:207
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:207
-#, fuzzy
msgid "Disk Write"
-msgstr "Całkowity zapis"
+msgstr "Zapis"
#: pve-manager/www/manager6/Utils.js:693
#: pve-manager/www/manager6/form/DiskStorageSelector.js:142
@@ -3893,7 +3809,7 @@ msgstr "Wykorzystanie dysku"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:136
msgid "Disk, Network, USB"
-msgstr ""
+msgstr "dysk, sieć, USB"
#: pve-manager/www/manager6/lxc/CreateWizard.js:225
#: pve-manager/www/manager6/node/Config.js:318
@@ -3918,9 +3834,8 @@ msgid "Do not use any media"
msgstr "Nie używaj żadnego nośnika"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:14
-#, fuzzy
msgid "Do you want to reset {0} to its default settings?"
-msgstr "Jesteś pewien, że chcesz zresetować VM {0}?"
+msgstr "Czy chcesz zresetować VM {0} do ustawień domyślnych?"
#: proxmox-widget-toolkit/src/panel/NotificationConfigView.js:120
msgid "Do you want to send a test notification to '{0}'?"
@@ -4031,7 +3946,7 @@ msgstr "Napęd"
#: proxmox-backup/www/tape/DriveStatus.js:353
msgid "Drive Activity"
-msgstr ""
+msgstr "Aktywność napędu"
#: proxmox-backup/www/tape/DriveConfig.js:172
#: proxmox-backup/www/tape/window/DriveEdit.js:56
@@ -4123,14 +4038,12 @@ msgid "E-Mail attribute"
msgstr "Atrybut e-mail"
#: pve-manager/www/manager6/node/ACME.js:220
-#, fuzzy
msgid "EAB Key"
-msgstr "Klucz API"
+msgstr "Klucz EAB"
#: pve-manager/www/manager6/node/ACME.js:210
-#, fuzzy
msgid "EAB Key ID"
-msgstr "ID kluczy"
+msgstr "ID klucza EAB"
#: proxmox-widget-toolkit/src/Utils.js:795
msgid "EB"
@@ -4155,10 +4068,11 @@ msgid ""
"EFI state cannot be imported, you may need to reconfigure the boot order "
"(see {0})"
msgstr ""
+"Nie można zaimportować stanu EFI, może być konieczna zmiana kolejności "
+"uruchamiania (zobacz {0})"
#: proxmox-yew-comp/src/user_panel.rs:510
#: proxmox-yew-comp/src/user_panel.rs:535
-#, fuzzy
msgid "EMail"
msgstr "E-mail"
@@ -4291,9 +4205,8 @@ msgstr "Edytuj tagi"
#: proxmox-yew-comp/src/acme/acme_domains.rs:233
#: proxmox-yew-comp/src/acme/acme_domains.rs:423
-#, fuzzy
msgid "Edit account settings"
-msgstr "Edytuj opcje panelu"
+msgstr "Edytuj ustawienia konta"
#: proxmox-backup/www/Dashboard.js:243
msgid "Edit dashboard settings"
@@ -4304,7 +4217,6 @@ msgid "Edit existing encryption key (dangerous!)"
msgstr "Edycja klucza szyfrowania (niebezpieczne!)"
#: proxmox-widget-toolkit/src/panel/NotesView.js:145
-#, fuzzy
msgid "Edit notes"
msgstr "Edycja notatki"
@@ -4330,8 +4242,8 @@ msgstr "Musi być skonfigurowane mailto albo mailto-user"
msgid ""
"Either reboot or use 'Apply Configuration' (needs ifupdown2) to activate"
msgstr ""
-"aktywacja przez restart lub naciśnięcie przycisku \"Zastosuj zmiany\" "
-"(wymaga pakietu ifupdown2)"
+"aktywacja przez restart lub naciśnięcie przycisku \"Zastosuj "
+"zmiany\" (wymaga pakietu ifupdown2)"
#: proxmox-backup/www/tape/BackupJobs.js:230
#: proxmox-backup/www/tape/DriveStatus.js:227
@@ -4358,9 +4270,8 @@ msgid "Email from address"
msgstr "Powiadomienia z adresu"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:97
-#, fuzzy
msgid "Email to"
-msgstr "E-mail"
+msgstr "E-mail do"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:197
#: proxmox-widget-toolkit/src/node/APTRepositories.js:571
@@ -4392,9 +4303,8 @@ msgid "Enable Job"
msgstr "Włącz"
#: pve-manager/www/manager6/qemu/SevEdit.js:125
-#, fuzzy
msgid "Enable Kernel Hashes"
-msgstr "Nowi użytkownicy"
+msgstr "Włącz hasze jądra"
#: pve-manager/www/manager6/qemu/ProcessorEdit.js:231
msgid "Enable NUMA"
@@ -4414,19 +4324,19 @@ msgstr "Włącz logowanie TLS"
#: pve-manager/www/manager6/ha/ResourceEdit.js:119
msgid "Enable if HA resource should automatically adjust to HA rules."
-msgstr ""
+msgstr "Włącz jeśli zasób powinien automatycznie dostosowywać się do reguł HA."
#: pve-manager/www/manager6/ha/rules/NodeAffinityRuleEdit.js:133
msgid "Enable if the HA Resources must be restricted to the nodes."
-msgstr ""
+msgstr "Włącz jeśli zasoby HA mają być przywiązane do węzłów."
#: pve-manager/www/manager6/storage/LVMEdit.js:235
msgid "Enable if the LVM is located on a shared LUN."
-msgstr ""
+msgstr "Włącz jeśli LVM znajduje się na współdzielonym LUN."
#: pve-manager/www/manager6/storage/DirEdit.js:36
msgid "Enable if the underlying file system is already shared between nodes."
-msgstr ""
+msgstr "Włącz jeśli system plików już jest współdzielony między węzłami."
#: proxmox-widget-toolkit/src/window/SyncWindow.js:97
#: pve-manager/www/manager6/dc/SyncWindow.js:121
@@ -4445,7 +4355,7 @@ msgstr "Włącz limity pojemności"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:66
msgid "Enable support for extended attributes."
-msgstr ""
+msgstr "Włącz obsługę rozszerzonych atrybutów."
#: proxmox-widget-toolkit/src/Utils.js:46
#: proxmox-widget-toolkit/src/node/APTRepositories.js:242
@@ -4499,7 +4409,7 @@ msgstr "włączone dla Windows"
#: pve-manager/www/manager6/window/Migrate.js:646
msgid "Enables live migration of conntrack entries for this VM."
-msgstr ""
+msgstr "Umożliwia migrację połączeń conntrack dla tego VM."
#: pve-manager/www/manager6/ceph/OSD.js:101
msgid "Encrypt OSD"
@@ -4513,9 +4423,8 @@ msgid "Encrypted"
msgstr "Zaszyfrowane"
#: proxmox-backup/www/window/SyncJobEdit.js:469
-#, fuzzy
msgid "Encrypted Only"
-msgstr "Zaszyfrowane"
+msgstr "Tylko zaszyfrowane"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:76
#: pmg-gui/js/PBSConfig.js:168 pve-manager/www/manager6/storage/PBSEdit.js:474
@@ -4557,9 +4466,8 @@ msgstr "Czas zakończenia"
#: proxmox-backup/www/config/S3ClientView.js:115
#: proxmox-backup/www/form/S3ClientSelector.js:26
#: proxmox-backup/www/window/S3ClientEdit.js:46
-#, fuzzy
msgid "Endpoint"
-msgstr "Nazwa odbiorcy"
+msgstr "Pojemnik"
#: proxmox-widget-toolkit/src/panel/GotifyEditPanel.js:17
#: proxmox-widget-toolkit/src/panel/SendmailEditPanel.js:28
@@ -4570,9 +4478,8 @@ msgstr "Nazwa odbiorcy"
#: proxmox-datacenter-manager/ui/src/remotes/add_wizard.rs:124
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:124
-#, fuzzy
msgid "Endpoints"
-msgstr "Nazwa odbiorcy"
+msgstr "Pojemniki"
#: proxmox-widget-toolkit/src/Utils.js:73
#: proxmox-datacenter-manager/ui/src/main.rs:309
@@ -4582,7 +4489,7 @@ msgstr "angielski"
#: proxmox-backup/www/datastore/OptionView.js:286
msgid "Ensure underlying storage honors access time updates"
-msgstr ""
+msgstr "Upewnij się, że magazyn obsługuje aktualizacje czasu dostępu"
#: pve-manager/www/manager6/window/DownloadUrlToStorage.js:141
msgid "Enter URL to download"
@@ -4610,7 +4517,7 @@ msgstr "Wpis"
#: pmg-gui/js/DKIMSettings.js:124
msgid "Envelope"
-msgstr ""
+msgstr "Koperta"
#: pve-manager/www/manager6/Utils.js:2097
#: proxmox-datacenter-manager/ui/src/tasks.rs:39
@@ -4619,9 +4526,8 @@ msgid "Erase data"
msgstr "Usuń dane"
#: proxmox-backup/www/Utils.js:746
-#, fuzzy
msgid "Erasing"
-msgstr "Usuń dane"
+msgstr "Usuwanie"
#: proxmox-widget-toolkit/src/Utils.js:50
#: proxmox-widget-toolkit/src/Utils.js:527
@@ -4872,9 +4778,8 @@ msgid "Example"
msgstr "Przykład"
#: proxmox-backup/www/form/GroupFilter.js:446
-#, fuzzy
msgid "Exclude"
-msgstr "Pomiń tagi"
+msgstr "Wykluczenia"
#: pve-manager/www/manager6/window/BulkAction.js:384
msgid "Exclude Tags"
@@ -4882,7 +4787,7 @@ msgstr "Pomiń tagi"
#: proxmox-backup/www/form/GroupFilter.js:422
msgid "Exclude filters will be applied after include filters"
-msgstr ""
+msgstr "Wykluczenia zostaną zastosowane po regułach uwzględnianych"
#: pve-manager/www/manager6/dc/Backup.js:260
#: pve-manager/www/manager6/dc/BackupJobDetail.js:411
@@ -4965,11 +4870,11 @@ msgstr "Nazwa systemu plików"
#: pve-manager/www/manager6/sdn/controllers/EvpnEdit.js:43
#: pve-manager/www/manager6/sdn/zones/VxlanEdit.js:64
msgid "Fabric"
-msgstr ""
+msgstr "Sieć"
#: pve-manager/www/manager6/dc/Config.js:242
msgid "Fabrics"
-msgstr ""
+msgstr "Sieci"
#: pmg-gui/js/RuleConfiguration.js:180
msgid "Factory Defaults"
@@ -4977,9 +4882,8 @@ msgstr "Ustawienia początkowe"
#: pve-manager/www/manager6/ha/ResourceEdit.js:115
#: pve-manager/www/manager6/ha/Resources.js:140
-#, fuzzy
msgid "Failback"
-msgstr "Przywróć"
+msgstr "domyślnie"
#: pve-manager/www/manager6/Utils.js:295
msgid "Failed"
@@ -4992,9 +4896,8 @@ msgstr "Problemy"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:145
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:168
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:193
-#, fuzzy
msgid "Fallback"
-msgstr "Przywróć"
+msgstr "domyślnie"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:173
#: pve-manager/www/manager6/dc/AuthEditAD.js:38
@@ -5033,17 +4936,15 @@ msgid "Field"
msgstr "Pole"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1331
-#, fuzzy
msgid "Field Name"
-msgstr "Nazwa systemu plików"
+msgstr "Pole"
#: proxmox-yew-comp/src/bandwidth_selector.rs:89
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:332
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:436
#: proxmox-yew-widget-toolkit/src/widget/form/textarea.rs:142
-#, fuzzy
msgid "Field may not be empty."
-msgstr "Tag nie może być pusty"
+msgstr "Pole nie może być puste."
#: proxmox-widget-toolkit/src/node/Tasks.js:194
msgid "Fields"
@@ -5138,9 +5039,8 @@ msgid "Filters ({0})"
msgstr "Filtry ({0})"
#: proxmox-backup/www/form/GroupFilter.js:366
-#, fuzzy
msgid "Filters are additive"
-msgstr "Filtry są addytywne (jak w OR)"
+msgstr "Filtry są addytywne"
#: proxmox-widget-toolkit/src/form/FingerprintField.js:6
#: proxmox-widget-toolkit/src/panel/Certificates.js:58
@@ -5179,9 +5079,8 @@ msgid "Finish Edit"
msgstr "Zakończ edycję"
#: pve-yew-mobile-gui/src/widgets/task_list_button.rs:148
-#, fuzzy
msgid "Finished"
-msgstr "Koniec"
+msgstr "Ukończone"
#: pve-manager/www/manager6/dc/Config.js:262
#: pve-manager/www/manager6/grid/FirewallOptions.js:66
@@ -5229,7 +5128,6 @@ msgstr "w pierwszy dzień roku"
#: proxmox-yew-comp/src/user_panel.rs:508
#: proxmox-yew-comp/src/user_panel.rs:527
-#, fuzzy
msgid "First name"
msgstr "Imię"
@@ -5238,27 +5136,24 @@ msgid "Fixed"
msgstr "Naprawione"
#: pmg-gui/js/AuthEditOIDC.js:218
-#, fuzzy
msgid "Fixed Role"
-msgstr "Naprawione"
+msgstr "Stała rola"
#: pmg-gui/js/AuthEditOIDC.js:204
msgid "Fixed role for all auto-created users"
-msgstr ""
+msgstr "Stała rola dla automatycznie utworzonych użytkowników"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:66
msgid "Flags"
msgstr "Flagi"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:210
-#, fuzzy
msgid "Fleecing"
-msgstr "Izolowanie węzłów"
+msgstr "Buforowanie"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:227
-#, fuzzy
msgid "Fleecing Storage"
-msgstr "Magazyn danych EFI"
+msgstr "Magazyn buforowania"
#: pve-manager/www/manager6/qemu/Options.js:137
msgid "Floppy"
@@ -5287,18 +5182,16 @@ msgid "Font-Size"
msgstr "Rozmiar czcionki"
#: proxmox-yew-comp/src/configuration/network_edit.rs:209
-#, fuzzy
msgid "For example, bond0, bond0.100, bond1, ..."
-msgstr "Na przykład vmbr0.100, vmbr0, vlan0.100, vlan0"
+msgstr "Na przykład: bond0, bond0.100, bond1..."
#: proxmox-yew-comp/src/configuration/network_edit.rs:134
-#, fuzzy
msgid "For example, vmbr0, vmbr0.100, vmbr1, ..."
-msgstr "Na przykład vmbr0.100, vmbr0, vlan0.100, vlan0"
+msgstr "Na przykład: vmbr0, vmbr0.100, vmbr1..."
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:334
msgid "For example, vmbr0.100, vmbr0, vlan0.100, vlan0"
-msgstr "Na przykład vmbr0.100, vmbr0, vlan0.100, vlan0"
+msgstr "Na przykład: vmbr0.100, vmbr0, vlan0.100, vlan0"
#: proxmox-widget-toolkit/src/window/AddTotp.js:163
#: proxmox-widget-toolkit/src/window/AddWebauthn.js:197
@@ -5311,7 +5204,7 @@ msgstr ""
#: pve-manager/www/manager6/dc/UserView.js:74
msgid "For the PAM realm, this applies only to the connected node."
-msgstr ""
+msgstr "W domenie PAM, dotyczy jedynie połączonego węzła."
#: pve-manager/www/manager6/window/Migrate.js:623
#: proxmox-backup/www/tape/window/MediaRemoveWindow.js:63
@@ -5366,26 +5259,26 @@ msgid "Format/Erase"
msgstr "Formatuj/kasuj"
#: proxmox-backup/www/Utils.js:747
-#, fuzzy
msgid "Formatting"
-msgstr "Format"
+msgstr "Formatowanie"
#: pve-manager/www/manager6/grid/FirewallOptions.js:160
#: pve-manager/www/manager6/grid/FirewallOptions.js:165
#: pve-manager/www/manager6/grid/FirewallOptions.js:170
-#, fuzzy
msgid "Forward Policy"
-msgstr "Reguły haszowania"
+msgstr "Reguła przekazywania"
#: pve-manager/www/manager6/grid/FirewallRules.js:247
msgid ""
"Forward rules only take effect when the nftables firewall is activated in "
"the host options"
msgstr ""
+"Reguły przekazywania działają tylko jeśli w ustawieniach hosta została "
+"aktywowana zapora nftables"
#: proxmox-widget-toolkit/src/Utils.js:734
msgid "Forwarded mails to the local root user"
-msgstr ""
+msgstr "Przekazane e-maile dla lokalnego roota"
#: pve-manager/www/manager6/node/ZFS.js:250 proxmox-backup/www/ZFSList.js:86
msgid "Fragmentation"
@@ -5406,7 +5299,6 @@ msgid "Freeze CPU at startup"
msgstr "Zamrożenie CPU przy starcie"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:95
-#, fuzzy
msgid "Freeze CPU on startup"
msgstr "Zamrożenie CPU przy starcie"
@@ -5447,9 +5339,8 @@ msgstr "jak w kopii"
#: pve-manager/www/manager6/window/GuestImport.js:727
#: pve-manager/www/manager6/window/GuestImport.js:921
-#, fuzzy
msgid "From Default"
-msgstr "domyślnie"
+msgstr "Z domyślnego"
#: pve-manager/www/manager6/qemu/PCIEdit.js:297
#: pve-manager/www/manager6/qemu/PCIEdit.js:306
@@ -5477,9 +5368,8 @@ msgid "From backup configuration"
msgstr "z konfiguracji kopii"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:80
-#, fuzzy
msgid "From:"
-msgstr "Od"
+msgstr "Od:"
#: pve-manager/www/manager6/ceph/OSDDetails.js:186
msgid "Front Address"
@@ -5501,20 +5391,20 @@ msgstr "GB"
#: proxmox-backup/www/Utils.js:907
msgid "GC Access-Time Cutoff"
-msgstr ""
+msgstr "Czas do rozpoczęcia usuwania"
#: proxmox-backup/www/datastore/OptionView.js:297
msgid "GC Access-Time Cutoff (minutes)"
-msgstr ""
+msgstr "Czas do rozpoczęcia usuwania (minuty)"
#: proxmox-backup/www/Utils.js:899
#: proxmox-backup/www/datastore/OptionView.js:281
msgid "GC Access-Time Support Check"
-msgstr ""
+msgstr "Obsługa czasu dostępu"
#: proxmox-backup/www/datastore/OptionView.js:305
msgid "GC Cache Capacity (# chunks)"
-msgstr ""
+msgstr "Pojemność bufora (# części)"
#: proxmox-backup/www/window/DataStoreEdit.js:138
#: proxmox-backup/www/window/GCJobEdit.js:25
@@ -5522,30 +5412,26 @@ msgid "GC Schedule"
msgstr "Plan usuwania"
#: proxmox-backup/www/Utils.js:912
-#, fuzzy
msgid "GC cache capacity"
-msgstr "Pojemność"
+msgstr "Pojemność bufora"
#: proxmox-backup/www/Utils.js:438
msgid "Garbage Collect"
msgstr "Rozpocznij usuwanie"
#: proxmox-backup/www/config/GCView.js:28
-#, fuzzy
msgid "Garbage Collect Jobs"
-msgstr "Rozpocznij usuwanie"
+msgstr "Zadania usuwania"
#: proxmox-backup/www/window/GCJobEdit.js:10
-#, fuzzy
msgid "Garbage Collect Schedule"
-msgstr "Plan usuwania"
+msgstr "Harmonogram usuwania"
#: proxmox-backup/www/window/NotifyOptions.js:154
msgid "Garbage Collection"
msgstr "Usuwanie"
#: proxmox-backup/www/Utils.js:477
-#, fuzzy
msgid "Garbage collection"
msgstr "Usuwanie"
@@ -5601,7 +5487,7 @@ msgstr "niemiecki"
#: pmg-gui/js/AuthEditOIDC.js:205
msgid "Get role from OIDC claim"
-msgstr ""
+msgstr "Pobierz rolę z OIDC"
#: pve-manager/www/manager6/ceph/StatusDetail.js:77
msgid "Ghost OSDs"
@@ -5627,7 +5513,7 @@ msgstr "Globalne flagi ograniczające samonaprawianie Cepha są włączone."
#: proxmox-yew-widget-toolkit/src/widget/form/tristate_boolean.rs:117
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:431
msgid "Got wrong data type!"
-msgstr ""
+msgstr "Niepoprawny typ danych!"
#: proxmox-widget-toolkit/src/panel/PermissionView.js:152
#: pve-manager/www/manager6/dc/PermissionView.js:148
@@ -5707,9 +5593,8 @@ msgid "Groups"
msgstr "Grupy"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:97
-#, fuzzy
msgid "Groups Claim"
-msgstr "Nazwa grupy"
+msgstr "Definicja grupy"
#: pmg-gui/js/LDAPConfig.js:449
msgid "Groups of '{0}'"
@@ -5752,7 +5637,7 @@ msgstr "Maszyny"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:347
msgid "Guests With the Highest CPU Usage"
-msgstr ""
+msgstr "Największe wykorzystanie CPU"
#: pve-manager/www/manager6/dc/Backup.js:665
#: pve-manager/www/manager6/dc/Backup.js:677
@@ -5760,36 +5645,34 @@ msgid "Guests Without Backup Job"
msgstr "Maszyny bez zadań kopii zapasowej"
#: pve-manager/www/manager6/ha/rules/NodeAffinityRules.js:6
-#, fuzzy
msgid "HA Node Affinity"
-msgstr "Afiniczność CPU"
+msgstr "Afiniczność węzłów HA"
#: pve-manager/www/manager6/ha/Rules.js:165
msgid "HA Node Affinity Rules"
-msgstr ""
+msgstr "Reguły afiniczności węzła HA"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRules.js:6
msgid "HA Resource Affinity"
-msgstr ""
+msgstr "Afiniczność zasobu HA"
#: pve-manager/www/manager6/ha/Rules.js:176
msgid "HA Resource Affinity Rules"
-msgstr ""
+msgstr "Reguły afiniczności zasobu HA"
#: pve-manager/www/manager6/ha/RuleEdit.js:75
#: pve-manager/www/manager6/ha/rules/NodeAffinityRules.js:23
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRules.js:23
-#, fuzzy
msgid "HA Resources"
-msgstr "Zasoby"
+msgstr "Zasoby HA"
#: pve-manager/www/manager6/ha/Rules.js:119
msgid "HA Rule has conflicts and/or errors."
-msgstr ""
+msgstr "Reguła HA zawiera konflikty i/lub błędy"
#: pve-manager/www/manager6/ha/Rules.js:121
msgid "HA Rule is OK."
-msgstr ""
+msgstr "Reguła HA jest OK"
#: pve-manager/www/manager6/dc/OptionView.js:192
msgid "HA Scheduling"
@@ -5806,39 +5689,43 @@ msgid "HA State"
msgstr "Stan HA"
#: pve-manager/www/manager6/tree/ResourceTree.js:167
-#, fuzzy
msgid "HA State: {0}"
-msgstr "Stan HA"
+msgstr "Stan HA: {0}"
#: pve-manager/www/manager6/window/Migrate.js:428
msgid "HA resource {0} with negative affinity to VM on selected target node"
msgstr ""
+"Zasób HA {0} z negatywną afinicznością wobec VM na wybranym węźle docelowym"
#: pve-manager/www/manager6/window/Migrate.js:515
msgid ""
"HA resource {0} with negative affinity to container on selected target node"
msgstr ""
+"Zasób HA {0} z negatywną afinicznością wobec kontenera na wybranym węźle "
+"docelowym"
#: pve-manager/www/manager6/window/Migrate.js:454
msgid ""
"HA resource {0} with positive affinity to VM is also migrated to selected "
"target node."
msgstr ""
+"Zasób HA {0} z pozytywną afinicznością wobec VM będzie migrował razem z nim "
+"na docelowy węzeł."
#: pve-manager/www/manager6/window/Migrate.js:541
msgid ""
"HA resource {0} with positive affinity to container is also migrated to "
"selected target node."
msgstr ""
+"Zasób HA {0} z pozytywną afinicznością wobec kontenera będzie migrował razem "
+"z nim na docelowy węzeł."
#: pve-manager/www/manager6/ha/RuleErrorsModal.js:10
-#, fuzzy
msgid "HA rule errors"
-msgstr "dowolna reguła pasuje"
+msgstr "Błędy reguły HA"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:309
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:319
-#, fuzzy
msgid "HA state"
msgstr "Stan HA"
@@ -5854,7 +5741,7 @@ msgstr "Wykorzystanie dysku "
#: pve-manager/www/manager6/dc/MetricServerView.js:681
msgid "HTTP Headers (JSON)"
-msgstr ""
+msgstr "Nagłówki HTTP (JSON)"
#: pmg-gui/js/SystemOptions.js:93 pve-manager/www/manager6/dc/OptionView.js:82
#: proxmox-backup/www/config/NodeOptionView.js:42
@@ -5929,13 +5816,12 @@ msgid "Hebrew"
msgstr "hebrajski"
#: pve-manager/www/manager6/sdn/fabrics/openfabric/FabricEdit.js:46
-#, fuzzy
msgid "Hello Interval"
-msgstr "Interwał"
+msgstr "Interwał Hello"
#: pve-manager/www/manager6/sdn/fabrics/openfabric/InterfacePanel.js:19
msgid "Hello Multiplier"
-msgstr ""
+msgstr "Mnożnik Hello"
#: proxmox-widget-toolkit/src/button/HelpButton.js:8
#: proxmox-widget-toolkit/src/button/HelpButton.js:73
@@ -5969,9 +5855,8 @@ msgid "Hide Internal Hosts"
msgstr "Ukryj hosty wewnętrzne"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:494
-#, fuzzy
msgid "Hide Password"
-msgstr "Hasło (bind)"
+msgstr "Ukryj hasło"
#: proxmox-widget-toolkit/src/window/ACMEPluginEdit.js:218
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:251
@@ -6009,9 +5894,8 @@ msgid "Host CPU usage"
msgstr "Wykorzystanie CPU serwera"
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:210
-#, fuzzy
msgid "Host CPU usage (avg.)"
-msgstr "Wykorzystanie CPU serwera"
+msgstr "Wykorzystanie CPU (śred.)"
#: pve-manager/www/manager6/data/ResourceStore.js:171
#: pve-manager/www/manager6/data/ResourceStore.js:307
@@ -6019,14 +5903,12 @@ msgid "Host Memory usage"
msgstr "Wykorzystanie pamięci serwera"
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:216
-#, fuzzy
msgid "Host Memory used"
-msgstr "Wykorzystanie pamięci serwera"
+msgstr "Wykorzystanie pamięci"
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:230
-#, fuzzy
msgid "Host Storage used"
-msgstr "Użycie magazynów danych"
+msgstr "Wykorzystanie dysku"
#: pve-manager/www/manager6/storage/ZFSEdit.js:118
msgid "Host group"
@@ -6034,7 +5916,6 @@ msgstr "Grupa hostów"
#: pve-manager/www/manager6/panel/GuestStatusView.js:120
#: pve-manager/www/manager6/panel/GuestSummary.js:48
-#, fuzzy
msgid "Host memory usage"
msgstr "Wykorzystanie pamięci serwera"
@@ -6056,14 +5937,12 @@ msgid "Hostname"
msgstr "Nazwa hosta"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_summary.rs:156
-#, fuzzy
msgid "Hostname/Address"
-msgstr "Nazwa hosta"
+msgstr "Nazwa hosta/adres"
#: proxmox-backup/www/window/DatastoreRepoInfo.js:49
-#, fuzzy
msgid "Hostname/IP"
-msgstr "Nazwa hosta"
+msgstr "Nazwa węzła/IP"
#: pve-manager/www/manager6/node/Config.js:220
msgid "Hosts"
@@ -6095,7 +5974,7 @@ msgstr "Godziny do pokazania"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:201
msgid "I/O workers in the QEMU process (VMs only)."
-msgstr ""
+msgstr "Wątki I/O w procesach QEMU (tylko VM)."
#: pve-manager/www/manager6/grid/FirewallRules.js:415
#: pve-manager/www/manager6/grid/FirewallRules.js:427
@@ -6122,15 +6001,16 @@ msgid ""
"ID may consist of alphanumeric characters and hyphen. It cannot start with a "
"number or end in a hyphen."
msgstr ""
+"ID może zawierać znaki alfanumeryczne oraz myślnik. Nie może się zaczynać "
+"cyfrą ani kończyć myślnikiem."
#: proxmox-widget-toolkit/src/window/TfaWindow.js:83
msgid "ID {0}"
msgstr "ID {0}"
#: pve-manager/www/manager6/dc/DirMapView.js:25
-#, fuzzy
msgid "ID/Node"
-msgstr "ID/węzeł/ścieżka"
+msgstr "ID/węzeł"
#: pve-manager/www/manager6/dc/PCIMapView.js:82
msgid "ID/Node/Path"
@@ -6152,7 +6032,7 @@ msgstr "Opóźnienie IO (ms)"
#: pve-manager/www/manager6/node/Summary.js:210
#: pve-manager/www/manager6/panel/GuestSummary.js:148
msgid "IO Pressure Stall"
-msgstr ""
+msgstr "Obciążenie IO"
#: pmg-gui/js/ServerStatus.js:124 pmg-gui/js/dashboard/NodeInfo.js:32
#: pve-manager/www/manager6/node/StatusView.js:35
@@ -6167,7 +6047,7 @@ msgstr "Oczekiwanie IO"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:191
msgid "IO-Workers"
-msgstr ""
+msgstr "Wątki IO"
#: pve-manager/www/manager6/form/MultiPCISelector.js:240
#: pve-manager/www/manager6/form/PCISelector.js:34
@@ -6206,9 +6086,8 @@ msgid "IP address"
msgstr "Adres IP"
#: pve-manager/www/manager6/storage/ESXIEdit.js:58
-#, fuzzy
msgid "IP address or hostname"
-msgstr "Adres IP na podstawie nazwy węzła"
+msgstr "Adres IP lub nazwa hosta"
#: pve-manager/www/manager6/grid/FirewallOptions.js:104
msgid "IP filter"
@@ -6217,6 +6096,7 @@ msgstr "Filtr IP"
#: proxmox-backup/www/window/S3ClientEdit.js:52
msgid "IP or FQDN S3 endpoint (allows {{bucket}} or {{region}} templating)"
msgstr ""
+"IP lub FQDN pojemnika S3 (dozwolone szablony {{bucket}} lub {{region}})"
#: pve-manager/www/manager6/dc/ClusterEdit.js:261
msgid "IP resolved by node's hostname"
@@ -6249,9 +6129,8 @@ msgid "IPv4"
msgstr "IPv4"
#: pve-manager/www/manager6/sdn/fabrics/FabricEdit.js:29
-#, fuzzy
msgid "IPv4 Prefix"
-msgstr "Prefiks ścieżki API"
+msgstr "Prefiks IPv4"
#: pve-manager/www/manager6/qemu/IPConfigEdit.js:111
#: proxmox-yew-comp/src/configuration/network_edit.rs:145
@@ -6269,9 +6148,8 @@ msgid "IPv6"
msgstr "IPv6"
#: pve-manager/www/manager6/sdn/fabrics/openfabric/FabricEdit.js:28
-#, fuzzy
msgid "IPv6 Prefix"
-msgstr "Prefiks ścieżki API"
+msgstr "Prefiks IPv6"
#: pve-manager/www/manager6/qemu/IPConfigEdit.js:177
#: proxmox-yew-comp/src/configuration/network_edit.rs:160
@@ -6282,7 +6160,7 @@ msgstr "IPv6/CIDR"
#: pve-manager/www/manager6/window/GuestImport.js:838
msgid "ISO"
-msgstr ""
+msgstr "ISO"
#: pve-manager/www/manager6/storage/Browser.js:100
msgid "ISO Images"
@@ -6302,15 +6180,16 @@ msgid ""
"If the display type uses SPICE you are able to use the default SPICE "
"clipboard."
msgstr ""
+"Jeśli dany typ wyświetlania używa SPICE, możesz korzystać z domyślnego "
+"schowka SPICE."
#: pmg-gui/js/Utils.js:435
-#, fuzzy
msgid "Ignore header information"
-msgstr "brak informacji o sieci"
+msgstr "Ignoruj informacje z nagłówka"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:72
msgid "Implies xattr support."
-msgstr ""
+msgstr "Wymaga obsługi xattr."
#: pve-manager/www/manager6/Utils.js:699
#: pve-manager/www/manager6/panel/MultiDiskEdit.js:283
@@ -6323,29 +6202,25 @@ msgid "Import"
msgstr "Import"
#: pve-manager/www/manager6/window/GuestImport.js:5
-#, fuzzy
msgid "Import Guest"
-msgstr "Maszyna docelowa"
+msgstr "Import gościa"
#: pve-manager/www/manager6/window/GuestImport.js:996
msgid "Import Guest - {0}"
-msgstr ""
+msgstr "Import gościa - {0}"
#: pve-manager/www/manager6/qemu/HDEdit.js:587
#: pve-manager/www/manager6/qemu/HardwareView.js:731
-#, fuzzy
msgid "Import Hard Disk"
-msgstr "Dysk"
+msgstr "Import dysku"
#: pve-manager/www/manager6/qemu/HDEdit.js:260
-#, fuzzy
msgid "Import Storage"
-msgstr "Magazyn danych EFI"
+msgstr "Magazyn importu"
#: pve-manager/www/manager6/window/GuestImport.js:598
-#, fuzzy
msgid "Import Working Storage"
-msgstr "Magazyn katalogów"
+msgstr "Magazyn roboczy"
#: proxmox-backup/www/tape/ChangerStatus.js:969
#: proxmox-backup/www/tape/window/ChangerEdit.js:41
@@ -6365,6 +6240,8 @@ msgid ""
"Importing an OVA temporarily requires extra space on the working storage "
"while extracting the contained disks for further processing."
msgstr ""
+"Importowanie OVA wymaga tymczasowo dodatkowej przestrzeni na magazynie "
+"roboczym aby rozpakować obrazy dysków do dalszego przetwarzania."
#: pmg-gui/js/Utils.js:113 pve-manager/www/manager6/ceph/StatusDetail.js:39
msgid "In"
@@ -6375,9 +6252,8 @@ msgid "In & Out"
msgstr "In & Out"
#: proxmox-backup/www/form/GroupFilter.js:445
-#, fuzzy
msgid "Include"
-msgstr "Zapisz stan pamięci"
+msgstr "Uwzględniane"
#: pmg-gui/js/MailTracker.js:145
msgid "Include Empty Senders"
@@ -6458,9 +6334,8 @@ msgid "Info"
msgstr "Informacje"
#: proxmox-yew-comp/src/subscription_panel.rs:210
-#, fuzzy
msgid "Info URL"
-msgstr "Informacje"
+msgstr "URL informacji"
#: pmg-gui/js/ClusterAdministration.js:84
#: pve-manager/www/manager6/dc/ClusterEdit.js:328
@@ -6490,7 +6365,7 @@ msgstr "Reguła ruchu przychodzącego"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:444
msgid "Input invalid: {}"
-msgstr ""
+msgstr "Nieprawidłowe dane: {}"
#: proxmox-backup/www/datastore/Summary.js:351
msgid "Input/Output Operations per Second (IOPS)"
@@ -6510,7 +6385,7 @@ msgstr "Instalacja"
#: pve-manager/www/manager6/qemu/MachineEdit.js:159
msgid "Intel (AMD Compatible)"
-msgstr ""
+msgstr "Intel (zgodne z AMD)"
#: proxmox-widget-toolkit/src/form/NetworkSelector.js:109
#: pve-manager/www/manager6/grid/FirewallRules.js:284
@@ -6521,12 +6396,11 @@ msgstr "Interfejs"
#: pve-manager/www/manager6/sdn/fabrics/InterfacePanel.js:32
msgid "Interface already has an address configured in /etc/network/interfaces"
-msgstr ""
+msgstr "Interfejs ma już skonfigurowany adres w /etc/network/interfaces"
#: pve-manager/www/manager6/sdn/fabrics/InterfacePanel.js:26
-#, fuzzy
msgid "Interface does not exist on node"
-msgstr "Taki odbiorca nie istnieje!"
+msgstr "Nie ma takiego interfejsu na węźle"
#: pmg-gui/js/SystemConfiguration.js:40
#: pve-manager/www/manager6/sdn/FabricsView.js:80
@@ -6545,7 +6419,7 @@ msgstr "Interwał"
#: pve-manager/www/manager6/dc/MetricServerView.js:695
#: pve-manager/www/manager6/dc/MetricServerView.js:716
msgid "Invalid JSON format"
-msgstr ""
+msgstr "Nieprawidłowy format JSON"
#: proxmox-widget-toolkit/src/form/ComboGrid.js:395
#: proxmox-widget-toolkit/src/form/ComboGrid.js:474
@@ -6568,7 +6442,7 @@ msgstr "Nieprawidłowy rozmiar pliku: "
#: proxmox-backup/www/form/PermissionPathSelector.js:135
msgid "Invalid permission path."
-msgstr "Nieprawidłowa ścieżka uprawnień"
+msgstr "Nieprawidłowa ścieżka uprawnień."
#: proxmox-backup/www/tape/ChangerStatus.js:398
#: proxmox-backup/www/tape/ChangerStatus.js:707
@@ -6592,9 +6466,8 @@ msgid "Is this token already registered?"
msgstr "Czy ten klucz jest już zarejestrowany?"
#: pve-manager/www/manager6/sdn/VnetEdit.js:81
-#, fuzzy
msgid "Isolate Ports"
-msgstr "Port"
+msgstr "Izolacja portów"
#: proxmox-widget-toolkit/src/panel/Certificates.js:18
#: proxmox-widget-toolkit/src/window/Certificates.js:26
@@ -6619,7 +6492,7 @@ msgstr "URL wystawcy"
#: proxmox-yew-comp/src/acme/acme_domains.rs:327
msgid "It is not possible to configure more that 5 ACME domain."
-msgstr ""
+msgstr "Nie można skonfigurować więcej niż 5 domen ACME."
#: pve-manager/www/manager6/window/Snapshot.js:103
msgid ""
@@ -6770,14 +6643,12 @@ msgid "Keep Monthly"
msgstr "Przechowuj miesięczne"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRuleEdit.js:17
-#, fuzzy
msgid "Keep Separate"
-msgstr "Przechowuj roczne"
+msgstr "Utrzymuj rozdzielone"
#: pve-manager/www/manager6/ha/rules/ResourceAffinityRuleEdit.js:16
-#, fuzzy
msgid "Keep Together"
-msgstr "Przechowuj miesięczne"
+msgstr "Utrzymuj razem"
#: proxmox-widget-toolkit/src/panel/PruneKeepPanel.js:56
#: pmg-gui/js/PBSRemoteEdit.js:164
@@ -6801,7 +6672,7 @@ msgstr "Przechowuj wszystkie kopie"
#: proxmox-backup/www/datastore/OptionView.js:62
msgid "Keep configured jobs and permissions"
-msgstr ""
+msgstr "Zachowaj skonfigurowane zadania i uprawnienia"
#: pve-manager/www/manager6/storage/PBSEdit.js:288
msgid "Keep encryption key"
@@ -6855,7 +6726,7 @@ msgstr "koreański"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:139
msgid "LDAP DN syntax can be used as well, e.g. cn=user,dc=company,dc=net"
-msgstr ""
+msgstr "Można także używać składni LDAP DN, np. cn=user,dc=company,dc=net"
#: pmg-gui/js/Utils.js:192
msgid "LDAP Group"
@@ -6953,9 +6824,8 @@ msgid "Last Backup"
msgstr "Ostatnia kopia"
#: proxmox-backup/www/config/GCView.js:189
-#, fuzzy
msgid "Last GC"
-msgstr "Ostatnie"
+msgstr "Ostatnie usuwanie"
#: pmg-gui/js/UserEdit.js:158 pve-manager/www/manager6/dc/UserEdit.js:88
#: proxmox-backup/www/window/UserEdit.js:154
@@ -6972,9 +6842,8 @@ msgid "Last Prune"
msgstr "Ostatnie czyszczenie"
#: proxmox-backup/www/config/GCView.js:203
-#, fuzzy
msgid "Last Status"
-msgstr "Ustaw stan"
+msgstr "Ostatni stan"
#: pve-manager/www/manager6/grid/Replication.js:365
#: proxmox-backup/www/config/SyncView.js:397
@@ -6998,7 +6867,6 @@ msgstr "Ostatnio sprawdzane"
#: proxmox-yew-comp/src/user_panel.rs:509
#: proxmox-yew-comp/src/user_panel.rs:534
-#, fuzzy
msgid "Last name"
msgstr "Nazwisko"
@@ -7044,7 +6912,7 @@ msgstr "Limit (bajtów/czas)"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:157
msgid "Limit I/O bandwidth."
-msgstr ""
+msgstr "Ograniczenie przepustowości."
#: pmg-gui/js/Settings.js:266 pve-manager/www/manager6/window/Settings.js:362
#: proxmox-backup/www/window/Settings.js:266
@@ -7069,50 +6937,48 @@ msgstr "Połączony klon"
#: proxmox-yew-comp/src/configuration/network_view.rs:204
#: proxmox-yew-comp/src/configuration/mod.rs:30
msgid "Linux Bond"
-msgstr ""
+msgstr "Linux Bond"
#: proxmox-yew-comp/src/configuration/network_view.rs:198
#: proxmox-yew-comp/src/configuration/mod.rs:29
-#, fuzzy
msgid "Linux Bridge"
-msgstr "Mostek"
+msgstr "Linux Bridge"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:128
-#, fuzzy
msgid "Linux Container"
-msgstr "Kontenery LXC"
+msgstr "kontener Linuksa"
#: proxmox-yew-comp/src/configuration/mod.rs:31
-#, fuzzy
msgid "Linux VLAN"
-msgstr "brak VLAN"
+msgstr "Linux VLAN"
#: pve-yew-mobile-gui/src/widgets/tasks_panel.rs:156
msgid "List contains no data"
-msgstr ""
+msgstr "Lista nie zawiera danych"
#: proxmox-yew-widget-toolkit/src/widget/form/selector.rs:398
msgid "List does not contain any items."
-msgstr ""
+msgstr "Lista nie zawiera żadnego elementu."
#: pve-yew-mobile-gui/src/widgets/storage_content_panel.rs:288
msgid "List is empty."
-msgstr ""
+msgstr "Lista jest pusta."
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:76
msgid ""
"List of VLAN IDs and ranges, useful for NICs with restricted VLAN offloading "
"support. For example: '2 4 100-200'"
msgstr ""
+"Lista identyfikatorów i zakresów VLAN, przydatne dla kart z ograniczoną "
+"obsługą offloadingu. Na przykład: '2 4 100-200'"
#: pve-manager/www/manager6/window/GuestImport.js:616
-#, fuzzy
msgid "Live Import"
-msgstr "Import"
+msgstr "Import w locie"
#: pve-manager/www/manager6/window/PCIMapEdit.js:261
msgid "Live Migration Capable"
-msgstr ""
+msgstr "Migracja w locie"
#: proxmox-widget-toolkit/src/panel/JournalView.js:292
#: proxmox-widget-toolkit/src/panel/LogView.js:307
@@ -7122,11 +6988,12 @@ msgstr "Bieżące komunikaty"
#: pve-manager/www/manager6/window/Restore.js:296
msgid "Live restore"
-msgstr "Odtwarzanie na żywo"
+msgstr "Odtwarzanie w locie"
#: pve-manager/www/manager6/window/Migrate.js:354
msgid "Live-migrating running VM with mapped resources (Experimental): {0}"
msgstr ""
+"Migracja działających VM ze zmapowanymi zasobami (eksperymentalne): {0}"
#: proxmox-backup/www/tape/ChangerStatus.js:779
msgid "Load"
@@ -7157,9 +7024,8 @@ msgstr "Średnie obciążenie"
#: proxmox-datacenter-manager/ui/src/pve/mod.rs:141
#: proxmox-yew-comp/src/loadable_component.rs:403
-#, fuzzy
msgid "Load failed"
-msgstr "wszystko błędne"
+msgstr "Ładowanie nie powiodło się"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:79
#: pve-manager/www/manager6/node/ACME.js:143 proxmox-backup/www/Utils.js:739
@@ -7168,9 +7034,8 @@ msgid "Loading"
msgstr "Ładowanie"
#: proxmox-yew-comp/src/acme/acme_register_account.rs:145
-#, fuzzy
msgid "Loading TOS failed: {0}"
-msgstr "wszystko błędne"
+msgstr "Ładowanie warunków korzystania nie powiodło się: {0}"
#: proxmox-widget-toolkit/src/Utils.js:404
#: pve-manager/www/manager6/ceph/OSD.js:502
@@ -7190,9 +7055,8 @@ msgid "Local Backup/Restore"
msgstr "Lokalna kopia i odtwarzanie"
#: proxmox-backup/www/window/DataStoreEdit.js:104
-#, fuzzy
msgid "Local Cache"
-msgstr "Lokalna przestrzeń nazw"
+msgstr "Lokalny bufor"
#: proxmox-backup/www/tape/window/TapeBackupJob.js:87
#: proxmox-backup/www/window/SyncJobEdit.js:140
@@ -7210,23 +7074,20 @@ msgid "Local Owner"
msgstr "Lokalny właściciel"
#: proxmox-backup/www/config/SyncView.js:366
-#, fuzzy
msgid "Local Owner/User"
-msgstr "Lokalny właściciel"
+msgstr "Lokalny właściciel/użytkownik"
#: proxmox-backup/www/config/SyncView.js:327
msgid "Local Store"
msgstr "Nośnik lokalny"
#: proxmox-backup/www/window/SyncJobEdit.js:40
-#, fuzzy
msgid "Local User"
-msgstr "Lokalny właściciel"
+msgstr "Lokalny użytkownik"
#: proxmox-backup/www/Utils.js:744
-#, fuzzy
msgid "Locating"
-msgstr "Położenie"
+msgstr "Lokalizowanie"
#: proxmox-backup/www/tape/TapeInventory.js:303
#: proxmox-backup/www/window/SyncJobEdit.js:238
@@ -7295,9 +7156,8 @@ msgid "Login"
msgstr "Zaloguj się"
#: pmg-gui/js/LoginView.js:12
-#, fuzzy
msgid "Login (OpenID Connect redirect)"
-msgstr "Logowanie (przekierowanie OpenID)"
+msgstr "Logowanie (przekierowanie OpenID Connect)"
#: pve-manager/www/manager6/window/LoginWindow.js:12
#: proxmox-backup/www/LoginView.js:12
@@ -7306,7 +7166,7 @@ msgstr "Logowanie (przekierowanie OpenID)"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_info.rs:247
msgid "Login and create Token"
-msgstr ""
+msgstr "Zaloguj się i utwórz klucz"
#: pmg-gui/js/LoginView.js:137
#: pve-manager/www/manager6/window/LoginWindow.js:159
@@ -7316,14 +7176,12 @@ msgstr "Logowanie nie powiodło się. Proszę spróbować ponownie"
#: proxmox-yew-comp/src/login_panel.rs:216
#: proxmox-yew-comp/src/login_panel.rs:316
-#, fuzzy
msgid "Login failed. Please try again ({0})"
-msgstr "Logowanie nie powiodło się. Proszę spróbować ponownie"
+msgstr "Logowanie nie powiodło się. Proszę spróbować ponownie ({0})"
#: pve-manager/www/manager6/window/LoginWindow.js:163
-#, fuzzy
msgid "Login failed:"
-msgstr "wszystko błędne"
+msgstr "Logowanie nie powiodło się:"
#: pmg-gui/js/MainView.js:230 pmg-gui/js/QuarantineView.js:270
#: pve-manager/www/manager6/Workspace.js:445 proxmox-backup/www/MainView.js:292
@@ -7341,9 +7199,8 @@ msgid "Longest Tasks"
msgstr "Najdłuższe zadania"
#: proxmox-yew-comp/src/configuration/mod.rs:27
-#, fuzzy
msgid "Lookback"
-msgstr "Przywróć"
+msgstr "Loopback"
#: pve-manager/www/manager6/sdn/controllers/BgpEdit.js:59
#: pve-manager/www/manager6/sdn/controllers/IsisEdit.js:55
@@ -7380,7 +7237,7 @@ msgstr "MB"
#: pve-manager/www/manager6/ceph/ServiceList.js:50
msgid "MDS ID"
-msgstr ""
+msgstr "ID MDS"
#: pve-manager/www/manager6/qemu/PCIEdit.js:260
msgid "MDev Type"
@@ -7414,9 +7271,8 @@ msgid "Machine"
msgstr "Typ maszyny"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/hardware_panel.rs:94
-#, fuzzy
msgid "Machine Type"
-msgstr "Typ trybu obsługi"
+msgstr "Typ maszyny"
#: pve-manager/www/manager6/qemu/MachineEdit.js:147
msgid ""
@@ -7461,7 +7317,6 @@ msgid "Maintenance mode"
msgstr "Tryb obsługi"
#: proxmox-backup/www/tape/window/LabelMedia.js:36
-#, fuzzy
msgid ""
"Make sure that the correct tape is inserted in the selected drive and type "
"in the label written on the tape."
@@ -7482,14 +7337,12 @@ msgid "Make sure to insert the tape into the selected drive."
msgstr "Upewnij się, że taśma znajduje się w wybranym napędzie."
#: pve-manager/www/manager6/ceph/OSD.js:875
-#, fuzzy
msgid "Manage Global Flags"
-msgstr "Zmień globalne flagi Cepha"
+msgstr "Zarządzaj globalnymi flagami"
#: pve-manager/www/manager6/ceph/OSD.js:241
-#, fuzzy
msgid "Manage Global OSD Flags"
-msgstr "Zmień globalne flagi Cepha"
+msgstr "Zarządzaj globalnymi flagami OSD"
#: pve-manager/www/manager6/lxc/Config.js:153
#: pve-manager/www/manager6/qemu/Config.js:120
@@ -7520,11 +7373,11 @@ msgstr "Zmapowane urządzenia"
#: pve-manager/www/manager6/window/Migrate.js:294
msgid "Mapped Resources ({0}) not available on selected target."
msgstr ""
+"Używanie zmapowanych zasobów ({0}) nie jest dozwolone na docelowej maszynie."
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:35
-#, fuzzy
msgid "Mapping ID"
-msgstr "Mapowanie na węźle"
+msgstr "ID mapowania"
#: pve-manager/www/manager6/form/PCIMapSelector.js:52
#: pve-manager/www/manager6/form/USBMapSelector.js:37
@@ -7544,6 +7397,8 @@ msgid ""
"Maps SCSI disks to SATA and changes the SCSI Controller. Useful for a "
"quicker switch to VirtIO-SCSI attached disks"
msgstr ""
+"Mapuje dyski SCSI do SATA i zmienia kontroler SCSI. Przydatne do szybkiego "
+"przejścia do dysków VirtIO-SCSI."
#: pmg-gui/js/LDAPGroupEditor.js:74
msgid "Match"
@@ -7575,9 +7430,8 @@ msgid "Match Severity"
msgstr "Reguła priorytetu"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1290
-#, fuzzy
msgid "Match Type"
-msgstr "Typ trybu obsługi"
+msgstr "Typ dopasowania"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:494
msgid "Match calendar: {0}"
@@ -7602,9 +7456,8 @@ msgid "Matcher Name"
msgstr "Nazwa reguły"
#: pve-manager/www/manager6/dc/MetricServerView.js:653
-#, fuzzy
msgid "Max Body Size (bytes)"
-msgstr "Maks. wielkość spamu (bajty)"
+msgstr "Maks. wielkość treści (bajty)"
#: proxmox-backup/www/tape/window/TapeBackup.js:50
msgid "Max Depth"
@@ -7731,19 +7584,17 @@ msgstr "Pamięć"
#: pve-manager/www/manager6/node/Summary.js:218
#: pve-manager/www/manager6/panel/GuestSummary.js:157
msgid "Memory Pressure Stall"
-msgstr ""
+msgstr "Obciążenie pamięci"
#: pve-manager/www/manager6/panel/GuestSummary.js:107
#: proxmox-datacenter-manager/ui/src/widget/pve_node_selector.rs:157
#: proxmox-datacenter-manager/ui/src/pve/node.rs:329
-#, fuzzy
msgid "Memory Usage"
msgstr "Wykorzystanie pamięci"
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:264
-#, fuzzy
msgid "Memory assigned"
-msgstr "Rozmiar pamięci"
+msgstr "Przydzielona pamięć"
#: pve-manager/www/manager6/data/ResourceStore.js:188
msgid "Memory size"
@@ -7803,7 +7654,7 @@ msgstr "Metadane"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:38
msgid "Method/URL"
-msgstr ""
+msgstr "Metoda/URL"
#: pve-manager/www/manager6/dc/Config.js:306
#: proxmox-backup/www/SystemConfiguration.js:50
@@ -7842,6 +7693,8 @@ msgid ""
"Migrating VM with local resources: {0}. This might fail if the resources are "
"not available on the target node."
msgstr ""
+"Migracja VM z lokalnymi zasobami: {0}. Może się nie powieść, jeśli te zasoby "
+"nie są dostępne na węźle docelowym."
#: pve-manager/www/manager6/dc/OptionView.js:357
msgid "Migration"
@@ -7854,11 +7707,11 @@ msgstr "Ustawienia migracji"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:323
msgid "Migration with local disk might take long: {0} ({1})"
-msgstr ""
+msgstr "Migracja z lokalnym dyskiem może długo potrwać: {0} ({1})"
#: pve-manager/www/manager6/window/Migrate.js:378
msgid "Migration with local disk might take long: {0} {1}"
-msgstr ""
+msgstr "Migracja z lokalnym dyskiem może długo potrwać: {0} {1}"
#: pve-manager/www/manager6/ceph/Pool.js:362
msgid "Min. # of PGs"
@@ -7888,7 +7741,6 @@ msgid "Mixed Subscriptions"
msgstr "Mieszane subskrypcje"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:65
-#, fuzzy
msgid "Mixed subscriptions"
msgstr "Mieszane subskrypcje"
@@ -7915,12 +7767,16 @@ msgid ""
"Mode to detect file changes and switch archive encoding format for container "
"backups to Proxmox Backup Server. Not available for VM backups."
msgstr ""
+"Tryb wykrywania zmian plików i przełączania formatu kodowania archiwum dla "
+"kopii kontenerów na PBS. Niedostępne dla kopii VM."
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:294
msgid ""
"Mode to detect file changes and switch archive encoding format for container "
"backups."
msgstr ""
+"Tryb wykrywania zmian plików i przełączania formatu kodowania archiwum dla "
+"kopii kontenerów."
#: pve-manager/www/manager6/dc/OptionView.js:552
#: pve-manager/www/manager6/dc/OptionView.js:556
@@ -8015,9 +7871,8 @@ msgid "Mount"
msgstr "Zamontuj"
#: proxmox-backup/www/Utils.js:445
-#, fuzzy
msgid "Mount Device"
-msgstr "z urządzenia"
+msgstr "Zamontuj urządzenie"
#: pve-manager/www/manager6/lxc/MPEdit.js:373
#: pve-manager/www/manager6/lxc/MPEdit.js:375
@@ -8041,9 +7896,8 @@ msgid "Mount point volumes are also erased."
msgstr "Punkty montowania dysków zostaną także usunięte."
#: proxmox-widget-toolkit/src/panel/DiskList.js:358
-#, fuzzy
msgid "Mounted"
-msgstr "Zamontuj"
+msgstr "Zamontowane"
#: pve-manager/www/manager6/lxc/Resources.js:275
#: pve-manager/www/manager6/qemu/HardwareView.js:437
@@ -8090,11 +7944,11 @@ msgstr ""
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:62
msgid "Must be a valid URL"
-msgstr ""
+msgstr "Musi być ważnym adresem URL"
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:190
msgid "Must be base32 [A-Z2-7=]"
-msgstr ""
+msgstr "Musi być typu base32 [A-Z2-7=]"
#: pve-manager/www/manager6/form/MultiPCISelector.js:42
msgid "Must choose at least one device"
@@ -8146,6 +8000,7 @@ msgstr "TERAZ"
#: pve-manager/www/manager6/window/GuestImport.js:1009
msgid "NVMe disks are currently not supported, '{0}' will get attached as SCSI"
msgstr ""
+"Dyski NVMe nie są obecnie obsługiwane, '{0}' zostanie podłączony jako SCSI"
#: proxmox-widget-toolkit/src/form/UserSelector.js:33
#: proxmox-widget-toolkit/src/grid/ObjectGrid.js:391
@@ -8283,14 +8138,12 @@ msgid "Name, Format, Notes"
msgstr "Nazwa, format, notatki"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:256
-#, fuzzy
msgid "Name/value must not be empty."
-msgstr "Tag nie może być pusty"
+msgstr "Nazwa/wartość nie może być pusta."
#: pve-yew-mobile-gui/src/pages/page_lxc_status/resources_panel.rs:125
-#, fuzzy
msgid "Nameserver"
-msgstr "Serwer DNS"
+msgstr "Serwer nazw"
#: pmg-gui/js/PBSRemoteEdit.js:52
#: pve-manager/www/manager6/storage/PBSEdit.js:582
@@ -8332,13 +8185,12 @@ msgstr "Zagnieżdżanie"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:204
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:204
msgid "Net In"
-msgstr ""
+msgstr "przychodzący"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:205
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:205
-#, fuzzy
msgid "Net Out"
-msgstr "Ruch wychodzący"
+msgstr "wychodzący"
#: pmg-gui/js/MailProxyOptions.js:56
msgid "Netmask for Greylisting IPv4"
@@ -8388,7 +8240,6 @@ msgstr "Interfejsy sieciowe"
#: pve-manager/www/manager6/panel/GuestSummary.js:123
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:395
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:404
-#, fuzzy
msgid "Network Traffic"
msgstr "Ruch sieciowy"
@@ -8428,9 +8279,8 @@ msgid "New Owner"
msgstr "Nowy właściciel"
#: proxmox-widget-toolkit/src/window/PasswordEdit.js:41
-#, fuzzy
msgid "New Password"
-msgstr "Hasło użytkownika"
+msgstr "Nowe hasło"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:118
msgid "Newest ceph version in cluster is {0}"
@@ -8438,7 +8288,7 @@ msgstr "Najnowsza wersja Cepha w tym klastrze to {0}"
#: proxmox-yew-comp/src/subscription_info.rs:19
msgid "Newly set subscription, not yet checked"
-msgstr ""
+msgstr "Nowo wprowadzona subskrypcja, jeszcze nie sprawdzona"
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:378
#: pve-manager/www/manager6/ceph/CephInstallWizard.js:495
@@ -8472,7 +8322,6 @@ msgid "Next Sync"
msgstr "Następny raz"
#: proxmox-yew-comp/src/subscription_panel.rs:203
-#, fuzzy
msgid "Next due data"
msgstr "Najbliższy termin"
@@ -8513,7 +8362,7 @@ msgstr "brak skonfigurowanych kont"
#: proxmox-backup/www/Utils.js:737
msgid "No Activity"
-msgstr ""
+msgstr "Brak aktywności"
#: pmg-gui/js/AttachmentGrid.js:81 pmg-gui/js/AttachmentGrid.js:101
msgid "No Attachments"
@@ -8667,9 +8516,8 @@ msgstr "nie wybrano VM"
#: pve-manager/www/manager6/sdn/FirewallVnetView.js:10
#: pve-manager/www/manager6/sdn/VnetView.js:6
-#, fuzzy
msgid "No VNet configured."
-msgstr "nie skonfigurowane"
+msgstr "Nie skonfigurowano VNet"
#: pve-manager/www/manager6/ceph/Status.js:134
msgid "No Warnings/Errors"
@@ -8701,9 +8549,8 @@ msgstr "brak zmian"
#: proxmox-datacenter-manager/ui/src/dashboard/top_entities.rs:257
#: proxmox-datacenter-manager/ui/src/widget/resource_tree.rs:273
-#, fuzzy
msgid "No data"
-msgstr "Kopiuj dane"
+msgstr "brak danych"
#: pmg-gui/js/AttachmentQuarantine.js:52 pmg-gui/js/ContactStatistics.js:115
#: pmg-gui/js/Dashboard.js:468 pmg-gui/js/DomainStatistics.js:75
@@ -8722,19 +8569,16 @@ msgid "No default available"
msgstr "brak domyślnych"
#: proxmox-yew-comp/src/apt_repositories.rs:663
-#, fuzzy
msgid "No description available"
-msgstr "Brak dostępnej pomocy"
+msgstr "brak opisu"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:181
-#, fuzzy
msgid "No enhancements"
-msgstr "Rozszerzenia SPICE"
+msgstr "Brak rozszerzeń"
#: pve-manager/www/manager6/grid/FirewallRules.js:623
-#, fuzzy
msgid "No firewall rule configured here."
-msgstr "nie zdefiniowano odbiorcy"
+msgstr "Nie skonfigurowano reguł zapory."
#: pmg-gui/js/QuarantineList.js:264
msgid "No match found"
@@ -8766,18 +8610,16 @@ msgid "No notification targets configured"
msgstr "Nie zdefiniowano odbiorców"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:237
-#, fuzzy
msgid "No recipients configured"
-msgstr "brak skonfigurowanych kont"
+msgstr "Nie skonfigurowano odbiorców"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:83
msgid "No remotes configured or could not fetch status."
-msgstr ""
+msgstr "Brak skonfigurowanych maszyn lub niepowodzenie w pobieraniu ich stanu."
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:64
-#, fuzzy
msgid "No remotes configured."
-msgstr "nie skonfigurowane"
+msgstr "Nie skonfigurowano maszyn."
#: pve-manager/www/manager6/sdn/zones/Base.js:45
#: pve-manager/www/manager6/storage/Base.js:42
@@ -8821,7 +8663,6 @@ msgid "No updates available."
msgstr "brak dostępnych aktualizacji"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:225
-#, fuzzy
msgid "No valid Subscription"
msgstr "Brak aktualnej subskrypcji"
@@ -8835,9 +8676,8 @@ msgid "No valid subscription"
msgstr "Brak aktualnej subskrypcji"
#: pve-manager/www/manager6/sdn/ZoneView.js:6
-#, fuzzy
msgid "No zone configured."
-msgstr "Brak dostępnych {0}."
+msgstr "Nie skonfigurowano strefy"
#: pve-manager/www/manager6/dc/RealmSyncJob.js:8
msgid "No {0} configured"
@@ -8861,9 +8701,8 @@ msgid "No {0} repository is enabled, you do not get any updates!"
msgstr "Nie włączono repozytorium {0}, nie będziesz otrzymywać aktualizacji!"
#: pve-manager/www/manager6/ha/Rules.js:71
-#, fuzzy
msgid "No {0} rules configured."
-msgstr "Brak dostępnych {0}."
+msgstr "Brak reguł {0}."
#: pve-manager/www/manager6/node/Directory.js:174
#: pve-manager/www/manager6/node/LVM.js:174
@@ -8917,14 +8756,12 @@ msgstr "Węzeł"
#: proxmox-datacenter-manager/ui/src/pve/node.rs:210
#: pve-yew-mobile-gui/src/pages/page_node_tasks.rs:32
-#, fuzzy
msgid "Node '{0}'"
-msgstr "Usuń '{0}'"
+msgstr "Węzeł '{0}'"
#: pve-manager/www/manager6/Utils.js:2168
-#, fuzzy
msgid "Node fencing notifications"
-msgstr "Wysyłanie powiadomień"
+msgstr "Powiadomienia o izolowaniu węzłów"
#: pve-manager/www/manager6/dc/Backup.js:567
msgid "Node is offline"
@@ -8940,9 +8777,8 @@ msgid "Node type"
msgstr "Typ reguły"
#: proxmox-datacenter-manager/ui/src/widget/resource_tree.rs:337
-#, fuzzy
msgid "Node/Error"
-msgstr "Błąd"
+msgstr "Węzeł/błąd"
#: pve-manager/www/manager6/dc/Cluster.js:284
msgid "Nodename"
@@ -8965,11 +8801,11 @@ msgstr "Węzły"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:353
msgid "Nodes With the Highest CPU Usage"
-msgstr ""
+msgstr "Węzły z najwyższym wykorzystaniem CPU"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:359
msgid "Nodes With the Highest Memory Usage"
-msgstr ""
+msgstr "Węzły z najwyższym wykorzystaniem pamięci"
#: proxmox-widget-toolkit/src/Utils.js:1406
msgid "Non production-ready repository enabled!"
@@ -8993,14 +8829,12 @@ msgid "None"
msgstr "brak"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:79
-#, fuzzy
msgid "None (insecure)"
-msgstr "niebezpieczne"
+msgstr "brak (niebezpieczne)"
#: pmg-gui/js/form/MatchModeSelector.js:9
-#, fuzzy
msgid "None matches"
-msgstr "żadna reguła nie pasuje"
+msgstr "Żadna nie pasuje"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:48
msgid "Normalized"
@@ -9056,9 +8890,8 @@ msgid "Not enough data"
msgstr "za mało danych"
#: pmg-yew-quarantine-gui/src/page_not_found.rs:8
-#, fuzzy
msgid "Not found"
-msgstr "nic nie znaleziono"
+msgstr "nie znaleziono"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:44
#: proxmox-yew-comp/src/apt_repositories.rs:658
@@ -9086,25 +8919,24 @@ msgstr "Uwaga:"
#: pve-manager/www/manager6/window/GuestImport.js:334
#: pve-manager/www/manager6/window/GuestImport.js:628
-#, fuzzy
msgid ""
"Note: If anything goes wrong during the live-import, new data written by the "
"VM may be lost."
msgstr ""
-"Uwaga: jeśli coś pójdzie źle podczas odtwarzania na żywo, nowe dane "
-"zapisywane przez maszynę mogą zostać utracone."
+"Uwaga: jeśli coś pójdzie źle podczas odtwarzania w locie, nowe dane "
+"zapisywane przez VM mogą zostać utracone."
#: pve-manager/www/manager6/window/Restore.js:305
msgid ""
"Note: If anything goes wrong during the live-restore, new data written by "
"the VM may be lost."
msgstr ""
-"Uwaga: jeśli coś pójdzie źle podczas odtwarzania na żywo, nowe dane "
+"Uwaga: jeśli coś pójdzie źle podczas odtwarzania w locie, nowe dane "
"zapisywane przez maszynę mogą zostać utracone."
#: pve-manager/www/manager6/qemu/SevEdit.js:82
msgid "Note: SEV-SNP requires host kernel version 6.11 or higher."
-msgstr ""
+msgstr "Uwaga: SEV-SNP wymaga jądra w wersji 6.11 lub wyższej."
#: proxmox-widget-toolkit/src/panel/NotesView.js:6
#: proxmox-widget-toolkit/src/window/NotesEdit.js:4
@@ -9163,9 +8995,8 @@ msgid "Notification system"
msgstr "System powiadamiania"
#: proxmox-widget-toolkit/src/Utils.js:719
-#, fuzzy
msgid "Notification type"
-msgstr "Odbiorca powiadomień"
+msgstr "Typ powiadomienia"
#: pve-manager/www/manager6/dc/Backup.js:352
#: pve-manager/www/manager6/dc/Config.js:369
@@ -9239,6 +9070,7 @@ msgstr "OSD bez metadanych, prawdopodobnie pozostałości po usunięciu"
#: pve-manager/www/manager6/window/GuestImport.js:1012
msgid "OVMF is built without LSI drivers, scsi hardware was set to '{1}'"
msgstr ""
+"OVMF zbudowany bez sterowników LSI, sprzęt SCSI został ustawiony jako '{1}'"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:161
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:181
@@ -9249,7 +9081,7 @@ msgstr "Opcje OVS"
#: pve-manager/www/manager6/ceph/OSD.js:197
msgid "Objects are degraded. Consider waiting until the cluster is healthy."
msgstr ""
-"Obiekty są obecnie zdegradowane. Najlepiej poczekać aż klaster będzie zdrowy."
+"Obiekty są obecnie zdegradowane. Spróbuj zaczekać aż klaster będzie zdrowy."
#: pve-manager/www/manager6/dc/Health.js:114
#: pve-manager/www/manager6/window/Migrate.js:45
@@ -9263,13 +9095,12 @@ msgstr "Nieaktywne"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:336
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:345
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:361
-#, fuzzy
msgid "Often called {0}"
-msgstr "Reguła kalendarzowa: {0}"
+msgstr "Często nazywane {0}"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:357
msgid "Often called {0} or {1}"
-msgstr ""
+msgstr "Często nazywane {0} lub {1}"
#: proxmox-widget-toolkit/src/window/PackageVersions.js:30
#: pve-manager/www/manager6/node/Summary.js:46
@@ -9299,19 +9130,20 @@ msgstr "na miejscu"
#: proxmox-yew-comp/src/apt_package_manager.rs:358
msgid "One item"
msgid_plural "{} items"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "Jeden element"
+msgstr[1] "elementy"
+msgstr[2] "elementów"
#: pve-yew-mobile-gui/src/pages/page_node_status/services_panel.rs:77
msgid "One or more required services not running"
-msgstr ""
+msgstr "Jedna lub więcej wymaganych usług nie działa"
#: proxmox-yew-comp/src/apt_repositories.rs:821
-#, fuzzy
msgid "One repository"
msgid_plural "{n} repositories"
-msgstr[0] "Repozytorium"
-msgstr[1] "Repozytorium"
+msgstr[0] "Jedno repozytorium"
+msgstr[1] "{n} repozytoria"
+msgstr[2] "{n} repozytoriów"
#: pve-manager/www/manager6/data/ResourceStore.js:87
#: pve-manager/www/manager6/dc/Health.js:108
@@ -9334,7 +9166,7 @@ msgstr ""
#: pmg-gui/js/Utils.js:389
msgid "Only top level headers"
-msgstr ""
+msgstr "Tylko nagłówki najwyższego poziomu"
#: proxmox-widget-toolkit/src/panel/NodeInfoRepoStatus.js:50
msgid "Open Repositories Panel"
@@ -9346,15 +9178,15 @@ msgstr "Otwórz zadanie"
#: proxmox-datacenter-manager/ui/src/pve/mod.rs:187
msgid "Open Web UI"
-msgstr ""
+msgstr "Otwórz Web UI"
#: pve-manager/www/manager6/window/Settings.js:297
msgid "Open editor on double-click"
-msgstr ""
+msgstr "Edycja przez podwójne kliknięcie"
#: proxmox-datacenter-manager/ui/src/pve/tree.rs:672
msgid "Open in PVE UI"
-msgstr ""
+msgstr "Otwórz w PVE UI"
#: proxmox-backup/www/tape/BackupOverview.js:365
msgid "Open restore wizard for {0}"
@@ -9364,20 +9196,17 @@ msgstr "Otwórz asystenta odzyskiwania dla {0}"
#: pve-manager/www/manager6/Utils.js:742
#: proxmox-yew-comp/src/auth_edit_openid.rs:171
msgid "OpenID Connect Server"
-msgstr "Serwer OpenID"
+msgstr "Serwer OpenID Connect"
#: pmg-gui/js/LoginView.js:248
-#, fuzzy
msgid "OpenID Connect login - please wait..."
-msgstr "Logowanie OpenID - proszę czekać..."
+msgstr "Logowanie OpenID Connect - proszę czekać..."
#: pmg-gui/js/LoginView.js:267
-#, fuzzy
msgid "OpenID Connect login failed, please try again"
msgstr "Logowanie nie powiodło się, proszę spróbować ponownie"
#: pmg-gui/js/LoginView.js:114
-#, fuzzy
msgid "OpenID Connect redirect failed."
msgstr "Przekierowanie nie powiodło się."
@@ -9400,14 +9229,12 @@ msgid "OpenID redirect failed."
msgstr "Przekierowanie nie powiodło się."
#: proxmox-yew-comp/src/auth_view.rs:198
-#, fuzzy
msgid "OpenId Connect Server"
-msgstr "Serwer OpenID"
+msgstr "Serwer OpenID Connect"
#: pve-manager/www/manager6/dc/MetricServerView.js:529
-#, fuzzy
msgid "OpenTelemetry Server"
-msgstr "Serwer OpenID"
+msgstr "Serwer OpenTelemetry"
#: pve-manager/www/manager6/ceph/Pool.js:348
msgid "Optimal # of PGs"
@@ -9450,7 +9277,6 @@ msgid "Order Certificate"
msgstr "Zamów certyfikat"
#: proxmox-yew-comp/src/acme/acme_domains.rs:240
-#, fuzzy
msgid "Order Certificate Now"
msgstr "Zamów certyfikat"
@@ -9458,7 +9284,7 @@ msgstr "Zamów certyfikat"
#: proxmox-widget-toolkit/src/panel/ACMEDomains.js:484
#: pve-manager/www/manager6/node/ACME.js:638
msgid "Order Certificates Now"
-msgstr "Zamów certyfikat"
+msgstr "Zamów certyfikaty"
#: pve-manager/www/manager6/dc/OptionView.js:519
msgid "Ordering"
@@ -9495,11 +9321,11 @@ msgstr "Inne"
#: proxmox-backup/www/Utils.js:741
msgid "Other Activity"
-msgstr ""
+msgstr "Inna aktywność"
#: proxmox-backup/www/Utils.js:749
msgid "Other DT Activity"
-msgstr ""
+msgstr "Inna aktywność DT"
#: proxmox-widget-toolkit/src/Utils.js:1419
msgid "Other Error"
@@ -9557,7 +9383,7 @@ msgstr "Nadpisuj ustawienia"
#: pve-manager/www/manager6/window/GuestStop.js:44
msgid "Overrule active shutdown tasks"
-msgstr ""
+msgstr "Wpływaj na trwające zadania wyłączenia"
#: pve-manager/www/manager6/window/Restore.js:378
#: proxmox-backup/www/tape/form/RetentionSelector.js:7
@@ -9565,22 +9391,20 @@ msgid "Overwrite"
msgstr "Nadpisuj"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:106
-#, fuzzy
msgid "Overwrite Groups"
-msgstr "Nadpisuj"
+msgstr "Nadpisuj grupy"
#: pmg-gui/js/DKIMSettings.js:187
msgid "Overwrite existing file"
msgstr "Nadpisuj istniejący plik"
#: proxmox-backup/www/window/DataStoreEdit.js:202
-#, fuzzy
msgid "Overwrite in-use marker"
-msgstr "Nadpisuj"
+msgstr "Nadpisuj znacznik in-use"
#: pve-manager/www/manager6/window/Migrate.js:626
msgid "Overwrite local resources unavailable check"
-msgstr ""
+msgstr "Nadpisuj sprawdzanie dostępności lokalnych zasobów"
#: proxmox-backup/www/datastore/Content.js:1163
#: proxmox-backup/www/tape/window/TapeRestore.js:466
@@ -9593,9 +9417,8 @@ msgstr "PB"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:280
#: pve-manager/www/manager6/window/Backup.js:71
-#, fuzzy
msgid "PBS change detection mode"
-msgstr "Tryb wyboru"
+msgstr "Tryb wykrywania zmian PBS"
#: pve-manager/www/manager6/qemu/HardwareView.js:308
#: pve-manager/www/manager6/qemu/HardwareView.js:766
@@ -9617,14 +9440,12 @@ msgid "PEM"
msgstr "PEM"
#: pve-manager/www/manager6/ceph/Pool.js:93
-#, fuzzy
msgid "PG Autoscaler Mode"
-msgstr "Tryb automatycznego skalowania"
+msgstr "Tryb autoskalowania PG"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:71
-#, fuzzy
msgid "POSIX ACLs"
-msgstr "Wyczyść ACL"
+msgstr "POSIX ACL"
#: proxmox-widget-toolkit/src/node/APT.js:26
#: pve-manager/www/manager6/storage/TemplateView.js:76
@@ -9633,9 +9454,8 @@ msgid "Package"
msgstr "Pakiet"
#: pve-manager/www/manager6/Utils.js:2165 proxmox-backup/www/Utils.js:478
-#, fuzzy
msgid "Package updates are available"
-msgstr "brak dostępnych aktualizacji"
+msgstr "Dostępne aktualizacje pakietów"
#: proxmox-widget-toolkit/src/window/PackageVersions.js:5
#: pmg-gui/js/ServerStatus.js:50 pve-manager/www/manager6/node/Summary.js:27
@@ -9702,9 +9522,8 @@ msgid "Password"
msgstr "Hasło"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:106
-#, fuzzy
msgid "Password/Secret"
-msgstr "Hasło"
+msgstr "Hasło/sekret"
#: proxmox-widget-toolkit/src/Toolkit.js:210
#: pve-manager/www/manager6/dc/UserEdit.js:22
@@ -9712,13 +9531,12 @@ msgid "Passwords do not match"
msgstr "Hasła nie pasują do siebie"
#: proxmox-yew-comp/src/user_panel.rs:252
-#, fuzzy
msgid "Passwords do not match!"
-msgstr "Hasła nie pasują do siebie"
+msgstr "Hasła nie pasują do siebie!"
#: pve-manager/www/manager6/dc/ClusterEdit.js:329
msgid "Paste encoded Cluster Information here"
-msgstr "Wklej tu zakodowane informacje o klastrze"
+msgstr "Wklej tutaj zakodowane informacje o klastrze"
#: proxmox-widget-toolkit/src/panel/PermissionView.js:29
#: pve-manager/www/manager6/dc/ACLView.js:21
@@ -9750,17 +9568,15 @@ msgstr "Ścieżka"
#: proxmox-backup/www/window/S3ClientEdit.js:68
msgid "Path Style"
-msgstr ""
+msgstr "Styl ścieżki"
#: pve-manager/www/manager6/lxc/DeviceEdit.js:59
-#, fuzzy
msgid "Path has to start with /dev/"
-msgstr "Musi się zaczynać od"
+msgstr "Ścieżka musi się zaczynać od /dev/"
#: proxmox-backup/www/window/DataStoreEdit.js:101
-#, fuzzy
msgid "Path on Device"
-msgstr "z urządzenia"
+msgstr "Ścieżka na urządzeniu"
#: pve-manager/www/manager6/Utils.js:2114
#: pve-manager/www/manager6/qemu/CmdMenu.js:68
@@ -9798,23 +9614,21 @@ msgid "Pending Changes"
msgstr "Wprowadzanie zmian"
#: proxmox-backup/www/config/GCView.js:225
-#, fuzzy
msgid "Pending Data"
-msgstr "Wprowadzanie zmian"
+msgstr "Dane oczekujące"
#: proxmox-widget-toolkit/src/node/NetworkView.js:431
#: pmg-gui/js/SpamDetectorCustom.js:310
msgid "Pending changes"
-msgstr "Wprowadzanie zmian"
+msgstr "Oczekujące zmiany"
#: proxmox-yew-comp/src/configuration/network_view.rs:268
-#, fuzzy
msgid ""
"Pending changes (Either reboot or use 'Apply Configuration' (needs "
"ifupdown2) to activate)"
msgstr ""
-"aktywacja przez restart lub naciśnięcie przycisku \"Zastosuj zmiany\" "
-"(wymaga pakietu ifupdown2)"
+"Oczekujące zmiany (aktywacja przez restart lub wciśnięcie przycisku "
+"\"Zastosuj zmiany\" (wymaga pakietu ifupdown2))"
#: pmg-gui/js/SpamScoreDistribution.js:44
msgid "Percentage"
@@ -9879,9 +9693,8 @@ msgid "Please (re-)query URL to get meta information"
msgstr "Uruchom (ponownie) analizę URL aby uzyskać metainformacje"
#: proxmox-yew-comp/src/acme/certificate_list.rs:308
-#, fuzzy
msgid "Please Reload"
-msgstr "Odczyt z taśmy"
+msgstr "Odśwież przeglądarkę"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:443
msgid "Please enter one of your single-use recovery keys"
@@ -9892,9 +9705,8 @@ msgid "Please enter the ID to confirm"
msgstr "Podaj identyfikator aby potwierdzić"
#: proxmox-yew-comp/src/safe_confirm_dialog.rs:116
-#, fuzzy
msgid "Please enter the ID to confirm ({0})"
-msgstr "Podaj identyfikator aby potwierdzić"
+msgstr "Podaj ID aby potwierdzić ({0})"
#: proxmox-widget-toolkit/src/window/TfaWindow.js:375
msgid "Please enter your TOTP verification code"
@@ -9957,18 +9769,16 @@ msgid "Please select a sender."
msgstr "Wybierz nadawcę"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:189
-#, fuzzy
msgid "Please select a target storage."
-msgstr "Wybierz regułkę"
+msgstr "Wybierz docelowy magazyn."
#: pmg-gui/js/ObjectGroup.js:15
msgid "Please select an object."
msgstr "wybierz obiekt"
#: pve-manager/www/manager6/window/LoginWindow.js:165
-#, fuzzy
msgid "Please try again"
-msgstr "Logowanie nie powiodło się. Proszę spróbować ponownie"
+msgstr "Proszę spróbować ponownie"
#: pmg-gui/js/ClusterAdministration.js:96
msgid ""
@@ -10097,9 +9907,8 @@ msgid "Portuguese (Brazil)"
msgstr "portugalski (brazylijski)"
#: pmg-gui/js/Utils.js:715
-#, fuzzy
msgid "Position"
-msgstr "Pozycja taśmy"
+msgstr "Pozycja"
#: pve-manager/www/manager6/dc/Backup.js:408
#: pve-manager/www/manager6/window/Backup.js:267
@@ -10131,6 +9940,8 @@ msgid ""
"Prefer a fast and local storage, ideally with support for discard and thin-"
"provisioning or sparse files."
msgstr ""
+"Preferowane szybkie lokalne dyski, najlepiej z obsługą dynamicznego "
+"zmniejszania oraz dynamicznego rozmiaru lub rozrzedzonych plików."
#: pve-manager/www/manager6/Utils.js:32
msgid "Premium"
@@ -10138,7 +9949,7 @@ msgstr "Premium"
#: pve-manager/www/manager6/window/GuestImport.js:753
msgid "Prepare for VirtIO-SCSI"
-msgstr ""
+msgstr "Przygotowanie dla VirtIO-SCSI"
#: proxmox-widget-toolkit/src/window/SyncWindow.js:146
#: pve-manager/www/manager6/dc/OptionView.js:492
@@ -10205,9 +10016,8 @@ msgid "Privileges"
msgstr "Uprawnienia"
#: proxmox-datacenter-manager/ui/src/remotes/add_wizard.rs:99
-#, fuzzy
msgid "Probe Remote"
-msgstr "Źródło zdalne"
+msgstr "Sprawdź maszynę"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:152
#: pve-manager/www/manager6/ceph/OSDDetails.js:169
@@ -10219,9 +10029,8 @@ msgid "Processing..."
msgstr "Przetwarzanie..."
#: pve-yew-mobile-gui/src/pages/page_qemu_status/hardware_panel.rs:73
-#, fuzzy
msgid "Processor"
-msgstr "Procesory"
+msgstr "Procesor"
#: pve-manager/www/manager6/panel/TemplateStatusView.js:40
#: pve-manager/www/manager6/qemu/HardwareView.js:99
@@ -10311,9 +10120,8 @@ msgid "Protocol"
msgstr "Protokół"
#: proxmox-yew-comp/src/proxmox_product.rs:60
-#, fuzzy
msgid "Proxmox Backup Server"
-msgstr "Logowanie do Proxmox Backup Server"
+msgstr "Proxmox Backup Server"
#: proxmox-backup/www/LoginView.js:271
msgid "Proxmox Backup Server Login"
@@ -10321,30 +10129,27 @@ msgstr "Logowanie do Proxmox Backup Server"
#: proxmox-yew-comp/src/proxmox_product.rs:62
msgid "Proxmox Datacenter Manager"
-msgstr ""
+msgstr "Proxmox Datacenter Manager"
#: proxmox-datacenter-manager/ui/src/main.rs:250
-#, fuzzy
msgid "Proxmox Datacenter Manager Login"
-msgstr "Logowanie do Proxmox Backup Server"
+msgstr "Logowanie do Proxmox Datacenter Manager"
#: proxmox-yew-comp/src/proxmox_product.rs:59
-#, fuzzy
msgid "Proxmox Mail Gateway"
-msgstr "Logowanie do Proxmox Mail Gateway"
+msgstr "Proxmox Mail Gateway"
#: pmg-gui/js/LoginView.js:332
msgid "Proxmox Mail Gateway Login"
msgstr "Logowanie do Proxmox Mail Gateway"
#: pmg-gui/js/QuarantineViewAbout.js:11
-#, fuzzy
msgid "Proxmox Mail Gateway Quarantine Help"
-msgstr "Logowanie do Proxmox Mail Gateway"
+msgstr "Pomoc do kwarantanny w Proxmox Mail Gateway"
#: proxmox-yew-comp/src/proxmox_product.rs:61
msgid "Proxmox Offline Mirror"
-msgstr ""
+msgstr "Proxmox Offline Mirror"
#: pve-manager/www/manager6/window/LoginWindow.js:351
msgid "Proxmox VE Login"
@@ -10352,7 +10157,7 @@ msgstr "Logowanie do Proxmox VE"
#: proxmox-yew-comp/src/proxmox_product.rs:58
msgid "Proxmox Virtual Environment"
-msgstr ""
+msgstr "Proxmox Virtual Environment"
#: pve-manager/www/manager6/window/Backup.js:111
#: pve-manager/www/manager6/window/Prune.js:212 proxmox-backup/www/Utils.js:447
@@ -10361,7 +10166,6 @@ msgid "Prune"
msgstr "Czyszczenie"
#: proxmox-backup/www/config/PruneAndGC.js:4
-#, fuzzy
msgid "Prune & GC Jobs"
msgstr "Czyszczenie i usuwanie"
@@ -10403,7 +10207,6 @@ msgid "Prune group"
msgstr "Wyczyść grupę"
#: proxmox-backup/www/Utils.js:479
-#, fuzzy
msgid "Prune job"
msgstr "Zadanie czyszczenia"
@@ -10416,7 +10219,6 @@ msgid "Prunes"
msgstr "Czyszczenie"
#: pve-manager/www/manager6/node/Certificates.js:327
-#, fuzzy
msgid "Public Key Algorithm"
msgstr "Algorytm klucza publicznego"
@@ -10441,9 +10243,8 @@ msgid "Public Key Type"
msgstr "Typ klucza publicznego"
#: proxmox-backup/www/config/SyncView.js:319
-#, fuzzy
msgid "Pull"
-msgstr "Pobierz plik"
+msgstr "Pull"
#: pve-manager/www/manager6/Utils.js:2105
#: proxmox-datacenter-manager/ui/src/tasks.rs:47
@@ -10453,16 +10254,15 @@ msgstr "Pobierz plik"
#: proxmox-backup/www/config/SyncView.js:367
msgid "Pull: The local owner."
-msgstr ""
+msgstr "Pull: Lokalny właściciel."
#: pve-manager/www/manager6/window/SafeDestroyGuest.js:13
msgid "Purge from job configurations"
msgstr "Usuń z konfiguracji zadań"
#: proxmox-backup/www/config/SyncView.js:316
-#, fuzzy
msgid "Push"
-msgstr "Wyślij plik"
+msgstr "Push"
#: pve-manager/www/manager6/Utils.js:2106
#: proxmox-datacenter-manager/ui/src/tasks.rs:48
@@ -10472,14 +10272,13 @@ msgstr "Wyślij plik"
#: proxmox-backup/www/config/SyncView.js:368
msgid "Push: The local user used for access control."
-msgstr ""
+msgstr "Push: Lokalny użytkownik stosowany przy kontroli dostępu."
#: pve-manager/www/manager6/qemu/PCIEdit.js:43
msgid "Q35 only"
msgstr "Tylko Q35"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:168
-#, fuzzy
msgid "QEMU Guest Agent"
msgstr "Agent QEMU"
@@ -10516,11 +10315,11 @@ msgstr "Analiza URL"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:144
msgid "Query userinfo endpoint"
-msgstr ""
+msgstr "Zapytanie userinfo"
#: proxmox-datacenter-manager/ui/src/pve/tree.rs:539
msgid "Querying Remote..."
-msgstr ""
+msgstr "Odpytywanie maszyny..."
#: pmg-gui/js/QueueAdministration.js:5
msgid "Queue Administration"
@@ -10558,7 +10357,7 @@ msgstr "Wykorzystanie RAM"
#: pve-manager/www/manager6/node/NodeOptionsView.js:75
msgid "RAM usage target for ballooning"
-msgstr ""
+msgstr "Dynamiczne wykorzystanie RAM"
#: pve-manager/www/manager6/storage/RBDEdit.js:250
msgid "RBD namespaces must be created manually!"
@@ -10633,13 +10432,12 @@ msgid "Re-Verify After"
msgstr "Ponawiaj weryfikację"
#: proxmox-backup/www/window/SyncJobEdit.js:452
-#, fuzzy
msgid "Re-sync Corrupt"
-msgstr "Odtwórz migawkę(-i)"
+msgstr "Ponawiaj uszkodzone"
#: proxmox-backup/www/window/SyncJobEdit.js:456
msgid "Re-sync snapshots, whose verification failed."
-msgstr ""
+msgstr "Ponownie synchronizuj migawki, których weryfikacja się nie powiodła."
#: proxmox-backup/www/ServerStatus.js:262
#: proxmox-backup/www/ServerStatus.js:269
@@ -10678,13 +10476,12 @@ msgid "Read-only"
msgstr "Tylko do odczytu"
#: proxmox-backup/www/Utils.js:742
-#, fuzzy
msgid "Reading data"
-msgstr "Weryfikator"
+msgstr "Odczytywanie danych"
#: proxmox-backup/www/Utils.js:751
msgid "Reading encrypted data"
-msgstr ""
+msgstr "Odczytywanie zaszyfrowanych danych"
#: pve-manager/www/manager6/ceph/Status.js:312
#: pve-manager/www/manager6/ceph/Status.js:324
@@ -10818,15 +10615,13 @@ msgid "Receiver"
msgstr "Odbiorca"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:218
-#, fuzzy
msgid "Recent backups"
-msgstr "Przechowuj wszystkie kopie"
+msgstr "Najnowsze kopie"
#: proxmox-backup/www/tape/window/TapeBackupJob.js:275
#: proxmox-backup/www/window/NotifyOptions.js:107
-#, fuzzy
msgid "Recipient"
-msgstr "Odbiorca(-y)"
+msgstr "Odbiorca"
#: proxmox-widget-toolkit/src/panel/EmailRecipientPanel.js:33
msgid "Recipient(s)"
@@ -10834,9 +10629,8 @@ msgstr "Odbiorca(-y)"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:230
#: pve-manager/www/manager6/panel/BackupNotificationOptions.js:79
-#, fuzzy
msgid "Recipients"
-msgstr "Odbiorca(-y)"
+msgstr "Odbiorcy"
#: pve-manager/www/manager6/ceph/Status.js:289
msgid "Recovery"
@@ -10853,9 +10647,8 @@ msgid "Recovery Keys"
msgstr "Klucze odzyskiwania"
#: proxmox-yew-comp/src/tfa/tfa_add_recovery.rs:119
-#, fuzzy
msgid "Recovery Keys for user '{}'"
-msgstr "Klucze odzyskiwania"
+msgstr "Klucze odzyskiwania dla użytkownika '{}'"
#: proxmox-backup/www/panel/PrunePanel.js:100
msgid "Recursive"
@@ -10875,22 +10668,23 @@ msgstr "Odśwież"
#: proxmox-backup/www/datastore/Content.js:1323
msgid "Refresh contents from S3 bucket"
-msgstr ""
+msgstr "Odśwież zawartość z pojemnika S3"
#: pve-manager/www/manager6/qemu/CloudInit.js:79
msgid "Regenerate Image"
msgstr "Odtwórz obraz"
#: proxmox-backup/www/config/TokenView.js:211
-#, fuzzy
msgid "Regenerate Secret"
-msgstr "Odtwórz obraz"
+msgstr "Odtwórz sekret"
#: proxmox-backup/www/config/TokenView.js:217
msgid ""
"Regenerate the secret of the API token '{0}'? All users of the previous "
"token secret will lose access!"
msgstr ""
+"Odnowić sekret dla klucza API '{0}'? Wszyscy użytkownicy poprzedniego "
+"sekretu utracą dostęp!"
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1304
#: proxmox-widget-toolkit/src/window/NotificationMatcherEdit.js:1374
@@ -10902,7 +10696,7 @@ msgstr "Wyrażenie regularne"
#: proxmox-backup/www/config/S3ClientView.js:128
#: proxmox-backup/www/window/S3ClientEdit.js:82
msgid "Region"
-msgstr ""
+msgstr "Region"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:12
#: pve-manager/www/manager6/Utils.js:2067
@@ -10995,9 +10789,8 @@ msgid "Reload"
msgstr "Odśwież zawartość"
#: pve-manager/www/manager6/Utils.js:2127
-#, fuzzy
msgid "Reload network configuration on all nodes"
-msgstr "Nie udało się rozpoznać konfiguracji sieci"
+msgstr "Przeładuj konfigurację sieci na wszystkich węzłach."
#: pmg-gui/js/TFAView.js:27 proxmox-backup/www/config/WebauthnView.js:11
#: proxmox-backup/www/config/WebauthnView.js:79
@@ -11015,9 +10808,8 @@ msgid "Remote"
msgstr "Nazwa"
#: proxmox-datacenter-manager/ui/src/pve/mod.rs:172
-#, fuzzy
msgid "Remote '{0}'"
-msgstr "Usuń '{0}'"
+msgstr "Maszyna '{0}'"
#: proxmox-backup/www/config/RemoteView.js:129
#: proxmox-backup/www/config/SyncView.js:340
@@ -11031,7 +10823,6 @@ msgid "Remote ID"
msgstr "Zdalny ID"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:418
-#, fuzzy
msgid "Remote Migration Settings"
msgstr "Ustawienia migracji"
@@ -11055,19 +10846,16 @@ msgid "Remotes"
msgstr "Zdalne konta"
#: proxmox-backup/www/window/DataStoreEdit.js:63
-#, fuzzy
msgid "Removable"
-msgstr "Usuń"
+msgstr "Usuwalne"
#: proxmox-backup/www/window/CreateDirectory.js:59
-#, fuzzy
msgid "Removable datastore"
-msgstr "Usuń magazyn"
+msgstr "Usuwalny magazyn"
#: proxmox-backup/www/NavigationTree.js:296
-#, fuzzy
msgid "Removable datastore not mounted"
-msgstr "Usuń magazyn"
+msgstr "Usuwalny magazyn nie jest zamontowany"
#: pve-manager/www/manager6/grid/Replication.js:343
#: pve-manager/www/manager6/grid/Replication.js:346
@@ -11148,9 +10936,8 @@ msgid "Remove Group"
msgstr "Usuń grupę"
#: proxmox-backup/www/tape/window/MediaRemoveWindow.js:19
-#, fuzzy
msgid "Remove Media"
-msgstr "Przywróć zestaw nośników"
+msgstr "Usuń media"
#: proxmox-backup/www/Utils.js:432
msgid "Remove Namespace"
@@ -11168,7 +10955,6 @@ msgid "Remove Subscription"
msgstr "Usuń subskrypcję"
#: proxmox-backup/www/window/SyncJobEdit.js:401
-#, fuzzy
msgid "Remove Vanished"
msgstr "Usuwaj brakujące"
@@ -11187,7 +10973,7 @@ msgstr "Usuń wszystkie załączniki"
#: proxmox-backup/www/datastore/OptionView.js:23
msgid "Remove data from S3 bucket and local cache (dangerous!)"
-msgstr ""
+msgstr "Usuń dane z pojemnika S3 i z lokalnego bufora (niebezpieczne!)"
#: proxmox-backup/www/config/PruneView.js:177
#: proxmox-backup/www/config/SyncView.js:248
@@ -11213,17 +10999,16 @@ msgid "Remove namespace '{0}'"
msgstr "Usuń przestrzeń nazw '{0}'"
#: proxmox-backup/www/window/SyncJobEdit.js:405
-#, fuzzy
msgid ""
"Remove snapshots from sync target datastore if they vanished from source "
"datastore?"
msgstr ""
-"Czy usuwać migawki z lokalnego magazynu jeśli brak ich w magazynie źródłowym?"
+"Czy usuwać migawki z docelowego magazynu jeśli brak ich w magazynie "
+"źródłowym?"
#: proxmox-yew-comp/src/auth_edit_ldap.rs:142
-#, fuzzy
msgid "Remove vanished properties"
-msgstr "Usuń brakujących użytkowników"
+msgstr "Usuwaj brakujące właściwości"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:436
#: proxmox-widget-toolkit/src/window/SyncWindow.js:125
@@ -11231,24 +11016,23 @@ msgstr "Usuń brakujących użytkowników"
#: pve-manager/www/manager6/dc/RealmSyncJob.js:384
#: pve-manager/www/manager6/dc/SyncWindow.js:147
msgid "Remove vanished properties from synced users."
-msgstr "Usuwaj brakujące właściwości ze zsynchronizowanych użytkowników."
+msgstr "Usuwaj brakujące właściwości zsynchronizowanych użytkowników."
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:430
#: proxmox-yew-comp/src/auth_edit_ldap.rs:138
msgid "Remove vanished user"
-msgstr "Usuń brakujących użytkowników"
+msgstr "Usuwaj brakujących użytkowników"
#: proxmox-widget-toolkit/src/window/SyncWindow.js:118
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:342
#: pve-manager/www/manager6/dc/RealmSyncJob.js:377
#: pve-manager/www/manager6/dc/SyncWindow.js:140
msgid "Remove vanished user and group entries."
-msgstr "Usuń brakujących użytkowników i grupy."
+msgstr "Usuwaj brakujących użytkowników i grupy."
#: proxmox-backup/www/config/GCView.js:217
-#, fuzzy
msgid "Removed Data"
-msgstr "Usuń magazyn"
+msgstr "Usunięte dane"
#: pve-manager/www/manager6/Utils.js:2068 proxmox-backup/www/Utils.js:425
#: proxmox-datacenter-manager/ui/src/tasks.rs:10
@@ -11276,14 +11060,12 @@ msgid "Replication Log"
msgstr "Log replikacji"
#: pve-manager/www/manager6/dc/OptionView.js:131
-#, fuzzy
msgid "Replication Settings"
-msgstr "Ustawienia migracji"
+msgstr "Ustawienia replikacji"
#: pve-manager/www/manager6/Utils.js:2167
-#, fuzzy
msgid "Replication job notifications"
-msgstr "Zadanie replikacji"
+msgstr "Powiadomienia o replikacji"
#: pve-manager/www/manager6/grid/Replication.js:226
msgid "Replication needs at least two nodes"
@@ -11310,7 +11092,7 @@ msgstr "Stan repozytorium"
#: proxmox-backup/www/window/DatastoreRepoInfo.js:65
msgid "Repository for CLI and API"
-msgstr ""
+msgstr "Repozytorium dla CLI i API"
#: pmg-gui/js/LoginView.js:176 pmg-gui/js/LoginView.js:404
msgid "Request Quarantine Link"
@@ -11353,7 +11135,7 @@ msgstr ""
#: proxmox-widget-toolkit/src/window/Edit.js:331
msgid "Reset form data"
-msgstr ""
+msgstr "Wyczyść formularz"
#: pmg-gui/js/RuleConfiguration.js:100
msgid "Reset rule database to factory defaults?"
@@ -11383,9 +11165,8 @@ msgid "Resource"
msgstr "Zasoby"
#: pve-manager/www/manager6/dc/MetricServerView.js:702
-#, fuzzy
msgid "Resource Attributes (JSON)"
-msgstr "Nazwa atrybutu użytkownika"
+msgstr "Atrybuty zasobu (JSON)"
#: pve-manager/www/manager6/dc/Config.js:323
msgid "Resource Mappings"
@@ -11410,7 +11191,6 @@ msgid "Resources"
msgstr "Zasoby"
#: proxmox-yew-comp/src/apt_repositories.rs:701
-#, fuzzy
msgid "Respository"
msgstr "Repozytorium"
@@ -11429,9 +11209,8 @@ msgid "Restart Mode"
msgstr "Wymaga restartu"
#: pmg-gui/js/SpamDetectorCustom.js:96
-#, fuzzy
msgid "Restart pmg-smtp-filter to activate changes."
-msgstr "Proszę zrestartować pmg-smtp-filter aby aktywować zmiany"
+msgstr "Zrestartuj pmg-smtp-filter aby aktywować zmiany."
#: pmg-gui/js/BackupRestore.js:21 pmg-gui/js/BackupRestore.js:24
#: pmg-gui/js/BackupRestore.js:100 pmg-gui/js/BackupRestore.js:140
@@ -11470,9 +11249,8 @@ msgid "Restore Snapshot(s)"
msgstr "Odtwórz migawkę(-i)"
#: pve-manager/www/manager6/window/GuestImport.js:950
-#, fuzzy
msgid "Resulting Config"
-msgstr "Konfiguracja retencji"
+msgstr "Konfiguracja wyjściowa"
#: pve-manager/www/manager6/Utils.js:2118
#: pve-manager/www/manager6/Utils.js:2147
@@ -11492,7 +11270,7 @@ msgstr "Retencja"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:284
msgid "Retention Configuration"
-msgstr "Konfiguracja retencji"
+msgstr "Ustawienia retencji"
#: proxmox-backup/www/tape/PoolConfig.js:125
#: proxmox-backup/www/tape/form/PoolSelector.js:34
@@ -11505,9 +11283,8 @@ msgid "Retired"
msgstr "Wycofana"
#: proxmox-backup/www/window/DataStoreEdit.js:186
-#, fuzzy
msgid "Reuse existing datastore"
-msgstr "Usuń magazyn"
+msgstr "Używaj tego samego magazynu"
#: pve-manager/www/manager6/sdn/ZoneView.js:167
msgid "Reverse DNS"
@@ -11536,9 +11313,8 @@ msgid "Rewind Media"
msgstr "Przewiń nośnik"
#: proxmox-backup/www/Utils.js:745
-#, fuzzy
msgid "Rewinding"
-msgstr "oczekujące"
+msgstr "Przewijanie"
#: proxmox-widget-toolkit/src/form/RoleSelector.js:25
#: pmg-gui/js/ClusterAdministration.js:245 pmg-gui/js/UserEdit.js:104
@@ -11554,9 +11330,8 @@ msgid "Role"
msgstr "Rola"
#: pmg-gui/js/AuthEditOIDC.js:229
-#, fuzzy
msgid "Role Claim"
-msgstr "Nazwa grupy"
+msgstr "Definicja roli"
#: pve-manager/www/manager6/dc/Config.js:135
msgid "Roles"
@@ -11603,18 +11378,16 @@ msgstr "Wykorzystanie dysku głównego"
#: pve-yew-mobile-gui/src/pages/page_lxc_status/resources_panel.rs:78
#: pve-yew-mobile-gui/src/pages/page_node_status/dashboard_panel.rs:108
-#, fuzzy
msgid "Root Filesystem"
-msgstr "System plików"
+msgstr "Główny system plików"
#: proxmox-backup/www/datastore/Content.js:359
msgid "Root Namespace"
msgstr "Główna przestrzeń nazw"
#: proxmox-datacenter-manager/ui/src/pve/node.rs:253
-#, fuzzy
msgid "Root filesystem usage"
-msgstr "Wykorzystanie dysku głównego"
+msgstr "Użycie głównego systemu plików"
#: pve-manager/www/manager6/sdn/zones/EvpnEdit.js:87
msgid "Route Target Import"
@@ -11653,6 +11426,8 @@ msgid ""
"Run jobs as soon as possible if they couldn't start on schedule, for "
"example, due to the node being offline."
msgstr ""
+"Wykonaj zadania kiedy to tylko możliwe jeśli nie były wykonane na czas, na "
+"przykład z powodu wyłączenia węzła."
#: pve-manager/www/manager6/dc/Backup.js:622
#: proxmox-backup/www/config/GCView.js:163
@@ -11664,14 +11439,12 @@ msgid "Run now"
msgstr "Wykonaj"
#: proxmox-backup/www/window/SyncJobEdit.js:495
-#, fuzzy
msgid "Run on Mount"
-msgstr "Wykonaj"
+msgstr "Uruchom po zamontowaniu"
#: proxmox-backup/www/window/SyncJobEdit.js:499
-#, fuzzy
msgid "Run this job when a relevant removable datastore gets mounted."
-msgstr "Usuń magazyn"
+msgstr "Uruchom to zadanie kiedy odpowiedni magazyn zostanie zamontowany"
#: pve-manager/www/manager6/dc/Guests.js:42
#: pve-manager/www/manager6/dc/Guests.js:87
@@ -11696,39 +11469,33 @@ msgid "S.Port"
msgstr "Port źródłowy"
#: proxmox-backup/www/window/DataStoreEdit.js:64
-#, fuzzy
msgid "S3 (tech preview)"
-msgstr "Podgląd synchronizacji"
+msgstr "S3 (podgląd technologii)"
#: proxmox-backup/www/window/S3ClientEdit.js:10
-#, fuzzy
msgid "S3 Endpoint"
-msgstr "Nazwa odbiorcy"
+msgstr "Pojemnik S3"
#: proxmox-backup/www/config/S3ClientView.js:108
#: proxmox-backup/www/form/S3ClientSelector.js:19
#: proxmox-backup/www/window/DataStoreEdit.js:127
#: proxmox-backup/www/window/S3ClientEdit.js:35
-#, fuzzy
msgid "S3 Endpoint ID"
-msgstr "Nazwa odbiorcy"
+msgstr "ID pojemnika S3"
#: proxmox-backup/www/NavigationTree.js:60
#: proxmox-backup/www/config/S3ClientView.js:15
-#, fuzzy
msgid "S3 Endpoints"
-msgstr "Nazwa odbiorcy"
+msgstr "Pojemniki S3"
#: proxmox-backup/www/Utils.js:451
#: proxmox-backup/www/window/MaintenanceOptions.js:99
-#, fuzzy
msgid "S3 Refresh"
-msgstr "Odśwież"
+msgstr "Odświeżanie S3"
#: proxmox-backup/www/Utils.js:850
-#, fuzzy
msgid "S3 refresh"
-msgstr "Odśwież"
+msgstr "Odświeżanie S3"
#: pve-manager/www/manager6/qemu/HDEdit.js:204
#: pve-manager/www/manager6/qemu/HardwareView.js:194
@@ -11848,9 +11615,8 @@ msgid "Scan"
msgstr "Skanowanie"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_info.rs:342
-#, fuzzy
msgid "Scan OK"
-msgstr "Skanowanie"
+msgstr "Skanowanie OK"
#: proxmox-widget-toolkit/src/window/AddTotp.js:254
#: proxmox-yew-comp/src/tfa/tfa_add_totp.rs:136
@@ -11914,9 +11680,8 @@ msgstr "Zaplanowana weryfikacja"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:157
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:181
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:201
-#, fuzzy
msgid "Schema default: {0}"
-msgstr "Plan wykonywania na '{0}'"
+msgstr "Domyślnie: {0}"
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:262
#: pve-manager/www/manager6/dc/RealmSyncJob.js:333
@@ -11940,9 +11705,8 @@ msgid "Score"
msgstr "Punktacja"
#: pmg-yew-quarantine-gui/src/spam_list.rs:227
-#, fuzzy
msgid "Score: {0}"
-msgstr "Tryb: {0}"
+msgstr "Punkty: {0}"
#: pve-manager/www/manager6/ceph/OSD.js:967
msgid "Scrub"
@@ -11968,7 +11732,7 @@ msgstr "Szukaj"
#: proxmox-datacenter-manager/ui/src/widget/search_box.rs:123
msgid "Search (Ctrl+Space / Ctrl+Shift+F)"
-msgstr ""
+msgstr "Szukaj (Ctrl+Spacja / Ctrl+Shift+F)"
#: proxmox-widget-toolkit/src/node/DNSEdit.js:19
#: proxmox-widget-toolkit/src/node/DNSView.js:30
@@ -12011,9 +11775,8 @@ msgid "Secret Length"
msgstr "Długość sekretu"
#: proxmox-widget-toolkit/src/panel/WebhookEditPanel.js:92
-#, fuzzy
msgid "Secrets"
-msgstr "Sekret"
+msgstr "Sekrety"
#: pve-manager/www/manager6/sdn/ipams/PhpIpamEdit.js:47
msgid "Section"
@@ -12029,18 +11792,16 @@ msgid "Security Group"
msgstr "Grupy bezpieczeństwa"
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:192
-#, fuzzy
msgid "Select Date"
-msgstr "Dysk maszyny"
+msgstr "Wybierz datę"
#: pve-manager/www/manager6/window/UploadToStorage.js:200
msgid "Select File"
msgstr "Wybierz plik"
#: pve-manager/www/manager6/qemu/HDEdit.js:276
-#, fuzzy
msgid "Select Image"
-msgstr "Dysk maszyny"
+msgstr "Wybierz obraz"
#: proxmox-backup/www/tape/window/TapeRestore.js:316
msgid "Select Media-Set to restore"
@@ -12065,9 +11826,8 @@ msgid "Selected \"{0}\""
msgstr "Wybrano \"{0}\""
#: pve-manager/www/manager6/qemu/HDEdit.js:248
-#, fuzzy
msgid "Selected Image"
-msgstr "Wybrana poczta"
+msgstr "Wybrany obraz"
#: pmg-gui/js/AttachmentQuarantine.js:100 pmg-gui/js/SpamQuarantine.js:205
#: pmg-gui/js/VirusQuarantine.js:108
@@ -12107,9 +11867,8 @@ msgid "Send daily admin reports"
msgstr "Wysyłaj codzienne raporty"
#: pve-manager/www/manager6/dc/BackupJobDetail.js:223
-#, fuzzy
msgid "Send email on failure"
-msgstr "Wyślij e-mail do"
+msgstr "Wyślij e-mail w razie błędów"
#: pve-manager/www/manager6/window/Backup.js:34
msgid "Send email to"
@@ -12164,7 +11923,7 @@ msgstr "Interfejs szeregowy '{0}' nie jest prawidłowo skonfigurowany"
#: pve-manager/www/manager6/window/GuestImport.js:1015
msgid "Serial socket '{0}' will be mapped to a socket"
-msgstr ""
+msgstr "Port szeregowy '{0}' zostanie zmapowany do portu"
#: pve-manager/www/manager6/Utils.js:610 pve-manager/www/manager6/Utils.js:611
#: pve-manager/www/manager6/Utils.js:612 pve-manager/www/manager6/Utils.js:613
@@ -12209,7 +11968,6 @@ msgstr "ID serwera"
#: pve-manager/www/manager6/node/Summary.js:172
#: proxmox-datacenter-manager/ui/src/pve/node.rs:151
-#, fuzzy
msgid "Server Load"
msgstr "Obciążenie serwera"
@@ -12259,9 +12017,8 @@ msgid "Service"
msgstr "Usługa"
#: proxmox-widget-toolkit/src/node/ServiceView.js:120
-#, fuzzy
msgid "Service System Log"
-msgstr "System"
+msgstr "Logi usługi"
#: pve-manager/www/manager6/sdn/zones/QinQEdit.js:36
msgid "Service VLAN"
@@ -12307,10 +12064,9 @@ msgstr "Ustaw stan"
#: proxmox-widget-toolkit/src/window/AuthEditSimple.js:25
#: pmg-gui/js/AuthEditOIDC.js:98
msgid "Set realm as default for login"
-msgstr ""
+msgstr "Ustaw domenę jako domyślną przy logowaniu."
#: proxmox-yew-comp/src/utils.rs:225
-#, fuzzy
msgid "Setrvice"
msgstr "Usługa"
@@ -12365,14 +12121,12 @@ msgid "Shell"
msgstr "Konsola"
#: proxmox-yew-comp/src/utils.rs:219
-#, fuzzy
msgid "Shell (Spice)"
-msgstr "Shell"
+msgstr "Konsola (SPICE)"
#: proxmox-yew-comp/src/utils.rs:220
-#, fuzzy
msgid "Shell (VNC)"
-msgstr "Shell"
+msgstr "Konsola (VNC)"
#: pmg-gui/js/SpamQuarantineOptions.js:15
msgid "Short"
@@ -12398,9 +12152,8 @@ msgid "Show Configuration"
msgstr "Pokaż konfigurację"
#: proxmox-backup/www/datastore/Summary.js:243
-#, fuzzy
msgid "Show Connection Information"
-msgstr "Zaproszenie do klastra"
+msgstr "Informacje o połączeniu"
#: pmg-gui/js/LDAPConfig.js:466
msgid "Show E-Mail addresses"
@@ -12411,9 +12164,8 @@ msgid "Show Fingerprint"
msgstr "Pokaż odcisk"
#: proxmox-datacenter-manager/ui/src/top_nav_bar.rs:198
-#, fuzzy
msgid "Show Local Tasks"
-msgstr "Pokaż wszystkie zadania"
+msgstr "Pokaż lokalne zadania"
#: proxmox-backup/www/config/GCView.js:156
#: proxmox-backup/www/config/PruneView.js:183
@@ -12424,9 +12176,8 @@ msgid "Show Log"
msgstr "Pokaż log"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:492
-#, fuzzy
msgid "Show Password"
-msgstr "Hasło użytkownika"
+msgstr "Pokaż hasło"
#: pve-manager/www/manager6/dc/TokenView.js:109
#: proxmox-backup/www/config/TokenView.js:225
@@ -12436,9 +12187,8 @@ msgid "Show Permissions"
msgstr "Pokaż uprawnienia"
#: proxmox-datacenter-manager/ui/src/top_nav_bar.rs:203
-#, fuzzy
msgid "Show Remote Tasks"
-msgstr "Pokaż wszystkie zadania"
+msgstr "Pokaż zdalne zadania"
#: proxmox-widget-toolkit/src/panel/DiskList.js:393
msgid "Show S.M.A.R.T. values"
@@ -12461,7 +12211,7 @@ msgstr ""
#: proxmox-widget-toolkit/src/node/ServiceView.js:47
msgid "Show only installed services"
-msgstr ""
+msgstr "Pokaż tylko zainstalowane usługi"
#: pmg-gui/js/ServerStatus.js:74 pmg-gui/js/ServerStatus.js:76
#: pve-manager/www/manager6/Utils.js:2093
@@ -12542,9 +12292,8 @@ msgid "Signed/Offline"
msgstr "Podpisane/ręcznie"
#: pmg-gui/js/DKIMSettings.js:194
-#, fuzzy
msgid "Signing Domain Source"
-msgstr "Podpisz domenę"
+msgstr "Źródło podpisu domeny"
#: pve-manager/www/manager6/window/ScheduleSimulator.js:108
msgid "Simulate"
@@ -12597,9 +12346,8 @@ msgid "Size Increment"
msgstr "Powiększ rozmiar o"
#: pve-manager/www/manager6/storage/ESXIEdit.js:82
-#, fuzzy
msgid "Skip Certificate Verification"
-msgstr "Ostatnia weryfikacja"
+msgstr "Pomijaj weryfikację certyfikatu"
#: proxmox-backup/www/config/VerifyView.js:233
#: proxmox-backup/www/window/VerifyAll.js:50
@@ -12619,9 +12367,8 @@ msgid "Slaves"
msgstr "Interfejsy podrzędne"
#: pve-manager/www/manager6/window/GuestImport.js:819
-#, fuzzy
msgid "Slot"
-msgstr "Kieszenie"
+msgstr "Kieszeń"
#: proxmox-backup/www/tape/ChangerStatus.js:729
msgid "Slots"
@@ -12663,9 +12410,8 @@ msgid "Snapshots"
msgstr "Migawki"
#: pve-manager/www/manager6/storage/Base.js:97
-#, fuzzy
msgid "Snapshots as Volume-Chain are a technology preview."
-msgstr "nie znaleziono migawek"
+msgstr "Migawki w postaci łańcucha woluminów aą podglądem technologii."
#: pve-manager/www/manager6/Utils.js:698
#: pve-manager/www/manager6/storage/Browser.js:125
@@ -12731,13 +12477,12 @@ msgid "Source Slot"
msgstr "Kieszeń źródłowa"
#: pve-manager/www/manager6/window/GuestImport.js:600
-#, fuzzy
msgid "Source Storage"
-msgstr "Zmień magazyn"
+msgstr "Magazyn źródłowy"
#: pmg-gui/js/AuthEditOIDC.js:193
msgid "Source for Role Assignment"
-msgstr ""
+msgstr "Źródło przypisywania ról"
#: pve-manager/www/manager6/window/Migrate.js:576
msgid "Source node"
@@ -12897,13 +12642,11 @@ msgid "Start at boot"
msgstr "Uruchom przy starcie"
#: pve-yew-mobile-gui/src/widgets/guest_backup_panel.rs:104
-#, fuzzy
msgid "Start backup now"
msgstr "Utwórz kopię"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:86
#: pve-yew-mobile-gui/src/pages/page_lxc_status/config_panel.rs:86
-#, fuzzy
msgid "Start on boot"
msgstr "Uruchom przy starcie"
@@ -12932,13 +12675,13 @@ msgstr "Kolejność włączania/zatrzymywania"
#: pve-manager/www/manager6/window/GuestImport.js:339
msgid "Starts a VM and imports the disks in the background"
-msgstr ""
+msgstr "Uruchamia VM i wykonuje import dysków w tle"
#: pve-manager/www/manager6/window/GuestImport.js:341
msgid ""
"Starts a previously stopped VM on Proxmox VE and imports the disks in the "
"background."
-msgstr ""
+msgstr "Uruchamia zatrzymany VM na Proxmox VE i wykonuje import dysków w tle."
#: proxmox-backup/www/dashboard/RunningTasks.js:78
msgid "Starttime"
@@ -13061,9 +12804,8 @@ msgid "Status (No Tape loaded)"
msgstr "Stan (nie wsunięto taśmy)"
#: pve-manager/www/manager6/tree/ResourceTree.js:161
-#, fuzzy
msgid "Status: {0}"
-msgstr "Stan"
+msgstr "Stan: {0}"
#: proxmox-widget-toolkit/src/Utils.js:755
#: proxmox-widget-toolkit/src/node/ServiceView.js:110
@@ -13148,12 +12890,11 @@ msgstr "Nośniki i dyski"
#: pve-manager/www/manager6/window/Backup.js:274
msgid "Storage Retention Configuration"
-msgstr "Konfiguracja retencji magazynu"
+msgstr "Ustawienia retencji magazynu"
#: pve-yew-mobile-gui/src/widgets/mod.rs:87
-#, fuzzy
msgid "Storage size/usage unknown"
-msgstr "Użycie magazynów danych"
+msgstr "Użycie/rozmiar magazynu nieznane"
#: proxmox-backup/www/datastore/Summary.js:341
msgid "Storage usage"
@@ -13172,20 +12913,19 @@ msgid ""
"Storage(s) ({0}) not available on selected target. Start VM to use live "
"storage migration or select other target node."
msgstr ""
+"Magazyn(y) ({0}) niedostępny(-e) na wybranym węźle. Uruchom VM aby rozpocząć "
+"migrację lub wybierz inny węzeł docelowy."
#: pve-manager/www/manager6/ha/rules/NodeAffinityRuleEdit.js:129
#: pve-manager/www/manager6/ha/rules/NodeAffinityRules.js:18
-#, fuzzy
msgid "Strict"
-msgstr "Brak ograniczeń"
+msgstr "Ścisłe"
#: pve-manager/www/manager6/qemu/PCIEdit.js:332
-#, fuzzy
msgid "Sub-Device ID"
msgstr "Sub-Device"
#: pve-manager/www/manager6/qemu/PCIEdit.js:323
-#, fuzzy
msgid "Sub-Vendor ID"
msgstr "Sub-Vendor"
@@ -13220,7 +12960,7 @@ msgstr "Temat, nadawca"
#: proxmox-yew-widget-toolkit/src/widget/form/submit_button.rs:162
msgid "Submit"
-msgstr ""
+msgstr "Wyślij"
#: pve-manager/www/manager6/sdn/SubnetEdit.js:26
#: pve-manager/www/manager6/sdn/SubnetEdit.js:241
@@ -13256,21 +12996,21 @@ msgstr "Klucz subskrypcji"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:141
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:175
-#, fuzzy
msgid "Subscription Status"
-msgstr "Subskrypcje"
+msgstr "Stan subskrypcji"
#: proxmox-yew-comp/src/subscription_info.rs:24
msgid "Subscription got (recently) suspended"
-msgstr ""
+msgstr "Subskrypcja została (niedawno) zawieszona"
#: proxmox-yew-comp/src/subscription_info.rs:23
msgid "Subscription set but expired for this server."
-msgstr ""
+msgstr "Subskrypcja została ustawiona, ale wygasła dla tego serwera."
#: proxmox-yew-comp/src/subscription_info.rs:22
msgid "Subscription set but invalid for this server."
msgstr ""
+"Subskrypcja została ustawiona, ale jest nieprawidłowa dla tego serwera."
#: pve-manager/www/manager6/dc/Summary.js:56
msgid "Subscriptions"
@@ -13392,11 +13132,11 @@ msgstr "Zadanie synchronizacji"
#: proxmox-backup/www/window/SyncJobEdit.js:12
#: proxmox-backup/www/window/SyncJobEdit.js:49
msgid "Sync Job - Pull Direction"
-msgstr ""
+msgstr "Synchronizacja - pobieranie"
#: proxmox-backup/www/window/SyncJobEdit.js:35
msgid "Sync Job - Push Direction"
-msgstr ""
+msgstr "Synchronizacja - wysyłanie"
#: proxmox-backup/www/config/SyncView.js:43
#: proxmox-backup/www/window/NotifyOptions.js:132
@@ -13424,17 +13164,16 @@ msgid "Sync Schedule"
msgstr "Plan synchronizacji"
#: proxmox-backup/www/Utils.js:480
-#, fuzzy
msgid "Sync job"
msgstr "Zadanie synchronizacji"
#: proxmox-backup/www/window/SyncJobEdit.js:473
msgid "Sync only encrypted backup snapshots, exclude others."
-msgstr ""
+msgstr "Synchronizuj tylko zaszyfrowane migawki, pomijaj pozostałe."
#: proxmox-backup/www/window/SyncJobEdit.js:486
msgid "Sync only verified backup snapshots, exclude others."
-msgstr ""
+msgstr "Synchronizuj tylko zweryfikowane migawki, pomijaj pozostałe."
#: pmg-gui/js/LDAPConfig.js:569
msgid "Synchronize"
@@ -13465,9 +13204,8 @@ msgid "System Configuration"
msgstr "Konfiguracja systemu"
#: pve-manager/www/manager6/node/Config.js:250
-#, fuzzy
msgid "System Log"
-msgstr "System"
+msgstr "Logi"
#: pmg-gui/js/Subscription.js:52 pmg-gui/js/Subscription.js:189
#: pve-manager/www/manager6/node/Subscription.js:57
@@ -13499,9 +13237,8 @@ msgid "TFA Lock"
msgstr "Blokada TFA"
#: proxmox-yew-comp/src/tfa/tfa_confirm_remove.rs:97
-#, fuzzy
msgid "TFA Removal"
-msgstr "Potwierdź usunięcie TFA"
+msgstr "Usunięcie TFA"
#: proxmox-widget-toolkit/src/panel/TfaView.js:232
#: proxmox-yew-comp/src/tfa/tfa_view.rs:387
@@ -13588,14 +13325,13 @@ msgid "Tag Style Override"
msgstr "Style tagów"
#: pve-manager/www/manager6/form/ViewSelector.js:39
-#, fuzzy
msgid "Tag View"
-msgstr "Widok magazynów danych"
+msgstr "Tagi"
#: pve-manager/www/manager6/form/ListField.js:59
#: pve-manager/www/manager6/form/TagColorGrid.js:165
msgid "Tag must not be empty."
-msgstr "Tag nie może być pusty"
+msgstr "Tag nie może być pusty."
#: pve-manager/www/manager6/data/ResourceStore.js:316
#: pve-manager/www/manager6/form/TagFieldSet.js:6
@@ -13662,13 +13398,12 @@ msgid "Tape Written"
msgstr "Taśma zapisana"
#: proxmox-backup/www/Utils.js:481
-#, fuzzy
msgid "Tape backup notifications"
-msgstr "Wysyłanie powiadomień"
+msgstr "Powiadomienia o kopii na taśmie"
#: proxmox-backup/www/Utils.js:482
msgid "Tape loading request"
-msgstr ""
+msgstr "Żądanie załadowania taśmy"
#: proxmox-backup/www/tape/BackupOverview.js:373
msgid "Tapes"
@@ -13693,9 +13428,8 @@ msgid "Target Datastore"
msgstr "Magazyn docelowy"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:384
-#, fuzzy
msgid "Target Endpoint"
-msgstr "Nazwa odbiorcy"
+msgstr "Docelowy pojemnik"
#: pve-manager/www/manager6/qemu/HDEdit.js:645
#: pve-manager/www/manager6/window/GuestDiskReassign.js:138
@@ -13714,14 +13448,12 @@ msgid "Target Namespace"
msgstr "Docelowa przestrzeń nazw"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:472
-#, fuzzy
msgid "Target Network"
-msgstr "Zaufane sieci"
+msgstr "Docelowa sieć"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:373
-#, fuzzy
msgid "Target Node"
-msgstr "Węzeł docelowy"
+msgstr "Docelowy węzeł"
#: pve-manager/www/manager6/ceph/Pool.js:189
#: pve-manager/www/manager6/ceph/Pool.js:222
@@ -13731,9 +13463,8 @@ msgstr "Docelowy współczynnik"
#: proxmox-backup/www/window/SyncJobEdit.js:37
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:357
-#, fuzzy
msgid "Target Remote"
-msgstr "Nazwa odbiorcy"
+msgstr "Docelowa maszyna"
#: proxmox-backup/www/config/MetricServerView.js:73
msgid "Target Server"
@@ -13752,9 +13483,8 @@ msgid "Target Storage"
msgstr "Magazyn docelowy"
#: proxmox-datacenter-manager/ui/src/widget/migrate_window.rs:436
-#, fuzzy
msgid "Target VMID"
-msgstr "Cel"
+msgstr "Docelowy VMID"
#: pve-manager/www/manager6/storage/ZFSEdit.js:82
msgid "Target group"
@@ -13797,9 +13527,8 @@ msgid "Task ID"
msgstr "ID zadania"
#: pve-yew-mobile-gui/src/widgets/task_list_button.rs:173
-#, fuzzy
msgid "Task List"
-msgstr "Historia zdarzeń"
+msgstr "Lista zadań"
#: proxmox-widget-toolkit/src/node/Tasks.js:352
msgid "Task Result"
@@ -13817,9 +13546,8 @@ msgid "Task Type"
msgstr "Typ zadania"
#: proxmox-yew-comp/src/task_viewer.rs:171
-#, fuzzy
msgid "Task Viewer"
-msgstr "Widok magazynów danych"
+msgstr "Zadania"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:125
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:131
@@ -13851,9 +13579,8 @@ msgid "Templates"
msgstr "Szablony"
#: proxmox-yew-comp/src/acme/acme_register_account.rs:128
-#, fuzzy
msgid "Terms Of Service"
-msgstr "Warunki świadczenia usług"
+msgstr "Warunki świadczenia usługi"
#: proxmox-widget-toolkit/src/window/ACMEAccount.js:177
#: proxmox-yew-comp/src/acme/acme_accounts.rs:234
@@ -13884,11 +13611,11 @@ msgstr "Zamiana tekstu"
#: pve-manager/www/manager6/ha/RuleErrorsModal.js:17
msgid "The HA rule has no errors."
-msgstr ""
+msgstr "Reguła HA nie ma błędów."
#: pve-manager/www/manager6/ha/RuleErrorsModal.js:29
msgid "The HA rule has the following errors:"
-msgstr ""
+msgstr "Reguła HA zawiera następujące błędy:"
#: pve-manager/www/manager6/ceph/Pool.js:215
msgid ""
@@ -13931,13 +13658,14 @@ msgid ""
"The node-specific 'vzdump.conf' or, if this is not set, the default from the "
"config schema is used to determine fallback values."
msgstr ""
+"Wartości domyślne są pobierane z pliku 'vzdump.conf' lub, jeśli tam nie są "
+"zdefiniowane, ze schematu konfiguracji."
#: pve-manager/www/manager6/dc/Backup.js:405
msgid "The notes are added to each backup created by this job."
msgstr "Do każdej kopii wykonanej przez to zadanie będzie dołączona notatka."
#: proxmox-widget-toolkit/src/panel/EmailRecipientPanel.js:43
-#, fuzzy
msgid "The notification will be sent to the user's configured mail address"
msgstr "Powiadomienia zostaną wysłane na podany adres odbiorcy"
@@ -13959,6 +13687,9 @@ msgid ""
"we are not aware of any major issues, there may be some bugs and the "
"Enterprise Repository is not yet available."
msgstr ""
+"Wybrana wersja jest obecnie uznawana za podgląd technologii. Choć nie "
+"znaleźliśmy w niej żadnych poważnych problemów, nadal może zawierać błędy i "
+"repozytorium komercyjne nie jest jeszcze dostępne."
#: proxmox-widget-toolkit/src/node/APTRepositories.js:306
#: proxmox-yew-comp/src/apt_repositories.rs:895
@@ -14007,14 +13738,12 @@ msgid "Theme"
msgstr "Motyw"
#: proxmox-yew-comp/src/theme_dialog.rs:57
-#, fuzzy
msgid "Theme mode"
-msgstr "Motyw"
+msgstr "Tryb motywu"
#: proxmox-yew-comp/src/theme_dialog.rs:53
-#, fuzzy
msgid "Theme name"
-msgstr "Nazwa klucza"
+msgstr "Nazwa motywu"
#: pve-manager/www/manager6/storage/LvmThinEdit.js:167
msgid "Thin Pool"
@@ -14036,7 +13765,7 @@ msgstr "To nie jest prawidłowa nazwa serwera"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:124
msgid "This option depends on your display type."
-msgstr ""
+msgstr "Ta opcja zależy od typu wyświetlania."
#: pve-manager/www/manager6/grid/BackupView.js:208
#: pve-manager/www/manager6/lxc/Resources.js:252
@@ -14066,7 +13795,7 @@ msgstr "Identyfikator {0} jest już używany"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:181
msgid "Threads used for zstd compression (non-PBS)."
-msgstr ""
+msgstr "Wątki używane do kompresji ZSTD (poza PBS)."
#: proxmox-widget-toolkit/src/window/DiskSmart.js:54
msgid "Threshold"
@@ -14104,7 +13833,7 @@ msgstr "Początek"
#: pve-manager/www/manager6/form/TFASelector.js:100
msgid "Time Step"
-msgstr "Krok czasowy"
+msgstr "Odstęp czasowy"
#: proxmox-widget-toolkit/src/window/AddTotp.js:201
msgid "Time period"
@@ -14169,9 +13898,8 @@ msgstr ""
"sprzętowych."
#: pmg-yew-quarantine-gui/src/page_spam_list.rs:87
-#, fuzzy
msgid "To:"
-msgstr "Do"
+msgstr "Do:"
#: pmg-gui/js/AttachmentQuarantine.js:116 pmg-gui/js/SpamQuarantine.js:226
#: pmg-gui/js/VirusQuarantine.js:129
@@ -14218,7 +13946,7 @@ msgstr "Za długie, polecamy użyć zestawy IP."
#: pve-manager/www/manager6/window/GuestImport.js:179
msgid "Too many disks, could not map to SATA."
-msgstr ""
+msgstr "Zbyt wiele dysków, nie można zmapować do SATA."
#: pmg-gui/js/Dashboard.js:454
msgid "Top Receivers"
@@ -14255,9 +13983,8 @@ msgid "Total Mails"
msgstr "Razem"
#: proxmox-datacenter-manager/ui/src/pve/node.rs:153
-#, fuzzy
msgid "Total Memory"
-msgstr "Razem rdzeni"
+msgstr "Całkowita pamięć"
#: pve-manager/www/manager6/data/ResourceStore.js:226
msgid "Total NetIn"
@@ -14305,9 +14032,8 @@ msgid "Transfer Rate (bytes/second)"
msgstr "Prędkość transferu (bajtów/sekundę)"
#: proxmox-yew-widget-toolkit/src/widget/language_selector.rs:188
-#, fuzzy
msgid "Translated"
-msgstr "Transfer"
+msgstr "Przetłumaczone"
#: pmg-gui/js/Transport.js:154
msgid "Transport"
@@ -14436,9 +14162,8 @@ msgid "U2F Settings"
msgstr "Ustawienia U2F"
#: pve-manager/www/manager6/dc/OptionView.js:244
-#, fuzzy
msgid "U2F is deprecated, use WebAuthn"
-msgstr "{0} jest przestarzałe, użyj {1}"
+msgstr "U2F jest przestarzałe, użyj WebAuthn"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:257
#: proxmox-yew-comp/src/apt_repositories.rs:772
@@ -14472,24 +14197,22 @@ msgstr "ukraiński"
#: proxmox-yew-comp/src/configuration/network_view.rs:176
msgid "Unable to apply changes"
-msgstr ""
+msgstr "Nie udało się zastosować zmian"
#: proxmox-datacenter-manager/ui/src/remotes/config.rs:157
#: proxmox-yew-comp/src/auth_view.rs:137
#: proxmox-yew-comp/src/configuration/network_view.rs:150
#: proxmox-yew-comp/src/tfa/tfa_view.rs:225
msgid "Unable to delete item"
-msgstr ""
+msgstr "Nie udało się usunąć elementu"
#: proxmox-yew-comp/src/user_panel.rs:155
-#, fuzzy
msgid "Unable to delete user"
-msgstr "Nowi użytkownicy"
+msgstr "Nie udało się usunąć użytkownika"
#: proxmox-yew-comp/src/subscription_info.rs:27
-#, fuzzy
msgid "Unable to get the subscription status (API problems)."
-msgstr "Nie udało się ustalić stanu subskrypcji"
+msgstr "Nie udało się ustalić stanu subskrypcji (problemy z API)"
#: pve-manager/www/manager6/dc/Support.js:67
msgid "Unable to load subscription status"
@@ -14501,7 +14224,7 @@ msgstr "Nie udało się rozpoznać konfiguracji sieci"
#: proxmox-yew-comp/src/configuration/network_view.rs:165
msgid "Unable to revert changes"
-msgstr ""
+msgstr "Nie udało się cofnąć zmian"
#: proxmox-widget-toolkit/src/panel/GotifyEditPanel.js:39
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:40
@@ -14527,9 +14250,8 @@ msgid "Unique"
msgstr "Unikalne"
#: pve-manager/www/manager6/window/GuestImport.js:943
-#, fuzzy
msgid "Unique MAC addresses"
-msgstr "Adres MAC"
+msgstr "Unikalny adres MAC"
#: proxmox-widget-toolkit/src/window/TaskViewer.js:166
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:153
@@ -14575,14 +14297,12 @@ msgstr "Nieznany błąd"
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:69
#: proxmox-datacenter-manager/ui/src/dashboard/subscription_info.rs:82
-#, fuzzy
msgid "Unknown subscriptions"
-msgstr "Brak subskrypcji"
+msgstr "Nieznane subskrypcje"
#: pve-manager/www/manager6/window/GuestImport.js:1032
-#, fuzzy
msgid "Unknown warning"
-msgstr "Nieznany błąd"
+msgstr "Nieznane ostrzeżenie"
#: proxmox-backup/www/window/SyncJobEdit.js:219
#: proxmox-backup/www/window/SyncJobEdit.js:228
@@ -14600,9 +14320,8 @@ msgid "Unload Media"
msgstr "Wysuń nośnik"
#: proxmox-backup/www/Utils.js:740
-#, fuzzy
msgid "Unloading"
-msgstr "Wysuń"
+msgstr "Wysuwanie"
#: pmg-gui/js/UserView.js:161 pve-manager/www/manager6/dc/UserView.js:107
#: proxmox-backup/www/config/UserView.js:202
@@ -14622,22 +14341,19 @@ msgid "Unmount"
msgstr "Odmontuj"
#: proxmox-backup/www/Utils.js:460
-#, fuzzy
msgid "Unmount Device"
-msgstr "Urządzenie USB"
+msgstr "Odmontuj urządzenie"
#: proxmox-backup/www/Utils.js:847
#: proxmox-backup/www/window/MaintenanceOptions.js:96
-#, fuzzy
msgid "Unmounting"
-msgstr "Odmontuj"
+msgstr "Odmontowanie"
#: pve-manager/www/manager6/form/USBSelector.js:185
msgid "Unplugged"
msgstr "Odłączone"
#: pve-yew-mobile-gui/src/pages/page_lxc_status/config_panel.rs:142
-#, fuzzy
msgid "Unpriviledged"
msgstr "nieuprzywilejowany"
@@ -14660,9 +14376,8 @@ msgstr "Do"
#. second row
#: proxmox-yew-comp/src/tasks.rs:411
-#, fuzzy
msgid "Until:"
-msgstr "Do"
+msgstr "Do:"
#: pve-manager/www/manager6/window/GuestDiskReassign.js:205
msgid "Unused"
@@ -14715,23 +14430,23 @@ msgstr "Aktualizacje"
#: proxmox-backup/www/Utils.js:750
msgid "Updating Microcode"
-msgstr ""
+msgstr "Aktualizacja mikrokodu"
#: pmg-gui/js/ServerAdministration.js:45
#: pve-manager/www/manager6/node/Config.js:270
#: proxmox-backup/www/ServerAdministration.js:48
#: proxmox-yew-comp/src/apt_package_manager.rs:200
msgid "Upgrade"
-msgstr "Aktualizuj"
+msgstr "Zainstaluj"
#: pve-manager/www/manager6/qemu/CloudInit.js:273
#: pve-manager/www/manager6/qemu/CloudInit.js:285
msgid "Upgrade packages"
-msgstr "Aktualizuj pakiety"
+msgstr "Zainstaluj pakiety"
#: pve-manager/www/manager6/qemu/CloudInit.js:279
msgid "Upgrade packages on boot"
-msgstr "Aktualizuj pakiety podczas startu"
+msgstr "Zainstaluj pakiety podczas startu"
#: proxmox-widget-toolkit/src/window/Certificates.js:111
#: pve-manager/www/manager6/node/Certificates.js:157
@@ -14770,6 +14485,8 @@ msgid ""
"Uploads are stored temporarily in '/var/tmp/', make sure there is enough "
"free space."
msgstr ""
+"Pliki są tymczasowo zapisywane w katalogu '/var/tmp/', upewnij się, że jest "
+"tam wystarczająco dużo miejsca."
#: pve-manager/www/manager6/dc/OptionView.js:399
msgid "Upper"
@@ -14812,9 +14529,8 @@ msgstr "Użycie: {0}%"
#: pve-manager/www/manager6/window/GuestImport.js:680
#: pve-manager/www/manager6/window/GuestImport.js:804
#: pve-manager/www/manager6/window/GuestImport.js:874
-#, fuzzy
msgid "Use"
-msgstr "Zajęte"
+msgstr "Użyj"
#: pve-manager/www/manager6/window/Restore.js:214
msgid "Use '0' to disable all bandwidth limits."
@@ -14826,7 +14542,7 @@ msgstr "Zastosuj filtr bayesowski"
#: pve-manager/www/manager6/qemu/CDEdit.js:78
msgid "Use CD/DVD disc image file (iso)"
-msgstr "Użyj pliku obrazu dysku CD/DVD (iso)"
+msgstr "Użyj pliku obrazu dysku CD/DVD (ISO)"
#: pve-manager/www/manager6/dc/OptionView.js:207
msgid "Use CRS to select the least loaded node when starting an HA service"
@@ -14862,7 +14578,7 @@ msgstr "Użyj wirtualnej puli Ceph zarządzanej przez Proxmox VE"
#: pve-manager/www/manager6/storage/CephFSEdit.js:131
msgid "Use Proxmox VE managed hyper-converged cephFS"
-msgstr "Użyj wirtualnego systemu plików CephFS zarządzanego przez Proxmox VE"
+msgstr "Użyj systemu plików CephFS zarządzanego przez Proxmox VE"
#: pmg-gui/js/SpamDetectorOptions.js:18
msgid "Use RBL checks"
@@ -14903,32 +14619,28 @@ msgid "Use auto-whitelists"
msgstr "Użyj automatycznej białej listy"
#: proxmox-datacenter-manager/ui/src/remotes/wizard_page_info.rs:293
-#, fuzzy
msgid "Use existing Token"
-msgstr "Usuń magazyn"
+msgstr "Użyj bieżącego klucza"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:117
msgid "Use first endpoint."
-msgstr ""
+msgstr "Użyj pierwszego pojemnika."
#: pve-manager/www/manager6/dc/BackupJobDetail.js:219
#: pve-manager/www/manager6/panel/BackupNotificationOptions.js:64
#: proxmox-backup/www/tape/window/TapeBackupJob.js:259
#: proxmox-backup/www/window/NotifyOptions.js:91
-#, fuzzy
msgid "Use global notification settings"
-msgstr "Wysyłanie powiadomień"
+msgstr "Użyj globalnej konfiguracji powiadomień"
#: pve-manager/www/manager6/window/Backup.js:43
#: proxmox-backup/www/datastore/OptionView.js:195
#: proxmox-backup/www/tape/window/TapeBackup.js:100
-#, fuzzy
msgid "Use global settings"
-msgstr "użyj ustawień hosta"
+msgstr "Użyj globalnej konfiguracji"
#: pve-yew-mobile-gui/src/pages/page_lxc_status/resources_panel.rs:117
#: pve-yew-mobile-gui/src/pages/page_lxc_status/resources_panel.rs:124
-#, fuzzy
msgid "Use host settings"
msgstr "użyj ustawień hosta"
@@ -14945,7 +14657,7 @@ msgstr "Użyj urządzenia zmapowanego"
#: proxmox-backup/www/window/S3ClientEdit.js:71
msgid "Use path style over vhost style bucket addressing."
-msgstr ""
+msgstr "Używaj adresowania pojemników w postaci ścieżek zamiast vhost."
#: pve-manager/www/manager6/qemu/CDEdit.js:108
msgid "Use physical CD/DVD Drive"
@@ -14953,16 +14665,15 @@ msgstr "Użyj fizycznego napędu CD/DVD"
#: pve-manager/www/manager6/window/Backup.js:44
#: proxmox-backup/www/tape/window/TapeBackup.js:101
-#, fuzzy
msgid "Use sendmail (legacy)"
-msgstr "E-mail (przestarzałe)"
+msgstr "Użyj sendmaila (przestarzałe)"
#: pve-manager/www/manager6/panel/BackupNotificationOptions.js:73
#: proxmox-backup/www/datastore/OptionView.js:197
#: proxmox-backup/www/tape/window/TapeBackupJob.js:268
#: proxmox-backup/www/window/NotifyOptions.js:100
msgid "Use sendmail to send an email (legacy)"
-msgstr ""
+msgstr "Użyj sendmaila do wysyłania e-maili (przestarzałe)"
#: pve-manager/www/manager6/qemu/Options.js:148
#: pve-manager/www/manager6/qemu/Options.js:154
@@ -14974,8 +14685,7 @@ msgstr "Użyj gładzika jako wskaźnik"
msgid ""
"Use the special value '1' to inherit the MTU value from the underlying bridge"
msgstr ""
-"Użyj specjalnej wartości '1' aby dziedziczyć wartość MTU z powiązanego "
-"mostka"
+"Użyj specjalnej wartości '1' aby dziedziczyć wartość MTU z powiązanego mostka"
#: pve-manager/www/manager6/ha/Fencing.js:23
msgid "Use watchdog based fencing."
@@ -15006,9 +14716,8 @@ msgid "Used"
msgstr "Zajęte"
#: proxmox-datacenter-manager/ui/src/pve/node.rs:152
-#, fuzzy
msgid "Used Memory"
-msgstr "Pamięć"
+msgstr "Używana pamięć"
#: pmg-gui/js/RuleInfo.js:313
msgid "Used Objects"
@@ -15146,9 +14855,8 @@ msgid "User/Group/API Token"
msgstr "Użytkownik/grupa/klucz API"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:99
-#, fuzzy
msgid "User/Token"
-msgstr "Użytkownik/grupa/klucz API"
+msgstr "Użytkownik/klucz"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:114
#: pmg-gui/js/FetchmailEdit.js:64 pmg-gui/js/PBSRemoteEdit.js:61
@@ -15165,7 +14873,7 @@ msgstr "Nazwa użytkownika"
#: pve-manager/www/manager6/dc/AuthEditOpenId.js:68
#: proxmox-yew-comp/src/auth_edit_openid.rs:114
msgid "Username Claim"
-msgstr "Typ nazwy użytkownika"
+msgstr "Definicja nazwy użytkownika"
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:267
#: pve-manager/www/manager6/dc/Config.js:95
@@ -15203,15 +14911,15 @@ msgstr "Nazwa VG"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:101
msgid "VID range includes not-a-number: {0}"
-msgstr ""
+msgstr "Zakres VID zawiera błędną liczbę: {0}"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:106
msgid "VID range must go from lower to higher tag: {0}"
-msgstr ""
+msgstr "Zakres VID musi się rozciągać od mniejszego do większego tagu: {0}"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:112
msgid "VID range outside of allowed 2 and 4094 limit: {0}"
-msgstr ""
+msgstr "Zakres VID wykracza poza dozwolony limit od 2 do 4094: {0}"
#: pve-manager/www/manager6/sdn/VnetACLView.js:173
msgid "VLAN"
@@ -15227,7 +14935,6 @@ msgid "VLAN ID"
msgstr "VLAN ID"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:69
-#, fuzzy
msgid "VLAN IDs"
msgstr "VLAN ID"
@@ -15257,16 +14964,14 @@ msgstr "Maszyna wirtualna"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:251
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:251
-#, fuzzy
msgid "VM '{0}'"
-msgstr "Weryfikuj '{0}'"
+msgstr "VM '{0}'"
#: pve-manager/www/manager6/storage/Browser.js:80
msgid "VM Disks"
msgstr "Dyski VM"
#: pve-yew-mobile-gui/src/pages/page_qemu_status/config_panel.rs:186
-#, fuzzy
msgid "VM State Storage"
msgstr "Magazyn stanu VM"
@@ -15285,7 +14990,7 @@ msgstr "format obrazu VMware"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:105
msgid "VNC clipboard requires spice-tools installed in the Guest-VM."
-msgstr ""
+msgstr "Schowek VNC wymaga instalacji spice-tools na maszynie gościa."
#: pve-manager/www/manager6/form/SDNVnetSelector.js:28
#: pve-manager/www/manager6/sdn/VnetEdit.js:123
@@ -15293,9 +14998,8 @@ msgid "VNet"
msgstr "VNet"
#: pve-manager/www/manager6/dc/Config.js:234
-#, fuzzy
msgid "VNet Firewall"
-msgstr "Zapora sieciowa"
+msgstr "Zapora VNet"
#: pve-manager/www/manager6/sdn/zones/EvpnEdit.js:38
msgid "VNet MAC Address"
@@ -15338,9 +15042,8 @@ msgid "Value"
msgstr "Wartość"
#: proxmox-yew-comp/src/safe_confirm_dialog.rs:84
-#, fuzzy
msgid "Value does not match!"
-msgstr "przynajmniej jedna reguła nie pasuje"
+msgstr "Wartość nie pasuje!"
#: pve-manager/www/manager6/ceph/OSDDetails.js:133
msgid "Various information about the OSD"
@@ -15366,9 +15069,8 @@ msgid "Vendor"
msgstr "Producent"
#: pve-manager/www/manager6/qemu/PCIEdit.js:296
-#, fuzzy
msgid "Vendor ID"
-msgstr "Producent"
+msgstr "Vendor ID"
#: pve-manager/www/manager6/dc/PCIMapView.js:87
msgid "Vendor/Device"
@@ -15393,14 +15095,12 @@ msgid "Verification Jobs"
msgstr "Zadania weryfikacji"
#: proxmox-backup/www/Utils.js:483
-#, fuzzy
msgid "Verification job"
msgstr "Zadanie weryfikacji"
#: proxmox-backup/www/window/SyncJobEdit.js:482
-#, fuzzy
msgid "Verified Only"
-msgstr "Weryfikacja"
+msgstr "Tylko zweryfikowane"
#: proxmox-backup/www/dashboard/TaskSummary.js:28
#: proxmox-backup/www/datastore/Content.js:1413
@@ -15458,9 +15158,8 @@ msgid "Verify Receivers"
msgstr "Weryfikuj odbiorców"
#: pve-manager/www/manager6/dc/MetricServerView.js:640
-#, fuzzy
msgid "Verify SSL"
-msgstr "Weryfikacja"
+msgstr "Weryfikacja SSL"
#: pve-manager/www/manager6/grid/BackupView.js:379
#: pve-manager/www/manager6/storage/BackupView.js:216
@@ -15481,7 +15180,7 @@ msgstr "Weryfikuj certyfikaty"
#: pve-manager/www/manager6/dc/AuthEditAD.js:100
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:100
msgid "Verify connection parameters and bind credentials on save"
-msgstr "Zweryfikuj parametry połączenia i logowania podczas zapisu"
+msgstr "Weryfikuj parametry połączenia i logowania podczas zapisu"
#: proxmox-backup/www/datastore/OptionView.js:216
msgid "Verify new backups immediately after completion"
@@ -15514,11 +15213,11 @@ msgstr "Widok"
#: pve-manager/www/manager6/node/Certificates.js:303
#: proxmox-yew-comp/src/acme/certificate_list.rs:144
msgid "View Certificate"
-msgstr "Obejrzyj certyfikat"
+msgstr "Pokaż certyfikat"
#: pmg-gui/js/DKIMSettings.js:212
msgid "View DNS Record"
-msgstr "Obejrzyj wpis w DNS"
+msgstr "Pokaż wpis w DNS"
#: proxmox-widget-toolkit/src/node/Tasks.js:234
#: proxmox-widget-toolkit/src/node/Tasks.js:461
@@ -15526,14 +15225,13 @@ msgstr "Obejrzyj wpis w DNS"
#: proxmox-backup/www/dashboard/LongestTasks.js:103
#: proxmox-backup/www/dashboard/RunningTasks.js:100
#: proxmox-backup/www/dashboard/TaskSummary.js:108
-#, fuzzy
msgid "View Task"
-msgstr "Obejrzyj obrazy"
+msgstr "Pokaż zadanie"
#: pmg-gui/js/SpamQuarantineOptions.js:66
#: pmg-gui/js/VirusQuarantineOptions.js:16
msgid "View images"
-msgstr "Obejrzyj obrazy"
+msgstr "Pokaż obrazy"
#: pve-manager/www/manager6/qemu/HardwareView.js:347
#: pve-manager/www/manager6/qemu/HardwareView.js:797
@@ -15544,11 +15242,11 @@ msgstr "VirtIO RNG"
#: pve-manager/www/manager6/qemu/HardwareView.js:356
#: pve-manager/www/manager6/qemu/HardwareView.js:805
msgid "Virtiofs"
-msgstr ""
+msgstr "Virtiofs"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:97
msgid "Virtiofs Filesystem Passthrough"
-msgstr ""
+msgstr "Bezpośredni dostęp do Virtiofs"
#: proxmox-widget-toolkit/src/Schema.js:98
msgid "Virtual"
@@ -15556,10 +15254,9 @@ msgstr "Wirtualne"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:266
msgid "Virtual Environment Nodes"
-msgstr ""
+msgstr "Węzły PVE"
#: pve-manager/www/manager6/storage/Browser.js:160
-#, fuzzy
msgid "Virtual Guests"
msgstr "Maszyny wirtualne"
@@ -15573,7 +15270,7 @@ msgstr "Maszyny wirtualne"
#: pve-manager/www/manager6/qemu/CreateWizard.js:27
#: pve-manager/www/manager6/tree/ResourceTree.js:30
msgid "Virtual Machine"
-msgstr "Maszyny wirtualne"
+msgstr "Maszyna wirtualna"
#: pve-manager/www/manager6/qemu/Config.js:277
msgid "Virtual Machine {0} on node '{1}'"
@@ -15590,6 +15287,8 @@ msgid ""
"Virtual guest seems to be running on source host. Import might fail or have "
"inconsistent state!"
msgstr ""
+"Wirtualny gość jest uruchomiony na źródłowym hoście. Import może się nie "
+"powieść lub zakończyć nieprawidłowym stanem!"
#: pmg-gui/js/ContactStatistics.js:175 pmg-gui/js/DomainStatistics.js:101
#: pmg-gui/js/DomainStatistics.js:144 pmg-gui/js/ReceiverStatistics.js:175
@@ -15669,7 +15368,7 @@ msgstr "Rozmiar WAL"
#: pve-manager/www/manager6/qemu/SevEdit.js:74
msgid "WARNING: When using SEV-SNP no EFI disk is loaded as pflash."
-msgstr ""
+msgstr "UWAGA: Przy używaniu SEV-SNP dysk EFI nie jest ładowany jako pflash."
#: pve-manager/www/manager6/qemu/ProcessorEdit.js:161
msgid ""
@@ -15703,11 +15402,11 @@ msgstr "Wake-on-LAN"
#: pve-manager/www/manager6/ceph/StatusDetail.js:195
#: proxmox-backup/www/dashboard/TaskSummary.js:168
#: proxmox-yew-comp/src/apt_repositories.rs:876
-#, fuzzy
msgid "Warning"
msgid_plural "Warnings"
msgstr[0] "Uwaga"
-msgstr[1] "Uwaga"
+msgstr[1] "Uwagi"
+msgstr[2] "Uwagi"
#: pve-manager/www/manager6/window/FirewallEnableEdit.js:28
msgid "Warning: Firewall still disabled at datacenter level!"
@@ -15745,13 +15444,12 @@ msgid "We recommend the following safe-keeping strategy:"
msgstr "Zalecamy następujące strategie bezpieczeństwa:"
#: proxmox-widget-toolkit/src/panel/DiskList.js:365
-#, fuzzy
msgid "Wearout"
-msgstr "Zużycie taśmy"
+msgstr "Zużycie"
#: proxmox-datacenter-manager/ui/src/remotes/edit_remote.rs:114
msgid "Web UI URL"
-msgstr ""
+msgstr "Web UI URL"
#: proxmox-widget-toolkit/src/panel/TfaView.js:268 pmg-gui/js/TFAView.js:97
#: proxmox-yew-comp/src/tfa/tfa_view.rs:251
@@ -15777,9 +15475,8 @@ msgid "Webauthn"
msgstr "WebAuthn"
#: proxmox-yew-comp/src/tfa/tfa_add_webauthn.rs:109
-#, fuzzy
msgid "Webauthn Device"
-msgstr "Zarejestruj urządzenie WebAuthn"
+msgstr "Urządzenie WebAuthn"
#: pmg-gui/js/Settings.js:133 pve-manager/www/manager6/window/Settings.js:166
#: proxmox-backup/www/window/Settings.js:133
@@ -15853,9 +15550,8 @@ msgid "Wipe Disk"
msgstr "Wyczyść dysk"
#: pve-manager/www/manager6/storage/LVMEdit.js:242
-#, fuzzy
msgid "Wipe Removed Volumes"
-msgstr "Przenieś dysk"
+msgstr "Wyczyść usunięte dyski"
#: pve-manager/www/manager6/window/SafeDestroyStorage.js:19
msgid "Wipe labels and other left-overs"
@@ -15863,12 +15559,11 @@ msgstr "Wyczyść etykiety i inne pozostałości"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:175
msgid "With 0, half of the available cores are used"
-msgstr ""
+msgstr "Przy wartości 0 zostanie użyta połowa dostępnych rdzeni"
#: proxmox-backup/www/window/DatastoreRepoInfo.js:75
-#, fuzzy
msgid "With Current User"
-msgstr "bieżący użytkownik"
+msgstr "Jako bieżący użytkownik"
#: pmg-gui/js/UserBlackWhiteList.js:273
msgid ""
@@ -15887,27 +15582,24 @@ msgstr ""
"jako spam."
#: pve-manager/www/manager6/storage/Base.js:154
-#, fuzzy
msgid ""
"Without any keep option, the node's vzdump.conf or `keep-all` is used as "
"fallback for backup jobs"
msgstr ""
-"Jeśli nie określono żadnych opcji, używane są ustawienia z plików "
-"vzdump.conf na poszczególnych węzłach lub `keep-all`"
+"Jeśli nie określono żadnych opcji, wartości pobierane są domyślnie z pliku "
+"vzdump.conf dla danego węzła lub jako `keep-all`."
#: pve-manager/www/manager6/dc/Backup.js:366
-#, fuzzy
msgid ""
"Without any keep option, the storage's configuration or node's vzdump.conf "
"is used as fallback"
msgstr ""
-"Jeśli nie określono żadnych opcji, używane są ustawienia magazynu lub "
-"ustawienia z plików vzdump.conf na poszczególnych węzłach"
+"Jeśli nie określono żadnych opcji, wartości pobierane są domyślnie z "
+"ustawień magazynu lub z pliku vzdump.conf dla danego węzła"
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:133
-#, fuzzy
msgid "Worker ID"
-msgstr "ID serwera"
+msgstr "ID zadania"
#: proxmox-widget-toolkit/src/window/DiskSmart.js:60
msgid "Worst"
@@ -15950,11 +15642,11 @@ msgstr "Zapis"
#: proxmox-backup/www/Utils.js:743
msgid "Writing data"
-msgstr ""
+msgstr "Zapisywanie danych"
#: proxmox-backup/www/Utils.js:752
msgid "Writing encrypted data"
-msgstr ""
+msgstr "Zapisywanie zaszyfrowanych danych"
#: pve-manager/www/manager6/window/UploadToStorage.js:221
msgid "Wrong file extension"
@@ -16005,7 +15697,7 @@ msgstr "Jesteś tutaj!"
#: pve-manager/www/manager6/storage/ImageView.js:53
msgid "You can delete the image from the guest's hardware pane"
-msgstr "Możesz usunąć dysk w konfiguracji sprzętu tej maszyny"
+msgstr "Możesz usunąć dysk z konfiguracji sprzętu tej maszyny"
#: pve-manager/www/manager6/storage/PBSEdit.js:377
msgid "You can drag-and-drop a key file here."
@@ -16018,12 +15710,13 @@ msgstr "Możesz używać składni Markdown aby formatować tekst"
#: pve-manager/www/manager6/qemu/DisplayEdit.js:114
msgid "You cannot live-migrate while using the VNC clipboard."
-msgstr ""
+msgstr "Nie można wykonywać migracji podczas korzystania ze schowka VNC."
#: pve-manager/www/manager6/qemu/DisplayEdit.js:102
msgid ""
"You cannot use the default SPICE clipboard if the VNC clipboard is selected."
msgstr ""
+"Nie można używać domyślnego schowka SPICE, jeśli został wybrany schowek VNC."
#: proxmox-widget-toolkit/src/Utils.js:167
#: proxmox-yew-comp/src/subscription_info.rs:36
@@ -16031,6 +15724,8 @@ msgid ""
"You do not have a valid subscription for this server. Please visit {0} to "
"get a list of available options."
msgstr ""
+"Nie masz ważnej subskrypcji na ten serwer. Odwiedź stronę {0}, aby zapoznać "
+"się z dostępnymi opcjami."
#: proxmox-widget-toolkit/src/node/APTRepositories.js:484
#: proxmox-yew-comp/src/apt_repositories.rs:166
@@ -16052,24 +15747,27 @@ msgstr "Przynajmniej jeden węzeł nie posiada subskrypcji."
#: proxmox-yew-widget-toolkit/src/tr.rs:234
msgid "You have one new foo"
msgid_plural "You have {n} new {}s"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "Masz jedno nowe foo"
+msgstr[1] "Masz {n} nowe foo"
+msgstr[2] "Masz {n} nowych foo"
#: proxmox-yew-widget-toolkit/src/tr.rs:254
#: proxmox-yew-widget-toolkit/src/tr.rs:264
msgctxt "context"
msgid "You have one new foo"
msgid_plural "You have {n} new {}s"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "Masz jedno nowe foo"
+msgstr[1] "Masz {n} nowe foo"
+msgstr[2] "Masz {n} nowych foo"
#: proxmox-yew-widget-toolkit/src/tr.rs:198
#: proxmox-yew-widget-toolkit/src/tr.rs:202
#: proxmox-yew-widget-toolkit/src/tr.rs:206
msgid "You have one new message"
msgid_plural "You have {n} new messages"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "Masz jedną nową wiadomość"
+msgstr[1] "Masz {n} nowe wiadomości"
+msgstr[2] "Masz {n} nowych wiadomości"
#: proxmox-yew-widget-toolkit/src/tr.rs:212
#: proxmox-yew-widget-toolkit/src/tr.rs:216
@@ -16077,19 +15775,19 @@ msgstr[1] ""
#: proxmox-yew-widget-toolkit/src/tr.rs:230
#: proxmox-yew-widget-toolkit/src/tr.rs:284
#: proxmox-yew-widget-toolkit/src/tr.rs:288
-#, fuzzy
msgid "You have one new {}"
msgid_plural "You have {n} new {}s"
-msgstr[0] "Jesteś zalogowany jako {0}"
-msgstr[1] "Jesteś zalogowany jako {0}"
+msgstr[0] "Masz jeden nowy {}"
+msgstr[1] "Masz {n} nowe {}"
+msgstr[2] "Masz {n} nowych {}"
#: proxmox-yew-widget-toolkit/src/tr.rs:292
-#, fuzzy
msgctxt "context"
msgid "You have one new {}"
msgid_plural "You have {n} new {}s"
-msgstr[0] "Jesteś zalogowany jako {0}"
-msgstr[1] "Jesteś zalogowany jako {0}"
+msgstr[0] "Masz jeden nowy {}"
+msgstr[1] "Masz {n} nowe {}"
+msgstr[2] "Masz {n} nowych {}"
#: pve-manager/www/manager6/qemu/QemuBiosEdit.js:38
msgid ""
@@ -16101,7 +15799,7 @@ msgstr ""
#: pmg-gui/js/DKIMSettings.js:9
msgid "You need to create a Selector before enabling DKIM Signing"
-msgstr "Musisz utworzyć selektora aby móc włączyć podpisywanie DKIM"
+msgstr "Musisz utworzyć selektor aby móc włączyć podpisywanie DKIM"
#: pve-manager/www/manager6/window/CephInstall.js:39
msgid "You need to create an initial config once."
@@ -16116,9 +15814,8 @@ msgstr ""
"bezpieczeństwa. Zalecamy aktualizację."
#: proxmox-widget-toolkit/src/window/PasswordEdit.js:28
-#, fuzzy
msgid "Your Current Password"
-msgstr "zweryfikuj bieżące hasło"
+msgstr "Twoje bieżące hasło"
#: pmg-gui/js/LoginView.js:185
msgid "Your E-Mail"
@@ -16151,7 +15848,7 @@ msgstr "ZB"
#: pve-manager/www/manager6/node/Summary.js:184
msgid "ZFS ARC"
-msgstr ""
+msgstr "ZFS ARC"
#: pve-manager/www/manager6/storage/ZFSPoolEdit.js:17
#: pve-manager/www/manager6/storage/ZFSPoolEdit.js:71
@@ -16184,9 +15881,8 @@ msgid "Zones"
msgstr "Strefy"
#: pve-manager/www/manager6/panel/BackupAdvancedOptions.js:166
-#, fuzzy
msgid "Zstd Threads"
-msgstr "{0} godzin"
+msgstr "Wątki ZSTD"
#: pve-manager/www/manager6/ceph/Pool.js:159
msgid "a min_size of 1 is not recommended and can lead to data loss"
@@ -16229,21 +15925,21 @@ msgstr "średnio"
#: pve-manager/www/manager6/window/Migrate.js:434
#: pve-manager/www/manager6/window/Migrate.js:521
msgid "blocking HA resource {0} on selected target node"
-msgstr ""
+msgstr "blokowanie zasobu HA {0} na wybranym węźle docelowym"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:49
msgid "cannot represent number as f64"
-msgstr ""
+msgstr "nie można zapisać liczby jako f64"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:103
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:112
msgid "cannot represent number as signed integer"
-msgstr ""
+msgstr "nie można reprezentować liczby jako signed integer"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:179
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:188
msgid "cannot represent number as unsigned integer"
-msgstr ""
+msgstr "nie można reprezentować liczby jako unsigned integer"
#: proxmox-widget-toolkit/src/node/APT.js:35
#: proxmox-yew-comp/src/apt_package_manager.rs:308
@@ -16280,14 +15976,12 @@ msgid "default"
msgstr "domyślnie"
#: proxmox-backup/www/window/S3ClientEdit.js:60
-#, fuzzy
msgid "default (443)"
-msgstr "domyślnie"
+msgstr "domyślnie (443)"
#: proxmox-backup/www/window/S3ClientEdit.js:83
-#, fuzzy
msgid "default (us-west-1)"
-msgstr "domyślnie (zawsze)"
+msgstr "domyślnie (us-west-1)"
#: pve-manager/www/manager6/node/Directory.js:174
#: proxmox-backup/www/DirectoryList.js:96
@@ -16306,12 +16000,11 @@ msgstr "DNS"
#: proxmox-backup/www/window/S3ClientEdit.js:48
msgid "e.g. {{bucket}}.s3.{{region}}.amazonaws.com"
-msgstr ""
+msgstr "np. {{bucket}}.s3.{{region}}.amazonaws.com"
#: proxmox-yew-comp/src/auth_edit_openid.rs:128
-#, fuzzy
msgid "email profile"
-msgstr "Wyślij e-mail do"
+msgstr "profil e-mail"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:49
#: proxmox-yew-comp/src/apt_repositories.rs:652
@@ -16320,7 +16013,7 @@ msgstr "włączone"
#: proxmox-yew-comp/src/tfa/tfa_add_webauthn.rs:147
msgid "failed to parse webauthn registration challenge"
-msgstr ""
+msgstr "nieprawidłowa odpowiedź WebAuthn na żądanie rejestracji"
#: pve-manager/www/manager6/form/BackupCompressionSelector.js:6
msgid "fast"
@@ -16338,43 +16031,42 @@ msgstr "pierwszy dysk"
#: proxmox-yew-widget-toolkit/src/tr.rs:170
#: proxmox-yew-widget-toolkit/src/tr.rs:277
msgid "foo bar"
-msgstr ""
+msgstr "foo bar"
#: proxmox-yew-widget-toolkit/src/gettext_wrapper.rs:208
#: proxmox-yew-widget-toolkit/src/tr.rs:278
msgctxt "context"
msgid "foo bar"
-msgstr ""
+msgstr "foo bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:181
#: proxmox-yew-widget-toolkit/src/tr.rs:182
msgid "foo {{bar}}"
-msgstr ""
+msgstr "foo {{bar}}"
#: proxmox-yew-widget-toolkit/src/tr.rs:172
msgid "foo {}"
-msgstr ""
+msgstr "foo {}"
#: pve-manager/www/manager6/form/BackupCompressionSelector.js:7
msgid "good"
msgstr "dobra"
#: proxmox-yew-widget-toolkit/src/widget/form/checkbox.rs:172
-#, fuzzy
msgid "got invalid value."
-msgstr "Niepoprawna wartość"
+msgstr "otrzymano niepoprawną wartość."
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:57
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:124
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:200
msgid "got wrong data type"
-msgstr ""
+msgstr "otrzymano niepoprawny typ danych"
#: proxmox-yew-widget-toolkit/src/widget/form/radio_button.rs:147
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:327
#: proxmox-yew-widget-toolkit/src/widget/form/selector.rs:206
msgid "got wrong data type."
-msgstr ""
+msgstr "otrzymano niepoprawny typ danych."
#: proxmox-backup/www/datastore/Content.js:1369
msgid "group, date or owner"
@@ -16401,13 +16093,12 @@ msgstr "za {0}"
#. do not allow "inf", "nan", ...
#: proxmox-yew-widget-toolkit/src/dom/number_format.rs:112
#: proxmox-yew-widget-toolkit/src/dom/number_format.rs:117
-#, fuzzy
msgid "invalid float literal"
-msgstr "Nieprawidłowy rozmiar pliku"
+msgstr "nieprawidłowy literał typu float"
#: proxmox-yew-widget-toolkit/src/dom/number_format.rs:101
msgid "invalid float literal (wrong decimal separator)"
-msgstr ""
+msgstr "nieprawidłowy zapis float (niewłaściwy separator dziesiętny)"
#: pve-manager/www/manager6/window/Prune.js:135
#: proxmox-backup/www/datastore/Prune.js:167
@@ -16486,7 +16177,7 @@ msgstr "nowe"
#: pve-manager/www/manager6/grid/FirewallOptions.js:88
msgid "nftables (tech preview)"
-msgstr ""
+msgstr "nftables (podgląd technologii)"
#: proxmox-widget-toolkit/src/form/VlanField.js:7
#: pve-manager/www/manager6/form/VLanField.js:7
@@ -16520,7 +16211,7 @@ msgstr "brak (wyłączone)"
#: proxmox-widget-toolkit/src/node/NetworkEdit.js:92
msgid "not a valid bridge VLAN ID entry: {0}"
-msgstr ""
+msgstr "nieprawidłowy VLAN ID mostka: {0}"
#: proxmox-widget-toolkit/src/node/ServiceView.js:213
#: pve-yew-mobile-gui/src/pages/page_node_status/updates_panel.rs:47
@@ -16532,14 +16223,14 @@ msgstr "nie zainstalowane"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:165
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:193
msgid "number too large (n > {})"
-msgstr ""
+msgstr "liczba zbyt duża (n > {})"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:95
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:120
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:171
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:196
msgid "number too small (n < {})"
-msgstr ""
+msgstr "liczba zbyt mała (n < {})"
#: pve-manager/www/manager6/dc/Summary.js:210
msgid "of {0} CPU(s)"
@@ -16548,48 +16239,45 @@ msgstr "z {0} procesorów"
#: proxmox-yew-widget-toolkit/src/gettext_wrapper.rs:204
#: proxmox-yew-widget-toolkit/src/gettext_wrapper.rs:205
#: proxmox-yew-widget-toolkit/src/gettext_wrapper.rs:206
-#, fuzzy
msgid "one"
msgid_plural "plural"
-msgstr[0] "Gotowe"
-msgstr[1] "Gotowe"
+msgstr[0] "jedno"
+msgstr[1] "wiele"
+msgstr[2] "wiele"
#: proxmox-yew-widget-toolkit/src/gettext_wrapper.rs:210
#: proxmox-yew-widget-toolkit/src/gettext_wrapper.rs:211
#: proxmox-yew-widget-toolkit/src/gettext_wrapper.rs:212
-#, fuzzy
msgctxt "context"
msgid "one"
msgid_plural "plural"
-msgstr[0] "Gotowe"
-msgstr[1] "Gotowe"
+msgstr[0] "jedno"
+msgstr[1] "wiele"
+msgstr[2] "wiele"
#: proxmox-widget-toolkit/src/Toolkit.js:79
msgid "only unicast addresses are allowed"
msgstr "dozwolone są tylko adresy unicast"
#: pve-manager/www/manager6/node/ACME.js:23
-#, fuzzy
msgid "optional"
-msgstr "Opcja"
+msgstr "opcjonalne"
#: pve-manager/www/manager6/dc/MetricServerView.js:588
-#, fuzzy
msgid "otel-collector.example.com"
-msgstr "mail.example.com"
+msgstr "otel-collector.example.com"
#: pmg-yew-quarantine-gui/src/page_not_found.rs:9
msgid "page not found"
-msgstr ""
+msgstr "strona nie znaleziona"
#: pve-manager/www/manager6/form/NetworkCardSelector.js:7
msgid "paravirtualized"
msgstr "parawirtualizacja"
#: proxmox-datacenter-manager/ui/src/dashboard/guest_panel.rs:82
-#, fuzzy
msgid "paused"
-msgstr "Wstrzymane"
+msgstr "wstrzymane"
#: pve-manager/www/manager6/dc/ClusterEdit.js:248
msgid "peer's link address: {0}"
@@ -16603,7 +16291,7 @@ msgstr "oczekujące"
#: pmg-gui/js/AuthEditOIDC.js:128
msgid "preferred_username"
-msgstr ""
+msgstr "preferred_username"
#: pve-manager/www/manager6/lxc/FeaturesEdit.js:17
msgid "privileged only"
@@ -16620,9 +16308,8 @@ msgstr ""
"pveproxy zostanie zrestartowane z nowymi certyfikatami, odśwież stronę!"
#: pve-manager/www/manager6/node/ACME.js:23
-#, fuzzy
msgid "required"
-msgstr "Wycofana"
+msgstr "wymagane"
#: proxmox-backup/www/config/NodeOptionView.js:51
msgid "root@$hostname"
@@ -16645,32 +16332,29 @@ msgid "stopped"
msgstr "zatrzymane"
#: pmg-gui/js/AuthEditOIDC.js:127
-#, fuzzy
msgid "sub (subject)"
-msgstr "Podmiot"
+msgstr "sub (temat)"
#: proxmox-backup/www/Utils.js:446
msgid "sync jobs handler triggered by mount"
-msgstr ""
+msgstr "synchronizacja po zamontowaniu"
#: pve-manager/www/manager6/grid/Replication.js:373
msgid "syncing"
msgstr "synchronizacja"
#: proxmox-yew-comp/src/bandwidth_selector.rs:98
-#, fuzzy
msgid "unable to parse number"
-msgstr "Nie udało się rozpoznać konfiguracji sieci"
+msgstr "Nie udało się rozpoznać liczby"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:341
-#, fuzzy
msgid "unable to parse number: {}"
-msgstr "Nie udało się rozpoznać konfiguracji sieci"
+msgstr "Nie udało się rozpoznać liczby: {}"
#: proxmox-yew-comp/src/bandwidth_selector.rs:104
#: proxmox-yew-comp/src/bandwidth_selector.rs:113
msgid "unable to parse value: {}"
-msgstr ""
+msgstr "Nie udało się rozpoznać wartości: {}"
#: pve-manager/www/manager6/dc/MetricServerView.js:207
#: proxmox-backup/www/window/InfluxDbEdit.js:12
@@ -16679,7 +16363,6 @@ msgstr "brak zmian"
#: pve-yew-mobile-gui/src/pages/page_task_status.rs:126
#: proxmox-yew-comp/src/subscription_panel.rs:181
-#, fuzzy
msgid "unknown"
msgstr "nieznane"
@@ -16724,9 +16407,8 @@ msgstr "użyj ustawień hosta"
#: pve-manager/www/manager6/sdn/controllers/EvpnEdit.js:37
#: pve-manager/www/manager6/sdn/zones/VxlanEdit.js:58
-#, fuzzy
msgid "used as underlay network"
-msgstr "Takie jak sieć publiczna"
+msgstr "używana jako sieć bazowa"
#: proxmox-widget-toolkit/src/panel/SmtpEditPanel.js:144
msgid "user@example.com"
@@ -16735,23 +16417,23 @@ msgstr "user@example.com"
#: pve-manager/www/manager6/qemu/MachineEdit.js:153
#: pve-manager/www/manager6/qemu/MachineEdit.js:170
msgid "vIOMMU"
-msgstr ""
+msgstr "vIOMMU"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:450
msgid "value must be greater than or equal to '{0}'"
-msgstr ""
+msgstr "wartość musi być większa lub równa '{0}'"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:346
msgid "value must be greater than or equal to '{}'"
-msgstr ""
+msgstr "wartość musi być większa lub równa '{}'"
#: proxmox-yew-widget-toolkit/src/widget/form/number.rs:458
msgid "value must be less than or equal to '{0}'"
-msgstr ""
+msgstr "wartość musi być mniejsza lub równa '{0}'"
#: proxmox-yew-widget-toolkit/src/widget/form/field.rs:354
msgid "value must be less than or equal to '{}'"
-msgstr ""
+msgstr "wartość musi być mniejsza lub równa '{}'"
#: proxmox-widget-toolkit/src/window/TfaEdit.js:80
msgid "verify current password"
@@ -16762,9 +16444,8 @@ msgid "with options"
msgstr "z opcjami"
#: pve-manager/www/manager6/qemu/VirtiofsEdit.js:65
-#, fuzzy
msgid "xattr Support"
-msgstr "Wsparcie"
+msgstr "Obsługa xattr"
#: pmg-gui/js/Settings.js:223 pve-manager/www/manager6/window/Settings.js:319
#: proxmox-backup/www/window/Settings.js:223
@@ -16778,6 +16459,10 @@ msgid ""
" \"X-Custom-Header\": \"value\"\n"
"}"
msgstr ""
+"{\n"
+" \"Authorization\": \"Bearer token\",\n"
+" \"X-Custom-Header\": \"value\"\n"
+"}"
#: pve-manager/www/manager6/dc/MetricServerView.js:705
msgid ""
@@ -16787,11 +16472,15 @@ msgid ""
" \"region\": \"us-east-1\"\n"
"}"
msgstr ""
+"{\n"
+" \"environment\": \"production\",\n"
+" \"datacenter\": \"dc1\",\n"
+" \"region\": \"us-east-1\"\n"
+"}"
#: proxmox-datacenter-manager/ui/src/pve/node.rs:275
-#, fuzzy
msgid "{0} ({1} sockets)"
-msgstr "{0} ({1})"
+msgstr "{0} ({1} gniazda)"
#: proxmox-widget-toolkit/src/window/AuthEditLDAP.js:376
#: pve-manager/www/manager6/dc/AuthEditLDAP.js:314
@@ -16804,7 +16493,7 @@ msgstr "{0} ({1}/{2}) udało się"
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:194
msgid "{0} / {1} (running / total)"
-msgstr ""
+msgstr "{0} / {1} (uruchomionych / wszystkich)"
#: pmg-gui/js/AttachmentGrid.js:75
msgid "{0} Attachments"
@@ -16819,10 +16508,9 @@ msgid "{0} Items"
msgstr "{0} elementów"
#: proxmox-yew-widget-toolkit/src/tr.rs:281
-#, fuzzy
msgctxt "context"
msgid "{0} bar"
-msgstr "{0} lat"
+msgstr "{0} bar"
#: proxmox-backup/www/Utils.js:826
msgid "{0} conflicting tasks still active."
@@ -16841,9 +16529,8 @@ msgstr "{0} godzin"
#: pve-manager/www/manager6/lxc/DeviceEdit.js:68
#: pve-manager/www/manager6/lxc/DeviceEdit.js:77
-#, fuzzy
msgid "{0} in CT"
-msgstr "{0} minut"
+msgstr "{0} w CT"
#: proxmox-widget-toolkit/src/node/APTRepositories.js:78
msgid "{0} is already configured"
@@ -16859,12 +16546,11 @@ msgstr "{0} miesięcy"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:93
msgid "{0} nodes have an unknown status"
-msgstr ""
+msgstr "{0} węzłów w nieznanym stanie"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:101
-#, fuzzy
msgid "{0} nodes online"
-msgstr "Węzeł jest niedostępny"
+msgstr "{0} uruchomionych węzłów"
#: pve-manager/www/manager6/Utils.js:1817
msgid "{0} not installed."
@@ -16872,7 +16558,7 @@ msgstr "{0} nie jest zainstalowany."
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:98
msgid "{0} of an unknown number of nodes online"
-msgstr ""
+msgstr "{0} z nieznanej liczby aktywnych węzłów"
#: proxmox-widget-toolkit/src/Utils.js:1135
#: pve-manager/www/manager6/ceph/Status.js:362
@@ -16885,12 +16571,11 @@ msgstr "{0} z {1}"
#: proxmox-datacenter-manager/ui/src/dashboard/mod.rs:89
msgid "{0} of {1} nodes are offline"
-msgstr ""
+msgstr "{0} z {1} węzłów jest niedostępnych"
#: proxmox-datacenter-manager/ui/src/dashboard/top_entities.rs:242
-#, fuzzy
msgid "{0} on Remote '{1}'"
-msgstr "Strefa {0} na węźle {1}"
+msgstr "{0} na maszynie '{1}'"
#: pmg-gui/js/Utils.js:866
msgid "{0} on behalf of {1}"
@@ -16898,12 +16583,12 @@ msgstr "{0} w imieniu {1}"
#: proxmox-datacenter-manager/ui/src/dashboard/remote_panel.rs:74
msgid "{0} remotes failed to reach."
-msgstr ""
+msgstr "{0} niedostępnych maszyn."
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:256
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:267
msgid "{0} running / {1} physical ({2} total configured)"
-msgstr ""
+msgstr "{0} włączonych / {1} fizycznych ({2} wszystkich)"
#: pmg-gui/js/GeneralMailStatistics.js:120
msgid "{0} seconds"
@@ -16934,9 +16619,8 @@ msgid "{0} years"
msgstr "{0} lat"
#: proxmox-yew-widget-toolkit/src/tr.rs:175
-#, fuzzy
msgid "{0} {1}"
-msgstr "{0} ({1})"
+msgstr "{0} {1}"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:335
#: proxmox-datacenter-manager/ui/src/pve/node.rs:245
@@ -16944,71 +16628,79 @@ msgstr "{0} ({1})"
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:345
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:219
#: proxmox-datacenter-manager/ui/src/pve/remote.rs:233
-#, fuzzy
msgid "{0}% ({1} of {2})"
-msgstr "{0} do {1} ({2})"
+msgstr "{0}% ({1} z {2})"
#: proxmox-widget-toolkit/src/Utils.js:1122
-#, fuzzy, javascript-format
+#, javascript-format
msgid "{0}% of {1}"
msgstr "{0}% z {1}"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:322
#: proxmox-datacenter-manager/ui/src/pve/node.rs:232
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:332
-#, fuzzy
msgid "{0}% of {1} CPU(s)"
-msgstr "z {0} procesorów"
+msgstr "{0}% z {1} procesorów"
#: proxmox-datacenter-manager/ui/src/pve/lxc.rs:303
#: proxmox-datacenter-manager/ui/src/pve/qemu.rs:313
-#, fuzzy
msgid "{0}, Group: {1}"
-msgstr "{0} z {1}"
+msgstr "{0}, grupa: {1}"
#: proxmox-yew-widget-toolkit/src/tr.rs:176
-#, fuzzy
msgid "{1} {0}"
-msgstr "ID {0}"
+msgstr "{1} {0}"
#: proxmox-yew-widget-toolkit/src/tr.rs:243
msgctxt "context"
msgid "{foo} bar"
-msgstr ""
+msgstr "{foo} bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:178
#: proxmox-yew-widget-toolkit/src/tr.rs:179
msgid "{foo} {bar}"
-msgstr ""
+msgstr "{foo} {bar}"
#: proxmox-yew-widget-toolkit/src/tr.rs:190
msgid "{{foo}} bar"
-msgstr ""
+msgstr "{{foo}} bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:186
msgid "{{{0}}} bar"
-msgstr ""
+msgstr "{{{0}}} bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:185
msgid "{{{var}}} bar"
-msgstr ""
+msgstr "{{{var}}} bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:187
msgid "{{{}} bar"
-msgstr ""
+msgstr "{{{}} bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:280
msgid "{} bar"
-msgstr ""
+msgstr "{} bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:244
msgctxt "context"
msgid "{} bar"
-msgstr ""
+msgstr "{} bar"
#: proxmox-yew-widget-toolkit/src/tr.rs:173
msgid "{} {}"
-msgstr ""
+msgstr "{} {}"
+
+#~ msgid "HA Group"
+#~ msgstr "Grupa HA"
+
+#~ msgid ""
+#~ "You do not have a valid subscription for this server. Please visit <a "
+#~ "target=\"_blank\" href=\"{}\">www.proxmox.com</a> to get\n"
+#~ "a list of available options. "
+#~ msgstr ""
+#~ "Nie masz ważnej subskrypcji na ten serwer. Odwiedź stronę <a "
+#~ "target=\"_blank\" href=\"{}\">www.proxmox.com</a>,\n"
+#~ "aby zapoznać się z dostępnymi opcjami."
#~ msgid " Network/Time"
#~ msgstr "Sieć/czas"
@@ -17245,9 +16937,6 @@ msgstr ""
#~ msgid "Gotify"
#~ msgstr "Gotify"
-#~ msgid "HA Group"
-#~ msgstr "Grupa HA"
-
#~ msgid "HA managed VM/CT"
#~ msgstr "HA zarządzanie VM/CT"
--
2.43.0
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply related [relevance 2%]
Results 1-143 of 143 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2025-07-31 20:10 2% [pve-devel] [PATCH proxmox-i18n] Polish translation update Daniel Koć
[not found] <20260130073139.248418-2-k.chai@proxmox.com>
2026-02-04 12:19 ` [PATCH proxmox-i18n v3] update Simplified Chinese translations Kefu Chai
2026-02-04 12:19 2% ` Kefu Chai
2026-07-31 10:21 7% [RFC pve-storage/proxmox-widget-toolkit/pve-manager 00/27] add guided remote storage setup and SAN visibility Dietmar Maurer
2026-07-31 10:21 14% ` [RFC pve-storage 03/27] diskmanage: qualify NVMe over fabrics transport Dietmar Maurer
2026-07-31 10:21 13% ` [RFC pve-storage 11/27] diskmanage: add helper querying NVMe native multipath path state Dietmar Maurer
2026-10-05 0:26 8% [PATCH storage v3 0/4] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-10-05 0:26 9% ` [PATCH storage v3 1/4] zfsnvme: " Joaquin Varela
2026-10-05 0:26 5% ` [PATCH storage v3 2/4] test: add zfsnvme plugin tests Joaquin Varela
2026-10-05 0:26 14% ` [PATCH docs v3] storage: document ZFS over NVMe/TCP Joaquin Varela
2026-11-05 23:30 5% [PATCH v3 proxmox,proxmox-perl-rs,cluster,storage,docs,manager 00/76] SAN: cluster-wide multipath, SAN views and a guided storage setup Thomas Lamprecht
2026-11-05 23:30 6% ` [PATCH v3 storage 05/76] lvm: find a shared volume group created by another node Thomas Lamprecht
2026-11-05 23:30 14% ` [PATCH v3 storage 14/76] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
2026-11-05 23:30 9% ` [PATCH v3 storage 21/76] disks: lvm: allow volume groups on SAN LUNs and multipath maps Thomas Lamprecht
2026-11-05 23:30 13% ` [PATCH v3 storage 23/76] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
2026-11-05 23:31 8% ` [PATCH v3 docs 44/76] storage: document the cluster-wide multipath management Thomas Lamprecht
2026-11-13 3:00 5% [PATCH v4 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-13 3:00 13% ` [PATCH v4 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
2026-11-13 3:00 13% ` [PATCH v4 storage 05/36] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
2026-11-13 3:00 9% ` [PATCH v4 storage 16/36] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-13 3:00 9% ` [PATCH v4 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view Thomas Lamprecht
2026-11-13 3:04 12% [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-13 3:04 8% ` [PATCH storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
2026-11-13 3:04 17% ` [PATCH storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH storage 04/17] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
2026-11-13 3:04 8% ` [PATCH storage 05/17] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
2026-11-13 3:04 21% ` [PATCH storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage Thomas Lamprecht
2026-11-13 3:04 14% ` [PATCH storage 07/17] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
2026-11-13 3:04 10% ` [PATCH storage 08/17] multipath: report the NVMe host NQN of each node Thomas Lamprecht
2026-11-13 3:04 15% ` [PATCH storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
2026-11-13 3:04 21% ` [PATCH docs 10/17] storage: document NVMe over Fabrics storages Thomas Lamprecht
2026-11-13 3:04 6% ` [PATCH manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints Thomas Lamprecht
2026-11-13 3:04 16% ` [PATCH manager 12/17] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
2026-11-13 3:04 18% ` [PATCH manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
2026-11-13 3:04 12% ` [PATCH manager 15/17] ui: node: san: list NVMe over Fabrics controllers Thomas Lamprecht
2026-11-13 3:04 9% ` [PATCH manager 17/17] ui: dc: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-18 20:44 6% ` superseded: [PATCH storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-16 1:23 5% [PATCH v5 cluster,storage,docs,manager 00/36] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-16 1:23 13% ` [PATCH v5 storage 03/36] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
2026-11-16 1:23 13% ` [PATCH v5 storage 05/36] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
2026-11-16 1:23 9% ` [PATCH v5 storage 16/36] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-16 1:23 9% ` [PATCH v5 manager 36/36] ui: storage: point the iSCSI and LVM add dialogs to the SAN view Thomas Lamprecht
2026-11-18 6:52 6% [PATCH v6 cluster,storage,docs,manager 00/42] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-18 6:52 13% ` [PATCH v6 storage 03/42] diskmanage: qualify NVMe over fabrics transport Thomas Lamprecht
2026-11-18 6:52 13% ` [PATCH v6 storage 05/42] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
2026-11-18 6:52 9% ` [PATCH v6 storage 18/42] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-18 6:52 10% ` [PATCH v6 manager 39/42] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
2026-11-18 20:25 6% [PATCH v7 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-18 20:25 13% ` [PATCH v7 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
2026-11-18 20:25 13% ` [PATCH v7 storage 05/43] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
2026-11-18 20:26 9% ` [PATCH v7 storage 18/43] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-18 20:26 10% ` [PATCH v7 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
2026-11-18 20:42 10% [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-18 20:42 8% ` [PATCH v2 storage 01/17] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-18 20:42 17% ` [PATCH v2 storage 02/17] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
2026-11-18 20:42 16% ` [PATCH v2 storage 03/17] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
2026-11-18 20:42 16% ` [PATCH v2 storage 04/17] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
2026-11-18 20:42 9% ` [PATCH v2 storage 05/17] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
2026-11-18 20:42 21% ` [PATCH v2 storage 06/17] api: scan: san-luns: attribute NVMe namespaces to storage Thomas Lamprecht
2026-11-18 20:42 14% ` [PATCH v2 storage 07/17] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
2026-11-18 20:42 10% ` [PATCH v2 storage 08/17] multipath: report the NVMe host NQN of each node Thomas Lamprecht
2026-11-18 20:42 16% ` [PATCH v2 storage 09/17] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
2026-11-18 20:42 20% ` [PATCH v2 docs 10/17] storage: document NVMe over Fabrics storages Thomas Lamprecht
2026-11-18 20:42 6% ` [PATCH v2 manager 11/17] api: nodes: mount the NVMe over Fabrics endpoints Thomas Lamprecht
2026-11-18 20:42 18% ` [PATCH v2 manager 12/17] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
2026-11-18 20:42 18% ` [PATCH v2 manager 13/17] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
2026-11-18 20:42 19% ` [PATCH v2 manager 14/17] ui: dc: san: add a guided setup for shared LVM on NVMe over Fabrics Thomas Lamprecht
2026-11-18 20:42 12% ` [PATCH v2 manager 15/17] ui: node: san: list NVMe over Fabrics controllers Thomas Lamprecht
2026-11-18 20:42 9% ` [PATCH v2 manager 17/17] ui: dc: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-22 14:52 6% ` superseded: [PATCH v2 storage,docs,manager 00/17] NVMe over Fabrics storage Thomas Lamprecht
2026-11-19 19:46 6% [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-19 19:46 13% ` [PATCH v8 storage 03/43] diskmanage: qualify NVMe over Fabrics transport Thomas Lamprecht
2026-11-19 19:46 13% ` [PATCH v8 storage 05/43] diskmanage: collect native NVMe multipath path state Thomas Lamprecht
2026-11-19 19:46 9% ` [PATCH v8 storage 18/43] api: scan: add a SAN LUN inventory Thomas Lamprecht
2026-11-19 19:46 10% ` [PATCH v8 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Thomas Lamprecht
2026-11-20 8:45 5% ` [PATCH v8 cluster,storage,docs,manager 00/43] SAN: cluster-wide multipath, SAN views and a guided setup for shared LVM Thomas Lamprecht
2026-11-22 1:25 11% [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
2026-11-22 1:25 8% ` [PATCH v3 storage 01/18] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 02/18] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 03/18] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 04/18] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
2026-11-22 1:25 11% ` [PATCH v3 storage 05/18] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
2026-11-22 1:25 20% ` [PATCH v3 storage 06/18] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
2026-11-22 1:25 16% ` [PATCH v3 storage 07/18] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
2026-11-22 1:25 10% ` [PATCH v3 storage 08/18] multipath: report the NVMe host NQN of each node Thomas Lamprecht
2026-11-22 1:25 18% ` [PATCH v3 storage 09/18] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
2026-11-22 1:25 20% ` [PATCH v3 docs 10/18] storage: document NVMe over Fabrics storages Thomas Lamprecht
2026-11-22 1:25 19% ` [PATCH v3 manager 12/18] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
2026-11-22 1:25 20% ` [PATCH v3 manager 13/18] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
2026-11-22 1:25 19% ` [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 13% ` [PATCH v3 manager 15/18] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
2026-11-22 1:25 13% ` [PATCH v3 manager 17/18] ui: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-22 1:25 14% ` [PATCH v3 manager 18/18] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
2026-11-23 2:02 6% ` superseded: [PATCH v3 storage,docs,manager 00/18] NVMe over Fabrics storage Thomas Lamprecht
2026-11-23 1:47 11% [PATCH v4 storage,docs,manager 00/25] " Thomas Lamprecht
2026-11-23 1:47 8% ` [PATCH v4 storage 01/25] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-23 1:47 15% ` [PATCH v4 storage 02/25] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only Thomas Lamprecht
2026-11-23 1:47 15% ` [PATCH v4 storage 04/25] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
2026-11-23 1:47 16% ` [PATCH v4 storage 07/25] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
2026-11-23 1:47 15% ` [PATCH v4 storage 08/25] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
2026-11-23 1:47 11% ` [PATCH v4 storage 09/25] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
2026-11-23 1:47 20% ` [PATCH v4 storage 10/25] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
2026-11-23 1:47 17% ` [PATCH v4 storage 11/25] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
2026-11-23 1:47 10% ` [PATCH v4 storage 12/25] multipath: report the NVMe host NQN of each node Thomas Lamprecht
2026-11-23 1:47 17% ` [PATCH v4 storage 13/25] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
2026-11-23 1:47 5% ` [PATCH v4 storage 14/25] d/control: break pve-manager versions without namespace notifications Thomas Lamprecht
2026-11-23 1:47 19% ` [PATCH v4 docs 15/25] storage: document NVMe over Fabrics storages Thomas Lamprecht
2026-11-23 1:47 18% ` [PATCH v4 manager 17/25] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
2026-11-23 1:47 20% ` [PATCH v4 manager 18/25] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
2026-11-23 1:47 19% ` [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 13% ` [PATCH v4 manager 20/25] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
2026-11-23 1:47 12% ` [PATCH v4 manager 22/25] ui: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-23 1:48 13% ` [PATCH v4 manager 23/25] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
2026-11-23 1:48 13% ` [PATCH v4 manager 25/25] d/control: bump versioned dependencies for NVMe over Fabrics Thomas Lamprecht
2026-11-23 13:35 6% ` superseded: [PATCH v4 storage,docs,manager 00/25] NVMe over Fabrics storage Thomas Lamprecht
2026-11-23 13:31 11% applied: [PATCH v5 storage,docs,manager 00/26] " Thomas Lamprecht
2026-11-23 13:31 13% ` [PATCH v5 storage 01/26] api: config: activate a new storage without holding the lock Thomas Lamprecht
2026-11-23 13:31 10% ` [PATCH v5 storage 02/26] diskmanage: skip SMART queries for NVMe fabric namespaces Thomas Lamprecht
2026-11-23 13:31 16% ` [PATCH v5 storage 03/26] diskmanage: list NVMe namespaces attached over TCP or RDMA for SAN only Thomas Lamprecht
2026-11-23 13:31 15% ` [PATCH v5 storage 05/26] nvmeof: add a storage for NVMe over Fabrics subsystems Thomas Lamprecht
2026-11-23 13:32 18% ` [PATCH v5 storage 08/26] lvm: allow a volume group on an NVMe over Fabrics namespace Thomas Lamprecht
2026-11-23 13:32 15% ` [PATCH v5 storage 09/26] api: scan: add NVMe over Fabrics discovery Thomas Lamprecht
2026-11-23 13:32 11% ` [PATCH v5 storage 10/26] pvesm: add a scan command for NVMe over Fabrics Thomas Lamprecht
2026-11-23 13:32 20% ` [PATCH v5 storage 11/26] api: san luns: attribute NVMe namespaces to storage Thomas Lamprecht
2026-11-23 13:32 17% ` [PATCH v5 storage 12/26] api: add node-level NVMe over Fabrics status and controller removal Thomas Lamprecht
2026-11-23 13:32 10% ` [PATCH v5 storage 13/26] multipath: report the NVMe host NQN of each node Thomas Lamprecht
2026-11-23 13:32 17% ` [PATCH v5 storage 14/26] multipath: report NVMe over Fabrics namespaces in the cluster status Thomas Lamprecht
2026-11-23 13:32 5% ` [PATCH v5 storage 15/26] d/control: break pve-manager versions without namespace notifications Thomas Lamprecht
2026-11-23 13:32 19% ` [PATCH v5 docs 16/26] storage: document NVMe over Fabrics storages Thomas Lamprecht
2026-11-23 13:32 18% ` [PATCH v5 manager 18/26] ui: storage: add NVMe over Fabrics storage Thomas Lamprecht
2026-11-23 13:32 20% ` [PATCH v5 manager 19/26] ui: lvm: offer NVMe over Fabrics storages as base storage Thomas Lamprecht
2026-11-23 13:32 19% ` [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 13% ` [PATCH v5 manager 22/26] ui: node san: list NVMe over Fabrics controllers Thomas Lamprecht
2026-11-23 13:32 12% ` [PATCH v5 manager 24/26] ui: san: show that a namespace uses native multipath Thomas Lamprecht
2026-11-23 13:32 13% ` [PATCH v5 manager 25/26] pvestatd: notify on NVMe over Fabrics namespaces as on multipath maps Thomas Lamprecht
2026-11-23 13:32 13% ` [PATCH v5 manager 26/26] d/control: bump versioned dependencies for NVMe over Fabrics Thomas Lamprecht
2026-11-26 15:09 8% [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-11-26 15:09 11% ` [PATCH storage v5 04/13] zfsnvme: connect the nodes and register the plugin Joaquin Varela
2026-11-26 15:09 25% ` [PATCH storage v5 05/13] api: san luns: count zfsnvme storages as owners of their subsystem Joaquin Varela
2026-11-26 15:09 6% ` [PATCH storage v5 07/13] test: zfsnvme: add configuration and volume tests Joaquin Varela
2026-11-26 15:09 7% ` [PATCH storage v5 08/13] test: zfsnvme: add node side tests Joaquin Varela
2026-11-26 15:10 16% ` [PATCH docs v5] storage: document ZFS over NVMe/TCP Joaquin Varela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox