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 411A81FF165 for <inbox@lore.proxmox.com>; Thu, 5 Jun 2025 13:11:34 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B7C5B16B0E; Thu, 5 Jun 2025 13:11:46 +0200 (CEST) From: Fiona Ebner <f.ebner@proxmox.com> To: pve-devel@lists.proxmox.com Date: Thu, 5 Jun 2025 13:11:09 +0200 Message-Id: <20250605111109.52712-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250605111109.52712-1-f.ebner@proxmox.com> References: <20250605111109.52712-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.032 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. [zfsplugin.pm] Subject: [pve-devel] [PATCH v3 storage 2/2] zfs over iscsi: on-add hook: dynamically determine base path 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> This reduces the potential breakage from commit "fix #5071: zfs over iscsi: add 'zfs-base-path' configuration option". Only setups where '/dev/zvol' exists, but is not a valid base, will still be affected. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Tested-by: Christoph Heiss <c.heiss@proxmox.com> --- No changes in v3. src/PVE/Storage/ZFSPlugin.pm | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/PVE/Storage/ZFSPlugin.pm b/src/PVE/Storage/ZFSPlugin.pm index d0d330c..ed7adad 100644 --- a/src/PVE/Storage/ZFSPlugin.pm +++ b/src/PVE/Storage/ZFSPlugin.pm @@ -3,9 +3,10 @@ package PVE::Storage::ZFSPlugin; use strict; use warnings; use IO::File; -use POSIX; +use POSIX qw(ENOENT); use PVE::Tools qw(run_command); use PVE::Storage::ZFSPoolPlugin; +use PVE::RESTEnvironment qw(log_warn); use PVE::RPCEnvironment; use base qw(PVE::Storage::ZFSPoolPlugin); @@ -246,9 +247,26 @@ sub on_add_hook { $base_path = PVE::Storage::LunCmd::Istgt::get_base($scfg); } elsif ($scfg->{iscsiprovider} eq 'iet' || $scfg->{iscsiprovider} eq 'LIO') { # Provider implementations hard-code '/dev/', which does not work for distributions like - # Debian 12. Keep that implementation as-is for backwards compatibility, but use - # '/dev/zvol' here. - $base_path = '/dev/zvol'; + # Debian 12. Keep that implementation as-is for backwards compatibility, but use custom + # logic here. + my $target = 'root@' . $scfg->{portal}; + my $cmd = [@ssh_cmd, '-i', "$id_rsa_path/$scfg->{portal}_id_rsa", $target]; + push $cmd->@*, 'ls', '/dev/zvol'; + + my $rc = eval { run_command($cmd, timeout => 10, noerr => 1, quiet => 1) }; + my $err = $@; + if (defined($rc) && $rc == 0) { + $base_path = '/dev/zvol'; + } elsif (defined($rc) && $rc == ENOENT) { + $base_path = '/dev'; + } else { + my $message = $err ? $err : "remote command failed"; + chomp($message); + $message .= " ($rc)" if defined($rc); + $message .= " - check 'zfs-base-path' setting manually!"; + log_warn($message); + $base_path = '/dev/zvol'; + } } else { $zfs_unknown_scsi_provider->($scfg->{iscsiprovider}); } -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel