const char *auditReason = "shutdown";
unsigned int stopFlags = 0;
virObjectEvent *event = NULL;
+ bool migration;
if (vm->def->id != domid) {
VIR_DEBUG("Domain %s was restarted, ignoring EOF",
if (qemuProcessBeginStopJob(vm, VIR_JOB_DESTROY, true) < 0)
return;
+ migration = vm->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_IN;
+
if (!virDomainObjIsActive(vm)) {
VIR_DEBUG("Domain %p '%s' is not active, ignoring EOF",
vm, vm->def->name);
auditReason = "failed";
}
- if (vm->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_IN) {
+ if (migration) {
stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
qemuMigrationDstErrorSave(driver, vm->def->name,
qemuMonitorLastError(priv->mon));
virObjectEventStateQueue(driver->domainEventState, event);
endjob:
- qemuDomainRemoveInactive(driver, vm, 0, false);
+ qemuDomainRemoveInactive(driver, vm, 0, migration);
qemuProcessEndStopJob(vm);
}
* and there is no 'goto cleanup;' in the middle of those */
VIR_FREE(priv->origname);
virDomainObjRemoveTransientDef(vm);
- qemuDomainRemoveInactive(driver, vm, 0, false);
+ qemuDomainRemoveInactive(driver, vm, 0, true);
}
virDomainObjEndAPI(&vm);
virErrorRestore(&origErr);
}
if (!qemuDomainObjIsActive(vm))
- qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM, false);
+ qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM, true);
virErrorRestore(&orig_err);
return NULL;
qemuMigrationJobFinish(vm);
if (!virDomainObjIsActive(vm))
- qemuDomainRemoveInactive(driver, vm, 0, false);
+ qemuDomainRemoveInactive(driver, vm, 0, true);
}
size_t i;
g_autofree char *timestamp = NULL;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
- bool outgoingMigration;
VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%lld, "
"reason=%s, asyncJob=%s, flags=0x%x",
qemuDomainCleanupRun(driver, vm);
- outgoingMigration = (flags & VIR_QEMU_PROCESS_STOP_MIGRATED) &&
- (asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT);
-
- qemuExtDevicesStop(driver, vm, outgoingMigration);
+ qemuExtDevicesStop(driver, vm, !!(flags & VIR_QEMU_PROCESS_STOP_MIGRATED));
qemuDBusStop(driver, vm);
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
- qemuDomainRemoveInactive(driver, dom, 0, false);
+ qemuDomainRemoveInactive(driver, dom, 0, !!(stopFlags & VIR_QEMU_PROCESS_STOP_MIGRATED));
qemuProcessEndStopJob(dom);