[PATCH v2 3/8] Added low-level API to qemu post-copy migration

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

 



Signed-off-by: Cristian Klein <cristian.klein@xxxxxxxxx>
---
 src/qemu/qemu_monitor.c      | 24 ++++++++++++++++++++++--
 src/qemu/qemu_monitor.h      |  4 ++++
 src/qemu/qemu_monitor_json.c | 23 ++++++++++++++++++++++-
 src/qemu/qemu_monitor_json.h |  1 +
 4 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 543384d..dbd854c 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -117,11 +117,11 @@ VIR_ONCE_GLOBAL_INIT(qemuMonitor)
 
 VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
               QEMU_MONITOR_MIGRATION_STATUS_LAST,
-              "inactive", "active", "completed", "failed", "cancelled", "setup")
+              "inactive", "active", "completed", "failed", "cancelled", "setup", "postcopy-active")
 
 VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
               QEMU_MONITOR_MIGRATION_CAPS_LAST,
-              "xbzrle", "auto-converge", "rdma-pin-all")
+              "xbzrle", "auto-converge", "rdma-pin-all", "x-postcopy-ram")
 
 VIR_ENUM_IMPL(qemuMonitorVMStatus,
               QEMU_MONITOR_VM_STATUS_LAST,
@@ -2378,6 +2378,26 @@ int qemuMonitorMigrateToUnix(qemuMonitorPtr mon,
     return ret;
 }
 
+int qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon)
+{
+    VIR_DEBUG("mon=%p", mon);
+
+    if (!mon) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("monitor must not be NULL"));
+        return -1;
+    }
+
+    if (!mon->json) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("JSON monitor is required"));
+        return -1;
+    }
+
+    return qemuMonitorJSONMigrateStartPostCopy(mon);
+}
+
+
 int qemuMonitorMigrateCancel(qemuMonitorPtr mon)
 {
     int ret;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index adf18ab..e42c6af 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -427,6 +427,7 @@ enum {
     QEMU_MONITOR_MIGRATION_STATUS_ERROR,
     QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,
     QEMU_MONITOR_MIGRATION_STATUS_SETUP,
+    QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_ACTIVE,
 
     QEMU_MONITOR_MIGRATION_STATUS_LAST
 };
@@ -480,6 +481,7 @@ typedef enum {
     QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
     QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
     QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
+    QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY,
 
     QEMU_MONITOR_MIGRATION_CAPS_LAST
 } qemuMonitorMigrationCaps;
@@ -535,6 +537,8 @@ int qemuMonitorMigrateToUnix(qemuMonitorPtr mon,
                              unsigned int flags,
                              const char *unixfile);
 
+int qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon);
+
 int qemuMonitorMigrateCancel(qemuMonitorPtr mon);
 
 int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index b3b6451..1a9e6e1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2550,7 +2550,8 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
         status->setup_time_set = true;
 
     if (status->status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE ||
-        status->status == QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
+        status->status == QEMU_MONITOR_MIGRATION_STATUS_COMPLETED ||
+        status->status == QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_ACTIVE)  {
         virJSONValuePtr ram = virJSONValueObjectGet(ret, "ram");
         if (!ram) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2790,6 +2791,26 @@ int qemuMonitorJSONMigrate(qemuMonitorPtr mon,
     return ret;
 }
 
+int qemuMonitorJSONMigrateStartPostCopy(qemuMonitorPtr mon)
+{
+    int ret;
+    virJSONValuePtr cmd;
+    cmd = qemuMonitorJSONMakeCommand("migrate-start-postcopy", NULL);
+
+    virJSONValuePtr reply = NULL;
+    if (!cmd)
+        return -1;
+
+    ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+
+    if (ret == 0)
+        ret = qemuMonitorJSONCheckError(cmd, reply);
+
+    virJSONValueFree(cmd);
+    virJSONValueFree(reply);
+    return ret;
+}
+
 int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon)
 {
     int ret;
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index ef9b552..3fba203 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -149,6 +149,7 @@ int qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitorPtr mon,
                                            bool *spice_migrated);
 
 
+int qemuMonitorJSONMigrateStartPostCopy(qemuMonitorPtr mon);
 int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon);
 
 int qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
-- 
1.9.1

--
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]