[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v4 2/4] block: support passing 'bac
From: |
Fam Zheng |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v4 2/4] block: support passing 'backing': '' to 'blockdev-add' |
Date: |
Tue, 15 Sep 2015 10:27:21 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, 09/14 19:01, Alberto Garcia wrote:
> Passing an empty string allows opening an image but not its backing
> file. This was already described in the API documentation, only the
> implementation was missing.
>
> This is useful for creating snapshots using images opened with
> blockdev-add, since they are not supposed to have a backing image
> before the operation.
>
> Signed-off-by: Alberto Garcia <address@hidden>
> ---
> block.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/block.c b/block.c
> index 22d3b0e..ad1792d 100644
> --- a/block.c
> +++ b/block.c
> @@ -1402,6 +1402,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs,
> const char *filename,
> BlockDriverState *file = NULL, *bs;
> BlockDriver *drv = NULL;
> const char *drvname;
> + const char *backing;
> Error *local_err = NULL;
> int snapshot_flags = 0;
>
> @@ -1469,6 +1470,12 @@ static int bdrv_open_inherit(BlockDriverState **pbs,
> const char *filename,
>
> assert(drvname || !(flags & BDRV_O_PROTOCOL));
>
> + backing = qdict_get_try_str(options, "backing");
> + if (backing && *backing == '\0') {
> + flags |= BDRV_O_NO_BACKING;
> + }
> + qdict_del(options, "backing");
> +
> bs->open_flags = flags;
> bs->options = options;
> options = qdict_clone_shallow(options);
> --
> 2.5.1
>
>
Specifying a non-empty "backing" will be a slient nop now, but it used to be an
error before. Should we return an error?
Fam
[Qemu-block] [PATCH v4 4/4] block: add tests for the 'blockdev-snapshot' command, Alberto Garcia, 2015/09/14