[pve-devel] [Patch storage] fix #1770: allow ex/import linked clones.

Wolfgang Link w.link at proxmox.com
Fri May 18 14:16:20 CEST 2018


We encode the base-volume-name in the volname what is not needed.
On ex/import we need the correct dataset name.
---
 PVE/Storage/ZFSPoolPlugin.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index fd63d94..32e53aa 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -674,6 +674,8 @@ sub volume_export {
     die "$class storage can only export snapshots\n"
 	if !defined($snapshot);
 
+    my $dataset = ($class->parse_volname($volname))[1];
+
     my $fd = fileno($fh);
     die "internal error: invalid file handle for volume_export\n"
 	if !defined($fd);
@@ -687,7 +689,7 @@ sub volume_export {
 	my $arg = $with_snapshots ? '-I' : '-i';
 	push @$cmd, $arg, $base_snapshot;
     }
-    push @$cmd, '--', "$scfg->{pool}/$volname\@$snapshot";
+    push @$cmd, '--', "$scfg->{pool}/$dataset\@$snapshot";
 
     run_command($cmd, output => $fd);
 
@@ -714,7 +716,8 @@ sub volume_import {
     die "internal error: invalid file handle for volume_import\n"
 	if !defined($fd);
 
-    my $zfspath = "$scfg->{pool}/$volname";
+    my $dataset = ($class->parse_volname($volname))[1];
+    my $zfspath = "$scfg->{pool}/$dataset";
     my $suffix = defined($base_snapshot) ? "\@$base_snapshot" : '';
     my $exists = 0 == run_command(['zfs', 'get', '-H', 'name', $zfspath.$suffix],
 			     noerr => 1, errfunc => sub {});
-- 
2.11.0





More information about the pve-devel mailing list