qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] full introspection support for QMP


From: Amos Kong
Subject: Re: [Qemu-devel] [PATCH] full introspection support for QMP
Date: Thu, 20 Jun 2013 18:16:14 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jun 19, 2013 at 08:49:14PM +0800, Amos Kong wrote:
> On Wed, Jun 19, 2013 at 08:24:37PM +0800, Amos Kong wrote:
> > Introduces new monitor command to query QMP schema information,
> > the return data is a nested dict/list, it contains the useful
> > metadata.
> > 
> > we can add events definations to qapi-schema.json, then it can
> > also be queried.
>  
> I didn't implement to return complete schema in one go in this
> version, will do it in next version. We have a recursive define
> 'DataObject', we only display one layer for it.


I have implemented the return whole schema in one go.
Attached the whole output [query-qmp-schema--whole.txt]
I will send the patch out after cleanup.

DataObject description might cause confuse, I also plan
to add a detail document [docs/qmp-full-introspection.txt] (uncompleted)

Welcome your comments :)

============== full introspection support for QMP ===================

== Purpose ==

Add a new interface to provide QMP schema information to management,

== Usage ==

Execute QMP command:

  { "execute": "query-qmp-schema" }

Returns:

  { "return": [
      {
          "name": "query-name",
          "type": "Command",
          "returns": [
              {
                  "name": "*name",
                  "type": "str"
              }
          ]
      }  
   }

The whole schema information will be returned in one go, it contains
commands and event. It doesn't support to filter information by type
or name.

We have four types (ImageInfo, BlockStats, PciDeviceInfo,
SchemaData) that uses themself in their own define data
directly or indirectly, we will not repeatedly extend them.

== more description of 'DataObject' type ==

We use 'DataObject' to describe dynamical data struct, it might be
nested dictionary, list or string.

'DataObject' itself is a arbitrary and nested dictionary, the
dictionary has three keys ('name', 'type', 'data'), 'name' and
'data' are optional.

* For describing Dictionary, we set the key to 'name', and set the
  value to 'type'
* For describing List, we don't set 'name', just set the value to
  'type'
* If the value of dictionary or list is non-native type, we extend
  the non-native type to dictionary, set it to 'data',  and set the
  non-native type's name to 'type'.


1) Dict, value is native type
{ 'id': 'str', ... }
--------------------
[
    {
        "name": "id", 
        "type": "str"
    },
    .....
]

2) Dict, value is defined types
{ 'options': 'TpmTypeOptions' }
-------------------------------
[
    {
        "name": "options", 
        "type": "TpmTypeOptions", 
        "data": [
            {
                "name": "passthrough", 
                "type": "str", 
            }
        ]
    },
    .....
]

3) List, value is native type
['str', ... ]
-------------
[
    {
        "type": "str"
    },
    ....
]

4) List, value is defined types
['TpmTypeOptions', ... ]
------------------------
[
    {
        "type": "TpmTypeOptions", 
        "data": [
            {
                "name": "passthrough", 
                "type": "str", 
            }
        ]
    },
    .....
]

Attachment: query-qmp-schema--whole.txt
Description: Text document


reply via email to

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