From: Juraj Marcin <jmar...@redhat.com> Depending on where an error during postcopy_start() happens, the state can be either "active", "device" or "cancelling", but never "postcopy-active". Migration state is transitioned to "postcopy-active" only just before a successful return from the function.
Accept any state except "cancelling" when transitioning to "failed" state. Signed-off-by: Juraj Marcin <jmar...@redhat.com> --- migration/migration.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 10c216d25d..e5ce2940d5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2872,8 +2872,9 @@ static int postcopy_start(MigrationState *ms, Error **errp) fail_closefb: qemu_fclose(fb); fail: - migrate_set_state(&ms->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_FAILED); + if ( ms->state != MIGRATION_STATUS_CANCELLING) { + migrate_set_state(&ms->state, ms->state, MIGRATION_STATUS_FAILED); + } migration_block_activate(NULL); migration_call_notifiers(ms, MIG_EVENT_PRECOPY_FAILED, NULL); bql_unlock(); -- 2.50.1