qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: libvir-list@redhat.com, Gerd Hoffmann <kraxel@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [libvirt]  libvirt doesn't work with qemu 1.0
Date: Wed, 25 Jan 2012 20:55:14 -0700	[thread overview]
Message-ID: <4F20CEA2.8020308@redhat.com> (raw)
In-Reply-To: <4ED935E9.4050006@codemonkey.ws>

[-- Attachment #1: Type: text/plain, Size: 3161 bytes --]

On 12/02/2011 01:32 PM, Anthony Liguori wrote:
>> But we already have to call 'qemu -h' for other reasons; so we might as
>> well be efficient and learn as much as possible from that result than by
>> calling both 'qemu -h' and 'qemu -qmp ...', in order to probe what qemu
>> supports.
>>
>> Also, 'qemu -qmp' doesn't work.  What's the proper syntax for invoking
>> qemu in order to query QMP capabilities, but without also starting up a
>> guest?
> 
> 
> anthony@titi:~/build/qemu$ (sleep 1; echo -e '{"execute":
> "qmp_capabilities"}\n{"execute": "quit"}') |
> x86_64-softmmu/qemu-system-x86_64 -qmp stdio -S -display none | head -1
> {"QMP": {"version": {"qemu": {"micro": 94, "minor": 15, "major": 0},
> "package": ""}, "capabilities": []}}

Doesn't work on 0.12 (the first version with qmp):

$ /usr/libexec/qemu-kvm -qmp stdio -S -display none
qemu-kvm: -display: invalid option
$ /usr/libexec/qemu-kvm -qmp stdio -S -nographic
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Argument list too long

but if a temporary vnc port is okay, I was indeed able to get a list of
commands.

$ (sleep .1; printf
'{"execute":"qmp_capabilities"}\n{"execute":"query-commands"}\n{"execute":"quit"}\n')
| /usr/libexec/qemu-kvm -qmp stdio -S
VNC server running on `127.0.0.1:5901'
{"QMP": {"version": {"qemu": {"micro": 1, "minor": 12, "major": 0},
"package": "(qemu-kvm-0.12.1.2)"}, "capabilities": []}}
{"return": {}}
{"return": [{"name": "block_stream"}, {"name": "block_job_cancel"}, ...

> 
> The sleep 1 is due to a bug.  What I would suggest libvirt due is run
> this command but connect to the monitor properly, execute those two
> commands, and use the monitor greeting to figure out the version number.
> 
> If you really want a command to invoke, we could also add a command line
> switch that took a QMP command or something like that.

Yes, that would be nice, especially since it would be the sort of patch
that would be worth backporting into distro qemu instances that insist
on staying at 0.12 (yes, I'm looking at RHEL).  That way, libvirt can
automatically decide if qmp is new enough [basically, if qemu is 0.15 or
newer, or if qemu is 0.12 through 0.14 _and_ has hmp passthrough
backported].  In other words, if 'qemu -h' says -qmp-command is
available, and I could run the above as:

qemu-kvm -qmp-command '{"execute":"query-commands"}'

and have qemu automatically fill in the rest, it would be a bit easier
to use.

> Parsing help output is not the supported way of getting the version.  We
> happen to provide a nice, programmatic and stable interface for getting
> the version information.  Please use it.

I'm still stuck with the fact that with everything I tried, 0.12
temporarily opens a VNC port, and that there's a difference between 0.12
(-display none didn't exist) and newer versions; the best would be a
command sequence that works for all versions of qemu that have qmp, and
if it fails, then fall back to -h scraping.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2012-01-26  3:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 14:21 [Qemu-devel] libvirt doesn't work with qemu 1.0 Gerd Hoffmann
2011-12-02 14:50 ` Anthony Liguori
2011-12-02 15:08   ` Jiri Denemark
2011-12-02 15:15     ` Anthony Liguori
2011-12-02 19:29       ` [Qemu-devel] [libvirt] " Eric Blake
2011-12-02 20:32         ` Anthony Liguori
2012-01-26  3:55           ` Eric Blake [this message]
2012-01-26  9:41             ` Paolo Bonzini
2012-01-26 10:55               ` Markus Armbruster
2012-01-26 12:46               ` Eric Blake
2012-01-26 13:00                 ` Paolo Bonzini
2012-01-26 19:23             ` Luiz Capitulino
2011-12-02 18:53 ` Dave Allan

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=4F20CEA2.8020308@redhat.com \
    --to=eblake@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=kraxel@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).