all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] fix #5071: zfs over iscsi: iet, lio: use /dev/zvol as a base path if it exists
Date: Tue, 27 May 2025 12:59:13 +0200	[thread overview]
Message-ID: <20250527105913.39464-1-f.ebner@proxmox.com> (raw)

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


             reply	other threads:[~2025-05-27 10:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 10:59 Fiona Ebner [this message]
2025-05-27 11:59 ` Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250527105913.39464-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal