提交 ab2eaa14 编写于 作者: N Nikolay Shirokovskiy

qemu: Map suspended state reason to suspended event detail

Map is based on existing cases in code where we send suspended
event after changing domain state to paused.
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
上级 93c7d13e
...@@ -13988,3 +13988,37 @@ qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg, ...@@ -13988,3 +13988,37 @@ qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
return 0; return 0;
} }
virDomainEventSuspendedDetailType
qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason)
{
switch (reason) {
case VIR_DOMAIN_PAUSED_MIGRATION:
return VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED;
case VIR_DOMAIN_PAUSED_FROM_SNAPSHOT:
return VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT;
case VIR_DOMAIN_PAUSED_POSTCOPY_FAILED:
return VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED;
case VIR_DOMAIN_PAUSED_POSTCOPY:
return VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY;
case VIR_DOMAIN_PAUSED_UNKNOWN:
case VIR_DOMAIN_PAUSED_USER:
case VIR_DOMAIN_PAUSED_SAVE:
case VIR_DOMAIN_PAUSED_DUMP:
case VIR_DOMAIN_PAUSED_IOERROR:
case VIR_DOMAIN_PAUSED_WATCHDOG:
case VIR_DOMAIN_PAUSED_SHUTTING_DOWN:
case VIR_DOMAIN_PAUSED_SNAPSHOT:
case VIR_DOMAIN_PAUSED_CRASHED:
case VIR_DOMAIN_PAUSED_STARTING_UP:
case VIR_DOMAIN_PAUSED_LAST:
break;
}
return VIR_DOMAIN_EVENT_SUSPENDED_PAUSED;
}
...@@ -1118,4 +1118,7 @@ int ...@@ -1118,4 +1118,7 @@ int
qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg, qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
virDomainDefPtr def); virDomainDefPtr def);
virDomainEventSuspendedDetailType
qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason);
#endif /* LIBVIRT_QEMU_DOMAIN_H */ #endif /* LIBVIRT_QEMU_DOMAIN_H */
...@@ -647,7 +647,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED, ...@@ -647,7 +647,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virQEMUDriverPtr driver = opaque; virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL; virObjectEventPtr event = NULL;
virDomainPausedReason reason; virDomainPausedReason reason;
virDomainEventSuspendedDetailType detail = VIR_DOMAIN_EVENT_SUSPENDED_PAUSED; virDomainEventSuspendedDetailType detail;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
...@@ -658,18 +658,17 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED, ...@@ -658,18 +658,17 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) { if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) {
if (priv->job.current->status == if (priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY)
QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
reason = VIR_DOMAIN_PAUSED_POSTCOPY; reason = VIR_DOMAIN_PAUSED_POSTCOPY;
detail = VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY; else
} else {
reason = VIR_DOMAIN_PAUSED_MIGRATION; reason = VIR_DOMAIN_PAUSED_MIGRATION;
detail = VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED;
}
} }
VIR_DEBUG("Transitioned guest %s to paused state, reason %s", detail = qemuDomainPausedReasonToSuspendedEvent(reason);
vm->def->name, virDomainPausedReasonTypeToString(reason)); VIR_DEBUG("Transitioned guest %s to paused state, "
"reason %s, event detail %d",
vm->def->name, virDomainPausedReasonTypeToString(reason),
detail);
if (priv->job.current) if (priv->job.current)
ignore_value(virTimeMillisNow(&priv->job.current->stopped)); ignore_value(virTimeMillisNow(&priv->job.current->stopped));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册