[Qemu-devel] [PATCH 08/10] migration: reorder processing in hmp_savevm
State deletion can be performed on running VM which reduces VM downtime This approach looks a bit more natural. Signed-off-by: Denis V. Lunev CC: Juan Quintela --- migration/savevm.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index f72349d..b4a3930 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1266,6 +1266,15 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) return; } +/* Delete old snapshots of the same name */ +if (name && bdrv_all_delete_snapshot(name, &bs1, &local_err) < 0) { +monitor_printf(mon, + "Error while deleting snapshot on device '%s': %s\n", + bdrv_get_device_name(bs1), error_get_pretty(local_err)); +error_free(local_err); +return; +} + bs = find_vmstate_bs(); if (!bs) { monitor_printf(mon, "No block device can accept snapshots\n"); @@ -1303,15 +1312,6 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm); } -/* Delete old snapshots of the same name */ -if (name && bdrv_all_delete_snapshot(name, &bs1, &local_err) < 0) { -monitor_printf(mon, - "Error while deleting snapshot on device '%s': %s\n", - bdrv_get_device_name(bs1), error_get_pretty(local_err)); -error_free(local_err); -goto the_end; -} - /* save the VM state */ f = qemu_fopen_bdrv(bs, 1); if (!f) { -- 2.5.0
[Qemu-devel] [PATCH 08/10] migration: reorder processing in hmp_savevm
State deletion can be performed on running VM which reduces VM downtime This approach looks a bit more natural. Signed-off-by: Denis V. Lunev CC: Juan Quintela --- migration/savevm.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index c2d677d..f4da064 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1267,6 +1267,15 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) return; } +/* Delete old snapshots of the same name */ +if (name && bdrv_all_delete_snapshot(name, &bs1, &local_err) < 0) { +monitor_printf(mon, + "Error while deleting snapshot on device '%s': %s\n", + bdrv_get_device_name(bs1), error_get_pretty(local_err)); +error_free(local_err); +return; +} + bs = find_vmstate_bs(); if (!bs) { monitor_printf(mon, "No block device can accept snapshots\n"); @@ -1304,15 +1313,6 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm); } -/* Delete old snapshots of the same name */ -if (name && bdrv_all_delete_snapshot(name, &bs1, &local_err) < 0) { -monitor_printf(mon, - "Error while deleting snapshot on device '%s': %s\n", - bdrv_get_device_name(bs1), error_get_pretty(local_err)); -error_free(local_err); -goto the_end; -} - /* save the VM state */ f = qemu_fopen_bdrv(bs, 1); if (!f) { -- 2.5.0
[Qemu-devel] [PATCH 08/10] migration: reorder processing in hmp_savevm
State deletion can be performed on running VM which reduces VM downtime This approach looks a bit more natural. Signed-off-by: Denis V. Lunev Reviewed-by: Fam Zheng CC: Juan Quintela --- migration/savevm.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index b004f84..9ec9117 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1935,6 +1935,15 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) return; } +/* Delete old snapshots of the same name */ +if (name && bdrv_all_delete_snapshot(name, &bs1, &local_err) < 0) { +monitor_printf(mon, + "Error while deleting snapshot on device '%s': %s\n", + bdrv_get_device_name(bs1), error_get_pretty(local_err)); +error_free(local_err); +return; +} + bs = find_vmstate_bs(); if (!bs) { monitor_printf(mon, "No block device can accept snapshots\n"); @@ -1972,15 +1981,6 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm); } -/* Delete old snapshots of the same name */ -if (name && bdrv_all_delete_snapshot(name, &bs1, &local_err) < 0) { -monitor_printf(mon, - "Error while deleting snapshot on device '%s': %s\n", - bdrv_get_device_name(bs1), error_get_pretty(local_err)); -error_free(local_err); -goto the_end; -} - /* save the VM state */ f = qemu_fopen_bdrv(bs, 1); if (!f) { -- 2.5.0