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

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



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


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