From: Amos Kong <akong@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com,
Markus Armbruster <armbru@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
qiaonuohan@cn.fujitsu.com, Ronen Hod <rhod@redhat.com>,
lcapitulino@redhat.com
Subject: Re: [Qemu-devel] RFC: Full introspection support for QMP (with draft patch)
Date: Tue, 18 Jun 2013 20:21:12 +0800 [thread overview]
Message-ID: <20130618122030.GA25925@amosk.info> (raw)
In-Reply-To: <51BAF9ED.4000206@redhat.com>
On Fri, Jun 14, 2013 at 12:09:33PM +0100, Eric Blake wrote:
> On 06/14/2013 10:52 AM, Amos Kong wrote:
> > +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.
I found a solution :-)
Generate a string array in C head file to record the raw json string;
Convert each json string to QObject, and convert the QObject to QDict
for traversal by recursion;
Define a new type and uion [1] to describe dynamical date for QMP.
and allocate & connect nested members in recursion function.
Finally, we can provide dynamical data with metadate according the
definition in json file.
I will send a v1 patch later.
---- [1] ----
{ 'union': 'DataValue', 'data': { 'string': 'str', 'obj': 'DataObj' } }
{ 'type': 'DataObj', 'data': { '*key': 'str', 'value': 'DataValue' } }
{ 'type': 'SchemaData',
'data': { 'type': 'str', 'name': 'str', '*data': ['DataObj'], '*returns': ['DataObj'] } }
--
Amos.
prev parent reply other threads:[~2013-06-18 12:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-22 13:40 [Qemu-devel] RFC: Full introspection support for QMP Amos Kong
2013-05-22 14:44 ` Kevin Wolf
2013-05-22 16:14 ` Anthony Liguori
2013-05-23 8:18 ` Kevin Wolf
2013-05-23 12:08 ` Anthony Liguori
2013-05-23 12:40 ` Luiz Capitulino
2013-05-23 12:52 ` Anthony Liguori
2013-05-23 12:54 ` Kevin Wolf
2013-05-23 13:52 ` Anthony Liguori
2013-05-23 14:17 ` Eric Blake
2013-05-23 14:29 ` Kevin Wolf
2013-05-22 17:56 ` Luiz Capitulino
2013-05-23 12:58 ` Eric Blake
2013-06-07 10:12 ` [Qemu-devel] RFC: Full introspection support for QMP (with draft patch) Amos Kong
2013-06-07 10:17 ` Amos Kong
2013-06-14 9:52 ` Amos Kong
2013-06-14 10:59 ` Eric Blake
2013-06-14 11:09 ` Eric Blake
2013-06-18 12:21 ` Amos Kong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130618122030.GA25925@amosk.info \
--to=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qiaonuohan@cn.fujitsu.com \
--cc=rhod@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).