]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Add support for migrate-recover QMP command
authorJiri Denemark <jdenemar@redhat.com>
Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 7 Jun 2022 15:40:20 +0000 (17:40 +0200)
This command tells QEMU to start listening for an incoming post-copy
recovery connection. Just like migrate-incoming is used for starting
fresh migration on the destination host.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
tests/qemumonitorjsontest.c

index ec56d413da2c6f3a47f30abb5c9e8a475f717459..e9b9390c80e373b310eaf1edaff748f9fe57c19d 100644 (file)
@@ -4521,3 +4521,15 @@ qemuMonitorChangeMemoryRequestedSize(qemuMonitor *mon,
 
     return qemuMonitorJSONChangeMemoryRequestedSize(mon, alias, requestedsize);
 }
+
+
+int
+qemuMonitorMigrateRecover(qemuMonitor *mon,
+                          const char *uri)
+{
+    VIR_DEBUG("uri=%s", uri);
+
+    QEMU_CHECK_MONITOR(mon);
+
+    return qemuMonitorJSONMigrateRecover(mon, uri);
+}
index 98496b9037c21b056b9c5dc4e755d5640a5258ab..4f6c7e40fdd100197e94af1579a9e1e3a815a178 100644 (file)
@@ -1545,3 +1545,7 @@ int
 qemuMonitorChangeMemoryRequestedSize(qemuMonitor *mon,
                                      const char *alias,
                                      unsigned long long requestedsize);
+
+int
+qemuMonitorMigrateRecover(qemuMonitor *mon,
+                          const char *uri);
index 8b026e8adef19ed460920f3598f048d60ffdf2da..99c5e1b40f52afe59a1d3f13eb62a9f948eef354 100644 (file)
@@ -8970,3 +8970,22 @@ qemuMonitorJSONChangeMemoryRequestedSize(qemuMonitor *mon,
 
     return qemuMonitorJSONSetObjectProperty(mon, path, "requested-size", &prop);
 }
+
+
+int
+qemuMonitorJSONMigrateRecover(qemuMonitor *mon,
+                              const char *uri)
+{
+    g_autoptr(virJSONValue) cmd = NULL;
+    g_autoptr(virJSONValue) reply = NULL;
+
+    if (!(cmd = qemuMonitorJSONMakeCommand("migrate-recover",
+                                           "s:uri", uri,
+                                           NULL)))
+        return -1;
+
+    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
+        return -1;
+
+    return qemuMonitorJSONCheckError(cmd, reply);
+}
index 3c442d669f2fd37e0679fe574b855c346d65e4ed..305faafce423c317fd50943abc404a78968ccf4c 100644 (file)
@@ -872,3 +872,7 @@ int
 qemuMonitorJSONChangeMemoryRequestedSize(qemuMonitor *mon,
                                          const char *alias,
                                          unsigned long long requestedsize);
+
+int
+qemuMonitorJSONMigrateRecover(qemuMonitor *mon,
+                              const char *uri);
index 2de282dcba434c8a22cff7c86fd9bf0d630c695c..96d6da1f4789657fdd884325b5f2f630245930d4 100644 (file)
@@ -1210,6 +1210,7 @@ GEN_TEST_FUNC(qemuMonitorJSONSetMigrationDowntime, 1)
 GEN_TEST_FUNC(qemuMonitorJSONMigrate, QEMU_MONITOR_MIGRATE_BACKGROUND |
               QEMU_MONITOR_MIGRATE_NON_SHARED_DISK |
               QEMU_MONITOR_MIGRATE_NON_SHARED_INC, "tcp:localhost:12345")
+GEN_TEST_FUNC(qemuMonitorJSONMigrateRecover, "tcp://destination.host:54321");
 GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol", "elf",
               true)
 GEN_TEST_FUNC(qemuMonitorJSONGraphicsRelocate, VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
@@ -3109,6 +3110,7 @@ mymain(void)
     DO_TEST_GEN_DEPRECATED(qemuMonitorJSONSetMigrationSpeed, true);
     DO_TEST_GEN_DEPRECATED(qemuMonitorJSONSetMigrationDowntime, true);
     DO_TEST_GEN(qemuMonitorJSONMigrate);
+    DO_TEST_GEN(qemuMonitorJSONMigrateRecover);
     DO_TEST_GEN(qemuMonitorJSONDump);
     DO_TEST_GEN(qemuMonitorJSONGraphicsRelocate);
     DO_TEST_GEN(qemuMonitorJSONRemoveNetdev);