qemu: Drop priv->gotShutdown

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@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Jiri Denemark 2018-11-07 14:40:57 +01:00
parent 294397b63b
commit 03abfd2a6e
3 changed files with 3 additions and 8 deletions

View File

@ -286,7 +286,6 @@ struct _qemuDomainObjPrivate {
qemuAgentPtr agent;
bool agentError;
bool gotShutdown;
bool beingDestroyed;
char *pidfile;

View File

@ -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;

View File

@ -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);