From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtHi5-0006PO-Hl for qemu-devel@nongnu.org; Mon, 02 Nov 2015 11:11:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtHi4-0007YS-HC for qemu-devel@nongnu.org; Mon, 02 Nov 2015 11:11:53 -0500 References: <693e03976f7b27b0cafa27c2e0cac754b61cf0be.1446465949.git.berto@igalia.com> From: Eric Blake Message-ID: <56378B42.4040505@redhat.com> Date: Mon, 2 Nov 2015 09:11:46 -0700 MIME-Version: 1.0 In-Reply-To: <693e03976f7b27b0cafa27c2e0cac754b61cf0be.1446465949.git.berto@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sMQWopu6CTIkOMbqok2Fk4UMIMw4fWsxJ" Subject: Re: [Qemu-devel] [PATCH v2 1/2] block: Disallow snapshots if the overlay doesn't support backing files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sMQWopu6CTIkOMbqok2Fk4UMIMw4fWsxJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/02/2015 05:15 AM, Alberto Garcia wrote: > This addresses scenarios like this one: >=20 > { 'execute': 'blockdev-add', 'arguments': > { 'options': { 'driver': 'qcow2', > 'node-name': 'new0', > 'file': { 'driver': 'file', > 'filename': 'new.qcow2', > 'node-name': 'file0' } } } } >=20 > { 'execute': 'blockdev-snapshot', 'arguments': > { 'node': 'virtio0', > 'overlay': 'file0' } } >=20 > Signed-off-by: Alberto Garcia > --- > blockdev.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/blockdev.c b/blockdev.c > index a567a05..2774bf5 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1667,6 +1667,11 @@ static void external_snapshot_prepare(BlkTransac= tionState *common, > =20 > if (state->new_bs->backing !=3D NULL) { > error_setg(errp, "The snapshot already has a backing image"); > + return; > + } > + > + if (!state->new_bs->drv->supports_backing) { > + error_setg(errp, "The snapshot does not support backing images= "); > } > } You could avoid the 'return' by doing: if (state->new_bs->backing) { error_setg(...); } else if (!state->new_bs->drv->supports_backing) { error_setg(...); } but I don't care enough to require a respin. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sMQWopu6CTIkOMbqok2Fk4UMIMw4fWsxJ 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/ iQEcBAEBCAAGBQJWN4tCAAoJEKeha0olJ0NqrE8H/i1h3uls2BlIgPwhKxgbQTV7 bPx/dj33BuG/APZkrJNoZvjBhzdp7vt1ox5UD6z288gsJ1R0g0wErIxgnyDv28ZI 6hQs5tjxd/mYThqlVr7JfQCh/Pezfno4aQ/IPHxm3j+D9y8BKaT3IAqKj5RfNNjK Zp7E3hBsOr2iwY0PkzeUL9xHLYt2vJ4r8GKGdD+JrDb36TrreloKkf4CZ/42NREM UpWRF87RFcixbG5Ufu6l3C+2dvoAnK9+NypMWXjkvyP98i7ExV0JkJkjqXtdybyK 4OLo3vMFofD2kE5bpPUXnugAW7/6oT7CWjINIC3Pm540ZDKUbi9V6dWN7aC0pZI= =2v7l -----END PGP SIGNATURE----- --sMQWopu6CTIkOMbqok2Fk4UMIMw4fWsxJ--