]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: process: Terminate backup job on VM destroy
authorPeter Krempa <pkrempa@redhat.com>
Fri, 20 Dec 2019 10:20:24 +0000 (11:20 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 6 Jan 2020 09:15:36 +0000 (10:15 +0100)
Commit d75f865fb989b3e6330c78c28e1c3bf7fa28e6a5 caused a job-deadlock if
a VM is running the backup job and being destroyed as it removed the
cleanup of the async job type and there was nothing to clean up the
backup job.

Add an explicit cleanup of the backup job when destroying a VM.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_backup.c
src/qemu/qemu_backup.h
src/qemu/qemu_process.c

index 04c07dfaaf158541574a60326cbdc44aba4361c8..c0445e0869434bb14aa924e7fbdc07329b494695 100644 (file)
@@ -604,7 +604,7 @@ qemuBackupBeginCollectIncrementalCheckpoints(virDomainObjPtr vm,
 }
 
 
-static void
+void
 qemuBackupJobTerminate(virDomainObjPtr vm,
                        qemuDomainJobStatus jobstatus)
 
index 1b8a03612c2a64ada2fe5e415b39e67f8cbce982..3321ba0b6f25c291058dbb84e2fc617c980ccc23 100644 (file)
@@ -42,6 +42,9 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
                             unsigned long long end,
                             int asyncJob);
 
+void
+qemuBackupJobTerminate(virDomainObjPtr vm,
+                       qemuDomainJobStatus jobstatus);
 
 int
 qemuBackupGetJobInfoStats(virQEMUDriverPtr driver,
index 0a886378cd972e7cfb061bac07e9898372a8e7fd..1e128d1d839d072f57947176c843d89164de2daa 100644 (file)
@@ -57,6 +57,7 @@
 #include "qemu_security.h"
 #include "qemu_extdevice.h"
 #include "qemu_firmware.h"
+#include "qemu_backup.h"
 
 #include "cpu/cpu.h"
 #include "cpu/cpu_x86.h"
@@ -7504,6 +7505,10 @@ void qemuProcessStop(virQEMUDriverPtr driver,
         virResctrlAllocRemove(vm->def->resctrls[i]->alloc);
     }
 
+    /* clean up a possible backup job */
+    if (priv->backup)
+        qemuBackupJobTerminate(vm, QEMU_DOMAIN_JOB_STATUS_CANCELED);
+
     qemuProcessRemoveDomainStatus(driver, vm);
 
     /* Remove VNC and Spice ports from port reservation bitmap, but only if