[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 5/7] block: Accept device model name for blo
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC PATCH 5/7] block: Accept device model name for blockdev-open/close-tray |
Date: |
Fri, 24 Jun 2016 14:39:18 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 06/23/2016 08:36 AM, Kevin Wolf wrote:
> This is an example conversion of a QMP command that operates on the
> BlockBackend level to accept both the device model name (which is
> supposed to become the primary interface) and the BlockBackend name.
>
> Naming suggestions for the new QMP field are welcome. The obvious one
> would be "device", but that's already taken...
>
> We'll also want QAPI to understand that exactly one of the two fields
> must be given, so we can remove/don't have to add explicit code in the
> command implementations to check that.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> blockdev.c | 60
> +++++++++++++++++++++++++++++++++++++++-------------
> qapi/block-core.json | 14 ++++++++----
> qmp-commands.hx | 12 +++++++----
> 3 files changed, 63 insertions(+), 23 deletions(-)
>
> +++ b/qapi/block-core.json
> @@ -2201,7 +2201,9 @@
> # to it
> # - if the guest device does not have an actual tray
> #
> -# @device: block device name
> +# @device: block device name (deprecated, use @id instead)
> +#
> +# @id: the name or QOM path of the guest device
> #
Is this something we want to rush into 2.7, or is it big enough to
convert all the commands that we may want to wait for 2.8? Either way,
we'll probably want to add a '(since 2.x)' hint, and maybe come up with
a standard way to document mutually-exclusive members given that
Marc-Andre is trying to automate documentation from the .json file.
> # @force: #optional if false (the default), an eject request will be sent to
> # the guest if it has locked the tray (and the tray will not be
> opened
> @@ -2211,7 +2213,8 @@
> # Since: 2.5
> ##
> { 'command': 'blockdev-open-tray',
> - 'data': { 'device': 'str',
> + 'data': { '*device': 'str',
> + '*id': 'str',
> '*force': 'bool' } }
>
Your idea about having some particular QAPI shorthand for marking two
mutually-exclusive members may indeed be worth addressing, since we're
going to have more cases of it. But off-hand, I don't know what syntax
would be best, particularly if we want to keep QAPI close to JSON.
> +++ b/qmp-commands.hx
> @@ -4255,7 +4255,7 @@ EQMP
>
> {
> .name = "blockdev-open-tray",
> - .args_type = "device:s,force:b?",
> + .args_type = "device:s?,id:s?,force:b?",
> .mhandler.cmd_new = qmp_marshal_blockdev_open_tray,
On the bright side, once Marc-Andre's work goes in, we won't have
qmp-commands.hx to worry about.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [RFC PATCH 1/7] block/qdev: Allow node name for drive properties, (continued)
- [Qemu-devel] [RFC PATCH 1/7] block/qdev: Allow node name for drive properties, Kevin Wolf, 2016/06/23
- [Qemu-devel] [RFC PATCH 4/7] qdev-monitor: Add blk_by_qdev_id(), Kevin Wolf, 2016/06/23
- [Qemu-devel] [RFC PATCH 3/7] qdev-monitor: Factor out find_device_state(), Kevin Wolf, 2016/06/23
- [Qemu-devel] [RFC PATCH 2/7] block: Add blk_by_dev(), Kevin Wolf, 2016/06/23
- [Qemu-devel] [RFC PATCH 5/7] block: Accept device model name for blockdev-open/close-tray, Kevin Wolf, 2016/06/23
- Re: [Qemu-devel] [RFC PATCH 5/7] block: Accept device model name for blockdev-open/close-tray,
Eric Blake <=
- [Qemu-devel] [RFC PATCH 7/7] block/qdev: Allow configuring WCE with qdev properties, Kevin Wolf, 2016/06/23
- [Qemu-devel] [RFC PATCH 6/7] block: Accept node-name for block-stream, Kevin Wolf, 2016/06/23
- Re: [Qemu-devel] [RFC PATCH 0/7] BlockBackends, nodes and guest devices, Paolo Bonzini, 2016/06/23
- Re: [Qemu-devel] [RFC PATCH 0/7] BlockBackends, nodes and guest devices, Max Reitz, 2016/06/27