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

[libvirt] [PATCHv4 04/15] qemu: support migration to fd



* src/qemu/qemu_monitor.h (qemuMonitorMigrateToFd): New
prototype.
* src/qemu/qemu_monitor.c (qemuMonitorMigrateToFd): New function.
---
 src/qemu/qemu_monitor.c |   31 +++++++++++++++++++++++++++++++
 src/qemu/qemu_monitor.h |    4 ++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 765a1ae..1e79523 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1384,6 +1384,37 @@ int qemuMonitorGetMigrationStatus(qemuMonitorPtr mon,
 }


+int qemuMonitorMigrateToFd(qemuMonitorPtr mon,
+                           unsigned int flags,
+                           int fd)
+{
+    int ret;
+    VIR_DEBUG("mon=%p fd=%d flags=%u",
+          mon, fd, flags);
+
+    if (!mon) {
+        qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+                        _("monitor must not be NULL"));
+        return -1;
+    }
+
+    if (qemuMonitorSendFileHandle(mon, "migrate", fd) < 0)
+        return -1;
+
+    if (mon->json)
+        ret = qemuMonitorJSONMigrate(mon, flags, "fd:migrate");
+    else
+        ret = qemuMonitorTextMigrate(mon, flags, "fd:migrate");
+
+    if (ret < 0) {
+        if (qemuMonitorCloseFileHandle(mon, "migrate") < 0)
+            VIR_WARN0("failed to close migration handle");
+    }
+
+    return ret;
+}
+
+
 int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
                              unsigned int flags,
                              const char *hostname,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 0ea1330..1a64ac0 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -260,6 +260,10 @@ typedef enum {
   QEMU_MONITOR_MIGRATION_FLAGS_LAST
 } QEMU_MONITOR_MIGRATE;

+int qemuMonitorMigrateToFd(qemuMonitorPtr mon,
+                           unsigned int flags,
+                           int fd);
+
 int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
                              unsigned int flags,
                              const char *hostname,
-- 
1.7.4


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