All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Michael Roth <mdroth@linux.vnet.ibm.com>,
	Amos Kong <akong@redhat.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command
Date: Wed, 1 Apr 2015 17:02:36 +0200	[thread overview]
Message-ID: <20150401150236.GA28058@igalia.com> (raw)
In-Reply-To: <87bnjvy2vi.fsf@blackfin.pond.sub.org>

On Sat, Mar 14, 2015 at 05:12:33PM +0100, Markus Armbruster wrote:

  [QMP introspection]
> Detail.  I want us to figure out what information we want to provide
> first, how to encode it second, and how to fit it into the existing
> introspection interfaces third.

Ok, I managed to find some time to take look at this.

Here's a rough proposal of the kind of information we can provide
and how to encode it. The type names I'm using are probably not very
well thought-out, but my intention at this point is to discuss the
structure rather than the names.

So let's start with the basics:

  { 'type': 'SimpleTypeInfo',
    'data': {
        'name': 'str',
        'array': 'bool'
    }
  }

This would be what describes a single, named data type (as opposed
to a dictionary). The name would refer to any of the build-in types,
complex types, enums or unions. Alternatively instead of an 'str' it
could also be an enum, which could be auto-generated and would contain
all possible type names. I don't know if this last option is feasible,
I had the impression that it's not for commands with 'gen' == 'no',
but correct me if I'm wrong.

Then I think that all instances where a simple type can appear also
allow arrays, so an additional boolean field can be used for that,
e.g.:

    'returns': 'str'           // name: str, array: no
    'returns': ['EventInfo']   // name: EventInfo, array: yes

Next:

  { 'type': 'DataFieldInfo',
    'data': {
        'name': 'str',
        'optional': 'bool',
        'type': 'SimpleTypeInfo'
    }
  }

That's for command arguments and fields in complex data types and
events. I think this one does not need much explanation. I admit that
the name that I chose is not very good :)

  { 'type': 'ComplexTypeInfo',
    'data': {
        'name': 'str',
        'fields': [ 'DataFieldInfo' ]
    }
  }

  { 'type': 'EnumInfo',
    'data': {
        'name': 'str',
        'values': [ 'str' ]
    }
  }

  { 'type': 'EventInfo',
    'data': {
        'name': 'str',
        'fields': [ 'DataFieldInfo' ]
    }
  }

This is for complex types, unions and events. I also think they don't
need much explanation. ComplexTypeInfo and EventInfo could be merged
into the same type, although I guess it's a good idea to keep them
separated in case one of them needs to be extended in the future.

  { 'type': 'UnionFieldInfo',
    'data': {
        'name': 'str',
        'type': 'str',
    }
  }

  { 'type': 'UnionInfo',
    'data': {
        'name': 'str',
        '*base': 'str'
        '*discriminator': 'str',
        'fields': [ 'UnionFieldInfo' ]
    }
  }

Unions. The type for 'base' could be (instead of 'str') an
autogenerated enum with all complex data types. 'discriminator' would
be 'type' for the default case. If the union is anonymous then this
field would be absent.

  { 'type': 'CommandInfo',
    'data': {
        'name': 'str',
        'args': [ 'DataFieldInfo' ],
        '*returns': 'SimpleTypeInfo',
        'gen': 'bool',
        'success-response': 'bool'
    }
  }

Commands. As far as I can see all of them return a single type (or an
array thereof), but this could be replaced if we want something else.

I think that's all.

Then as you said we could hide complex types and flatten them all when
we expose them. It would probably makes things easier in terms of
allowing changes in the API, but sounds like it would make the life of
API users more difficult? I don't know.

Last, about the query commands, I don't think they're so important
at the moment. Whether we want to have 'query-schema' or a set of
'query-*' for different things, or a combination of both, is something
that does not really have much impact on this discussion. Once we know
what we want to expose, the commands will come naturally I think.

Berto

  reply	other threads:[~2015-04-01 15:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 13:51 [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command Alberto Garcia
2015-02-24 13:51 ` [Qemu-devel] [PATCH 1/1] qmp: Add support for requesting the list of arguments from a command Alberto Garcia
2015-03-06 17:11 ` [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command Eric Blake
2015-03-11  9:18   ` Alberto Garcia
2015-03-11 10:21     ` Markus Armbruster
2015-03-11 10:39       ` Kevin Wolf
2015-03-11 16:02       ` Alberto Garcia
2015-03-11 19:22         ` Markus Armbruster
2015-03-12 12:39           ` Kevin Wolf
2015-03-14 16:12             ` Markus Armbruster
2015-04-01 15:02               ` Alberto Garcia [this message]
2015-04-01 15:30                 ` Markus Armbruster
2015-03-11 10:26   ` Kevin Wolf

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=20150401150236.GA28058@igalia.com \
    --to=berto@igalia.com \
    --cc=akong@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.