From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBUgT-0005CU-C2 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 16:41:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBUgS-000174-88 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 16:41:29 -0500 References: <1450802786-20893-1-git-send-email-kwolf@redhat.com> <1450802786-20893-7-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <5679C37C.9010400@redhat.com> Date: Tue, 22 Dec 2015 14:41:16 -0700 MIME-Version: 1.0 In-Reply-To: <1450802786-20893-7-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="t024m1DGBDrsURocouDcruPrV7i2mw9Sk" Subject: Re: [Qemu-devel] [PATCH 06/10] qemu-img: Prepare for locked images List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --t024m1DGBDrsURocouDcruPrV7i2mw9Sk Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/22/2015 09:46 AM, Kevin Wolf wrote: > This patch extends qemu-img for working with locked images. It prints a= > helpful error message when trying to access a locked image read-write, > and adds a 'qemu-img force-unlock' command as well as a 'qemu-img check= > -r all --force' option in order to override a lock left behind after a > qemu crash. >=20 > Signed-off-by: Kevin Wolf > --- > include/block/block.h | 1 + > include/qapi/error.h | 1 + > qapi/common.json | 3 +- > qemu-img-cmds.hx | 10 ++++-- > qemu-img.c | 96 +++++++++++++++++++++++++++++++++++++++++++= -------- > qemu-img.texi | 20 ++++++++++- > 6 files changed, 113 insertions(+), 18 deletions(-) >=20 > diff --git a/include/block/block.h b/include/block/block.h > index 0d00ac1..1ae655c 100644 > --- a/include/block/block.h > +++ b/include/block/block.h > @@ -101,6 +101,7 @@ typedef struct HDGeometry { > #define BDRV_OPT_CACHE_DIRECT "cache.direct" > #define BDRV_OPT_CACHE_NO_FLUSH "cache.no-flush" > =20 > +#define BDRV_OPT_OVERRIDE_LOCK "override-lock" New dict key here... > =20 > blk =3D blk_new_open(id, filename, NULL, options, flags, &local_er= r); > + if (!blk && error_get_class(local_err) =3D=3D ERROR_CLASS_IMAGE_FI= LE_LOCKED) { > + if (force) { > + qdict_put(options, BDRV_OPT_OVERRIDE_LOCK, qstring_from_st= r("on")); =2E..but not supported by any of the block drivers until 10/10 adds it fo= r qcow2. I guess what happens is that... > + blk =3D blk_new_open(id, filename, NULL, options, flags, N= ULL); =2E..the second blk_new_open() fails if the option is unrecognized, but w= e ignore the second failure; and therefore the option makes a difference only if the block driver understands the option. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --t024m1DGBDrsURocouDcruPrV7i2mw9Sk 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/ iQEcBAEBCAAGBQJWecN8AAoJEKeha0olJ0NqLHEH/1b5/eDHfL0jN/QMc73mlSP1 7ksM5+vG6oGg740rDmFSPpTO3px87ChcGeZIXnwR1xPaRJWSpbfKUl0N973y5KNa 1vm6X6Icbqc/ZHLC6PHQNt71NQV9xdC8vwudsvFElXPtFx8onC+dLv7JgEh3CHdE 8zUBBvNv/xjUeemtm1NdIkTQKEwOYPhwEDJWeyqlXXgvLxCOVjZqBGSuhXq538s5 63dyYi9egxoV+DpdQ78mBD3ykBaULHzRQ9Hhywdape9FYu6S9WDjVAtEMGTkYNIn Y3iUPpcDRXtzxxcJf4Khe2f9lxk9NujFpfWThjkpCf/R2EwdQ5vt9SjtYzfJBq8= =vqU8 -----END PGP SIGNATURE----- --t024m1DGBDrsURocouDcruPrV7i2mw9Sk--