diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f9bf32c61d..78df7d1bf5 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3076,6 +3076,13 @@ qemuDomainAgentAvailable(virDomainObjPtr vm, { qemuDomainObjPrivatePtr priv = vm->privateData; + if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { + if (reportError) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); + } + return false; + } if (priv->agentError) { if (reportError) { virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", @@ -3099,13 +3106,6 @@ qemuDomainAgentAvailable(virDomainObjPtr vm, return false; } } - if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { - if (reportError) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); - } - return false; - } return true; }