99cbc7
From 12fe6020638d011daf9772cc822c28b55d662310 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <12fe6020638d011daf9772cc822c28b55d662310@dist-git>
99cbc7
From: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Date: Wed, 7 Nov 2018 14:34:52 +0100
99cbc7
Subject: [PATCH] qemu: Don't ignore resume events
99cbc7
99cbc7
Since commit v4.7.0-302-ge6d77a75c4 processing RESUME event is mandatory
99cbc7
for updating domain state. But the event handler explicitly ignored this
99cbc7
event in some cases. Thus the state would be wrong after a fake reboot
99cbc7
or when a domain was rebooted after it crashed.
99cbc7
99cbc7
BTW, the code to ignore RESUME event after SHUTDOWN didn't make sense
99cbc7
even before making RESUME event mandatory. Most likely it was there as a
99cbc7
result of careless copy&paste from qemuProcessHandleStop.
99cbc7
99cbc7
The corresponding debug message was clarified since the original state
99cbc7
does not have to be "paused" only and while we have a "resumed" event,
99cbc7
the state is called "running".
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1612943
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
(cherry picked from commit e47949357ba268e7e8c3adea7c262b84fa002302)
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1634759
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1634758
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1643338
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Reviewed-by: Erik Skultety <eskultet@redhat.com>
99cbc7
---
99cbc7
 src/qemu/qemu_process.c | 12 +++---------
99cbc7
 1 file changed, 3 insertions(+), 9 deletions(-)
99cbc7
99cbc7
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
99cbc7
index 2d51c0fa25..9b5cb93325 100644
99cbc7
--- a/src/qemu/qemu_process.c
99cbc7
+++ b/src/qemu/qemu_process.c
99cbc7
@@ -699,15 +699,10 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
99cbc7
         priv->runningReason = VIR_DOMAIN_RUNNING_UNKNOWN;
99cbc7
     }
99cbc7
 
99cbc7
-    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
99cbc7
-        if (priv->gotShutdown) {
99cbc7
-            VIR_DEBUG("Ignoring RESUME event after SHUTDOWN");
99cbc7
-            goto unlock;
99cbc7
-        }
99cbc7
-
99cbc7
+    if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
99cbc7
         eventDetail = qemuDomainRunningReasonToResumeEvent(reason);
99cbc7
-        VIR_DEBUG("Transitioned guest %s out of paused into resumed state, "
99cbc7
-                  "reason '%s', event detail %d",
99cbc7
+        VIR_DEBUG("Transitioned guest %s into running state, reason '%s', "
99cbc7
+                  "event detail %d",
99cbc7
                   vm->def->name, virDomainRunningReasonTypeToString(reason),
99cbc7
                   eventDetail);
99cbc7
 
99cbc7
@@ -722,7 +717,6 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
99cbc7
         }
99cbc7
     }
99cbc7
 
99cbc7
- unlock:
99cbc7
     virObjectUnlock(vm);
99cbc7
     virObjectEventStateQueue(driver->domainEventState, event);
99cbc7
     virObjectUnref(cfg);
99cbc7
-- 
99cbc7
2.21.0
99cbc7