[pve-devel] [PATCH storage] fix #5071: zfs over iscsi: iet, lio: use /dev/zvol as a base path if it exists
Fiona Ebner
f.ebner at proxmox.com
Tue May 27 12:59:13 CEST 2025
On Debian 12 Bookworm (and also Proxmox VE 8), the old value '/dev'
cannot be used as the base path, because '/dev/<pool>' will not exist.
If '/dev/zvol' exists, assume that it will contain the usual ZFS
device paths. Only fall back to '/dev' if '/dev/zvol' does not exist
for backwards compatibility.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
If other exotic setups pop up where this is not enough, it can still
be made into an actual storage configuration property. From the
existing reports, this should be enough however and the logic makes
sense as the default behavior even if we later add it as a storage
configuration property. Of course then we can use an on_add() hook,
only check the existence once and write the result to the config.
I can also go with that approach right away if we deem the breakage
potential for existing exotic setups where /dev/zvol exists, but is
not valid as the base path, too high.
src/PVE/Storage/LunCmd/Iet.pm | 6 +++++-
src/PVE/Storage/LunCmd/LIO.pm | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/LunCmd/Iet.pm b/src/PVE/Storage/LunCmd/Iet.pm
index 5b09b88..ae13058 100644
--- a/src/PVE/Storage/LunCmd/Iet.pm
+++ b/src/PVE/Storage/LunCmd/Iet.pm
@@ -18,6 +18,7 @@ use warnings;
use PVE::Tools qw(run_command file_read_firstline trim dir_glob_regex dir_glob_foreach);
+my $base_dir;
sub get_base;
# A logical unit can max have 16864 LUNs
@@ -471,7 +472,10 @@ sub run_lun_command {
}
sub get_base {
- return '/dev';
+ if (!$base_dir) {
+ $base_dir = -e '/dev/zvol' ? '/dev/zvol' : '/dev';
+ }
+ return $base_dir;
}
1;
diff --git a/src/PVE/Storage/LunCmd/LIO.pm b/src/PVE/Storage/LunCmd/LIO.pm
index 9264e46..5811157 100644
--- a/src/PVE/Storage/LunCmd/LIO.pm
+++ b/src/PVE/Storage/LunCmd/LIO.pm
@@ -24,6 +24,7 @@ use warnings;
use PVE::Tools qw(run_command);
use JSON;
+my $base_dir;
sub get_base;
# targetcli constants
@@ -414,7 +415,10 @@ sub run_lun_command {
}
sub get_base {
- return '/dev';
+ if (!$base_dir) {
+ $base_dir = -e '/dev/zvol' ? '/dev/zvol' : '/dev';
+ }
+ return $base_dir;
}
1;
--
2.39.5
More information about the pve-devel
mailing list