diff mbox series

[6/8] colo: Reject colo with postcopy capability enabled

Message ID 1054ff7b2410ce8ec05a8b60cdc8faf306a7374d.1687429356.git.lukasstraub2@web.de (mailing list archive)
State New, archived
Headers show
Series colo migration cleanups | expand

Commit Message

Lukas Straub June 22, 2023, 12:16 p.m. UTC
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
---
 migration/migration.c | 5 +++--
 migration/options.c   | 9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/migration/migration.c b/migration/migration.c
index a954ff4f7d..9860f960f2 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2333,9 +2333,10 @@  static void migration_completion(MigrationState *s)
         goto fail;
     }
 
-    if (migrate_colo() && s->state == MIGRATION_STATUS_ACTIVE) {
+    if (migrate_colo()) {
         /* COLO does not support postcopy */
-        migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+        assert(s->state != MIGRATION_STATUS_POSTCOPY_ACTIVE);
+        migrate_set_state(&s->state, current_active_state,
                           MIGRATION_STATUS_COLO);
     } else {
         migrate_set_state(&s->state, current_active_state,
diff --git a/migration/options.c b/migration/options.c
index b62ab30cd5..d3d4525d40 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -445,8 +445,17 @@  bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
         error_append_hint(errp, "Please enable replication before COLO.\n");
         return false;
     }
+#else
+    if (new_caps[MIGRATION_CAPABILITY_X_COLO]) {
+        if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
+            error_setg(errp, "COLO is not compatible with postcopy");
+            return false;
+        }
+    }
 #endif
 
+
+
     if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
         /* This check is reasonably expensive, so only when it's being
          * set the first time, also it's only the destination that needs