On 07/25/2014 09:39 AM, Sanidhya Kashyap wrote: > I have provided a qmp interface for getting the list of qdevified devices > that have been registered with SaveVMHandlers. > > Signed-off-by: Sanidhya Kashyap > --- > qapi-schema.json | 22 ++++++++++++++++++++++ > qmp-commands.hx | 25 +++++++++++++++++++++++++ > savevm.c | 34 ++++++++++++++++++++++++++++++++++ > 3 files changed, 81 insertions(+) > > +# @device: list of qdevified device names > +# > +# Since 2.2 > +## > +{ 'type': 'VMStatesQdevDevices', > + 'data': { 'device': ['str'] } } Here, you name it 'device' [1] > + > +## > +# @query-qdev-devices > +# > +# returns the VMStatesQdevDevices that have the associated value > +# > +# Since 2.2 > +## > +{ 'command': 'query-qdev-devices', > + 'returns': 'VMStatesQdevDevices' } and state that it returns a single struct [2] > diff --git a/qmp-commands.hx b/qmp-commands.hx > index 4be4765..2e20032 100644 > --- a/qmp-commands.hx > +++ b/qmp-commands.hx > @@ -3755,3 +3755,28 @@ Example: > <- { "return": {} } > > EQMP > + > + { > + .name = "query-qdev-devices", > + .args_type = "", > + .mhandler.cmd_new = qmp_marshal_input_query_qdev_devices, > + }, > + > +SQMP > +query-qdev-devices > +------------------ > + > +Shows registered Qdevified devices > + > + > +Example (1): > + > +-> { "execute": "query-qdev-devices" } > +<- { "return": [ But here, your example shows it returning an array of structs [2] > + { > + "devices": [ "kvm-tpr-opt", "piix4_pm" ] where each struct contains a member named 'devices' [1] that is also an array. I actually think the most extensible thing would be to return something more like this QMP wire contents: { "return": [ { "device": "kvm-tpr-opt" }, { "device": "piix4_pm" } ] } which would match this .json content: { 'type': 'VMStatesQdevDevices', 'data': { 'device': 'str' } } { 'command': 'query-qdev-devices', 'returns': [ 'VMStatesQdevDevices' ] } and also be the most extensible for future tweaks, such as adding an optional boolean flag to the json to tell us more about certain devices: { 'type': 'VMStatesQdevDevices', 'data': { 'device': 'str', '*foo': 'bool' } } and lead to this QMP wire transaction: { "return": [ { "device": "kvm-tpr-opt" }, { "device": "piix4_pm", 'foo': true } ] } At any rate, you MUST make your example match your documentation. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org