qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/10] block: Accept device model name for eject


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 07/10] block: Accept device model name for eject
Date: Wed, 14 Sep 2016 16:09:12 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 08/19/2016 11:50 AM, Kevin Wolf wrote:
> In order to remove the necessity to use BlockBackend names in the
> external API, we want to allow qdev device names in all device related
> commands.
> 
> This converts eject to accept a qdev device name.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  blockdev.c      | 10 +++++++---
>  hmp.c           |  2 +-
>  qapi/block.json |  7 ++++++-
>  qmp-commands.hx |  8 +++++---
>  4 files changed, 19 insertions(+), 8 deletions(-)
> 

> +++ b/blockdev.c

> @@ -2272,14 +2274,16 @@ void qmp_eject(const char *device, bool has_force, 
> bool force, Error **errp)
>          force = false;
>      }
>  
> -    rc = do_open_tray(device, NULL, force, &local_err);
> +    rc = do_open_tray(has_device ? device : NULL,
> +                      has_id ? id : NULL,
> +                      force, &local_err);
>      if (rc && rc != -ENOSYS) {
>          error_propagate(errp, local_err);
>          return;
>      }
>      error_free(local_err);
>  
> -    qmp_x_blockdev_remove_medium(true, device, false, NULL, errp);
> +    qmp_x_blockdev_remove_medium(has_device, device, has_id, id, errp);

Hmm. We have to call into the underlying x- command, without breaking
'eject' which must indeed keep the deprecated 'device' parameter.  So
maybe that answers my question on 5 and 6.

Or can we teach qmp_eject() to do the lookup now, so that it can call
into qmp_x_blockdev_remove_medium() with just id, even if the user
called in with device?  Do we even have that information readily
accessible (given a device, resolve it to an id that would work as if we
were passing an id in the first place)?

> +++ b/qapi/block.json
> @@ -127,6 +127,8 @@
>  #
>  # @device:  The name of the device
>  #
> +# @id:      The name or QOM path of the guest device (since: 2.8)
> +#

Missing mention of '#optional' in both parameters, as well as the
deprecation warning you had in 4/10.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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