qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] block/rbd: add .bdrv_reopen_prepare() stub


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] block/rbd: add .bdrv_reopen_prepare() stub
Date: Fri, 13 May 2016 10:45:48 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 13.05.2016 um 10:29 hat Sebastian Färber geschrieben:
> Add support for reopen() by adding the .bdrv_reopen_prepare() stub
> 
> Signed-off-by: Sebastian Färber <address@hidden>
> Tested-by: Sebastian Färber <address@hidden>
> ---
>  block/rbd.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/block/rbd.c b/block/rbd.c
> index 5bc5b32..5f121b5 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -577,6 +577,14 @@ failed_opts:
>      return r;
>  }
> 
> +/* Note that this will not re-establish a connection with the Ceph cluster
> +   - it is effectively a NOP.  */
> +static int qemu_rbd_reopen_prepare(BDRVReopenState *state,
> +                                   BlockReopenQueue *queue, Error **errp)
> +{
> +    return 0;
> +}

A correct reopen implementation must consider all options and flags that
.bdrv_open() looked at.

The options are okay, as both "filename" and "password-secret" aren't
things that we want to allow a reopen to change. However, in the flags
BDRV_O_NOCACHE makes a difference:

    if (flags & BDRV_O_NOCACHE) {
        rados_conf_set(s->cluster, "rbd_cache", "false");
    } else {
        rados_conf_set(s->cluster, "rbd_cache", "true");
    }

A reopen must either update the setting, or if it can't (e.g. because
librbd doesn't support it) any attempt to change the flag must fail.

Kevin



reply via email to

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