On Tue, Mar 10, 2015 at 02:48:46PM +0100, Kevin Wolf wrote: > Am 10.03.2015 um 14:28 hat Stefan Hajnoczi geschrieben: > > On Mon, Mar 09, 2015 at 09:32:47PM +0800, Yi Wang wrote: > > > This will trigger the problem: vda has snapshot s1 with id "1", vdb > > > doesn't have s1 but has snapshot s2 with id "1"。When we want to run > > > command "virsh 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"! > > > > > > This shows the condition: > > > # qemu-img snapshot -l win7.img.1 > > > Snapshot list: > > > ID TAG VM SIZE DATE VM CLOCK > > > 1 s1 534M 2015-03-09 10:28:54 00:03:54.504 > > > > > > # qemu-img snapshot -l win7.append > > > Snapshot list: > > > ID TAG VM SIZE DATE VM CLOCK > > > 1 s2 0 2015-03-05 10:29:21 00:00:00.000 > > > > > > # virsh snapshot-create-as win7 s1 > > > error: operation failed: Failed to take snapshot: Error while creating > > > snapshot on 'drive-virtio-disk1' > > > > Then we've arrived at changing the behavior of 'savevm' so it always > > generates IDs. > > > > Kevin: What do you think about changing savevm semantics to always > > generate IDs? > > Sounds reasonable. We're free to set whatever ID we want. > > However, I wouldn't set id_str = "" like in the patch below, but remove > the check qcow2_snapshot_create() and call find_new_snapshot_id() > unconditionally.
Good idea! Yi: If you are happy with the approach Kevin suggested, please send a patch. Stefan
pgpXGs79z00Vd.pgp
Description: PGP signature