提交 93c7d13e 编写于 作者: N Nikolay Shirokovskiy

qemu: Pass stop reason from qemuProcessStopCPUs to stop handler

Similar to commit [1] which saves and passes the running reason to
the RESUME event handler, during qemuProcessStopCPUs let's save and pass
the pause reason in the domain private data so that the STOP event
handler can use it.

[1] 5dab984e : qemu: Pass running reason to RESUME event handler
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
上级 b701e45b
......@@ -371,6 +371,10 @@ struct _qemuDomainObjPrivate {
* RESUME event handler to use it */
virDomainRunningReason runningReason;
/* qemuProcessStopCPUs stores the reason for pausing vCPUs here for the
* STOP event handler to use it */
virDomainPausedReason pausedReason;
/* true if libvirt remembers the original owner for files */
bool rememberOwner;
......
......@@ -646,14 +646,17 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
{
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
virDomainPausedReason reason = VIR_DOMAIN_PAUSED_UNKNOWN;
virDomainPausedReason reason;
virDomainEventSuspendedDetailType detail = VIR_DOMAIN_EVENT_SUSPENDED_PAUSED;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectLock(vm);
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
qemuDomainObjPrivatePtr priv = vm->privateData;
reason = priv->pausedReason;
priv->pausedReason = VIR_DOMAIN_PAUSED_UNKNOWN;
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) {
if (priv->job.current->status ==
QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
......@@ -3235,6 +3238,8 @@ int qemuProcessStopCPUs(virQEMUDriverPtr driver,
VIR_FREE(priv->lockState);
priv->pausedReason = reason;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
......@@ -3257,6 +3262,9 @@ int qemuProcessStopCPUs(virQEMUDriverPtr driver,
VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
cleanup:
if (ret < 0)
priv->pausedReason = VIR_DOMAIN_PAUSED_UNKNOWN;
return ret;
}
......@@ -6104,6 +6112,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
priv->monError = false;
priv->monStart = 0;
priv->runningReason = VIR_DOMAIN_RUNNING_UNKNOWN;
priv->pausedReason = VIR_DOMAIN_PAUSED_UNKNOWN;
VIR_DEBUG("Updating guest CPU definition");
if (qemuProcessUpdateGuestCPU(vm->def, priv->qemuCaps, caps, flags) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册