From: Caio Carrara <ccarrara@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Wainer dos Santos Moschetta <wainersm@redhat.com>,
qemu-devel@nongnu.org, crosa@redhat.com, philmd@redhat.com
Subject: Re: [Qemu-devel] [PATCH] scripts/qemu.py: allow to launch the VM without a monitor
Date: Wed, 21 Nov 2018 13:56:00 -0200 [thread overview]
Message-ID: <20181121155559.GB32503@localhost.localdomain> (raw)
In-Reply-To: <20181120190238.GR4755@habkost.net>
Hello Wainer and Eduardo,
On Tue, Nov 20, 2018 at 05:02:38PM -0200, Eduardo Habkost wrote:
> On Tue, Nov 20, 2018 at 11:53:00AM -0500, Wainer dos Santos Moschetta wrote:
> > QEMUMachine launches the VM with a monitor enabled, afterwards
> > a qmp connection is attempted on _post_launch(). In case
> > the QEMU process exits with an error, qmp.accept() reaches
> > timeout and raises an exception.
> >
> > But sometimes you don't need that monitor. As an example,
> > when a test launches the VM expects its immediate crash,
> > and only intend to check the process's return code. In this
> > case the fact that launch() tries to establish the qmp
> > connection (ending up in an exception) is troublesome.
> >
> > So this patch adds the disable_qmp() that allow to
> > launch the VM without creating the monitor machinery.
> >
{...}
> > +
> > + self._args.extend(['-chardev', moncdev, '-mon', 'chardev=mon,mode=control'])
>
> This will extend self._args multiple times if making a
> .shutdown()/.launch() cycle:
>
{...}
>
> Why did you move this code outside _base_args(), where it already
> worked without relying on method side-effects and required no
> extra state to be kept inside self._args?
Eduardo, I think the purpose was to get a way to set up the monitor
conditionally. So the arguments related with monitor was moved out
_base_args() method and put into the _setup_qmp(). However, as you
showed, this implementation has undesired side-effects.
Wainer, probably the most straightforward way to add this capability to
QEMUMachine is to change the _base_args() method to only include monitor
arguments when necessary. Something like this:
```
# create a proper method to get moncdev_args
def _get_moncdev_args():
if isinstance(self._monitor_address, tuple):
return "socket,id=mon,host=%s,port=%s" % (
self._monitor_address[0],
self._monitor_address[1])
else:
return 'socket,id=mon,path=%s' % self._vm_monitor
# update _base_args method to use new attribute _with_qmp
def _base_args(self):
args = ['-display', 'none', '-vga', 'none']
if self._with_qmp:
args.extend(['-chardev', self._get_moncdev_args(),
'-mon', 'chardev=mon,mode=control'])
if self._machine is not None:
```
Does it make sense?
>
{...}
>
> --
> Eduardo
--
Caio Carrara
Software Engineer, Virt Team - Red Hat
ccarrara@redhat.com
next prev parent reply other threads:[~2018-11-21 15:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181120165300.18993-1-wainersm@redhat.com>
2018-11-20 19:02 ` [Qemu-devel] [PATCH] scripts/qemu.py: allow to launch the VM without a monitor Eduardo Habkost
2018-11-21 15:56 ` Caio Carrara [this message]
2018-11-21 16:02 ` Eduardo Habkost
2018-11-21 16:45 ` Wainer dos Santos Moschetta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121155559.GB32503@localhost.localdomain \
--to=ccarrara@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).