migration: Switch to COLO process after finishing loadvm

Switch from normal migration loadvm process into COLO checkpoint process if
COLO mode is enabled.

We add three new members to struct MigrationIncomingState,
'have_colo_incoming_thread' and 'colo_incoming_thread' record the COLO
related thread for secondary VM, 'migration_incoming_co' records the
original migration incoming coroutine.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit@amitshah.net>
This commit is contained in:
zhanghailiang 2016-10-27 14:42:55 +08:00 committed by Amit Shah
parent 0b827d5e72
commit 25d0c16f62
6 changed files with 67 additions and 0 deletions

View file

@ -27,6 +27,13 @@ bool migration_in_colo_state(void)
return (s->state == MIGRATION_STATUS_COLO);
}
bool migration_incoming_in_colo_state(void)
{
MigrationIncomingState *mis = migration_incoming_get_current();
return mis && (mis->state == MIGRATION_STATUS_COLO);
}
static void colo_process_checkpoint(MigrationState *s)
{
qemu_mutex_lock_iothread();
@ -46,3 +53,17 @@ void migrate_start_colo_process(MigrationState *s)
colo_process_checkpoint(s);
qemu_mutex_lock_iothread();
}
void *colo_process_incoming_thread(void *opaque)
{
MigrationIncomingState *mis = opaque;
migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
MIGRATION_STATUS_COLO);
/* TODO: COLO checkpoint restore loop */
migration_incoming_exit_colo();
return NULL;
}