From: Thomas Lamprecht Date: Sat, 30 Mar 2019 08:36:30 +0000 (+0100) Subject: drive mirror: cleanup exception handling code a bit X-Git-Url: https://git.proxmox.com/?p=qemu-server.git;a=commitdiff_plain;h=6dde5ea273c9a62f5a0924a2e99a27a9fdfc2292 drive mirror: cleanup exception handling code a bit Signed-off-by: Thomas Lamprecht --- diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index e60aa28..fd854c4 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -6757,11 +6757,12 @@ sub qemu_drive_mirror { 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) }; - die "mirroring error: $err"; + warn "$@\n" if $@; + die "mirroring error: $err\n"; } qemu_drive_mirror_monitor ($vmid, $vmiddst, $jobs, $skipcomplete, $qga);