aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorzhanghailiang <zhang.zhanghailiang@huawei.com>2018-09-03 12:38:59 +0800
committerJason Wang <jasowang@redhat.com>2018-10-19 11:15:03 +0800
commit2518aec19250531c4e03208b273a6b44b1344c33 (patch)
tree3a69e23437ab03136427a551a5f0c4df6f1380dc /migration
parent7b3435309d27910587c7e6e8ba07e4070fb37bbb (diff)
COLO: quick failover process by kick COLO thread
COLO thread may sleep at qemu_sem_wait(&s->colo_checkpoint_sem), while failover works begin, It's better to wakeup it to quick the process. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/colo.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/migration/colo.c b/migration/colo.c
index 57a85424fc..956ac236b7 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -131,6 +131,11 @@ static void primary_vm_do_failover(void)
migrate_set_state(&s->state, MIGRATION_STATUS_COLO,
MIGRATION_STATUS_COMPLETED);
+ /*
+ * kick COLO thread which might wait at
+ * qemu_sem_wait(&s->colo_checkpoint_sem).
+ */
+ colo_checkpoint_notify(migrate_get_current());
/*
* Wake up COLO thread which may blocked in recv() or send(),
@@ -539,6 +544,9 @@ static void colo_process_checkpoint(MigrationState *s)
qemu_sem_wait(&s->colo_checkpoint_sem);
+ if (s->state != MIGRATION_STATUS_COLO) {
+ goto out;
+ }
ret = colo_do_checkpoint_transaction(s, bioc, fb);
if (ret < 0) {
goto out;