[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2 |
Date: |
Mon, 21 May 2012 16:47:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Il 21/05/2012 16:40, Anthony Liguori ha scritto:
> On 05/21/2012 09:26 AM, Paolo Bonzini wrote:
>> Il 21/05/2012 16:19, Anthony Liguori ha scritto:
>>>>
>>>
>>> I'm not against it in principle, just in practice. Today, checking
>>> whether a command exists is:
>>>
>>> commands = qmp.query_commands()
>>>
>>> if 'block-stream' in commands:
>>> # has block-stream
>>>
>>> I have a hard time envisioning how schema introspection can be
>>> reasonably implemented in a client.
>>
>> schema = qmp.query_command_schema('block-stream')
>
> What would schema return?
>
> Did you mean:
>
> if schema['arguments'].has_key('on_error'):
Yes, something like that.
> What about adding a parameter to a structure?
schema = qmp.query_type('foo')
if schema['data'].has_key('xyz')
> BTW, the other problem with adding arguments like this is that it makes
> a stable C API impossible.
Adding fields to structs is not a problem as long as "libqmp" takes care
of all allocations on part of its client. Adding parameters to commands
requires some smartness, but there are ways to do it:
1) add the first version number to the schema, generate versioned entry
points
qmp_block_stream_v1_1
qmp_block_stream_v1_2
etc. Provide multiple headers libqmp-1.1.h, libqmp-1.2.h etc. that take
care of #define'ing qmp_block_stream to one of them
2) Same as (1) but use qmp_block_stream for the oldest version having
the command.
3) have fun with the preprocessor (macro with variable arguments,
sizeof, designated initializers, whatever) and emulate keyword arguments
for the C API.
Paolo
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, (continued)
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Stefan Hajnoczi, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Luiz Capitulino, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Kevin Wolf, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Anthony Liguori, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Luiz Capitulino, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Anthony Liguori, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Paolo Bonzini, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Anthony Liguori, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2,
Paolo Bonzini <=
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Anthony Liguori, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Paolo Bonzini, 2012/05/21
- Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Kevin Wolf, 2012/05/21
Re: [Qemu-devel] Proposal for extensions of block job commands in QEMU 1.2, Paolo Bonzini, 2012/05/21
[Qemu-devel] Block job commands in QEMU 1.2 [v2, including support for replication], Paolo Bonzini, 2012/05/24