From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKYK8-0005hV-G4 for qemu-devel@nongnu.org; Fri, 13 Sep 2013 14:42:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKYK3-0004N0-J5 for qemu-devel@nongnu.org; Fri, 13 Sep 2013 14:42:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKYK3-0004Mw-Ah for qemu-devel@nongnu.org; Fri, 13 Sep 2013 14:42:27 -0400 Message-ID: <52335C90.4060006@redhat.com> Date: Fri, 13 Sep 2013 12:42:24 -0600 From: Eric Blake MIME-Version: 1.0 References: <1379073063-14963-1-git-send-email-kwolf@redhat.com> <1379073063-14963-16-git-send-email-kwolf@redhat.com> In-Reply-To: <1379073063-14963-16-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Nclrfxjjsh5risEQepPWmlqPHN1knFhoF" Subject: Re: [Qemu-devel] [PULL 15/33] snapshot: distinguish id and name in snapshot delete List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Nclrfxjjsh5risEQepPWmlqPHN1knFhoF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/13/2013 05:50 AM, Kevin Wolf wrote: > From: Wenchao Xia >=20 > Snapshot creation actually already distinguish id and name since it tak= e > a structured parameter *sn, but delete can't. Later an accurate delete > is needed in qmp_transaction abort and blockdev-snapshot-delete-sync, > so change its prototype. Also *errp is added to tip error, but return > value is kepted to let caller check what kind of error happens. Existin= g s/kepted/kept/ > caller for it are savevm, delvm and qemu-img, they are not impacted by > introducing a new function bdrv_snapshot_delete_by_id_or_name(), which > check the return value and do the operation again. >=20 > Before this patch: > For qcow2, it search id first then name to find the one to delete. > For rbd, it search name. > For sheepdog, it does nothing. >=20 > After this patch: > For qcow2, logic is the same by call it twice in caller. > For rbd, it always fails in delete with id, but still search for name= > in second try, no change to user. >=20 > Some code for *errp is based on Pavel's patch. >=20 > Signed-off-by: Wenchao Xia > Signed-off-by: Pavel Hrdina > Signed-off-by: Kevin Wolf > --- > =20 > static int qemu_rbd_snap_remove(BlockDriverState *bs, > - const char *snapshot_name) > + const char *snapshot_id, > + const char *snapshot_name, > + Error **errp) > { > BDRVRBDState *s =3D bs->opaque; > int r; > =20 > + if (!snapshot_name) { > + error_setg(errp, "rbd need a valid snapshot name"); s/need/needs/ > + return -EINVAL; > + } > + > + /* If snapshot_id is specified, it must be equal to name, see > + qemu_rbd_snap_list() */ > + if (snapshot_id && strcmp(snapshot_id, snapshot_name)) { > + error_setg(errp, > + "rbd do not support snapshot id, it should be NULL = or " s/do/does/ > -int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id= ) > +/** > + * Delete an internal snapshot by @snapshot_id and @name. > + * @bs: block device used in the operation > + * @snapshot_id: unique snapshot ID, or NULL > + * @name: snapshot name, or NULL > + * @errp: location to store error > + * > + * If both @snapshot_id and @name are specified, delete the first one = with > + * id @snapshot_id and name @name. > + * If only @snapshot_id is specified, delete the first one with id > + * @snapshot_id. > + * If only @name is specified, delete the first one with name @name. > + * if none is specified, return -ENINVAL. s/ENINVAL/EINVAL/ [Given that this is already in the pull request phase, I'm fine if the typo in the commit message stays, and if the remaining typos are cleaned up in a separate followup patch, rather than delaying this series any longer - my fault for not reviewing sooner] --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Nclrfxjjsh5risEQepPWmlqPHN1knFhoF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSM1yQAAoJEKeha0olJ0Nqb0cH/1siH/2KTYIkDei/+rAujCFr 8L/G6Y/lH1YsXiFIxfGxAqGdfdbZUfg6M5mwaWxwZH/25VsKEzeciww2ttBDQbXI TBRJYMdoD6aqeBPtnXGv9Fk9XDPavCZxL7NOWdPfsjt3e2vy3TGBzl/4f0STzTDh ViwkgUE0ygNDnyKI5pEDViDztOo7X5m4wiLAoOIN1IEA8yt9+PJMEz0UsK0p1yoj G776CDl7TstdIwnhKuBndK1gP2WWeWLXNohhjUYoOoMK+7HxdTG3Z2ROH6tRAalV 2n2lQaZAiIek7mkx+/MPiAv4R/rLoWBlEfFbDA7HqGhNA7dJ6tIu5E64h6cM25U= =GtgO -----END PGP SIGNATURE----- --Nclrfxjjsh5risEQepPWmlqPHN1knFhoF--