Map is based on existing cases in code where we send suspended event after changing domain state to paused. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- src/qemu/qemu_domain.c | 34 ++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_process.c | 9 ++++++--- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f00f1b3..557743b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -13558,3 +13558,37 @@ qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason) return VIR_DOMAIN_EVENT_RESUMED_UNPAUSED; } + + +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; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 380ea14..ee88266 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1093,4 +1093,7 @@ void qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv); virDomainEventResumedDetailType qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason); +virDomainEventSuspendedDetailType +qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason); + #endif /* __QEMU_DOMAIN_H__ */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 27021b9..6858377 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -642,7 +642,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; @@ -668,8 +668,11 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED, } } - 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)); -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list