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

[libvirt] [PATCH] LXC: Set default driver for image backed filesystems



From: "Daniel P. Berrange" <berrange redhat com>

If no explicit driver is set for an image backed filesystem,
set it to use the loop driver (if raw) or nbd driver (if
non-raw)

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 src/lxc/lxc_controller.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 568227f..ef35c05 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -457,6 +457,14 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
         if (fs->type != VIR_DOMAIN_FS_TYPE_FILE)
             continue;
 
+        if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) {
+            if (fs->format == VIR_STORAGE_FILE_RAW ||
+                fs->format == VIR_STORAGE_FILE_NONE)
+                fs->fsdriver = VIR_DOMAIN_FS_DRIVER_TYPE_LOOP;
+            else
+                fs->fsdriver = VIR_DOMAIN_FS_DRIVER_TYPE_NBD;
+        }
+
         if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_LOOP) {
             if (fs->format != VIR_STORAGE_FILE_RAW &&
                 fs->format != VIR_STORAGE_FILE_NONE) {
-- 
1.8.3.1


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