From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWZmp-0001fL-TR for qemu-devel@nongnu.org; Fri, 02 Dec 2011 15:32:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWZmn-0000w4-Up for qemu-devel@nongnu.org; Fri, 02 Dec 2011 15:32:47 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:53375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWZmn-0000w0-Rf for qemu-devel@nongnu.org; Fri, 02 Dec 2011 15:32:45 -0500 Received: by iakk32 with SMTP id k32so5475831iak.4 for ; Fri, 02 Dec 2011 12:32:45 -0800 (PST) Message-ID: <4ED935E9.4050006@codemonkey.ws> Date: Fri, 02 Dec 2011 14:32:41 -0600 From: Anthony Liguori 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> In-Reply-To: <4ED9271E.7020800@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Eric Blake Cc: libvir-list@redhat.com, Gerd Hoffmann , "qemu-devel@nongnu.org" On 12/02/2011 01:29 PM, Eric Blake wrote: > On 12/02/2011 08:15 AM, Anthony Liguori wrote: >>> Which of course only works with new enough QEMU that is known to >>> support QMP >>> (which BTW we detect by checking the version number). >> >> Or you could just try the -qmp option and if QEMU exits, it doesn't >> support it. That's going to be a lot more reliable than checking a >> version number. > > 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": []}} 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. > > At any rate, yes, we want to improve libvirt to cache qemu capabilities, > to do the probing once at startup and then again any time the mtime of > the qemu binary changes, rather than the current policy of doing it on > every VM startup; once we cache information, making multiple probes will > still be more efficient in the long ran than the current probe per guest. That's all well and good but please use the interfaces that we support. 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. Regards, Anthony Liguori