fix #1770: allow ex/import linked clones.

We encode the base-volume-name in the volname what is not needed.
On ex/import we need the correct dataset name.
This commit is contained in:
Wolfgang Link
2018-05-18 14:16:20 +02:00
committed by Wolfgang Bumiller
parent d0d314a965
commit 9a75947b49

View File

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