[PATCH 2/2] qemu_conf: Allow overriding of path for managed-save

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

 



This patch allows users to set different path for managed-save
images than under /var/lib/libvirt/qemu/save; Some sysadmins
do have small / and thus /var but don't want to compile libvirt
on their own just to override this path.
---
 src/qemu/qemu.conf   |    7 +++++++
 src/qemu/qemu_conf.c |   15 ++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 95428c1..ae634ef 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -350,3 +350,10 @@
 #
 #keepalive_interval = 5
 #keepalive_count = 5
+
+###################################################################
+# Configurable paths:
+# This allows user to override some paths libvirt uses for storing
+# files like managed-save, etc.
+#
+# managed_save_dir = "/var/lib/libvirt/qemu/save/"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index a22f3c7..0b06ef2 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -505,9 +505,18 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         if (virAsprintf(&driver->cacheDir,
                       "%s/cache/libvirt/qemu", LOCALSTATEDIR) == -1)
             goto out_of_memory;
-        if (virAsprintf(&driver->saveDir,
-                      "%s/lib/libvirt/qemu/save", LOCALSTATEDIR) == -1)
-            goto out_of_memory;
+
+        p = virConfGetValue (conf, "managed_save_dir");
+        CHECK_TYPE ("managed_save_dir", VIR_CONF_STRING);
+        if (p && p->str) {
+            if (!(driver->saveDir = strdup(p->str)))
+                goto out_of_memory;
+        } else {
+            if (virAsprintf(&driver->saveDir,
+                            "%s/lib/libvirt/qemu/save", LOCALSTATEDIR) == -1)
+                goto out_of_memory;
+        }
+
         if (virAsprintf(&driver->snapshotDir,
                         "%s/lib/libvirt/qemu/snapshot", LOCALSTATEDIR) == -1)
             goto out_of_memory;
-- 
1.7.3.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]