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

[libvirt] [PATCH 10/11] qemu: Update domain state to pmsuspended while suspend event occurs



---
 src/qemu/qemu_process.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d55c269..e041f8d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1092,6 +1092,19 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virDomainObjLock(vm);
     event = virDomainEventPMSuspendNewFromObj(vm);
 
+    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
+        VIR_DEBUG("Transitioned guest %s to pmsuspended state due to "
+                  "QMP suspend event", vm->def->name);
+
+        virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+                             VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+
+        if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
+            VIR_WARN("Unable to save status on vm %s after suspend event",
+                     vm->def->name);
+        }
+    }
+
     virDomainObjUnlock(vm);
 
     if (event) {
-- 
1.7.1


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