Received: from [140.186.70.92] (port=59474 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCt0c-0000pb-OV for qemu-devel@nongnu.org; Fri, 14 May 2010 07:25:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCt0a-0001Wy-T8 for qemu-devel@nongnu.org; Fri, 14 May 2010 07:24:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62987) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCt0a-0001Wp-Ls for qemu-devel@nongnu.org; Fri, 14 May 2010 07:24:48 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 1/1] Add -version-simple argument, printing only version number. References: <1273739572-30840-1-git-send-email-Jes.Sorensen@redhat.com> <1273739572-30840-2-git-send-email-Jes.Sorensen@redhat.com> <20100513133322.GI12207@redhat.com> <20100514100654.GC9282@redhat.com> Date: Fri, 14 May 2010 13:24:44 +0200 In-Reply-To: <20100514100654.GC9282@redhat.com> (Daniel P. Berrange's message of "Fri, 14 May 2010 11:06:54 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Jes.Sorensen@redhat.com, aliguori@us.ibm.com, clalance@redhat.com, qemu-devel@nongnu.org, crobinso@redhat.com "Daniel P. Berrange" writes: > On Fri, May 14, 2010 at 11:42:57AM +0200, Markus Armbruster wrote: >> "Daniel P. Berrange" writes: [...] >> > It would also be nice to avoid having to parse the -help output to determine >> > ARGV supported too. I wonder if it would be a good idea to just produce a >> > well structured equivalent to -help that provides the same data, but in >> > JSON format for sane parsing. That would let peple easily determine the >> > supported ARGV as well as version number(s) >> >> I'm all for machine-readable self-documentation. And the place for that >> is QMP. Humble beginnings are already there: >> >> { "execute": "query-version", "arguments": { } } >> --> {"return": {"qemu": "0.12.50", "package": ""}} >> >> { "execute": "query-commands", "arguments": { } } >> --> {"return": [{"name": "quit"}, {"name": "eject"}, [...] >> >> Any practical problems with use of QMP instead of parsing command line >> option output? > > It is unneccessarily complex for such a simple task, requiring you to > configure & connect to the monitor & do the capabilities negotiaton > and then issue the command. > > To just query the version requires this ridiculous interaction: > > $ qemu -chardev stdio,id=monitor -monitor chardev=monitor,mode=control > {"execute":"qmp_capabilities"} > {"QMP": {"version": {"qemu": "0.12.1", "package": " (qemu-kvm-0.12.1.2)"}, "capabilities": []}} > {"execute":"query-version"} > {"return": {"qemu": "0.12.50", "package": ""}} Actually, $ qemu -nodefaults -nographic -S -chardev stdio,id=qmp -mon mode=control,chardev=qmp I'm suggesting we just allow some simple syntactic sugar on the command > line for the handful of QMP commands that are just returning static info > about the binary, that are not affected by VM state. > > eg, make this work: > > $ qemu -query-version > {"qemu": "0.12.50", "package": ""} I wouldn't mind.