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