[libvirt] [PATCH 3/4] Add support for detecting capablities using QMP commands
Daniel P. Berrange
berrange at redhat.com
Fri Sep 28 15:24:56 UTC 2012
On Fri, Sep 28, 2012 at 09:20:01AM -0600, Eric Blake wrote:
> On 09/28/2012 08:58 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> >
> > Start a QEMU process using
> >
> > $QEMU -S -no-user-config -nodefaults \
> > -nographic -M none -qmp unix:/some/path,server,nowait
> >
> > and talk QMP over stdio to discover what capabilities the
> > binary supports. This works for QEMU 1.2.0 or later and
> > for older QEMU automatically fallback to the old approach
> > of parsing -help and related command line args.
> >
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> > src/qemu/qemu_capabilities.c | 394 +++++++++++++++++++++++++++++++++++++++----
> > 1 file changed, 358 insertions(+), 36 deletions(-)
> >
>
> > +
> > +/* Capabilities that we assume are always enabled
> > + * for QEMU >= 1.2.0
> > + */
> > +static void
> > +qemuCapsInitQMPBasic(qemuCapsPtr caps)
> > +{
> > + qemuCapsSet(caps, QEMU_CAPS_VNC_COLON);
> > + qemuCapsSet(caps, QEMU_CAPS_NO_REBOOT);
>
> I think qemuCapsSetList() would be nicer than setting one bit at a time,
> but that doesn't change semantics.
>
>
> > +
> > +static int
> > +qemuCapsInitQMP(qemuCapsPtr caps)
> > +{
> > + int ret = -1;
> > + virCommandPtr cmd = NULL;
> > + qemuMonitorPtr mon = NULL;
> > + int major, minor, micro;
> > + char *package;
> > + int status = 0;
> > + virDomainChrSourceDef config;
> > +
> > + memset(&config, 0, sizeof(config));
> > + config.type = VIR_DOMAIN_CHR_TYPE_UNIX;
> > + config.data.nix.path = (char*)"/tmp/qemu.sock";
>
> This does not seem like a safe file name (it is easily guessable).
> Should we instead be generating something under /var/run?
Of course it isn't :-( I blame the end of week exhaustion. Locally
I have an addition to make it use driver->libDir, as we do for normal
monitor sockets for actual VMs.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list