qemu: process: Terminate backup job on VM destroy

Commit d75f865fb9 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>
This commit is contained in:
Peter Krempa 2019-12-20 11:20:24 +01:00
parent bc8b159cb1
commit 5632ed8bad
3 changed files with 9 additions and 1 deletions

View File

@ -604,7 +604,7 @@ qemuBackupBeginCollectIncrementalCheckpoints(virDomainObjPtr vm,
}
static void
void
qemuBackupJobTerminate(virDomainObjPtr vm,
qemuDomainJobStatus jobstatus)

View File

@ -42,6 +42,9 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
unsigned long long end,
int asyncJob);
void
qemuBackupJobTerminate(virDomainObjPtr vm,
qemuDomainJobStatus jobstatus);
int
qemuBackupGetJobInfoStats(virQEMUDriverPtr driver,

View 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