summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2023-09-28 00:49:38 -0400
committerJohn Snow <jsnow@redhat.com>2023-10-11 16:02:02 -0400
commit91e11db7bcc486db2dc2bdab94ac5de62c02ce9a (patch)
tree6ea36cccb9e0249a56fbaebb56b790af501ab4d1
parenta51e5124a655b3dad80b36b18547cb1eca2c5eb2 (diff)
downloadfocaccia-qemu-91e11db7bcc486db2dc2bdab94ac5de62c02ce9a.tar.gz
focaccia-qemu-91e11db7bcc486db2dc2bdab94ac5de62c02ce9a.zip
python/machine: move socket setup out of _base_args property
This property isn't meant to do much else besides return a list of
strings, so move this setup back out into _pre_launch().

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20230928044943.849073-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
-rw-r--r--python/qemu/machine/machine.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 35d5a672db..345610d6e4 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -301,9 +301,7 @@ class QEMUMachine:
 
         if self._qmp_set:
             if self._sock_pair:
-                fd = self._sock_pair[0].fileno()
-                os.set_inheritable(fd, True)
-                moncdev = f"socket,id=mon,fd={fd}"
+                moncdev = f"socket,id=mon,fd={self._sock_pair[0].fileno()}"
             elif isinstance(self._monitor_address, tuple):
                 moncdev = "socket,id=mon,host={},port={}".format(
                     *self._monitor_address
@@ -340,6 +338,7 @@ class QEMUMachine:
         if self._qmp_set:
             if self._monitor_address is None:
                 self._sock_pair = socket.socketpair()
+                os.set_inheritable(self._sock_pair[0].fileno(), True)
                 sock = self._sock_pair[1]
             if isinstance(self._monitor_address, str):
                 self._remove_files.append(self._monitor_address)