fix #1135: always clean up ZFS snapshots on migration

otherwise there are situations where snapshots are left
behind for already sent volumes. also include more warnings.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2017-01-02 14:27:04 +01:00
committed by Dietmar Maurer
parent 46f114a53f
commit afd0afe4f5

View File

@ -586,12 +586,13 @@ sub storage_migrate {
eval{ eval{
run_command($send); run_command($send);
}; };
my $err; my $err = $@;
if ($err = $@){ warn "zfs send/receive failed, cleaning up snapshot(s)..\n" if $err;
run_command(['zfs', 'destroy', "$zfspath\@__migration__"]); eval { run_command(['zfs', 'destroy', "$zfspath\@__migration__"]); };
die $err; warn "could not remove source snapshot: $@\n" if $@;
} eval { run_command($destroy_target); };
run_command($destroy_target); warn "could not remove target snapshot: $@\n" if $@;
die $err if $err;
} else { } else {
die "$errstr - target type $tcfg->{type} is not valid\n"; die "$errstr - target type $tcfg->{type} is not valid\n";