On 01/27/2015 12:46 PM, Max Reitz wrote:
> Signed-off-by: Max Reitz <mre...@redhat.com>
> ---
>  blockdev.c           | 22 ++++++++++++++++++++++
>  qapi/block-core.json | 14 ++++++++++++++
>  qmp-commands.hx      | 33 +++++++++++++++++++++++++++++++++
>  3 files changed, 69 insertions(+)
> 

> +void qmp_blockdev_close_tray(const char *device, Error **errp)
> +{
> +    BlockBackend *blk;
> +
> +    blk = blk_by_name(device);
> +    if (!blk) {
> +        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
> +        return;
> +    }
> +
> +    if (!blk_dev_has_removable_media(blk)) {
> +        error_setg(errp, "Device '%s' is not removable", device);
> +        return;
> +    }
> +
> +    if (!blk_dev_is_tray_open(blk)) {
> +        return;
> +    }

Is it worth documenting that this (and the one in 38/50) are intentional
no-ops if the tray is already in the desired state?

Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
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