migration: options incompatible with cpr
authorSteve Sistare <steven.sistare@oracle.com>
Thu, 22 Feb 2024 17:28:40 +0000 (09:28 -0800)
committerPeter Xu <peterx@redhat.com>
Wed, 28 Feb 2024 03:31:28 +0000 (11:31 +0800)
Fail the migration request if options are set that are incompatible
with cpr.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/1708622920-68779-15-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
migration/migration.c
qapi/migration.json

index 90a90947fb41e961701eb5f2c3b71373223e9bdf..7652fd4d14db724bb989a830757ab6343b1bd777 100644 (file)
@@ -1953,6 +1953,23 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
         return false;
     }
 
+    if (migrate_mode_is_cpr(s)) {
+        const char *conflict = NULL;
+
+        if (migrate_postcopy()) {
+            conflict = "postcopy";
+        } else if (migrate_background_snapshot()) {
+            conflict = "background snapshot";
+        } else if (migrate_colo()) {
+            conflict = "COLO";
+        }
+
+        if (conflict) {
+            error_setg(errp, "Cannot use %s with CPR", conflict);
+            return false;
+        }
+    }
+
     if (blk || blk_inc) {
         if (migrate_colo()) {
             error_setg(errp, "No disk migration is required in COLO mode");
index bee5e71fe317444fd1f0f82ec3df13a70b23a1b0..0b33a71ab40760d1f29516eefb56c0629aaa1ae2 100644 (file)
 #     shared backend must be be non-volatile across reboot, such as by backing
 #     it with a dax device.
 #
+#     cpr-reboot may not be used with postcopy, colo, or background-snapshot.
+#
 #     (since 8.2)
 ##
 { 'enum': 'MigMode',