[pve-devel] [PATCH storage] fix regression in zfs volume activation

Stoiko Ivanov s.ivanov at proxmox.com
Tue Sep 29 18:49:44 CEST 2020


commit 815df2dd08ac4c7295135262e60d64fbb57b8f5c introduced a small issue
when activating linked clone volumes - the volname passed contains
basevol/subvol, which needs to be translated to subvol.

using the path method should be a robust way to get the actual path for
activation.

Found and tested by building the package as root (otherwise the zfs
regressiontests are skipped).

Reported-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 PVE/Storage/ZFSPoolPlugin.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 4f8df5e..6ac05b4 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -554,9 +554,10 @@ sub activate_volume {
     if ($format eq 'raw') {
 	$class->zfs_wait_for_zvol_link($scfg, $volname);
     } elsif ($format eq 'subvol') {
-	my $mounted = $class->zfs_get_properties($scfg, 'mounted', "$scfg->{pool}/$volname");
+	my ($path, undef, undef) = $class->path($scfg, $volname, $storeid);
+	my $mounted = $class->zfs_get_properties($scfg, 'mounted', "$path");
 	if ($mounted !~ m/^yes$/) {
-	    $class->zfs_request($scfg, undef, 'mount', "$scfg->{pool}/$volname");
+	    $class->zfs_request($scfg, undef, 'mount', "$path");
 	}
     }
 
-- 
2.20.1






More information about the pve-devel mailing list