mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-14 08:35:15 +00:00
Check for qemu guest agent availability after getting the job
This way checks requiring the job can be done in qemuDomainAgentAvailable. (cherry picked from commit c8b80b49f6db277eee1bf6caf9ff9cb8ffd91dfd)
This commit is contained in:
parent
5939f52a95
commit
99680243f6
@ -1988,16 +1988,16 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
|
|||||||
if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
|
if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
agentForced = agentRequested && !acpiRequested;
|
agentForced = agentRequested && !acpiRequested;
|
||||||
if (!qemuDomainAgentAvailable(priv, agentForced)) {
|
if (!qemuDomainAgentAvailable(priv, agentForced)) {
|
||||||
if (agentForced)
|
if (agentForced)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
useAgent = false;
|
useAgent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
@ -2086,9 +2086,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
|
|||||||
priv->agent))
|
priv->agent))
|
||||||
useAgent = true;
|
useAgent = true;
|
||||||
|
|
||||||
if (useAgent && !qemuDomainAgentAvailable(priv, true)) {
|
if (!useAgent) {
|
||||||
goto cleanup;
|
|
||||||
} else {
|
|
||||||
#if WITH_YAJL
|
#if WITH_YAJL
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
|
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
|
||||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
|
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
|
||||||
@ -2109,6 +2107,9 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
|
|||||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (useAgent && !qemuDomainAgentAvailable(priv, true))
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
@ -17659,12 +17660,12 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qemuDomainAgentAvailable(priv, true))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!qemuDomainAgentAvailable(priv, true))
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
@ -17779,12 +17780,12 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qemuDomainAgentAvailable(priv, true))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!qemuDomainAgentAvailable(priv, true))
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
@ -17888,12 +17889,12 @@ qemuDomainFSTrim(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qemuDomainAgentAvailable(priv, true))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!qemuDomainAgentAvailable(priv, true))
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user