render / rpms / libvirt

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