mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
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: John Ferlan <jferlan@redhat.com> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
This commit is contained in:
parent
93c7d13eec
commit
ab2eaa1492
@ -13988,3 +13988,37 @@ qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
|
||||
|
||||
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
|
||||
qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
|
||||
virDomainDefPtr def);
|
||||
|
||||
virDomainEventSuspendedDetailType
|
||||
qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason);
|
||||
|
||||
#endif /* LIBVIRT_QEMU_DOMAIN_H */
|
||||
|
@ -647,7 +647,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
virQEMUDriverPtr driver = opaque;
|
||||
virObjectEventPtr event = NULL;
|
||||
virDomainPausedReason reason;
|
||||
virDomainEventSuspendedDetailType detail = VIR_DOMAIN_EVENT_SUSPENDED_PAUSED;
|
||||
virDomainEventSuspendedDetailType detail;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
@ -658,18 +658,17 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
|
||||
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) {
|
||||
if (priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY)
|
||||
reason = VIR_DOMAIN_PAUSED_POSTCOPY;
|
||||
detail = VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY;
|
||||
} else {
|
||||
else
|
||||
reason = VIR_DOMAIN_PAUSED_MIGRATION;
|
||||
detail = VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED;
|
||||
}
|
||||
}
|
||||
|
||||
VIR_DEBUG("Transitioned guest %s to paused state, reason %s",
|
||||
vm->def->name, virDomainPausedReasonTypeToString(reason));
|
||||
detail = qemuDomainPausedReasonToSuspendedEvent(reason);
|
||||
VIR_DEBUG("Transitioned guest %s to paused state, "
|
||||
"reason %s, event detail %d",
|
||||
vm->def->name, virDomainPausedReasonTypeToString(reason),
|
||||
detail);
|
||||
|
||||
if (priv->job.current)
|
||||
ignore_value(virTimeMillisNow(&priv->job.current->stopped));
|
||||
|
Loading…
x
Reference in New Issue
Block a user