From d6943eab142a1a530eb719979ea915b7768489f1 Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Tue, 13 Aug 2019 13:53:59 -0600 Subject: [PATCH] libxl: send lifecycle event on PMSuspend After a successful call to libxl_domain_suspend_only(), set domain state to VIR_DOMAIN_PMSUSPENDED and send lifecycle event. Signed-off-by: Jim Fehlig Reviewed-by: Daniel Henrique Barboza --- src/libxl/libxl_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 2a9db026bb..d0396e4781 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1434,6 +1434,7 @@ libxlDomainPMSuspendForDuration(virDomainPtr dom, int ret = -1; libxlDriverPrivatePtr driver = dom->conn->privateData; libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); + virObjectEventPtr event = NULL; virCheckFlags(0, -1); if (target != VIR_NODE_SUSPEND_TARGET_MEM) { @@ -1474,6 +1475,10 @@ libxlDomainPMSuspendForDuration(virDomainPtr dom, goto endjob; } + virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED, VIR_DOMAIN_PMSUSPENDED_UNKNOWN); + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_PMSUSPENDED, + VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY); + ret = 0; endjob: @@ -1481,6 +1486,7 @@ libxlDomainPMSuspendForDuration(virDomainPtr dom, cleanup: virDomainObjEndAPI(&vm); + virObjectEventStateQueue(driver->domainEventState, event); return ret; } #endif -- GitLab