The 'restart' label is a complete misnomer since the last commit and the single operation of setting the error in the snapshot state can be inlined everywhere. Also adds it in two branches it was missing.
Lastly, improve the code style for checking whether migrate_init() failed by explicitly comparing against 0. Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- migration/savevm-async.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/migration/savevm-async.c b/migration/savevm-async.c index 72d8ed2739..d46f4e0275 100644 --- a/migration/savevm-async.c +++ b/migration/savevm-async.c @@ -371,6 +371,7 @@ void qmp_savevm_start(const char *statefile, Error **errp) } if (qemu_savevm_state_blocked(errp)) { + save_snapshot_error("setup failed"); return; } @@ -381,12 +382,14 @@ void qmp_savevm_start(const char *statefile, Error **errp) snap_state.target = blk_new_open(statefile, NULL, options, bdrv_oflags, &local_err); if (!snap_state.target) { error_setg(errp, "failed to open '%s'", statefile); - goto restart; + save_snapshot_error("setup failed"); + return; } target_bs = blk_bs(snap_state.target); if (!target_bs) { error_setg(errp, "failed to open '%s' - no block driver state", statefile); - goto restart; + save_snapshot_error("setup failed"); + return; } QIOChannel *ioc = QIO_CHANNEL(qio_channel_savevm_async_new(snap_state.target, @@ -395,7 +398,8 @@ void qmp_savevm_start(const char *statefile, Error **errp) if (!snap_state.file) { error_setg(errp, "failed to open '%s'", statefile); - goto restart; + save_snapshot_error("setup failed"); + return; } /* @@ -403,7 +407,8 @@ void qmp_savevm_start(const char *statefile, Error **errp) * State is cleared in process_savevm_co, but has to be initialized * here (blocking main thread, from QMP) to avoid race conditions. */ - if (migrate_init(ms, errp)) { + if (migrate_init(ms, errp) != 0) { + save_snapshot_error("setup failed"); return; } memset(&mig_stats, 0, sizeof(mig_stats)); @@ -419,6 +424,7 @@ void qmp_savevm_start(const char *statefile, Error **errp) if (ret != 0) { error_setg_errno(errp, -ret, "savevm state setup failed: %s", local_err ? error_get_pretty(local_err) : "unknown error"); + save_snapshot_error("setup failed"); return; } @@ -436,10 +442,6 @@ void qmp_savevm_start(const char *statefile, Error **errp) aio_co_schedule(iohandler_ctx, snap_state.co); return; - -restart: - - save_snapshot_error("setup failed"); } static void coroutine_fn wait_for_close_co(void *opaque) -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel