qemu: migration: Properly check for live VM after qemuDomainObjWait()

Similarly to the one change in commit 4d1a1fdffda19a62d62fa2457d162362
we should be checking that the VM is not being yet destroyed if we've
invoked qemuDomainObjWait().

Use the new helper qemuDomainObjIsActive().

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2024-06-13 16:15:58 +02:00
parent 9eb33b7f03
commit a52e125d56

View File

@ -2058,7 +2058,6 @@ qemuMigrationSrcWaitForCompletion(virDomainObj *vm,
virConnectPtr dconn, virConnectPtr dconn,
unsigned int flags) unsigned int flags)
{ {
qemuDomainObjPrivate *priv = vm->privateData;
virDomainJobData *jobData = vm->job->current; virDomainJobData *jobData = vm->job->current;
int rv; int rv;
@ -2069,7 +2068,7 @@ qemuMigrationSrcWaitForCompletion(virDomainObj *vm,
return rv; return rv;
if (qemuDomainObjWait(vm) < 0) { if (qemuDomainObjWait(vm) < 0) {
if (virDomainObjIsActive(vm) && !priv->beingDestroyed) if (qemuDomainObjIsActive(vm))
jobData->status = VIR_DOMAIN_JOB_STATUS_FAILED; jobData->status = VIR_DOMAIN_JOB_STATUS_FAILED;
return -2; return -2;
} }
@ -5055,7 +5054,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
error: error:
virErrorPreserveLast(&orig_err); virErrorPreserveLast(&orig_err);
if (virDomainObjIsActive(vm)) { if (qemuDomainObjIsActive(vm)) {
int reason; int reason;
virDomainState state = virDomainObjGetState(vm, &reason); virDomainState state = virDomainObjGetState(vm, &reason);
@ -6781,7 +6780,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver,
* overwrites it. */ * overwrites it. */
virErrorPreserveLast(&orig_err); virErrorPreserveLast(&orig_err);
if (virDomainObjIsActive(vm)) { if (qemuDomainObjIsActive(vm)) {
if (doKill) { if (doKill) {
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
VIR_ASYNC_JOB_MIGRATION_IN, VIR_ASYNC_JOB_MIGRATION_IN,
@ -6805,7 +6804,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver,
jobPriv->migParams, vm->job->apiFlags); jobPriv->migParams, vm->job->apiFlags);
} }
if (!virDomainObjIsActive(vm)) if (!qemuDomainObjIsActive(vm))
qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM, false); qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM, false);
virErrorRestore(&orig_err); virErrorRestore(&orig_err);
@ -7050,7 +7049,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
virErrorPreserveLast(&orig_err); virErrorPreserveLast(&orig_err);
/* Restore max migration bandwidth */ /* Restore max migration bandwidth */
if (virDomainObjIsActive(vm)) { if (qemuDomainObjIsActive(vm)) {
if (qemuMigrationParamsSetULL(migParams, if (qemuMigrationParamsSetULL(migParams,
QEMU_MIGRATION_PARAM_MAX_BANDWIDTH, QEMU_MIGRATION_PARAM_MAX_BANDWIDTH,
saveMigBandwidth * 1024 * 1024) == 0) saveMigBandwidth * 1024 * 1024) == 0)