On Tue, Dec 16, 2014 at 09:23:46AM -0700, Eric Blake wrote: > On 12/16/2014 12:30 AM, zhanghailiang wrote: > > +# Since: 2.3 > > +## > > +{ 'type': 'GuestOSVersion', > > + 'data': {'name': 'str', 'type': 'int'} } > > 'name' feels a bit vague; it looks like you are intending to use the > string as a free-form text field, where the guest can supply arbitrary > strings. Maybe name it 'info' instead? Is it worth being any stricter, > such as having actual enums of known values? On the other hand, tying > to known enums means we have to update qemu-ga every time a new guest > gains support for running the agent, while free-form string leaves us a > bit more flexible. Or maybe you want both, as in: > > { 'enum': 'GuestOSFamily', 'data': ['Windows', 'Linux', 'other'] } > { 'type': 'GuestOSVersion', > 'data': { 'info': 'str', 'family': 'GuestOSFamily', > 'word-width': 'int' } }
I think it's better to tie this to libosinfo, rather than invent yet another new classification for OSes. Rich. > > + > > +## > > +# @guest-get-os-version: > > +# > > +# Get the guest's operating system version and bit. > > s/bit/word width/ > > > +# > > +# This is a read-only operation. > > +# > > +# Returns: version > > +# > > +# Since: 2.3 > > +## > > +{ 'command': 'guest-get-os-version', > > + 'returns': 'GuestOSVersion' } > > with my suggestions, a usage might be: > => { "execute": "guest-get-os-version" } > <= { "return": { "family": "Windows", > "info": "Microsoft Windows Server 2012 R2", > "word-width": 64 } } > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html