diff --git a/migration/migration.c b/migration/migration.c index 9fe8fd2afd..b73ae3a72c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2799,6 +2799,7 @@ static void migration_completion(MigrationState *s) { int ret = 0; int current_active_state = s->state; + Error *local_err = NULL; if (s->state == MIGRATION_STATUS_ACTIVE) { ret = migration_completion_precopy(s, ¤t_active_state); @@ -2832,6 +2833,15 @@ static void migration_completion(MigrationState *s) return; fail: + if (qemu_file_get_error_obj(s->to_dst_file, &local_err)) { + migrate_set_error(s, local_err); + error_free(local_err); + } else if (ret) { + error_setg_errno(&local_err, -ret, "Error in migration completion"); + migrate_set_error(s, local_err); + error_free(local_err); + } + migration_completion_failed(s, current_active_state); }