qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v3 2/6] VMState test: get information about


From: Eric Blake
Subject: Re: [Qemu-devel] [RFC PATCH v3 2/6] VMState test: get information about the registered devices
Date: Mon, 11 Aug 2014 10:24:27 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

On 08/09/2014 12:26 AM, Sanidhya Kashyap wrote:
> Added both qmp and hmp interface to get the information about the devices that
> have been qdevified and are registered with the SaveVMHandlers. I have not 
> used 
> any format to print the device information for the hmp interface. It would be
> great if anyone can give me some pointers about this about the printing format
> if there is something.
> 
> The qmp command to extract the information about the devices is
> qmp_query_devices which provides the list of device names and their respective
> version. The hmp command name is 'info devices' which lists the same 
> information
> as provided by the qmp interface.
> 
> Signed-off-by: Sanidhya Kashyap <address@hidden>
> ---
>  hmp-commands.hx  |  2 ++
>  hmp.c            | 23 +++++++++++++++++++++++
>  hmp.h            |  1 +
>  monitor.c        |  7 +++++++
>  qapi-schema.json | 26 ++++++++++++++++++++++++++
>  qmp-commands.hx  | 43 +++++++++++++++++++++++++++++++++++++++++++
>  savevm.c         | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  7 files changed, 147 insertions(+)
> 
> +++ b/qapi-schema.json
> @@ -3480,3 +3480,29 @@
>  # Since: 2.1
>  ##
>  { 'command': 'rtc-reset-reinjection' }
> +
> +##
> +# @QemuDevice
> +#
> +# device that is registered with SaveVMHandlers

This sounds like an internal implementation detail; is there a better
description more suited to what this struct represents from the API
point of view, maybe as simple as: "Information about a device"


> +{ 'command': 'query-devices',
> +  'returns': [ 'QemuDevice' ] }

Looks okay here...

> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index 4be4765..e489197 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx

> +
> +Example (1):

s/ (1)// - unless you have a second example, you don't need to label the
first example with a 1 suffix

> +
> +-> { "execute": "query-devices" }
> +<- { "return": [
> +       {
> +           [ { 'device-name': 'kvm-tpr-opt', 'version': 1 },

... but this doesn't match your command.  You have too many layers.
Also, QMP wire format uses ONLY ", never '.  It should look like:

{ "return": [ { "device-name": "kvm-tpr-opt", "version": 1 },
              ...
            ] }

In fact, rather than trying to write it by hand, actually compile your
code and test the actual QMP output and paste that in - then you'll know
you got it right.


> +static QemuDeviceList *create_device_list(const char *name, int version,
> +                                           QemuDeviceList *list)

Indentation is off.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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