From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 19/22] qapi: add QMP put-event command
Date: Thu, 10 Mar 2011 16:24:58 +0200 [thread overview]
Message-ID: <4D78DF3A.9000600@redhat.com> (raw)
In-Reply-To: <4D78DC5A.3000601@codemonkey.ws>
On 03/10/2011 04:12 PM, Anthony Liguori wrote:
> On 03/10/2011 06:39 AM, Avi Kivity wrote:
>> What I mean is that the client should specify the handle, like it
>> does for everything else it gives a name (netdevs, blockdevs,
>> SCM_RIGHT fds, etc).
>>
>> { execute: listen-event, arguments: { event: blah, id: blah00001 } }
>> { execute: unlisten-event arguments: { id: blah00001 } }
>
> Yeah, I understand, it just doesn't fit the model quite as well of
> signal accessors.
>
> Normally, in a signal/slot event model, you'd have some notion of an
> object model and/or hierarchy. For instance, with dbus, you'd do
> something like:
>
> bus = dbus.SystemBus()
> hal = # magic to get a hal object
> device = hal.FindDeviceByCapability('media.storage')
>
> device.connect_to_signal('media-changed', fn)
>
> We don't have objects and I don't mean to introduce them, but I like
> the idea of treating signals as objects and returning them via an
> accessor function.
>
> So the idea is that the handle is a marshalled form of the signal object.
It's not a marshalled form, it's an opaque handle. A marshalled form
doesn't destroy information.
Anyway it would work with a client-provided tag just as well.
connect_to_signal() could manufacture one and provide it to the server.
>
>>> { 'BLOCK_IO_ERROR': { 'device': 'str', 'action': 'str', 'operation':
>>> 'str' } }
>>> [ 'get-block-io-error-event': {}, 'BLOCK_IO_ERROR' }
>>>
>>> The way we marshal a 'BLOCK_IO_ERROR' type is by generating a unique
>>> handle and returning that.
>>
>> I don't follow at all. Where's the handle here? Why don't we return
>> the BLOCK_IO_ERROR as an object, on the wire?
>
> How we marshal an object depends on the RPC layer.
>
> We marshal events on the wire as an integer handle. That is only a
> concept within the wire protocol.
I don't think it's an accurate description. We marshall an event as a
json object according to the schema above (BLOCK_IO_ERROR). How we
marshall a subscription to an event, or an unsubscription to an event,
depends on how we specify the protocol. It has nothing to do with
client or server internal rpc stubs.
>
> We could just as easily return an object but without diving into JSON
> class hinting, it'd be pretty meaningless because we'd just return "{
> 'handle': 32}" instead of "32".
Right, I suggest we return nothing at all. Instead the client provides
the handle.
>
>>> While this looks like an int on the wire, at both the server and
>>> libqmp level, it looks like a BlockIoErrorEvent object. So in QEMU:
>>>
>>> BlockIoErrorEvent *qmp_get_block_io_error_event(Error **errp)
>>> {
>>> }
>>>
>>> And in libqmp:
>>>
>>> BlockIoErrorEvent *libqmp_get_block_io_error_event(QmpSession *sess,
>>> Error **errp)
>>> {
>>> }
>>
>> What would the wire exchange look like?
>
> > { 'execute': 'get-block-io-error-event' }
> < { 'return' : 32 }
> ...
> < { 'event': 'BLOCK_IO_ERROR', 'data': { 'action': 'stop', 'device':
> 'ide0-hd0', 'operation': 'read' }, 'tag': 32 }
> ...
> > { 'execute': 'put-event', 'arguments': { 'tag': 32 } }
Well, I may be biased, but I prefer my variant.
btw, it's good to decree that a subscription is immediately followed by
an event with the current state (which means events have to provide
state and be idempotent); so the subscribe-and-query pattern is provided
automatically.
btw2, I now nominate subscribe and unsubscribe as replacements for get
and put.
>
>>> Ignoring default events, you'll never see an event until you execute
>>> a signal accessor function. When you execute this function, you
>>> will start receiving the events and those events will carry a tag
>>> containing the handle returned by the signal accessor.
>>
>> A "signal accessor" is a command to start listening to a signal?
>
> Yes, it basically enables the signal for the session.
Okay, the subscription command.
>
>> So why not have the signal accessor provide the tag? Like execute:
>> blah provides a tag?
>
> How would this map to a C API? You'd either have to completely drop
> the notion of signal objects and use a separate mechanism to register
> callbacks against a tag (and lose type safety) or do some major
> munging to have the C API take a radically different signature than
> the wire protocol.
A C API could create and maintain tags under the covers (an int that
keeps increasing would do).
>
>>>
>>> Within libqmp, any time you execute a signal accessor, a new signal
>>> object is created of the appropriate type. When that object is
>>> destroyed, you send a put-event to stop receiving the signal.
>>>
>>> When you connect to a signal object (via libqmp), you don't execute
>>> the signal accessor because the object is already receiving the signal.
>>>
>>> Default events (which exist to preserve compatibility) are a set of
>>> events that are automatically connected to after qmp_capabilities is
>>> executed. Because these connections are implicit, they arrive
>>> without a handle in the event object.
>>>
>>> At this point, libqmp just ignores default events. In the future,
>>> I'd like to add a command that can be executed before
>>> qmp_capabilities that will avoid connecting to default events.
>>
>> I'm really confused. Part of that is because the conversation mixes
>> libqmp, server API, and wire protocol. I'd like to understand the
>> wire protocol first, everything else follows from that.
>
> No, it's the opposite for me. We design a good C API and then figure
> out how to make it work well as a wire protocol. The whole point of
> this effort is to build an API that we can consume within QEMU such
> that we can start breaking large chunks of code out of the main
> executable.
That makes a C centric wire protocol. Clients don't have to be C.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-03-10 14:25 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-07 1:22 [Qemu-devel] [PATCH 00/22] QAPI Round 1 Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 01/22] Add hard build dependency on glib Anthony Liguori
2011-03-07 10:59 ` Daniel P. Berrange
2011-03-07 13:55 ` Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 02/22] qerror: expose a function to format an error Anthony Liguori
2011-03-07 11:14 ` Stefan Hajnoczi
2011-03-07 13:38 ` Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 03/22] qapi: add Error object Anthony Liguori
2011-03-07 11:06 ` Daniel P. Berrange
2011-03-07 13:59 ` Anthony Liguori
2011-03-07 14:24 ` Anthony Liguori
2011-03-07 11:38 ` Stefan Hajnoczi
2011-03-07 13:36 ` Anthony Liguori
2011-03-07 13:55 ` Stefan Hajnoczi
2011-03-07 1:22 ` [Qemu-devel] [PATCH 04/22] qerror: split out the reporting bits of QError Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 05/22] qerror: add new error message for invalid enum values Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 06/22] qapi: add JSON parsing error message Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 07/22] json: propagate error from parser Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 08/22] qapi: add code generator for qmp-types Anthony Liguori
2011-03-07 1:57 ` Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 09/22] qapi: add code generator for type marshallers Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 10/22] qapi: add core QMP server support Anthony Liguori
2011-03-07 13:09 ` Stefan Hajnoczi
2011-03-07 13:39 ` Anthony Liguori
2011-03-07 13:46 ` Daniel P. Berrange
2011-03-07 13:54 ` Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 11/22] qapi: add signal support to core QMP server Anthony Liguori
2011-03-07 13:21 ` Stefan Hajnoczi
2011-03-07 13:53 ` Anthony Liguori
2011-03-07 14:36 ` Stefan Hajnoczi
2011-03-07 14:41 ` Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 12/22] qapi: add QAPI module type Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 13/22] qapi: add code generators for QMP command marshaling Anthony Liguori
2011-03-07 13:27 ` Stefan Hajnoczi
2011-03-07 13:44 ` Anthony Liguori
2011-03-07 14:38 ` Stefan Hajnoczi
2011-03-07 1:22 ` [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command Anthony Liguori
2011-03-07 13:35 ` Stefan Hajnoczi
2011-03-07 13:41 ` Anthony Liguori
2011-03-09 13:28 ` Avi Kivity
2011-03-09 13:44 ` Anthony Liguori
2011-03-09 13:51 ` Avi Kivity
2011-03-09 14:13 ` Anthony Liguori
2011-03-09 13:36 ` Avi Kivity
2011-03-09 14:11 ` Anthony Liguori
2011-03-09 14:37 ` Avi Kivity
2011-03-09 14:47 ` Anthony Liguori
2011-03-10 12:41 ` Avi Kivity
2011-03-10 12:46 ` Avi Kivity
2011-03-10 13:52 ` Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 15/22] qapi: add new QMP server that uses CharDriverState Anthony Liguori
2011-03-07 13:52 ` Stefan Hajnoczi
2011-03-07 14:02 ` Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 16/22] vl: add a new -qmp2 option to expose experimental QMP server Anthony Liguori
2011-03-07 1:22 ` [Qemu-devel] [PATCH 17/22] qapi: add QMP quit command Anthony Liguori
2011-03-07 1:23 ` [Qemu-devel] [PATCH 18/22] qapi: add QMP qmp_capabilities command Anthony Liguori
2011-03-07 1:23 ` [Qemu-devel] [PATCH 19/22] qapi: add QMP put-event command Anthony Liguori
2011-03-09 13:31 ` Avi Kivity
2011-03-09 13:48 ` Anthony Liguori
2011-03-09 13:58 ` Avi Kivity
2011-03-09 14:26 ` Anthony Liguori
2011-03-10 12:39 ` Avi Kivity
2011-03-10 14:12 ` Anthony Liguori
2011-03-10 14:24 ` Avi Kivity [this message]
2011-03-10 15:30 ` Avi Kivity
2011-03-10 15:41 ` Anthony Liguori
2011-03-10 15:49 ` Avi Kivity
2011-03-10 16:42 ` Anthony Liguori
2011-03-12 20:37 ` Avi Kivity
2011-03-10 15:33 ` Anthony Liguori
2011-03-10 15:45 ` Avi Kivity
2011-03-10 16:04 ` Anthony Liguori
2011-03-12 20:42 ` Avi Kivity
2011-03-12 23:30 ` Anthony Liguori
2011-03-07 1:23 ` [Qemu-devel] [PATCH 20/22] qapi: add code generator for libqmp Anthony Liguori
2011-03-07 1:23 ` [Qemu-devel] [PATCH 21/22] qapi: add test-libqmp Anthony Liguori
2011-03-07 1:23 ` [Qemu-devel] [PATCH 22/22] qapi: generate HTML report for test-libqmp Anthony Liguori
2011-03-07 2:11 ` Anthony Liguori
2011-03-07 1:26 ` [Qemu-devel] [PATCH] qapi: qmp-types.c and qmp-types.h Anthony Liguori
2011-03-07 1:27 ` [Qemu-devel] [PATCH] qapi: qmp-marshal-types.c and qmp-marshal-types.h Anthony Liguori
2011-03-07 1:28 ` [Qemu-devel] [PATCH] qapi: add qmp-marshal.c and qmp.h Anthony Liguori
2011-03-07 1:29 ` [Qemu-devel] [PATCH] qapi: add libqmp.c and libqmp.h Anthony Liguori
2011-03-07 15:08 ` [Qemu-devel] [PATCH 00/22] QAPI Round 1 Stefan Hajnoczi
2011-03-07 15:59 ` Anthony Liguori
2011-03-08 11:12 ` Avi Kivity
2011-03-08 13:35 ` Anthony Liguori
2011-03-08 13:45 ` Avi Kivity
2011-03-08 13:54 ` Anthony Liguori
2011-03-08 14:00 ` Avi Kivity
2011-03-08 14:10 ` Anthony Liguori
2011-03-08 14:17 ` Avi Kivity
2011-03-08 14:20 ` Anthony Liguori
2011-03-08 14:38 ` Anthony Liguori
2011-03-08 14:52 ` Avi Kivity
2011-03-08 15:03 ` Anthony Liguori
2011-03-08 17:44 ` Avi Kivity
2011-03-08 19:19 ` Anthony Liguori
2011-03-09 8:51 ` Avi Kivity
2011-03-09 13:12 ` Anthony Liguori
2011-03-09 13:14 ` Avi Kivity
2011-03-09 13:51 ` Anthony Liguori
2011-03-09 13:55 ` Avi Kivity
2011-03-09 14:15 ` Anthony Liguori
2011-03-09 13:51 ` Michael Roth
2011-03-07 20:59 ` Anthony Liguori
2011-03-07 22:00 ` Stefan Hajnoczi
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=4D78DF3A.9000600@redhat.com \
--to=avi@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.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.