From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnRtk-0006tp-JS for qemu-devel@nongnu.org; Fri, 14 Jun 2013 07:10:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnRtf-00033G-Gc for qemu-devel@nongnu.org; Fri, 14 Jun 2013 07:10:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnRtf-000339-8v for qemu-devel@nongnu.org; Fri, 14 Jun 2013 07:10:23 -0400 Message-ID: <51BAF9ED.4000206@redhat.com> Date: Fri, 14 Jun 2013 12:09:33 +0100 From: Eric Blake MIME-Version: 1.0 References: <20130522134007.GA2051@t430s.nay.redhat.com> <20130607101230.GA32546@t430s.nay.redhat.com> <20130607101726.GB32546@t430s.nay.redhat.com> <20130614095244.GA24720@t430s.nay.redhat.com> In-Reply-To: <20130614095244.GA24720@t430s.nay.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2TRSQSSHEMJKQSHRTNCLI" Subject: Re: [Qemu-devel] RFC: Full introspection support for QMP (with draft patch) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, Markus Armbruster , qemu-devel , qiaonuohan@cn.fujitsu.com, Ronen Hod , lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2TRSQSSHEMJKQSHRTNCLI Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/14/2013 10:52 AM, Amos Kong wrote: >>>From 2b39fe0f380eea6a96de3589b3d148673d28c1ff Mon Sep 17 00:00:00 2001 > From: Amos Kong > Date: Fri, 7 Jun 2013 18:02:21 +0800 > Subject: [PATCH] full introspection support for QMP >=20 > Signed-off-by: Amos Kong > --- > 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(-) >=20 > 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': 's= tr' }, > + '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. > } > =20 > +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[] =3D { > +""" > + > +for i in exprs_all[1]: > + print i > + > + data =3D returns =3D "" > + type =3D i.keys()[0] > + name =3D i[type] > + for k in i.keys(): > + if isinstance(i[k], OrderedDict): > + ret =3D {} > + for key in i[k]: > + ret[key] =3D i[k][key] > + i[k] =3D ret > + > + if i.has_key('data'): > + data =3D 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2TRSQSSHEMJKQSHRTNCLI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRuvntAAoJEKeha0olJ0NqjfwH/iRQqZLjvcjDjdQT3SS7bQht EtuJe2lSMiq2mMmnc7nQ56Ab+7UTKjHgi3F2Njv33wl9FcPYK9ffrIjKUFU/uPcJ f+Yh7L7YhFr3t48j6/oNzId7Q1aXYJy9JXU6UcgBwZ6U2yPkExP+mCRJ+FVwagRB drvyQ8xagu2o2MidSRP/BCVGnl/S9lhrQZYyi7abqqXdcweluZH3icDeUr/67859 AO0KUstckorDFykiILPWfhZYmavbLYcj5ZUjs+WUIarL/hAq7fL9WNzuup91QYl9 AzDKiUW7NnlcgnzfAz6NT+3mk2AXsn2MM2hlMB9ZmAqXXHXxCF8IjWF2DSCKQCU= =TEcT -----END PGP SIGNATURE----- ------enig2TRSQSSHEMJKQSHRTNCLI--