qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RESEND 43/50] blockdev: Implement change with ba


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RESEND 43/50] blockdev: Implement change with basic operations
Date: Wed, 28 Jan 2015 13:30:41 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 01/27/2015 12:46 PM, Max Reitz wrote:
> Implement 'change' on block devices by calling blockdev-open-tray,
> blockdev-remove-medium, blockdev-insert-medium (a variation of that
> which does not need a node-name) and blockdev-close-tray.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  blockdev.c | 191 
> +++++++++++++++++++++++--------------------------------------
>  1 file changed, 72 insertions(+), 119 deletions(-)
> 

> +
> +    qmp_blockdev_open_tray(device, false, false, &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
> +
> +    qmp_blockdev_remove_medium(device, &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
> +
> +    qmp_blockdev_insert_anon_medium(device, medium_bs, &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
> +
> +    qmp_blockdev_close_tray(device, errp);

So if we fail anywhere in the middle, the device is left in an
unspecified state, and a followup query-block would be needed to learn
where we failed.  I guess that's life when you use a high-level command
instead of chaining low-level ones yourself.  I can live with it.

Reviewed-by: Eric Blake <address@hidden>

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