From: Peter Xu Date: Wed, 3 Jan 2018 12:20:05 +0000 (+0800) Subject: migration: assert colo instead of check X-Git-Tag: qemu-xen-4.12.0-rc1~518^2~12 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0d649a0e95b46fab94090f852a43c72d2621ebb9;p=qemu-xen.git migration: assert colo instead of check When reaching here if we are still "active" it means we must be in colo state. After a quick discussion offlist, we decided to use the safer error_report(). Finally I want to use "switch" here rather than lots of complicated if clauses. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- diff --git a/migration/migration.c b/migration/migration.c index 7a77b193c1..f579752d21 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2348,7 +2348,15 @@ static void *migration_thread(void *opaque) } runstate_set(RUN_STATE_POSTMIGRATE); } else { - if (s->state == MIGRATION_STATUS_ACTIVE && enable_colo) { + if (s->state == MIGRATION_STATUS_ACTIVE) { + /* + * We should really assert here, but since it's during + * migration, let's try to reduce the usage of assertions. + */ + if (!enable_colo) { + error_report("%s: critical error: calling COLO code without " + "COLO enabled", __func__); + } migrate_start_colo_process(s); qemu_savevm_state_cleanup(); /*