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:
committed by
Wolfgang Bumiller
parent
d0d314a965
commit
9a75947b49
@ -674,6 +674,8 @@ sub volume_export {
|
|||||||
die "$class storage can only export snapshots\n"
|
die "$class storage can only export snapshots\n"
|
||||||
if !defined($snapshot);
|
if !defined($snapshot);
|
||||||
|
|
||||||
|
my $dataset = ($class->parse_volname($volname))[1];
|
||||||
|
|
||||||
my $fd = fileno($fh);
|
my $fd = fileno($fh);
|
||||||
die "internal error: invalid file handle for volume_export\n"
|
die "internal error: invalid file handle for volume_export\n"
|
||||||
if !defined($fd);
|
if !defined($fd);
|
||||||
@ -687,7 +689,7 @@ sub volume_export {
|
|||||||
my $arg = $with_snapshots ? '-I' : '-i';
|
my $arg = $with_snapshots ? '-I' : '-i';
|
||||||
push @$cmd, $arg, $base_snapshot;
|
push @$cmd, $arg, $base_snapshot;
|
||||||
}
|
}
|
||||||
push @$cmd, '--', "$scfg->{pool}/$volname\@$snapshot";
|
push @$cmd, '--', "$scfg->{pool}/$dataset\@$snapshot";
|
||||||
|
|
||||||
run_command($cmd, output => $fd);
|
run_command($cmd, output => $fd);
|
||||||
|
|
||||||
@ -714,7 +716,8 @@ sub volume_import {
|
|||||||
die "internal error: invalid file handle for volume_import\n"
|
die "internal error: invalid file handle for volume_import\n"
|
||||||
if !defined($fd);
|
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 $suffix = defined($base_snapshot) ? "\@$base_snapshot" : '';
|
||||||
my $exists = 0 == run_command(['zfs', 'get', '-H', 'name', $zfspath.$suffix],
|
my $exists = 0 == run_command(['zfs', 'get', '-H', 'name', $zfspath.$suffix],
|
||||||
noerr => 1, errfunc => sub {});
|
noerr => 1, errfunc => sub {});
|
||||||
|
|||||||
Reference in New Issue
Block a user