qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] Add -version-simple argument, printing only


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH 1/1] Add -version-simple argument, printing only version number.
Date: Fri, 14 May 2010 14:34:33 +0100
User-agent: Mutt/1.4.1i

On Fri, May 14, 2010 at 01:24:44PM +0200, Markus Armbruster wrote:
> "Daniel P. Berrange" <address@hidden> writes:
> 
> > On Fri, May 14, 2010 at 11:42:57AM +0200, Markus Armbruster wrote:
> >> "Daniel P. Berrange" <address@hidden> 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 </dev/null
> {"QMP": {"version": {"qemu": "0.12.50", "package": ""}, "capabilities": []}}
> 
> suffices, with the minor wart that you have to SIGINT out.

Only in this particular example. The same pain I illustrate still exists
for other static query actions such as query-device, or a hypothetical 
query-argv for getting supported command line args. I really think we need
to map these into the more concise & easily accessible style:

> > eg, make this work:
> >
> >   $ qemu -query-version
> >   {"qemu": "0.12.50", "package": ""}
> 
> I wouldn't mind.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]