]> git.proxmox.com Git - qemu-server.git/commitdiff
drive mirror: cleanup exception handling code a bit
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 30 Mar 2019 08:36:30 +0000 (09:36 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 30 Mar 2019 08:36:30 +0000 (09:36 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm

index e60aa286ffe9dc2ce15a8742f76031e8dd87adc1..fd854c4e1a984897b79f7e062773ead17bb9b97a 100644 (file)
@@ -6757,11 +6757,12 @@ sub qemu_drive_mirror {
 
     print "drive mirror is starting for drive-$drive\n";
 
 
     print "drive mirror is starting for drive-$drive\n";
 
-    eval { vm_mon_cmd($vmid, "drive-mirror", %$opts); }; #if a job already run for this device,it's throw an error
-
+    # if a job already runs for this device we get an error, catch it for cleanup
+    eval { vm_mon_cmd($vmid, "drive-mirror", %$opts); };
     if (my $err = $@) {
        eval { PVE::QemuServer::qemu_blockjobs_cancel($vmid, $jobs) };
     if (my $err = $@) {
        eval { PVE::QemuServer::qemu_blockjobs_cancel($vmid, $jobs) };
-       die "mirroring error: $err";
+       warn "$@\n" if $@;
+       die "mirroring error: $err\n";
     }
 
     qemu_drive_mirror_monitor ($vmid, $vmiddst, $jobs, $skipcomplete, $qga);
     }
 
     qemu_drive_mirror_monitor ($vmid, $vmiddst, $jobs, $skipcomplete, $qga);