[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: |
Eric Blake |
Subject: |
Re: [Qemu-devel] RFC: Full introspection support for QMP (with draft patch) |
Date: |
Fri, 14 Jun 2013 12:09:33 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
On 06/14/2013 10:52 AM, Amos Kong wrote:
>>From 2b39fe0f380eea6a96de3589b3d148673d28c1ff Mon Sep 17 00:00:00 2001
> From: Amos Kong <address@hidden>
> Date: Fri, 7 Jun 2013 18:02:21 +0800
> Subject: [PATCH] full introspection support for QMP
>
> Signed-off-by: Amos Kong <address@hidden>
> ---
> qapi-schema.json | 6 ++++++
> qmp-commands.hx | 23 +++++++++++++++++++++++
> qmp.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> scripts/qapi-commands.py | 2 +-
> scripts/qapi-types.py | 42 +++++++++++++++++++++++++++++++++++++++++-
> scripts/qapi-visit.py | 2 +-
> scripts/qapi.py | 13 ++++++++++++-
> 7 files changed, 130 insertions(+), 4 deletions(-)
>
> diff --git a/qapi-schema.json b/qapi-schema.json
> index ef1f657..128cc58 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -3618,3 +3618,9 @@
> '*cpuid-input-ecx': 'int',
> 'cpuid-register': 'X86CPURegister32',
> 'features': 'int' } }
> +
> +{ 'type': 'SchemaData',
> + 'data': { 'type': 'str', 'name': 'str', '*data': 'str', '*returns': 'str'
> } }
> +
> +{ 'command': 'query-qmp-schema', 'data': { '*type': 'str', '*name': 'str' },
> + 'returns': ['SchemaData'] }
Needs documentation, and a since 1.6 notation in the docs (assuming that
we still make it in time for 1.6). Also, see my other mail complaining
that this is not structured enough, yet.
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index ffd130e..fc56fba 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -2932,3 +2932,26 @@ Example:
> +
> +EQMP
> \ No newline at end of file
Fix that.
> }
>
> +SchemaDataList * qmp_query_qmp_schema(bool has_type, const char * type,
No space after '*' when declaring a pointer return or pointer argument.
Should be:
SchemaDataList *qmp_query_qmp_schema(bool has_type, const char *type,
> +++ b/scripts/qapi-types.py
> +
> +struct qmp_schem {
Aren't structs supposed to be named in CamelCase?
> +const char *type;
> +const char *name;
> +const char *data;
> +const char *returns;
> +} qmp_schema_table[] = {
> +"""
> +
> +for i in exprs_all[1]:
> + print i
> +
> + data = returns = ""
> + type = i.keys()[0]
> + name = i[type]
> + for k in i.keys():
> + if isinstance(i[k], OrderedDict):
> + ret = {}
> + for key in i[k]:
> + ret[key] = i[k][key]
> + i[k] = ret
> +
> + if i.has_key('data'):
> + data = i['data']
I think this is where you'd need to do more processing of data to spit
it out in a more structured format, but my python is too weak to
actually write that conversion.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature