From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaS7i-0004r8-Qq for qemu-devel@nongnu.org; Fri, 11 Sep 2015 13:28:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaS7h-0005w4-M6 for qemu-devel@nongnu.org; Fri, 11 Sep 2015 13:28:30 -0400 References: <1be64a26c9a89ff0af4c2b1299d6c8b58361644a.1441890725.git.berto@igalia.com> From: Eric Blake Message-ID: <55F30F24.3000305@redhat.com> Date: Fri, 11 Sep 2015 11:28:04 -0600 MIME-Version: 1.0 In-Reply-To: <1be64a26c9a89ff0af4c2b1299d6c8b58361644a.1441890725.git.berto@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="G3XTopnvSAPfbT3mm0ANOhPQpW2i6mVaO" Subject: Re: [Qemu-devel] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --G3XTopnvSAPfbT3mm0ANOhPQpW2i6mVaO Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/10/2015 07:39 AM, Alberto Garcia wrote: > If set to true, the image will be opened with the BDRV_O_NO_BACKING > flag. 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. >=20 > Signed-off-by: Alberto Garcia > --- > block.c | 5 +++++ > qapi/block-core.json | 6 +++++- > 2 files changed, 10 insertions(+), 1 deletion(-) >=20 > diff --git a/block.c b/block.c > index 22d3b0e..4be32fb 100644 > --- a/block.c > +++ b/block.c > @@ -1469,6 +1469,11 @@ static int bdrv_open_inherit(BlockDriverState **= pbs, const char *filename, > =20 > assert(drvname || !(flags & BDRV_O_PROTOCOL)); > =20 > + if (qdict_get_try_bool(options, "ignore-backing", false)) { > + flags |=3D BDRV_O_NO_BACKING; > + } > + qdict_del(options, "ignore-backing"); What happens if the user specified "ignore-backing":true, "backing":...? Should that be a hard error? > { 'struct': 'BlockdevOptionsGenericCOWFormat', > 'base': 'BlockdevOptionsGenericFormat', > - 'data': { '*backing': 'BlockdevRef' } } > + 'data': { '*backing': 'BlockdevRef', > + '*ignore-backing': 'bool' } } Depending on whether the answer to my question is that we already behave sanely and don't leave a BlockdevRef dangling if the caller mixes the two approaches, then: Reviewed-by: Eric Blake But design-wise, would it make sense to support: "backing":null as an explicit request to not open a backing file? Right now, qapi does not have a way to express 'null' as part of an alternate type; but if it did, BlockdevRef would merely add 'null' as one of its allowed alternates. Then we wouldn't need ignore-backing from the QMP perspective. But I'm still not sure how it would map to the command line perspective. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --G3XTopnvSAPfbT3mm0ANOhPQpW2i6mVaO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV8w8kAAoJEKeha0olJ0NqwCQIAJ4UV7NPEgMPAahmIvXgoqgq uhPTb3Y3Yv/bvK6mjmQaK1gUpc4aolez3jhorwzOuBb2/OBaKneHAG8xB6WcuydA jPvS2utX7VYRw4vbFB0O6tNN0YKcugw9HbtErpOdv4mt5aznB+L1R7ENF0l2VGPP ssYOu9DmLE1kAlX76F8OTDzklAQrqxFyRdNvLSXJzxo5zySD6zO4GCcFUEmSFoph YLdXsWEZbxZOWT5aY85r9zBEkPLE8vrsWIvEMsGhctlSKphQc7SoAOmX1bCSkvH2 BylRsFH/hJ0USlnV5g7Q0obKVtqdmhHVFIEPazYUKZGYqtu/bqfyE4KQd0Jr83s= =CnkQ -----END PGP SIGNATURE----- --G3XTopnvSAPfbT3mm0ANOhPQpW2i6mVaO--