[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] RFC: Full introspection support for QMP (with draft pat
From: |
Amos Kong |
Subject: |
Re: [Qemu-devel] RFC: Full introspection support for QMP (with draft patch) |
Date: |
Fri, 14 Jun 2013 17:52:44 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Jun 07, 2013 at 06:17:26PM +0800, Amos Kong wrote:
> On Fri, Jun 07, 2013 at 06:12:30PM +0800, Amos Kong wrote:
> > Sent out a draft patch in the end of this week. It doesn't support:
> > * output all stuffs in one shot.
> > * introspect event
> > * provide metadata date
> >
> > How can we define a dynamic dict in qmp-schema.json ?
> >
> > Currently I just output the raw json dict by a string, Libvirt needs
> > parse two times, convert the string to json format.
> >
> > qmp-schema.h: auto generated head file by qapi script
> >
> > Attached some examples.
Hello all,
I defined a new type 'SchemaData', it contains 4 keys (type, name, data,
returns)
| { 'type': 'SchemaData',
| 'data': { 'type': 'str', 'name': 'str', '*data': 'str', '*returns': 'str' }
}
|
| { 'command': 'query-qmp-schema', 'data': { '*type': 'str', '*name': 'str' },
| 'returns': ['SchemaData'] }
Then we can provice meaningful result to Libvirt. Currently I set a string
for SchemaData['data'].
I tried to define a dynamical dict for 'data', but it's failed.
| { 'type': 'SchemaData',
| 'data': { 'type': 'str', 'name': 'str', '*data': '**', '*returns': 'str' }
} (Failed!!)
Does qapi support to define a dynamical dict, then I can convert dict string
and set to SchemaData['data'] ?
{ "execute": "query-qmp-schema"}
{
"return": [
{
"name": "ErrorClass",
"type": "enum",
"data": "['GenericError', 'CommandNotFound', 'DeviceEncrypted',
'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap']"
},
{
"name": "SchemaData",
"type": "type",
"data": "{'*returns': 'str', 'type': 'str', 'name': 'str', '*data':
'str'}"
},
......
......
{
"name": "query-qmp-schema",
"type": "command",
"returns": "['SchemaData']",
"data": "{'*name': 'str', '*type': 'str'}"
}
]
}
qmp-schema.h
Description: Text document
query-qmp-schema.output.txt
Description: Text document
0001-full-introspection-support-for-QMP.patch
Description: Text document