[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 01/76] savevm: create snapshot failed when id_str alr
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 01/76] savevm: create snapshot failed when id_str already exists |
Date: |
Tue, 28 Apr 2015 16:59:43 +0200 |
From: Yi Wang <address@hidden>
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". 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"!
The simplest way is call find_new_snapshot_id() unconditionally.
Signed-off-by: Yi Wang <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2-snapshot.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 2aa9dcb..17bb211 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -351,10 +351,8 @@ int qcow2_snapshot_create(BlockDriverState *bs,
QEMUSnapshotInfo *sn_info)
memset(sn, 0, sizeof(*sn));
- /* Generate an ID if it wasn't passed */
- if (sn_info->id_str[0] == '\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));
/* Check that the ID is unique */
if (find_snapshot_by_id_and_name(bs, sn_info->id_str, NULL) >= 0) {
--
1.8.3.1
- [Qemu-block] [PULL 00/76] Block patches, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 02/76] MAINTAINERS: Add myself as the maintainer of the Quorum driver, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 01/76] savevm: create snapshot failed when id_str already exists,
Kevin Wolf <=
- [Qemu-block] [PULL 03/76] bt-sdp: fix broken uuids power-of-2 calculation, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 04/76] hw/arm/nseries: convert ffs(3) to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 05/76] uninorth: convert ffs(3) to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 07/76] Convert ffs() != 0 callers to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 08/76] sd: convert sd_normal_command() ffs(3) call to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 09/76] omap_intc: convert ffs(3) to ctz32() in omap_inth_sir_update(), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 06/76] Convert (ffs(val) - 1) to ctz32(val), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 10/76] os-win32: drop ffs(3) prototype, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 11/76] checkpatch: complain about ffs(3) calls, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 12/76] block: Switch to host monotonic clock for IO throttling, Kevin Wolf, 2015/04/28