]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: allow per file system config setting
authorRamana Raja <rraja@redhat.com>
Thu, 5 Nov 2020 16:50:58 +0000 (22:20 +0530)
committerRamana Raja <rraja@redhat.com>
Fri, 20 Nov 2020 07:53:21 +0000 (13:23 +0530)
Signed-off-by: Ramana Raja <rraja@redhat.com>
qa/tasks/ceph.py
qa/tasks/cephfs/filesystem.py
qa/tasks/mds_thrash.py
qa/tasks/vstart_runner.py

index 50173b4bb8e0fde75b16a5113854798bc05f738e..423e4717f6b2139f5191572cfaef503b62897680 100644 (file)
@@ -3,6 +3,7 @@ Ceph cluster task.
 
 Handle the setup, starting, and clean-up of a Ceph cluster.
 """
+from copy import deepcopy
 from io import BytesIO
 from io import StringIO
 
@@ -391,10 +392,20 @@ def cephfs_setup(ctx, config):
     # If there are any MDSs, then create a filesystem for them to use
     # Do this last because requires mon cluster to be up and running
     if mdss.remotes:
-        log.info('Setting up CephFS filesystem...')
-
-        Filesystem(ctx, fs_config=config.get('cephfs', None), name='cephfs',
-                   create=True, ec_profile=config.get('cephfs_ec_profile', None))
+        log.info('Setting up CephFS filesystem(s)...')
+        cephfs_config = config.get('cephfs', {})
+        fs_configs =  cephfs_config.pop('fs', [{'name': 'cephfs'}])
+        set_allow_multifs = len(fs_configs) > 1
+
+        for fs_config in fs_configs:
+            assert isinstance(fs_config, dict)
+            name = fs_config.pop('name')
+            temp = deepcopy(cephfs_config)
+            teuthology.deep_merge(temp, fs_config)
+            fs = Filesystem(ctx, fs_config=temp, name=name, create=True)
+            if set_allow_multifs:
+                fs.set_allow_multifs()
+                set_allow_multifs = False
 
     yield
 
@@ -1678,6 +1689,20 @@ def task(ctx, config):
             cephfs:
               max_mds: 2
 
+    To change the max_mds of a specific filesystem, use::
+
+        tasks:
+        - ceph:
+            cephfs:
+              max_mds: 2
+              fs:
+                - name: a
+                  max_mds: 3
+                - name: b
+
+    In the above example, filesystem 'a' will have 'max_mds' 3,
+    and filesystme 'b' will have 'max_mds' 2.
+
     To change the mdsmap's default session_timeout (60 seconds), use::
 
         tasks:
index 4fbf5743e757ff507abfd81ca5208c4a495db599..9705dbe3cf7d26362603c8056d081890886bce70 100644 (file)
@@ -452,18 +452,17 @@ class Filesystem(MDSCluster):
     This object is for driving a CephFS filesystem.  The MDS daemons driven by
     MDSCluster may be shared with other Filesystems.
     """
-    def __init__(self, ctx, fs_config=None, fscid=None, name=None, create=False,
-                 ec_profile=None):
+    def __init__(self, ctx, fs_config={}, fscid=None, name=None, create=False):
         super(Filesystem, self).__init__(ctx)
 
         self.name = name
-        self.ec_profile = ec_profile
         self.id = None
         self.metadata_pool_name = None
         self.metadata_overlay = False
         self.data_pool_name = None
         self.data_pools = None
         self.fs_config = fs_config
+        self.ec_profile = fs_config.get('cephfs_ec_profile')
 
         client_list = list(misc.all_roles_of_type(self._ctx.cluster, 'client'))
         self.client_id = client_list[0]
index ebd9e81a30ab2caa140d786a2e1cb0f19c0a54b4..44dceae2287968160b839fd9f37c852a74190d3e 100644 (file)
@@ -416,7 +416,7 @@ def task(ctx, config):
         config['cluster'] = 'ceph'
 
     for fs in status.get_filesystems():
-        thrasher = MDSThrasher(ctx, manager, config, Filesystem(ctx, fs['id']), fs['mdsmap']['max_mds'])
+        thrasher = MDSThrasher(ctx, manager, config, Filesystem(ctx, fscid=fs['id']), fs['mdsmap']['max_mds'])
         thrasher.start()
         ctx.ceph[config['cluster']].thrashers.append(thrasher)
 
index 86a5a89f3f8b6e84b1b78ac006ea4b4dd0c06744..7e8529879dc29f56a798cf0c7751c3c7691a1c5b 100644 (file)
@@ -1165,18 +1165,18 @@ class LocalMgrCluster(LocalCephCluster, MgrCluster):
 
 
 class LocalFilesystem(Filesystem, LocalMDSCluster):
-    def __init__(self, ctx, fscid=None, name=None, create=False, ec_profile=None):
+    def __init__(self, ctx, fs_config={}, fscid=None, name=None, create=False):
         # Deliberately skip calling parent constructor
         self._ctx = ctx
 
         self.id = None
         self.name = name
-        self.ec_profile = ec_profile
         self.metadata_pool_name = None
         self.metadata_overlay = False
         self.data_pool_name = None
         self.data_pools = None
-        self.fs_config = None
+        self.fs_config = fs_config
+        self.ec_profile = fs_config.get('cephfs_ec_profile')
 
         # Hack: cheeky inspection of ceph.conf to see what MDSs exist
         self.mds_ids = set()