qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 19/22] qapi: add QMP put-event command


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 19/22] qapi: add QMP put-event command
Date: Thu, 10 Mar 2011 09:41:15 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8

On 03/10/2011 09:30 AM, Avi Kivity wrote:
On 03/10/2011 04:24 PM, Avi Kivity wrote:
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.

I also think it should be at the protocol layer:

> { execute: some-command, id: foo, arguments: { ... } }
< { result: { ... }, id: foo }
> { subscribe: block-io-error, id: bar, arguments: { ... } }
< { result: { ... } id: bar }
< { event: block-io-error, id: bar, data : { ... } }
> { unsubscribe: block-io-error, id: bar }
< { result: { ... } id: bar }

So events are now protocol-level pieces like commands, and the use of tags is uniform.

Maybe for QMPv2, but for QMPv1, this is going to introduce an extremely incompatible change.

Actually, we missed the json-rpc boat in designing QMP. It should look like:

> { method: some-command, id: foo, params: { ... } }
< { result: { ... }, id: foo, params: { ... }, error: null }
> { method: connect-block-io-error, id: bar, params: { ... } }
< { result: { ... }, id: bar, error: null }
< { method: block-io-error, id: null, params: { ... } }

Keys are different and null is passed instead of not including a tag. Events are sent exactly like methods but id is null. A result is never sent to the server for an event.

One of the good things about using a code generator and IDL though is that we can add a -qmp dev,protocol=json-rpc that encodes appropriately. We can probably do this translation at the QObject level really. But in the future, we can also add -qmp dev,protocol=xml-rpc, -qmp dev,protocol=rest, or -qmp dev,protocol=asn1-rpc

Regards,

Anthony Liguori





reply via email to

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