[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 31/32] hmp: use snapshot name to determine whether a
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 31/32] hmp: use snapshot name to determine whether a snapshot is 'fully available' |
Date: |
Fri, 8 Jul 2016 19:21:43 +0200 |
From: Lin Ma <address@hidden>
Currently qemu uses snapshot id to determine whether a snapshot is fully
available, It causes incorrect output in some scenario.
For instance:
(qemu) info block
drive_image1 (#block113): /opt/vms/SLES12-SP1-JeOS-x86_64-GM/disk0.qcow2
(qcow2)
Cache mode: writeback
drive_image2 (#block349): /opt/vms/SLES12-SP1-JeOS-x86_64-GM/disk1.qcow2
(qcow2)
Cache mode: writeback
(qemu)
(qemu) info snapshots
There is no snapshot available.
(qemu)
(qemu) snapshot_blkdev_internal drive_image1 snap1
(qemu)
(qemu) info snapshots
There is no suitable snapshot available
(qemu)
(qemu) savevm checkpoint-1
(qemu)
(qemu) info snapshots
ID TAG VM SIZE DATE VM CLOCK
1 snap1 0 2016-05-22 16:57:31 00:01:30.567
(qemu)
$ qemu-img snapshot -l disk0.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snap1 0 2016-05-22 16:57:31 00:01:30.567
2 checkpoint-1 165M 2016-05-22 16:58:07 00:02:06.813
$ qemu-img snapshot -l disk1.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 checkpoint-1 0 2016-05-22 16:58:07 00:02:06.813
The patch uses snapshot name instead of snapshot id to determine whether a
snapshot is fully available and uses '--' instead of snapshot id in output
because the snapshot id is not guaranteed to be the same on all images.
For instance:
(qemu) info snapshots
List of snapshots present on all disks:
ID TAG VM SIZE DATE VM CLOCK
-- checkpoint-1 165M 2016-05-22 16:58:07 00:02:06.813
Signed-off-by: Lin Ma <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
migration/savevm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 38b85ee..a8f22da 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2230,7 +2230,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
available_snapshots = g_new0(int, nb_sns);
total = 0;
for (i = 0; i < nb_sns; i++) {
- if (bdrv_all_find_snapshot(sn_tab[i].id_str, &bs1) == 0) {
+ if (bdrv_all_find_snapshot(sn_tab[i].name, &bs1) == 0) {
available_snapshots[total] = i;
total++;
}
@@ -2241,6 +2241,10 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "\n");
for (i = 0; i < total; i++) {
sn = &sn_tab[available_snapshots[i]];
+ /* The ID is not guaranteed to be the same on all images, so
+ * overwrite it.
+ */
+ pstrcpy(sn->id_str, sizeof(sn->id_str), "--");
bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, sn);
monitor_printf(mon, "\n");
}
--
1.8.3.1
- [Qemu-block] [PULL 23/32] qemu-img: Use strerror() for generic resize error, (continued)
- [Qemu-block] [PULL 23/32] qemu-img: Use strerror() for generic resize error, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 22/32] block: Remove BB options from blockdev-add, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 21/32] qemu-iotests: Test setting WCE with qdev, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 25/32] qemu-io: Use correct range limitations, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 27/32] Improve block job rate limiting for small bandwidth values, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 24/32] qcow2: Avoid making the L1 table too big, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 26/32] qcow2: Fix qcow2_get_cluster_offset(), Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 28/32] vmdk: fix metadata write regression, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 30/32] qemu-iotests: Test naming of throttling groups, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 29/32] blockdev: Fix regression with the default naming of throttling groups, Kevin Wolf, 2016/07/08
- [Qemu-block] [PULL 31/32] hmp: use snapshot name to determine whether a snapshot is 'fully available',
Kevin Wolf <=
- [Qemu-block] [PULL 32/32] hmp: show all of snapshot info on every block dev in output of 'info snapshots', Kevin Wolf, 2016/07/08
- Re: [Qemu-block] [Qemu-devel] [PULL 00/32] Block layer patches, Peter Maydell, 2016/07/11