From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqGQn-0002uL-N4 for qemu-devel@nongnu.org; Wed, 25 Jan 2012 22:55:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqGQm-0008IO-AA for qemu-devel@nongnu.org; Wed, 25 Jan 2012 22:55:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqGQl-0008I9-QX for qemu-devel@nongnu.org; Wed, 25 Jan 2012 22:55:24 -0500 Message-ID: <4F20CEA2.8020308@redhat.com> Date: Wed, 25 Jan 2012 20:55:14 -0700 From: Eric Blake MIME-Version: 1.0 References: <4ED8DF02.5060605@redhat.com> <4ED8E5A3.2080909@codemonkey.ws> <20111202150850.GJ2274323@orkuz.home> <4ED8EB8B.9090800@codemonkey.ws> <4ED9271E.7020800@redhat.com> <4ED935E9.4050006@codemonkey.ws> In-Reply-To: <4ED935E9.4050006@codemonkey.ws> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig043B31CA1ECF4C1B6A3D1502" Subject: Re: [Qemu-devel] [libvirt] libvirt doesn't work with qemu 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: libvir-list@redhat.com, Gerd Hoffmann , "qemu-devel@nongnu.org" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig043B31CA1ECF4C1B6A3D1502 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 12/02/2011 01:32 PM, Anthony Liguori wrote: >> But we already have to call 'qemu -h' for other reasons; so we might a= s >> 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 qem= u >> 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? >=20 >=20 > 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"}, ... >=20 > 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= =2E >=20 > If you really want a command to invoke, we could also add a command lin= e > 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. W= e > 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. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig043B31CA1ECF4C1B6A3D1502 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPIM6iAAoJEKeha0olJ0NqqBIIAKc8ig+jCXdRZNAontenPKie kToNVqT8KNc7R65Sb1QtyX8fUP8R4kftN41rFlbdjwhARpzXDFoxSuYmZ/yUL8Br QSYuWBhYX67aQH+pq2dwRGHYu8O40x1YyOVMIiQo982YoG6Ql2ifU8Vsp+bXFwoV UQja8/s+LtfeXROEU8twmgtUZh6Hd6lbGG+uPdz+gW0L3wmXsw+QqAJuWPNtc3ST gH/AGsmX00h9DxgKPTj29A3OpYNGW9gw0a8gP5ebxoIhP6t3WeaENcr8HWCfNVlK RxcWj+7/+Ea+xVewwzPtnfc/nE3EdFuMbExSygitCMZJm4hnUlfyHqNbZugqKjE= =jW/c -----END PGP SIGNATURE----- --------------enig043B31CA1ECF4C1B6A3D1502--