From fefd65a1d9e1d20a696b8c6e6100f86b6cfabd38 Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Wed, 21 Apr 2021 16:25:24 +0200 Subject: [PATCH] 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 --- PVE/QemuServer.pm | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index fec2edbf..d042a7e2 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -6386,28 +6386,17 @@ sub restore_proxmox_backup_archive { PVE::AccessControl::add_vm_to_pool($vmid, $options->{pool}) if $options->{pool}; if ($options->{live}) { - eval { - # enable interrupts - local $SIG{INT} = - local $SIG{TERM} = - local $SIG{QUIT} = - local $SIG{HUP} = - local $SIG{PIPE} = sub { die "got signal ($!) - abort\n"; }; + # enable interrupts + local $SIG{INT} = + local $SIG{TERM} = + local $SIG{QUIT} = + local $SIG{HUP} = + local $SIG{PIPE} = sub { die "got signal ($!) - abort\n"; }; - my $conf = PVE::QemuConfig->load_config($vmid); - die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf); + my $conf = PVE::QemuConfig->load_config($vmid); + 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); - }; - - $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; - } + pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name); } }