migration_completion: Take current state
Soon we'll be in either ACTIVE or POSTCOPY_ACTIVE when we complete migration, and we need to know which we expect to be in to change state safely. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
4886a1bcb7
commit
36f48567b8
|
@ -1243,10 +1243,12 @@ static int await_return_path_close_on_source(MigrationState *ms)
|
||||||
* The caller 'breaks' the loop when this returns.
|
* The caller 'breaks' the loop when this returns.
|
||||||
*
|
*
|
||||||
* @s: Current migration state
|
* @s: Current migration state
|
||||||
|
* @current_active_state: The migration state we expect to be in
|
||||||
* @*old_vm_running: Pointer to old_vm_running flag
|
* @*old_vm_running: Pointer to old_vm_running flag
|
||||||
* @*start_time: Pointer to time to update
|
* @*start_time: Pointer to time to update
|
||||||
*/
|
*/
|
||||||
static void migration_completion(MigrationState *s, bool *old_vm_running,
|
static void migration_completion(MigrationState *s, int current_active_state,
|
||||||
|
bool *old_vm_running,
|
||||||
int64_t *start_time)
|
int64_t *start_time)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1275,11 +1277,11 @@ static void migration_completion(MigrationState *s, bool *old_vm_running,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
migrate_set_state(s, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COMPLETED);
|
migrate_set_state(s, current_active_state, MIGRATION_STATUS_COMPLETED);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
migrate_set_state(s, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED);
|
migrate_set_state(s, current_active_state, MIGRATION_STATUS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1321,7 +1323,8 @@ static void *migration_thread(void *opaque)
|
||||||
qemu_savevm_state_iterate(s->file);
|
qemu_savevm_state_iterate(s->file);
|
||||||
} else {
|
} else {
|
||||||
trace_migration_thread_low_pending(pending_size);
|
trace_migration_thread_low_pending(pending_size);
|
||||||
migration_completion(s, &old_vm_running, &start_time);
|
migration_completion(s, MIGRATION_STATUS_ACTIVE,
|
||||||
|
&old_vm_running, &start_time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue