public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] fix #5071: zfs over iscsi: iet, lio: use /dev/zvol as a base path if it exists
@ 2025-05-27 10:59 Fiona Ebner
  2025-05-27 11:59 ` Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2025-05-27 10:59 UTC (permalink / raw)
  To: pve-devel

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH storage] fix #5071: zfs over iscsi: iet, lio: use /dev/zvol as a base path if it exists
  2025-05-27 10:59 [pve-devel] [PATCH storage] fix #5071: zfs over iscsi: iet, lio: use /dev/zvol as a base path if it exists Fiona Ebner
@ 2025-05-27 11:59 ` Fiona Ebner
  0 siblings, 0 replies; 2+ messages in thread
From: Fiona Ebner @ 2025-05-27 11:59 UTC (permalink / raw)
  To: pve-devel

Am 27.05.25 um 12:59 schrieb Fiona Ebner:
>  sub get_base {
> -    return '/dev';
> +    if (!$base_dir) {
> +	$base_dir = -e '/dev/zvol' ? '/dev/zvol' : '/dev';
> +    }
> +    return $base_dir;
>  }
>  

Of course, this is completely wrong, because the path would need to be
checked on the remote system. I'll also go for the cleaner approach with
using a storage configuration property while at it.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-27 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-27 10:59 [pve-devel] [PATCH storage] fix #5071: zfs over iscsi: iet, lio: use /dev/zvol as a base path if it exists Fiona Ebner
2025-05-27 11:59 ` Fiona Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal