[RFC PATCHv2 3/3] qemu: allow simple domain save to use fd: protocol

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

 



Work in progress - this fails for root-squash NFS, as well as for
older qemu that don't support fd: migration, and doesn't cover
compression coupled with migration.  All of those need to be
provided by a final solution.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new function
when there is no compression.
---

v2: new patch, provided for getting feedback on the approach

 src/qemu/qemu_driver.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c9095bb..54795ac 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1981,10 +1981,20 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,

     if (header.compressed == QEMUD_SAVE_FORMAT_RAW) {
         const char *args[] = { "cat", NULL };
+        /* XXX gross - why don't we reuse the fd already opened earlier */
+        int fd = open(path, O_WRONLY);
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
-        rc = qemuMonitorMigrateToFile(priv->mon,
-                                      QEMU_MONITOR_MIGRATE_BACKGROUND,
-                                      args, path, offset);
+        /* XXX needs to depend on QEMU_CAPS_MIGRATE_QEMU_FD */
+        if (fd >= 0 && lseek(fd, offset, SEEK_SET) == offset) {
+            rc = qemuMonitorMigrateToFd(priv->mon,
+                                        QEMU_MONITOR_MIGRATE_BACKGROUND,
+                                        fd);
+        } else {
+            rc = qemuMonitorMigrateToFile(priv->mon,
+                                          QEMU_MONITOR_MIGRATE_BACKGROUND,
+                                          args, path, offset);
+        }
+        VIR_FORCE_CLOSE(fd);
         qemuDomainObjExitMonitorWithDriver(driver, vm);
     } else {
         const char *prog = qemudSaveCompressionTypeToString(header.compressed);
-- 
1.7.4

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