]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: support migration to fd
authorEric Blake <eblake@redhat.com>
Wed, 2 Mar 2011 04:37:30 +0000 (21:37 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 15 Mar 2011 22:35:43 +0000 (16:35 -0600)
* src/qemu/qemu_monitor.h (qemuMonitorMigrateToFd): New
prototype.
* src/qemu/qemu_monitor.c (qemuMonitorMigrateToFd): New function.

src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h

index e06b0eb4f983709a70919e1ba952280235796f80..da380961a0ac86ceb569732114801390e35c3bce 100644 (file)
@@ -1396,6 +1396,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,
index ece15a88dede58b4a680424ae7f140940f385501..7bea083dd151885b61dc0ab7d80cef1535f9fe3d 100644 (file)
@@ -266,6 +266,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,