The gotShutdown bool has been redundant since we started setting VIR_DOMAIN_SHUTDOWN state after receiving SHUTDOWN event from QEMU. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_domain.h | 1 - src/qemu/qemu_driver.c | 3 ++- src/qemu/qemu_process.c | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 80bd4bde91..63d645a31a 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 a52e2495d5..cc7fde0695 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 820d90aef7..0f74d72490 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); -- 2.19.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list