[pve-devel] [PATCH qemu-server 2/3] live-restore: don't remove VM on error

Stefan Reiter s.reiter at proxmox.com
Wed Apr 21 16:25:24 CEST 2021


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

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---

The message printed in the task log already suggest as much.

 PVE/QemuServer.pm | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fec2edb..d042a7e 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);
     }
 }
 
-- 
2.20.1






More information about the pve-devel mailing list