5036: Add "--subtype foo" flag to set mounted filesystem type to "fuse.foo".
authorTom Clegg <tom@curoverse.com>
Thu, 9 Mar 2017 19:53:51 +0000 (14:53 -0500)
committerTom Clegg <tom@curoverse.com>
Thu, 9 Mar 2017 19:53:51 +0000 (14:53 -0500)
services/fuse/arvados_fuse/command.py
services/fuse/tests/test_mount_type.py [new file with mode: 0644]

index ca77cfcd7bd6bc3caafb55957f41e2b8d776c26b..66f8a4d39319fb9bdc8f864962bc9c02a0d57ac3 100644 (file)
@@ -31,6 +31,8 @@ class ArgumentParser(argparse.ArgumentParser):
         self.add_argument('mountpoint', type=str, help="""Mount point.""")
         self.add_argument('--allow-other', action='store_true',
                             help="""Let other users read the mount""")
+        self.add_argument('--subtype', type=str, metavar='STRING',
+                            help="""Report mounted filesystem type as "fuse.STRING", instead of just "fuse".""")
 
         mode = self.add_mutually_exclusive_group()
 
@@ -148,6 +150,8 @@ class Mount(object):
                 if getattr(self.args, optname)]
         # Increase default read/write size from 4KiB to 128KiB
         opts += ["big_writes", "max_read=131072"]
+        if self.args.subtype:
+            opts += ["subtype="+self.args.subtype]
         return opts
 
     def _setup_logging(self):
diff --git a/services/fuse/tests/test_mount_type.py b/services/fuse/tests/test_mount_type.py
new file mode 100644 (file)
index 0000000..f6a3e89
--- /dev/null
@@ -0,0 +1,23 @@
+import logging
+import subprocess
+
+from .integration_test import IntegrationTest
+
+logger = logging.getLogger('arvados.arv-mount')
+
+
+class MountTypeTest(IntegrationTest):
+    @IntegrationTest.mount(argv=["--subtype=arv-mount-test"])
+    def test_mount_type(self):
+        self.pool_test(self.mnt)
+
+    @staticmethod
+    def _test_mount_type(self, mnt):
+        self.assertEqual(["fuse.arv-mount-test"], [
+            toks[4]
+            for toks in [
+                line.split(' ')
+                for line in subprocess.check_output("mount").split("\n")
+            ]
+            if len(toks) > 4 and toks[2] == mnt
+        ])