From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vuz4b-0000c0-49 for qemu-devel@nongnu.org; Mon, 23 Dec 2013 01:33:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vuz4T-0003Mn-HZ for qemu-devel@nongnu.org; Mon, 23 Dec 2013 01:33:05 -0500 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:47978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vuz4S-0003M3-L4 for qemu-devel@nongnu.org; Mon, 23 Dec 2013 01:32:57 -0500 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Dec 2013 16:32:47 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id E2E672CE8051 for ; Mon, 23 Dec 2013 17:32:44 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBN6EGdL27459792 for ; Mon, 23 Dec 2013 17:14:18 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBN6WgOH031016 for ; Mon, 23 Dec 2013 17:32:42 +1100 Message-ID: <52B7D90E.50400@linux.vnet.ibm.com> Date: Mon, 23 Dec 2013 14:32:46 +0800 From: Wenchao Xia MIME-Version: 1.0 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> <20131220115705.GD2890@amosk.info> In-Reply-To: <20131220115705.GD2890@amosk.info> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: Amos Kong , Eric Blake Cc: "kwolf@redhat.com" , mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, qiaonuohan@cn.fujitsu.com, pbonzini@redhat.com, lcapitulino@redhat.com Hi, Amos > (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 "undefined struct" > If user have defined an arbitrary or embbed data struct, I think it is better leave as it is, instead of generate a new struct for it. Since qapi-visit.c and qapi-types.c doesn't have a "undefined" struct for it now, it is a bit risk to do it only in QMP introspection. Maybe leave it now, and support it when we found it is really useful?(and add it in qapi-visit.c and qapi-types.c correspondly) > eg 1: > { '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 'DataObjectUndefinedStruct' > is that we don't have 'name' for the DataObject union for undefined struct. > 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 > 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" > I guess you want to tip what type may be returned? It seems a bit too agressive, since the qapi-schema.json didn't tip that those types may be returned. > > 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 > ============== > https://raw.github.com/kongove/misc/master/txt/qmp-introspection.output.txt (1.6M) > > Latest schema definition > ======================== > { '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'] } >