summary refs log tree commit diff stats
path: root/python/qemu/machine/machine.py
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2023-05-17 12:34:05 -0400
committerJohn Snow <jsnow@redhat.com>2023-05-31 16:25:35 -0400
commit5bbc5936bb5b973848cbcabcc19346ffa812ae06 (patch)
tree3e84ebdd7026086d673e19ad8ea1485d9022e1c7 /python/qemu/machine/machine.py
parent7f5f3ae7d589d9297b2903e79cba1492807883d4 (diff)
downloadfocaccia-qemu-5bbc5936bb5b973848cbcabcc19346ffa812ae06.tar.gz
focaccia-qemu-5bbc5936bb5b973848cbcabcc19346ffa812ae06.zip
python/qmp/legacy: remove open_with_socket() calls
Favor using connect() when passing a socket instead of
open_with_socket(). Simultaneously, update constructor calls to use the
combined address argument for QEMUMonitorProtocol().

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20230517163406.2593480-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python/qemu/machine/machine.py')
-rw-r--r--python/qemu/machine/machine.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index cc636cb6bd..c16a0b6fed 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -337,16 +337,17 @@ class QEMUMachine:
             self._remove_files.append(self._console_address)
 
         if self._qmp_set:
-            sock = None
             if self._monitor_address is None:
                 self._sock_pair = socket.socketpair()
                 sock = self._sock_pair[1]
             if isinstance(self._monitor_address, str):
                 self._remove_files.append(self._monitor_address)
 
+            sock_or_addr = self._monitor_address or sock
+            assert sock_or_addr is not None
+
             self._qmp_connection = QEMUMonitorProtocol(
-                address=self._monitor_address,
-                sock=sock,
+                sock_or_addr,
                 server=bool(self._monitor_address),
                 nickname=self._name
             )