Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> Signed-off-by: Li Zhijian <lizhij...@cn.fujitsu.com> Signed-off-by: Lai Jiangshan <la...@cn.fujitsu.com> --- migration/colo.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/migration/colo.c b/migration/colo.c index a65f9ea..76bdd44 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -53,6 +53,7 @@ enum { }; static QEMUBH *colo_bh; +static bool vmstate_loading; static Coroutine *colo; /* colo buffer */ #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024) @@ -89,6 +90,11 @@ static bool colo_runstate_is_stopped(void) */ static void secondary_vm_do_failover(void) { + /* Wait for incoming thread loading vmstate */ + while (vmstate_loading) { + ; + } + colo = NULL; if (!autostart) { @@ -511,11 +517,15 @@ void *colo_process_incoming_checkpoints(void *opaque) qemu_mutex_lock_iothread(); qemu_system_reset(VMRESET_SILENT); + vmstate_loading = true; if (qemu_loadvm_state(fb) < 0) { error_report("COLO: loadvm failed"); + vmstate_loading = false; qemu_mutex_unlock_iothread(); goto out; } + + vmstate_loading = false; qemu_mutex_unlock_iothread(); ret = colo_ctl_put(ctl, COLO_CHECKPOINT_LOADED); -- 1.7.12.4