From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtyht-00042s-VM for qemu-devel@nongnu.org; Fri, 20 Dec 2013 06:57:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vtyho-0006AO-DS for qemu-devel@nongnu.org; Fri, 20 Dec 2013 06:57:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtyho-00069H-5r for qemu-devel@nongnu.org; Fri, 20 Dec 2013 06:57:24 -0500 Date: Fri, 20 Dec 2013 19:57:05 +0800 From: Amos Kong Message-ID: <20131220115705.GD2890@amosk.info> References: <1373971062-28909-1-git-send-email-akong@redhat.com> <1373971062-28909-3-git-send-email-akong@redhat.com> <51E9B81C.2090105@redhat.com> <20131127023217.GA6629@amosk.info> <20131220110001.GC2890@amosk.info> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qtZFehHsKgwS5rPz" Content-Disposition: inline In-Reply-To: <20131220110001.GC2890@amosk.info> Subject: Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: "kwolf@redhat.com" , mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, qiaonuohan@cn.fujitsu.com, pbonzini@redhat.com, xiawenc@linux.vnet.ibm.com --qtZFehHsKgwS5rPz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (resend without big attachment) Hello Eric, other We had "command, enumeration, type, unionobj" in Eric suggested DataObject union, it's helpful for us to provide meaningful metadata in the output. but there still exists some problem. We should describe some arbitrary data struct, I would like to call it "und= efined struct" eg 1:=20 { 'type': 'VersionInfo', 'data': {'qemu': {'major': 'int', 'minor': 'int', 'micro': 'int'}, 'package': 'str'} } it's same as: { 'type': 'newtype', 'data': {'major': 'int', 'minor': 'int', 'micro': 'int'} } { 'type': 'VersionInfo', 'data': { 'qemu': 'newtype', 'package': 'str'} } The difference between original 'DataObjectType' and 'DataObjectUndefined= Struct' is that we don't have 'name' for the DataObject union for undefined struc= t. so I set the 'name' item in DataObjectBase to be optional. eg 2: { 'command': 'human-monitor-command', 'data': {'command-line': 'str', '*cpu-index': 'int'}, 'returns': 'str' } ... 'returns': ['RxFilterInfo'] } ... 'returns': 'ChardevReturn' } We returns str (native type), list or extended dict here. Sometimes we returns a defined type, but it doesn't need to be extended. And we need= =20 to describe this kind of data (type str, dict or list) by "DataObject" in schema definition of DataObject** type. So I added a "'reference-type': 'String'" in DataObject union. list, dict will still be described by "DataObjectType" You can find the draft patches here: https://github.com/kongove/qemu/commits/qmp-introspection I will post the V3 when I finish the cleanup. Thanks, Amos Command output =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D https://raw.github.com/kongove/misc/master/txt/qmp-introspection.output.txt= (1.6M) Latest schema definition =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D { 'type': 'DataObjectBase', 'data': { '*name': 'str', 'type': 'str' } } { 'union': 'DataObjectMemberType', 'discriminator': {}, 'data': { 'reference': 'str', 'undefined': 'DataObject', 'extend': 'DataObject' } } { 'type': 'DataObjectMember', 'data': { 'type': 'DataObjectMemberType', '*name': 'str', '*optional': 'bool', '*recursive': 'bool' } } { 'type': 'DataObjectCommand', 'data': { '*data': [ 'DataObjectMember' ], '*returns': 'DataObject', '*gen': 'bool' } } { 'type': 'DataObjectEnumeration', 'data': { 'data': [ 'str' ] } } { 'type': 'DataObjectType', 'data': { 'data': [ 'DataObjectMember' ] } } { 'type': 'DataObjectUndefinedStruct', 'data': { 'data': [ 'DataObjectMember' ] } } { 'type': 'DataObjectUnion', 'data': { 'data': [ 'DataObjectMember' ], '*base': 'str', '*discriminator': 'str' } } { 'union': 'DataObject', 'base': 'DataObjectBase', 'discriminator': 'type', 'data': { 'command': 'DataObjectCommand', 'enumeration': 'DataObjectEnumeration', 'type': 'DataObjectType', 'undefined-struct': 'DataObjectUndefinedStruct', 'reference-type': 'String', 'unionobj': 'DataObjectUnion' } } { 'command': 'query-qmp-schema', 'returns': ['DataObject'] } --qtZFehHsKgwS5rPz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iQIcBAEBAgAGBQJStDCRAAoJELxSv6I5vP9jo4cQAJKbTb9wK1ATDEIPcfWAmcYD wG+LfYTPqHvvAQZZnV6l3rP/BRXNa4ca9IytPBFL5APABM9ZTBuMplsDvGGF/iYY 0nhACrQupEkRtFtqloB8ffve6qDuB4JN/zuWmYhksw885I//21hKuaz8gSjg257Z 54OcuFxBvCbqBZGr0eoA56AL9oOTveG8S6UrFbdVK0v7gMFbZaoNDv+gIoUXIRSA 9zlHxd0n96CLAK0DDXxwCUKqcDpu9I48fis75PPg4xEhf2QMoEWSuFxZCZD9x3jR Xke1Qh44CiWvGjjyZnNwfsy94a1Ts9nF8fa+myy0V1g/BSwX+ZsR6pxUKedhkRRx 3/PXt7MfDevODEaNsThTyJAD7phd2zw9q1GR/Ge6wzRHwq7AAqs+WbAXu+j0lc1r rMgfQJH2bEmnjFuwW7Q0Ri+XFZT0BnPM1485Lr5Za6LGBwNLn+dIpu9OguOiBGeb F106zzFxGi6aDj5JXaSLyOOI3BynGiIdBEj2EAiuZPZfXruOeJdpsOTzQIM5ZeRD hTzkQ5QXRwWHcDSOg59Cg5zzIk2qqlGz1JEfKfMb8t867MfgHO6qCIJO9Kyn0NNa HJQkaxORKZy5du/Q/FEWItloUiyYu4ExbJcQD5ekx3CllyONZoNSOkscNJP1wnIH /LN3tAJGWJbBzhykSlEJ =NLFp -----END PGP SIGNATURE----- --qtZFehHsKgwS5rPz--