[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/2] 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 <jfehlig suse com>
---
 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
-- 
2.22.0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]