Skip to contentSkip to conversation

Some minor fixes for migration states

PATCH New Zhang Chen 1 participant 4 messages Jan 27, 2022

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

v2 cover Some minor fixes for migration states

This series solved some fixme and comments in code. Please see the details in each patch commit message.

--V2:
-Fix typo.

Zhang Chen (3):
migration/migration.c: Add missed default error handler for migration
state
migration/migration.c: Avoid COLO boot in postcopy migration migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when
migration finished

 migration/migration.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH v2 2/3 migration/migration.c: Avoid COLO boot in postcopy migration

COLO does not support postcopy migration and remove the Fixme.

---
 migration/migration.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
migration/migration.c +5 -5
index 2afa77da03..3fac9c67ca 100644
@@ -3230,7 +3230,11 @@ static void migration_completion(MigrationState *s)
         goto fail_invalidate;
     }
 
-    if (!migrate_colo_enabled()) {
+    if (migrate_colo_enabled() && s->state == MIGRATION_STATUS_ACTIVE) {
+        /* COLO dose not support postcopy */
+        migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+                          MIGRATION_STATUS_COLO);
+    } else {
         migrate_set_state(&s->state, current_active_state,
                           MIGRATION_STATUS_COMPLETED);
     }
@@ -3621,10 +3625,6 @@ static void migration_iteration_finish(MigrationState *s)
                          "COLO enabled", __func__);
         }
         migrate_start_colo_process(s);
-        /*
-         * Fixme: we will run VM in COLO no matter its old running state.
-         * After exited COLO, we will keep running.
-         */
          /* Fallthrough */
     case MIGRATION_STATUS_ACTIVE:
         /*
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/3 migration/migration.c: Add missed default error handler for migration state

In reply to Zhang Chen

In the migration_completion() no other status is expected, for example MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED, etc.

---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/migration.c +1 -1
index 0652165610..2afa77da03 100644
@@ -3205,7 +3205,7 @@ static void migration_completion(MigrationState *s)
         qemu_mutex_unlock_iothread();
 
         trace_migration_completion_postcopy_end_after_complete();
-    } else if (s->state == MIGRATION_STATUS_CANCELLING) {
+    } else {
         goto fail;
     }
 
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH v2 3/3 migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when migration finished

In reply to Zhang Chen

The MIGRATION_STATUS_ACTIVE indicates that migration is running. Remove it to be handled by the default operation,
It should be part of the unknown ending states.

---
 migration/migration.c | 6 ------
 1 file changed, 6 deletions(-)
migration/migration.c +0 -6
index 3fac9c67ca..21e1498f46 100644
@@ -3625,12 +3625,6 @@ static void migration_iteration_finish(MigrationState *s)
                          "COLO enabled", __func__);
         }
         migrate_start_colo_process(s);
-         /* Fallthrough */
-    case MIGRATION_STATUS_ACTIVE:
-        /*
-         * We should really assert here, but since it's during
-         * migration, let's try to reduce the usage of assertions.
-         */
         s->vm_was_running = true;
         /* Fallthrough */
     case MIGRATION_STATUS_FAILED:
Signature · 1 line
2.25.1