fix regression in zfs volume activation

commit 815df2dd08 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@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
Stoiko Ivanov
2020-09-29 18:49:44 +02:00
committed by Thomas Lamprecht
parent e3eb131ec5
commit 59fdc2b71e

View File

@ -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");
}
}