[libvirt] [PATCH 2/3] storage: Add mountOpts to the storage pool mount command line

John Ferlan jferlan at redhat.com
Tue Dec 18 20:03:16 UTC 2018


Add the mountOpts to the generated backend mount command line for
the storage pool.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_util.c                              | 4 ++++
 tests/storagepoolxml2argvdata/pool-netfs-mountopts.argv | 1 +
 tests/storagepoolxml2argvtest.c                         | 1 +
 3 files changed, 6 insertions(+)
 create mode 100644 tests/storagepoolxml2argvdata/pool-netfs-mountopts.argv

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index a84ee5b600..6d7c01e425 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -4336,6 +4336,10 @@ virStorageBackendFileSystemMountCmd(const char *cmdstr,
         virStorageBackendFileSystemMountCIFSArgs(cmd, src, def);
     else
         virStorageBackendFileSystemMountDefaultArgs(cmd, src, def);
+
+    if (def->source.mountOpts)
+        virCommandAddArgList(cmd, "-o", def->source.mountOpts, NULL);
+
     return cmd;
 }
 
diff --git a/tests/storagepoolxml2argvdata/pool-netfs-mountopts.argv b/tests/storagepoolxml2argvdata/pool-netfs-mountopts.argv
new file mode 100644
index 0000000000..16d35bc175
--- /dev/null
+++ b/tests/storagepoolxml2argvdata/pool-netfs-mountopts.argv
@@ -0,0 +1 @@
+mount -t nfs localhost:/var/lib/libvirt/images /mnt -o nodev,nosuid
diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c
index 2f2d40e027..0df97fb390 100644
--- a/tests/storagepoolxml2argvtest.c
+++ b/tests/storagepoolxml2argvtest.c
@@ -159,6 +159,7 @@ mymain(void)
     DO_TEST("pool-netfs-auto");
     DO_TEST("pool-netfs-gluster");
     DO_TEST("pool-netfs-cifs");
+    DO_TEST("pool-netfs-mountopts");
     DO_TEST_FAIL("pool-scsi");
     DO_TEST_FAIL("pool-scsi-type-scsi-host");
     DO_TEST_FAIL("pool-scsi-type-fc-host");
-- 
2.17.2




More information about the libvir-list mailing list