]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Don't ignore resume events
authorJiri Denemark <jdenemar@redhat.com>
Wed, 7 Nov 2018 13:34:52 +0000 (14:34 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 8 Nov 2018 08:08:58 +0000 (09:08 +0100)
Since commit v4.7.0-302-ge6d77a75c4 processing RESUME event is mandatory
for updating domain state. But the event handler explicitly ignored this
event in some cases. Thus the state would be wrong after a fake reboot
or when a domain was rebooted after it crashed.

BTW, the code to ignore RESUME event after SHUTDOWN didn't make sense
even before making RESUME event mandatory. Most likely it was there as a
result of careless copy&paste from qemuProcessHandleStop.

The corresponding debug message was clarified since the original state
does not have to be "paused" only and while we have a "resumed" event,
the state is called "running".

https://bugzilla.redhat.com/show_bug.cgi?id=1612943

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_process.c

index 3bf84834ecea35b6af1b819f60bb379aee912cf3..06a65b44e4abbc698c56501e6da9a3f2c1b3721a 100644 (file)
@@ -719,15 +719,10 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
         priv->runningReason = VIR_DOMAIN_RUNNING_UNKNOWN;
     }
 
-    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
-        if (priv->gotShutdown) {
-            VIR_DEBUG("Ignoring RESUME event after SHUTDOWN");
-            goto unlock;
-        }
-
+    if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
         eventDetail = qemuDomainRunningReasonToResumeEvent(reason);
-        VIR_DEBUG("Transitioned guest %s out of paused into resumed state, "
-                  "reason '%s', event detail %d",
+        VIR_DEBUG("Transitioned guest %s into running state, reason '%s', "
+                  "event detail %d",
                   vm->def->name, virDomainRunningReasonTypeToString(reason),
                   eventDetail);
 
@@ -742,7 +737,6 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
         }
     }
 
- unlock:
     virObjectUnlock(vm);
     virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);