From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 6DC5C1FF16F
	for <inbox@lore.proxmox.com>; Tue, 27 May 2025 12:59:37 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 1E3F211CFA;
	Tue, 27 May 2025 12:59:49 +0200 (CEST)
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Tue, 27 May 2025 12:59:13 +0200
Message-Id: <20250527105913.39464-1-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.39.5
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.033 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [iet.pm, lio.pm]
Subject: [pve-devel] [PATCH storage] fix #5071: zfs over iscsi: iet,
 lio: use /dev/zvol as a base path if it exists
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

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