[PATCH v2 05/15] qemu: Add QMP functions for post-copy migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Cristian Klein <cristiklein@xxxxxxxxx>

Signed-off-by: Cristian Klein <cristiklein@xxxxxxxxx>
Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---

Notes:
    The migration capability is called x-postcopy-ram in QEMU, which
    means it's still considered experimental. The main reason for it
    is to make sure the feature is complete from libvirt's point of
    view. The "x-" prefix will be removed once we have a working
    implementation.
    
    Version 2:
    - no change

 src/qemu/qemu_monitor.c      | 14 +++++++++++++-
 src/qemu/qemu_monitor.h      |  3 +++
 src/qemu/qemu_monitor_json.c | 22 ++++++++++++++++++++++
 src/qemu/qemu_monitor_json.h |  3 +++
 4 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index edb3310..d34878b 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -167,7 +167,8 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
 
 VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
               QEMU_MONITOR_MIGRATION_CAPS_LAST,
-              "xbzrle", "auto-converge", "rdma-pin-all", "events")
+              "xbzrle", "auto-converge", "rdma-pin-all", "events",
+              "x-postcopy-ram")
 
 VIR_ENUM_IMPL(qemuMonitorVMStatus,
               QEMU_MONITOR_VM_STATUS_LAST,
@@ -3817,3 +3818,14 @@ qemuMonitorMigrateIncoming(qemuMonitorPtr mon,
 
     return qemuMonitorJSONMigrateIncoming(mon, uri);
 }
+
+
+int
+qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon)
+{
+    VIR_DEBUG("mon=%p", mon);
+
+    QEMU_CHECK_MONITOR_JSON(mon);
+
+    return qemuMonitorJSONMigrateStartPostCopy(mon);
+}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 420d82c..a655437 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -526,6 +526,7 @@ typedef enum {
     QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
     QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
     QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
+    QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY,
 
     QEMU_MONITOR_MIGRATION_CAPS_LAST
 } qemuMonitorMigrationCaps;
@@ -944,6 +945,8 @@ int qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon,
 int qemuMonitorMigrateIncoming(qemuMonitorPtr mon,
                                const char *uri);
 
+int qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon);
+
 /**
  * When running two dd process and using <> redirection, we need a
  * shell that will not truncate files.  These two strings serve that
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8d71dd4..463ec4e 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6682,3 +6682,25 @@ qemuMonitorJSONMigrateIncoming(qemuMonitorPtr mon,
     virJSONValueFree(reply);
     return ret;
 }
+
+
+int
+qemuMonitorJSONMigrateStartPostCopy(qemuMonitorPtr mon)
+{
+    int ret = -1;
+    virJSONValuePtr cmd;
+    virJSONValuePtr reply = NULL;
+
+    if (!(cmd = qemuMonitorJSONMakeCommand("migrate-start-postcopy", NULL)))
+        return -1;
+
+    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
+        goto cleanup;
+
+    ret = qemuMonitorJSONCheckError(cmd, reply);
+
+ cleanup:
+    virJSONValueFree(cmd);
+    virJSONValueFree(reply);
+    return ret;
+}
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 2c27c6f..99effa4 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -485,4 +485,7 @@ int qemuMonitorJSONMigrateIncoming(qemuMonitorPtr mon,
                                    const char *uri)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
+int qemuMonitorJSONMigrateStartPostCopy(qemuMonitorPtr mon)
+    ATTRIBUTE_NONNULL(1);
+
 #endif /* QEMU_MONITOR_JSON_H */
-- 
2.7.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]