]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
python: backport 'kick event queue on legacy event_pull()'
authorJohn Snow <jsnow@redhat.com>
Tue, 3 May 2022 18:07:10 +0000 (14:07 -0400)
committerJohn Snow <jsnow@redhat.com>
Mon, 15 Sep 2025 18:36:01 +0000 (14:36 -0400)
This corrects an oversight in qmp-shell operation where new events will
not accumulate in the event queue when pressing "enter" with an empty
command buffer, so no new events show up.

Reported-by: Jag Raman <jag.raman@oracle.com>
Signed-off-by: John Snow <jsnow@redhat.com>
cherry picked from commit python-qemu-qmp@0443582d16cf9efd52b2c41a7b5be7af42c856cd
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
python/qemu/qmp/legacy.py

index 22a2b5616efa5d32e86d2c61fe56cf3034cec2a6..c8d0a29b56fe03bc230befec986595a6402fe38b 100644 (file)
@@ -231,6 +231,9 @@ class QEMUMonitorProtocol:
 
         :return: The first available QMP event, or None.
         """
+        # Kick the event loop to allow events to accumulate
+        self._sync(asyncio.sleep(0))
+
         if not wait:
             # wait is False/0: "do not wait, do not except."
             if self._qmp.events.empty():