[libvirt] [PATCH] Extra filesystem options during backend filesystem mount.

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

 



New option index added to support -o options for various netfs. 
Currently added an option for glusterfs. 

---
 src/storage_backend_fs.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/storage_backend_fs.c b/src/storage_backend_fs.c
index c3d66b5..606fb47 100644
--- a/src/storage_backend_fs.c
+++ b/src/storage_backend_fs.c
@@ -604,6 +604,7 @@ static int
 virStorageBackendFileSystemMount(virConnectPtr conn,
                                  virStoragePoolObjPtr pool) {
     char *src;
+    char *options;
     const char **mntargv;
 
     /* 'mount -t auto' doesn't seem to auto determine nfs (or cifs),
@@ -611,6 +612,10 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
      *  accommodate this */
     int netauto = (pool->def->type == VIR_STORAGE_POOL_NETFS &&
                    pool->def->source.format == VIR_STORAGE_POOL_NETFS_AUTO);
+    int glusterfs = (pool->def->type == VIR_STORAGE_POOL_NETFS && 
+                     pool->def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS);
+
+    int option_index;
     int source_index;
 
     const char *netfs_auto_argv[] = {
@@ -632,9 +637,26 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
         NULL,
     };
 
+    const char *glusterfs_argv[] = {
+        MOUNT,
+        "-t",
+        pool->def->type == VIR_STORAGE_POOL_FS ?
+        virStoragePoolFormatFileSystemTypeToString(pool->def->source.format) :
+        virStoragePoolFormatFileSystemNetTypeToString(pool->def->source.format),
+        NULL,
+        "-o",
+        NULL,
+        pool->def->target.path,
+        NULL,
+    };
+
     if (netauto) {
         mntargv = netfs_auto_argv;
         source_index = 1;
+    } else if (glusterfs) {
+        mntargv = glusterfs_argv;
+        source_index = 3;
+        option_index = 5;
     } else {
         mntargv = fs_argv;
         source_index = 3;
@@ -670,6 +692,12 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
     }
 
     if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
+        if (pool->def->source.format = VIR_STORAGE_POOL_NETFS_GLUSTERFS) {
+            if (virAsprintf(&options, "direct-io-mode=1") == -1) {
+                virReportOOMError(conn);
+                return -1;
+            }
+        }
         if (virAsprintf(&src, "%s:%s",
                         pool->def->source.host.name,
                         pool->def->source.dir) == -1) {
@@ -685,6 +713,10 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
     }
     mntargv[source_index] = src;
 
+    if (glusterfs) {
+        mntargv[option_index] = options;
+    }
+
     if (virRun(conn, mntargv, NULL) < 0) {
         VIR_FREE(src);
         return -1;
-- 
1.6.0.6

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