qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP


From: Amos Kong
Subject: Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP
Date: Fri, 20 Dec 2013 19:57:05 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

(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"

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"


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'] }

Attachment: pgpbR1mFDjmpZ.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]