[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v2 03/12] VMState test: query command to ext
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH RFC v2 03/12] VMState test: query command to extract the qdevified device names |
Date: |
Mon, 28 Jul 2014 15:47:15 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
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 <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH RFC v2 00/12] VMState testing, Sanidhya Kashyap, 2014/07/25
- [Qemu-devel] [PATCH RFC v2 01/12] QEMUSizedBuffer/QEMUFile, Sanidhya Kashyap, 2014/07/25
- [Qemu-devel] [PATCH RFC v2 02/12] reset handler for qdevified devices, Sanidhya Kashyap, 2014/07/25
- [Qemu-devel] [PATCH RFC v2 03/12] VMState test: query command to extract the qdevified device names, Sanidhya Kashyap, 2014/07/25
- [Qemu-devel] [PATCH RFC v2 04/12] VMState test: hmp interface for showing qdevified devices, Sanidhya Kashyap, 2014/07/25
- [Qemu-devel] [PATCH RFC v2 05/12] VMstate test: basic VMState testing mechanism, Sanidhya Kashyap, 2014/07/25
- [Qemu-devel] [PATCH RFC v2 06/12] VMState test: hmp interface for vmstate testing, Sanidhya Kashyap, 2014/07/25
- [Qemu-devel] [PATCH RFC v2 07/12] VMState test: qmp interface for querying the vmstate testing process, Sanidhya Kashyap, 2014/07/25