From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaND6-0002fP-CP for qemu-devel@nongnu.org; Tue, 24 Mar 2015 07:41:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YaND3-0002oQ-6F for qemu-devel@nongnu.org; Tue, 24 Mar 2015 07:41:28 -0400 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:38369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaND2-0002oM-R4 for qemu-devel@nongnu.org; Tue, 24 Mar 2015 07:41:25 -0400 Received: by wibgn9 with SMTP id gn9so92987907wib.1 for ; Tue, 24 Mar 2015 04:41:24 -0700 (PDT) Date: Tue, 24 Mar 2015 11:41:20 +0000 From: Stefan Hajnoczi Message-ID: <20150324114120.GE13011@stefanha-thinkpad.redhat.com> References: <20150225094112.GB18680@stefanha-thinkpad.redhat.com> <20150305174013.GA19499@stefanha-thinkpad.redhat.com> <20150306155017.GA2431@stefanha-thinkpad.redhat.com> <20150310132858.GB19057@stefanha-thinkpad.redhat.com> <20150310134846.GE3770@noname.str.redhat.com> <20150311125750.GA10493@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dFWYt1i2NyOo1oI9" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] savevm: create snapshot failed when id_str already exits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yi Wang Cc: Kevin Wolf , wang.yi59@zte.com.cn, quintela@redhat.com, qemu-devel@nongnu.org, Stefan Hajnoczi , amit.shah@redhat.com --dFWYt1i2NyOo1oI9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 12, 2015 at 11:29:38PM +0800, Yi Wang wrote: > How about this? >=20 > From 913cf2cd04167b7f6b892ac1ab405a617d886b97 Mon Sep 17 00:00:00 2001 > From: Yi Wang > Date: Thu, 12 Mar 2015 22:54:42 +0800 > Subject: [PATCH] savevm: create snapshot failed when id_str already exists >=20 > The command "virsh create" will fail in such condition: vm has two > disks: vda and vdb. vda has snapshot s1 with id "1", vdb doesn't have > s1 but has snapshot s2 with id "1"=E3=80=82When we want to run command "v= irsh > create s1", del_existing_snapshots() only deletes s1 in vda, and > bdrv_snapshot_create() tries to create vdb's snapshot s1 with id "1", > but id "1" alreay exists in vdb with name "s2"! >=20 > The simplest way is call find_new_snapshot_id() unconditionally. >=20 > Signed-off-by: Yi Wang > --- > block/qcow2-snapshot.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c > index 5b3903c..cb00f56 100644 > --- a/block/qcow2-snapshot.c > +++ b/block/qcow2-snapshot.c > @@ -351,10 +351,8 @@ int qcow2_snapshot_create(BlockDriverState *bs, > QEMUSnapshotInfo *sn_info) >=20 > memset(sn, 0, sizeof(*sn)); >=20 > - /* Generate an ID if it wasn't passed */ > - if (sn_info->id_str[0] =3D=3D '\0') { > - find_new_snapshot_id(bs, sn_info->id_str, sizeof(sn_info->id_str= )); > - } > + /* Generate an ID */ > + find_new_snapshot_id(bs, sn_info->id_str, sizeof(sn_info->id_str)); >=20 > /* Check that the ID is unique */ > if (find_snapshot_by_id_and_name(bs, sn_info->id_str, NULL) >=3D 0) { > --=20 > 1.9.5.msysgit.0 Thanks, I've applied the patch to the block-next branch for QEMU 2.4: https://github.com/stefanha/qemu/commits/block-next Please send future patches as separate top-level email threads using git-send-email(1). I missed this reply since it was not a new email thread. git-am(1) refuses to apply the patch because of line-wrapping in your email, I had to fix that manually. Also, please stick to ASCII characters when possible. Your patch description uses the Chinese full stop (=E5=8F=A5=E8=99=9F). I had to manu= ally edit the patch because git-am(1) refuses to apply a copy-pasted patch without explicit character encoding information. Stefan --dFWYt1i2NyOo1oI9 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVEU1gAAoJEJykq7OBq3PItRwH/inTT+nK6poVH5piLWCbS8In G75Il/5sRVRLrr9ujhukF5UQ7fmk7lrYORPWgk6ILq1eqRaEPa+EprCBLzk2/DTc BnzdJYVOKLVWIoLjPkBHmBq+VcTIdi9jv84vkb3he/Kt499OPdfIrqMB2+bZV5eK giMLXlIvKRW32H9fzuDRbpUcO6Kqh+MxDNmA2xwucH7xsXdxvHfuXqNP3m3uYq76 SARtlDtwl4mK+AePwDMeBu7rURFcvShczMzxUfz2xpO8tO4gg0LI3zRY9U4HD2D4 IHzP8Eh0IYDJP4B1nIYGIPbzDzQ73UIGE4Q9YEXDXA6c5xv961iZYLuKzczHUuI= =3koQ -----END PGP SIGNATURE----- --dFWYt1i2NyOo1oI9--