qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] python/machine: QEMUMachine reopen_qmp_connection
@ 2023-02-07 19:03 Steve Sistare
  2023-02-07 20:28 ` John Snow
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Sistare @ 2023-02-07 19:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Steve Sistare

Provide reopen_qmp_connection() to reopen a closed monitor connection.
This will be needed by cpr, because qemu exec closes the monitor socket.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: John Snow <jsnow@redhat.com>
---
 python/qemu/machine/machine.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index ef94dcf..557209a 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -501,6 +501,16 @@ def _close_qmp_connection(self) -> None:
         finally:
             self._qmp_connection = None
 
+    def reopen_qmp_connection(self) -> None:
+        """Close and re-open the QMP connection."""
+        self._close_qmp_connection()
+        self._qmp_connection = QEMUMonitorProtocol(
+            self._monitor_address,
+            server=True,
+            nickname=self._name
+        )
+        self._qmp.accept(self._qmp_timer)
+
     def _early_cleanup(self) -> None:
         """
         Perform any cleanup that needs to happen before the VM exits.
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-07 21:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07 19:03 [PATCH V2] python/machine: QEMUMachine reopen_qmp_connection Steve Sistare
2023-02-07 20:28 ` John Snow
2023-02-07 21:04   ` Steven Sistare
2023-02-07 21:23     ` John Snow
2023-02-07 21:32       ` Steven Sistare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).