From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbfxy-00067q-CE for qemu-devel@nongnu.org; Mon, 14 Sep 2015 22:27:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbfxx-0002Hf-Ew for qemu-devel@nongnu.org; Mon, 14 Sep 2015 22:27:30 -0400 Date: Tue, 15 Sep 2015 10:27:21 +0800 From: Fam Zheng Message-ID: <20150915022721.GE14016@ad.nay.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v4 2/4] block: support passing 'backing': '' to 'blockdev-add' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz 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 > --- > 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