From: Jeff Cody <jcody@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v7 3/5] block: support passing 'backing': '' to 'blockdev-add'
Date: Tue, 13 Oct 2015 18:47:53 -0400 [thread overview]
Message-ID: <20151013224753.GQ11943@localhost.localdomain> (raw)
In-Reply-To: <6e347a922dffe8dc85d6b417f44772c483384739.1444640617.git.berto@igalia.com>
On Mon, Oct 12, 2015 at 12:16:15PM +0300, 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 <berto@igalia.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/block.c b/block.c
> index c9e3c6c..31d1b6e 100644
> --- a/block.c
> +++ b/block.c
> @@ -1406,6 +1406,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;
>
> @@ -1473,6 +1474,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.6.1
>
>
Reviewed-by: Jeff Cody <jcody@redhat.com>
next prev parent reply other threads:[~2015-10-13 22:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 9:16 [Qemu-devel] [PATCH v7 0/5] Add 'blockdev-snapshot' command Alberto Garcia
2015-10-12 9:16 ` [Qemu-devel] [PATCH v7 1/5] block: check for existing device IDs in external_snapshot_prepare() Alberto Garcia
2015-10-12 20:20 ` Max Reitz
2015-10-13 22:45 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2015-10-12 9:16 ` [Qemu-devel] [PATCH v7 2/5] block: rename BlockdevSnapshot to BlockdevSnapshotSync Alberto Garcia
2015-10-13 22:47 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2015-10-12 9:16 ` [Qemu-devel] [PATCH v7 3/5] block: support passing 'backing': '' to 'blockdev-add' Alberto Garcia
2015-10-13 22:47 ` Jeff Cody [this message]
2015-10-12 9:16 ` [Qemu-devel] [PATCH v7 4/5] block: add a 'blockdev-snapshot' QMP command Alberto Garcia
2015-10-12 20:29 ` Max Reitz
2015-10-13 5:45 ` Alberto Garcia
2015-10-12 9:16 ` [Qemu-devel] [PATCH v7 5/5] block: add tests for the 'blockdev-snapshot' command Alberto Garcia
2015-10-13 22:54 ` [Qemu-devel] [Qemu-block] " Jeff Cody
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151013224753.GQ11943@localhost.localdomain \
--to=jcody@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).