enter colo checkpointed restore loop after live migration. Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx> --- include/migration/migration-colo.h | 6 ++++++ migration-colo-comm.c | 10 ++++++++++ migration-colo.c | 22 ++++++++++++++++++++++ migration.c | 3 +++ stubs/migration-colo.c | 4 ++++ 5 files changed, 45 insertions(+) diff --git a/include/migration/migration-colo.h b/include/migration/migration-colo.h index 24589c0..861fa27 100644 --- a/include/migration/migration-colo.h +++ b/include/migration/migration-colo.h @@ -22,4 +22,10 @@ bool colo_supported(void); bool migrate_use_colo(void); void colo_init_checkpointer(MigrationState *s); +/* restore */ +bool restore_use_colo(void); +void restore_exit_colo(void); + +void colo_process_incoming_checkpoints(QEMUFile *f); + #endif diff --git a/migration-colo-comm.c b/migration-colo-comm.c index 4504ceb..b12a57a 100644 --- a/migration-colo-comm.c +++ b/migration-colo-comm.c @@ -38,6 +38,16 @@ static void colo_info_save(QEMUFile *f, void *opaque) /* restore */ +bool restore_use_colo(void) +{ + return colo_requested; +} + +void restore_exit_colo(void) +{ + colo_requested = false; +} + static int colo_info_load(QEMUFile *f, void *opaque, int version_id) { int value = qemu_get_byte(f); diff --git a/migration-colo.c b/migration-colo.c index 0cef8bd..d566b9d 100644 --- a/migration-colo.c +++ b/migration-colo.c @@ -10,6 +10,7 @@ #include "qemu/main-loop.h" #include "qemu/thread.h" +#include "block/coroutine.h" #include "migration/migration-colo.h" static QEMUBH *colo_bh; @@ -62,3 +63,24 @@ void colo_init_checkpointer(MigrationState *s) colo_bh = qemu_bh_new(colo_start_checkpointer, s); qemu_bh_schedule(colo_bh); } + +/* restore */ + +static Coroutine *colo; + +void colo_process_incoming_checkpoints(QEMUFile *f) +{ + if (!restore_use_colo()) { + return; + } + + colo = qemu_coroutine_self(); + assert(colo != NULL); + + /* TODO: COLO checkpointed restore loop */ + + colo = NULL; + restore_exit_colo(); + + return; +} diff --git a/migration.c b/migration.c index b7f8e7e..190571d 100644 --- a/migration.c +++ b/migration.c @@ -86,6 +86,9 @@ static void process_incoming_migration_co(void *opaque) int ret; ret = qemu_loadvm_state(f); + if (!ret) { + colo_process_incoming_checkpoints(f); + } qemu_fclose(f); free_xbzrle_decoded_buf(); if (ret < 0) { diff --git a/stubs/migration-colo.c b/stubs/migration-colo.c index 9013c40..55f0d37 100644 --- a/stubs/migration-colo.c +++ b/stubs/migration-colo.c @@ -18,3 +18,7 @@ bool colo_supported(void) void colo_init_checkpointer(MigrationState *s) { } + +void colo_process_incoming_checkpoints(QEMUFile *f) +{ +} -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html