File d6943eab-libxl-pmsuspend-event.patch of Package libvirt.16761

commit 03951b0d1c0c65e50f1766fb0133182dd91282bb
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Tue Aug 13 13:53:59 2019 -0600

    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>

Index: libvirt-5.1.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-5.1.0.orig/src/libxl/libxl_driver.c
+++ libvirt-5.1.0/src/libxl/libxl_driver.c
@@ -1420,6 +1420,7 @@ libxlDomainPMSuspendForDuration(virDomai
     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) {
@@ -1460,6 +1461,10 @@ libxlDomainPMSuspendForDuration(virDomai
         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:
@@ -1467,6 +1472,7 @@ libxlDomainPMSuspendForDuration(virDomai
 
  cleanup:
     virDomainObjEndAPI(&vm);
+    virObjectEventStateQueue(driver->domainEventState, event);
     return ret;
 }
 #endif
openSUSE Build Service is sponsored by