[PATCH v4 07/10] [RFC] migration: Make -i/-b an error for hmp and qmp

Juan Quintela quintela at redhat.com
Fri Oct 13 10:47:33 UTC 2023


[DON'T MERGE]

Block migration is obsolete, users should use blockdev-mirror
instead.
Make it one error to set them.

Signed-off-by: Juan Quintela <quintela at redhat.com>
---
 migration/migration-hmp-cmds.c | 15 ++++++++++++++-
 migration/migration.c          | 35 +++++++---------------------------
 2 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index e0e16afa34..582368926a 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -731,7 +731,20 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
     const char *uri = qdict_get_str(qdict, "uri");
     Error *err = NULL;
 
-    qmp_migrate(uri, !!blk, blk, !!inc, inc,
+    if (inc) {
+        monitor_printf(mon, "-i migrate option is deprecated, set the"
+                       "'block-incremental' migration parameter to 'true'"
+                       " instead.\n");
+        return;
+    }
+
+    if (blk) {
+        monitor_printf(mon, "-b migrate option is deprecated, set the "
+                       "'block' capability to 'true' instead.\n");
+        return;
+    }
+
+    qmp_migrate(uri, false, false, false, false,
                 false, false, true, resume, &err);
     if (hmp_handle_error(mon, err)) {
         return;
diff --git a/migration/migration.c b/migration/migration.c
index 9e4ae6b772..50fc112e98 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1599,17 +1599,17 @@ bool migration_is_blocked(Error **errp)
 static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
                             bool resume, Error **errp)
 {
-    Error *local_err = NULL;
-
     if (blk_inc) {
-        warn_report("@inc/-i migrate option is deprecated, set the"
-                    "'block-incremental' migration parameter to 'true'"
-                    " instead.");
+        error_setg(errp, "@inc migrate option is deprecated, set the"
+                   "'block-incremental' migration parameter to 'true'"
+                   " instead.");
+        return false;
     }
 
     if (blk) {
-        warn_report("@blk/-i migrate option is deprecated, set the "
-                    "'block' capability to 'true' instead.");
+        error_setg(errp, "@blk/-i migrate option is deprecated, set the "
+                   "'block' capability to 'true' instead.");
+        return false;
     }
 
     if (resume) {
@@ -1661,27 +1661,6 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
         return false;
     }
 
-    if (blk || blk_inc) {
-        if (migrate_colo()) {
-            error_setg(errp, "No disk migration is required in COLO mode");
-            return false;
-        }
-        if (migrate_block() || migrate_block_incremental()) {
-            error_setg(errp, "Command options are incompatible with "
-                       "current migration capabilities");
-            return false;
-        }
-        if (!migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, true, &local_err)) {
-            error_propagate(errp, local_err);
-            return false;
-        }
-        s->must_remove_block_options = true;
-    }
-
-    if (blk_inc) {
-        migrate_set_block_incremental(true);
-    }
-
     if (migrate_init(s, errp)) {
         return false;
     }
-- 
2.41.0



More information about the libvir-list mailing list