[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP |
Date: |
Tue, 16 Jul 2013 13:08:55 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 |
Il 16/07/2013 13:04, Amos Kong ha scritto:
>>> > > So here I defined a 'DataObject' type in qapi-schema.json,
>>> > > it's used to describe the dynamical dictionary/list/string.
>>> > >
>>> > > { 'type': 'DataObject',
>>> > > 'data': { '*key': 'str', '*type': 'str', '*data': ['DataObject'] } }
>
> Hi Paolo,
>
>> > This is missing '*optional': 'bool'. Also, how do you distinguish these:
>> >
>> > { 'command': 'query-tpm-types', 'returns': 'TpmType] }
> do you mean 'TpmType' ? not 'TpmType]
Yes.
> {
> "name": "query-tpm-types",
> "type": "Command",
> "returns": [
> > {
> > "type": "passthrough"
> > }
> ]
> },
>
>> > { 'command': 'query-tpm-types', 'returns': ['TpmType'] }
> {
> "name": "query-tpm-types",
> "type": "Command",
> "returns": [
> > {
> > "type": "TpmType",
> > "data": [
> > {
> > "type": "passthrough"
> > }
> > ]
> > }
> ]
> },
Thanks. I see this is unique, but it is also not too intuitive.
So, could you add a "kind" field to DataObject that is an enum
(list/dict/scalar, or something like that)? This would make it easier
to parse (for humans at least, but I guess also for programs).
Paolo
>> >
>> > Could it have to be like this?
>> >
>> > 'data': { '*key': 'str', '*type': 'str', '*list': 'bool',
>> > '*optional': 'bool',
>> > '*data': ['DataObject'] } }
> there are three conditions:
> 1) list
> 2) dict
> 3) string
>
>> > Can you document, in the commit message or the code,
>
> I added a document for QMP introspection support.
> (docs/qmp-full-introspection.txt)
>
> The DataObject is described in docs/qmp-full-introspection.txt in
> detail.
>
>> > how you avoid infinite loops (possible with optional or list fields)?
>
> +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 to avoid dead loop.
>
> +/*
> + * Use a string to record the visit path, type index of each node
> + * will be saved to the string, indexes are split by ':'.
> + */
>
> related functions:
> pop_id()
> push_id()
>
> The detail needs to be added to qmp-full-introspection.txt
>
Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP, Luiz Capitulino, 2013/07/17
Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP, Eric Blake, 2013/07/19