diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 554435e0a9..87de433b22 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -286,7 +286,6 @@ struct _qemuDomainObjPrivate { qemuAgentPtr agent; bool agentError; - bool gotShutdown; bool beingDestroyed; char *pidfile; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9f71641dfa..09e04b8544 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4748,7 +4748,8 @@ processMonitorEOFEvent(virQEMUDriverPtr driver, goto endjob; } - if (priv->monJSON && !priv->gotShutdown) { + if (priv->monJSON && + virDomainObjGetState(vm, NULL) != VIR_DOMAIN_SHUTDOWN) { VIR_DEBUG("Monitor connection to '%s' closed without SHUTDOWN event; " "assuming the domain crashed", vm->def->name); eventReason = VIR_DOMAIN_EVENT_STOPPED_FAILED; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index fc02c4779e..1850923914 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -491,7 +491,6 @@ qemuProcessFakeReboot(void *opaque) "%s", _("resume operation failed")); goto endjob; } - priv->gotShutdown = false; if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) { VIR_WARN("Unable to save status on vm %s after state change", @@ -578,7 +577,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virObjectLock(vm); priv = vm->privateData; - if (priv->gotShutdown) { + if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_SHUTDOWN) { VIR_DEBUG("Ignoring repeated SHUTDOWN event from domain %s", vm->def->name); goto unlock; @@ -587,7 +586,6 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED, vm->def->name); goto unlock; } - priv->gotShutdown = true; VIR_DEBUG("Transitioned guest %s to shutdown state", vm->def->name); @@ -5980,7 +5978,6 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, priv->monJSON = true; priv->monError = false; priv->monStart = 0; - priv->gotShutdown = false; priv->runningReason = VIR_DOMAIN_RUNNING_UNKNOWN; VIR_DEBUG("Updating guest CPU definition"); @@ -7394,8 +7391,6 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, monConfig = NULL; priv->monJSON = monJSON; - priv->gotShutdown = false; - /* Attaching to running QEMU so we need to detect whether it was started * with -no-reboot. */ qemuProcessPrepareAllowReboot(vm);