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(a)redhat.com>
---
src/qemu/qemu_backup.c | 2 +-
src/qemu/qemu_backup.h | 3 +++
src/qemu/qemu_process.c | 5 +++++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index 1381505d9f..3bac6b353c 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -604,7 +604,7 @@ qemuBackupBeginCollectIncrementalCheckpoints(virDomainObjPtr vm,
}
-static void
+void
qemuBackupJobTerminate(virDomainObjPtr vm,
qemuDomainJobStatus jobstatus)
diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h
index 1b8a03612c..3321ba0b6f 100644
--- a/src/qemu/qemu_backup.h
+++ b/src/qemu/qemu_backup.h
@@ -42,6 +42,9 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
unsigned long long end,
int asyncJob);
+void
+qemuBackupJobTerminate(virDomainObjPtr vm,
+ qemuDomainJobStatus jobstatus);
int
qemuBackupGetJobInfoStats(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e6c6c0bee2..3b036ac4bc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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"
@@ -7609,6 +7610,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
--
2.23.0