live-restore: don't remove VM on error

Potentially an admin can still recover some data, or wants to inspect
the state.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
Stefan Reiter 2021-04-21 16:25:24 +02:00 committed by Thomas Lamprecht
parent 020dd358f9
commit fefd65a1d9

View File

@ -6386,7 +6386,6 @@ sub restore_proxmox_backup_archive {
PVE::AccessControl::add_vm_to_pool($vmid, $options->{pool}) if $options->{pool}; PVE::AccessControl::add_vm_to_pool($vmid, $options->{pool}) if $options->{pool};
if ($options->{live}) { if ($options->{live}) {
eval {
# enable interrupts # enable interrupts
local $SIG{INT} = local $SIG{INT} =
local $SIG{TERM} = local $SIG{TERM} =
@ -6398,16 +6397,6 @@ sub restore_proxmox_backup_archive {
die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf); die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf);
pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name); pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
};
$err = $@;
if ($err) {
warn "destroying partially live-restored VM, all temporary data will be lost!\n";
$restore_deactivate_volumes->($storecfg, $devinfo);
$restore_destroy_volumes->($storecfg, $devinfo);
PVE::QemuConfig->destroy_config($vmid);
die $err;
}
} }
} }