From: Anthony Liguori <aliguori@us.ibm.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com, kraxel@redhat.com,
qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 12/13] qapi: support for keyworded variable-length argument list
Date: Thu, 29 Mar 2012 13:53:45 -0500 [thread overview]
Message-ID: <4F74AFB9.1090203@us.ibm.com> (raw)
In-Reply-To: <20120329154234.13c18fbe@doriath.home>
On 03/29/2012 01:42 PM, Luiz Capitulino wrote:
> On Thu, 29 Mar 2012 13:26:34 -0500
> Anthony Liguori<aliguori@us.ibm.com> wrote:
>
>> On 03/29/2012 12:26 PM, Luiz Capitulino wrote:
>>> This allows for QAPI functions to receive a variable-length argument
>>> list. This is going to be used by device_add and netdev_add commands.
>>>
>>> In the schema, the argument list is represented by type name '**',
>>> like this example:
>>>
>>> { 'command': 'foo', 'data': { 'arg-list': '**' } }
>>>
>>> Each argument is represented by the KeyValues type and the C
>>> implementation should expect a KeyValuesList, like:
>>>
>>> void qmp_foo(KeyValuesList *values_list, Error **errp);
>>>
>>> XXX: This implementation is simple but very hacky. We just iterate
>>> through all arguments and build the KeyValuesList list to be
>>> passed to the QAPI function.
>>>
>>> Maybe we could have a kwargs type, that does exactly this but
>>> through a visitor instead?
>>>
>>> Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
>>
>> What about just treating '**' as "marshal remaining arguments to a string" and
>> then pass that string to device_add? qmp_device_add can then parse that string
>> with QemuOpts.
>
> If this turns out to be simple enough, I'm fine with it.
I don't love doing this sort of double conversion but it's really the only
practical way to do it I think. device_add has a weird semantic where
printing/parsing is implied so I think it's unavoidable.
>> It's a bit ugly, but that's how things worked. When we introduce qom_add, this
>> problem goes away because you would make multiple calls to qom_set to set all of
>> the properties.
>
> Just out of curiosity, is qom_add going to supersede device_add?
Eventually...
I'd like to see qom_add as the low level interface but then I'd like to see nice
high level interfaces like 'block_add' which took a parameter of virtio-blk and
did all of the magic to create a block device in such a way that's compliant to
the current machine type.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2012-03-29 18:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-29 17:26 [Qemu-devel] [RFC 00/13]: convert device_add to the qapi Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 01/13] qemu-option: qemu_opts_create(): use error_set() Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 02/13] qemu-option: parse_option_number(): " Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 03/13] qemu-option: parse_option_bool(): " Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 04/13] qemu-option: parse_option_size(): " Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 05/13] qemu-option: qemu_opt_parse(): " Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 06/13] qemu-option: opt_set(): " Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 07/13] qemu-option: opts_do_parse(): " Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 08/13] qemu-option: introduce qemu_opt_set_err() Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 09/13] qerror: introduce QERR_INVALID_OPTION_GROUP Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 10/13] qemu-config: find_list(): use error_set() Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 11/13] qemu-config: introduce qemu_find_opts_err() Luiz Capitulino
2012-03-29 17:26 ` [Qemu-devel] [PATCH 12/13] qapi: support for keyworded variable-length argument list Luiz Capitulino
2012-03-29 18:26 ` Anthony Liguori
2012-03-29 18:42 ` Luiz Capitulino
2012-03-29 18:53 ` Anthony Liguori [this message]
2012-03-29 19:28 ` Michael Roth
2012-03-29 20:01 ` Anthony Liguori
2012-03-29 22:39 ` Michael Roth
2012-03-29 22:56 ` Michael Roth
2012-03-30 7:49 ` Paolo Bonzini
2012-03-30 13:01 ` Luiz Capitulino
2012-03-29 20:03 ` Paolo Bonzini
2012-03-29 17:26 ` [Qemu-devel] [PATCH 13/13] qapi: convert device_add Luiz Capitulino
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=4F74AFB9.1090203@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).