]> git.proxmox.com Git - qemu-server.git/commitdiff
live-restore: don't remove VM on error
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 21 Apr 2021 14:25:24 +0000 (16:25 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Apr 2021 15:46:05 +0000 (17:46 +0200)
Potentially an admin can still recover some data, or wants to inspect
the state.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
PVE/QemuServer.pm

index fec2edbf1115c0967de34df3a3aec4f1be32f6d2..d042a7e241bd959aa0d2a7c2140ddf7e85caa8d5 100644 (file)
@@ -6386,28 +6386,17 @@ sub restore_proxmox_backup_archive {
     PVE::AccessControl::add_vm_to_pool($vmid, $options->{pool}) if $options->{pool};
 
     if ($options->{live}) {
     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"; };
-
-           my $conf = PVE::QemuConfig->load_config($vmid);
-           die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf);
+       # enable interrupts
+       local $SIG{INT} =
+           local $SIG{TERM} =
+           local $SIG{QUIT} =
+           local $SIG{HUP} =
+           local $SIG{PIPE} = sub { die "got signal ($!) - abort\n"; };
 
 
-           pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
-       };
+       my $conf = PVE::QemuConfig->load_config($vmid);
+       die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf);
 
 
-       $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);
     }
 }
 
     }
 }