[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 32/39] blockdev: Implement eject with basic o
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v7 32/39] blockdev: Implement eject with basic operations |
Date: |
Fri, 23 Oct 2015 15:54:35 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 19.10.2015 um 17:53 hat Max Reitz geschrieben:
> Implement 'eject' by calling blockdev-open-tray and
> blockdev-remove-medium.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> blockdev.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index a4c278f..0481686 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1941,16 +1941,15 @@ out:
>
> void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
> {
> - BlockBackend *blk;
> + Error *local_err = NULL;
>
> - blk = blk_by_name(device);
> - if (!blk) {
> - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
> - "Device '%s' not found", device);
> + qmp_blockdev_open_tray(device, has_force, force, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> return;
> }
This changes the behaviour, in the current patch series in two ways if
the device is locked:
1. With force, the qmp_blockdev_remove_medium() call will fail because
we only unlocked the device, but didn't actually open the tray (I
commented on this in the qmp_blockdev_open_tray() patch). This breaks
the API, obviously.
2. Without force, eject previously sent an eject request and also
returned a "Device is locked" error. Now it fails with "Tray of
device is not open". Regression in the message quality, but not an
API breakage because tools must not parse the message.
> - eject_device(blk, force, errp);
> + qmp_blockdev_remove_medium(device, errp);
> }
Kevin
- Re: [Qemu-devel] [PATCH v7 31/39] blockdev: Add blockdev-insert-medium, (continued)
Re: [Qemu-devel] [PATCH v7 31/39] blockdev: Add blockdev-insert-medium, Kevin Wolf, 2015/10/23
[Qemu-devel] [PATCH v7 29/39] blockdev: Add blockdev-close-tray, Max Reitz, 2015/10/19
[Qemu-devel] [PATCH v7 32/39] blockdev: Implement eject with basic operations, Max Reitz, 2015/10/19
- Re: [Qemu-devel] [PATCH v7 32/39] blockdev: Implement eject with basic operations,
Kevin Wolf <=
[Qemu-devel] [PATCH v7 33/39] blockdev: Implement change with basic operations, Max Reitz, 2015/10/19
[Qemu-devel] [PATCH v7 34/39] block: Inquire tray state before tray-moved events, Max Reitz, 2015/10/19
[Qemu-devel] [PATCH v7 35/39] qmp: Introduce blockdev-change-medium, Max Reitz, 2015/10/19