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