]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/cephfs: support multi-fs in kernel client
authorJohn Spray <john.spray@redhat.com>
Sun, 6 Nov 2016 22:01:00 +0000 (22:01 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 7 Dec 2016 00:45:46 +0000 (00:45 +0000)
Change the Mount interface to take it as an
argument to mount() instead of setting it
out of band in a config file as we used to
for the fuse client.

Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/fuse_mount.py
tasks/cephfs/kernel_mount.py
tasks/cephfs/mount.py
tasks/cephfs/test_failover.py
tasks/vstart_runner.py

index df2b82085228786f469893fa82ce3f060f0863ef..896ca5c67fd55abeadc0af65e7f7ace4d746cada 100644 (file)
@@ -22,7 +22,7 @@ class FuseMount(CephFSMount):
         self.fuse_daemon = None
         self._fuse_conn = None
 
-    def mount(self, mount_path=None):
+    def mount(self, mount_path=None, mount_fs_name=None):
         log.info("Client client.%s config is %s" % (self.client_id, self.client_config))
 
         daemon_signal = 'kill'
@@ -54,6 +54,9 @@ class FuseMount(CephFSMount):
         if mount_path is not None:
             fuse_cmd += ["--client_mountpoint={0}".format(mount_path)]
 
+        if mount_fs_name is not None:
+            fuse_cmd += ["--client_mds_namespace={0}".format(mount_fs_name)]
+
         fuse_cmd += [
             '--name', 'client.{id}'.format(id=self.client_id),
             # TODO ceph-fuse doesn't understand dash dash '--',
index 41091ef1da2cfb0ba1f928f23113251d431fa3c8..9ea3edecdd8d80087243082a3a4283ae1d9a5191 100644 (file)
@@ -41,7 +41,7 @@ class KernelMount(CephFSMount):
             ],
         )
 
-    def mount(self, mount_path=None):
+    def mount(self, mount_path=None, mount_fs_name=None):
         log.info('Mounting kclient client.{id} at {remote} {mnt}...'.format(
             id=self.client_id, remote=self.client_remote, mnt=self.mountpoint))
 
@@ -61,6 +61,12 @@ class KernelMount(CephFSMount):
         if mount_path is None:
             mount_path = "/"
 
+        opts = 'name={id},secretfile={secret}'.format(id=self.client_id,
+                                                      secret=secret)
+
+        if mount_fs_name is not None:
+            opts += ",mds_namespace={0}".format(mount_fs_name)
+
         self.client_remote.run(
             args=[
                 'sudo',
@@ -72,8 +78,7 @@ class KernelMount(CephFSMount):
                 self.mountpoint,
                 '-v',
                 '-o',
-                'name={id},secretfile={secret}'.format(id=self.client_id,
-                                                       secret=secret),
+                opts
             ],
         )
 
index 7b9c22342b994ce5b793e79ecbf0f84a75d755e6..dc76ad500b9582453784ca91ac063539e83d8fca 100644 (file)
@@ -37,7 +37,7 @@ class CephFSMount(object):
     def is_mounted(self):
         raise NotImplementedError()
 
-    def mount(self, mount_path=None):
+    def mount(self, mount_path=None, mount_fs_name=None):
         raise NotImplementedError()
 
     def umount(self):
index f91822eb7ffa196bdf0dce382e3ff9ee35b12277..b9dd582f261f2139238151a717a5919222b127ad 100644 (file)
@@ -286,22 +286,14 @@ class TestMultiFilesystems(CephFSTestCase):
         fs_a, fs_b = self._setup_two()
 
         # Mount a client on fs_a
-        fs_a.set_ceph_conf(
-            "client.{0}".format(self.mount_a.client_id),
-           "client_mds_namespace", fs_a.name
-        )
-        self.mount_a.mount()
+        self.mount_a.mount(mount_fs_name=fs_a.name)
         self.mount_a.write_n_mb("pad.bin", 1)
         self.mount_a.write_n_mb("test.bin", 2)
         a_created_ino = self.mount_a.path_to_ino("test.bin")
         self.mount_a.create_files()
 
         # Mount a client on fs_b
-        fs_b.set_ceph_conf(
-            "client.{0}".format(self.mount_b.client_id),
-           "client_mds_namespace", fs_b.name
-        )
-        self.mount_b.mount()
+        self.mount_b.mount(mount_fs_name=fs_b.name)
         self.mount_b.write_n_mb("test.bin", 1)
         b_created_ino = self.mount_b.path_to_ino("test.bin")
         self.mount_b.create_files()
index c17dc14a91eb5698da5c864746f4c538396808e8..67da66a62d8a5504fe124a7148db3f75baba497f 100644 (file)
@@ -400,7 +400,7 @@ class LocalFuseMount(FuseMount):
         if self.is_mounted():
             super(LocalFuseMount, self).umount()
 
-    def mount(self, mount_path=None):
+    def mount(self, mount_path=None, mount_fs_name=None):
         self.client_remote.run(
             args=[
                 'mkdir',
@@ -440,6 +440,9 @@ class LocalFuseMount(FuseMount):
         if mount_path is not None:
             prefix += ["--client_mountpoint={0}".format(mount_path)]
 
+        if mount_fs_name is not None:
+            prefix += ["--client_mds_namespace={0}".format(mount_fs_name)]
+
         self.fuse_daemon = self.client_remote.run(args=
                                             prefix + [
                                                 "-f",