On Wed, Dec 11, 2019 at 01:55:35PM -0500, Wainer dos Santos Moschetta wrote: > The QEMUMachine VM has a monitor setup on which an QMP > connection is always attempted on _post_launch() (executed > by launch()). In case the QEMU process immediatly exits > then the qmp.accept() (used to establish the connection) stalls > until it reaches timeout and consequently an exception raises. > > That behavior is undesirable when, for instance, it needs to > gather information from the QEMU binary ($ qemu -cpu list) or a > test which launches the VM expecting its failure. > > This patch adds the set_qmp_monitor() method to QEMUMachine that > allows turn off the creation of the monitor machinery on VM launch. > > Signed-off-by: Wainer dos Santos Moschetta > Reviewed-by: Cleber Rosa > --- > python/qemu/machine.py | 66 +++++++++++++++++++++++++++--------------- > 1 file changed, 43 insertions(+), 23 deletions(-) > > diff --git a/python/qemu/machine.py b/python/qemu/machine.py > index a4631d6934..7d4d621a42 100644 > --- a/python/qemu/machine.py > +++ b/python/qemu/machine.py > @@ -104,6 +104,7 @@ class QEMUMachine(object): > self._events = [] > self._iolog = None > self._socket_scm_helper = socket_scm_helper > + self._qmp_set = True # Enable QMP monitor by default. > self._qmp = None > self._qemu_full_args = None > self._test_dir = test_dir > @@ -228,15 +229,16 @@ class QEMUMachine(object): > self._iolog = iolog.read() > > def _base_args(self): > - if isinstance(self._monitor_address, tuple): > - moncdev = "socket,id=mon,host=%s,port=%s" % ( > + args = ['-display', 'none', '-vga', 'none'] > + if self._qmp_set: > + if isinstance(self._monitor_address, tuple): > + moncdev = "socket,id=mon,host=%s,port=%s" % ( > self._monitor_address[0], > self._monitor_address[1]) One thing I missed in my review on v1 was this now became badly indented. No worries, it's a minor issue that I can fix on my side when queueing this patch. - Cleber.