]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
task/ceph: move set_max_mds into cephfs_setup
authorJohn Spray <jspray@redhat.com>
Mon, 7 Jul 2014 12:15:41 +0000 (13:15 +0100)
committerJohn Spray <jspray@redhat.com>
Mon, 7 Jul 2014 12:44:05 +0000 (13:44 +0100)
Move the calculation of active MDS count out
of the generic service setup and into the
filesystem setup.

Fixes: #8750
Signed-off-by: John Spray <john.spray@redhat.com>
teuthology/task/ceph.py

index b1ab5d49b28939b190dd40c0165aff94f49d8bec..655689fe5d52518e627cc70e619f0f1a6e874f95 100644 (file)
@@ -438,6 +438,9 @@ def write_conf(ctx, conf_path=DEFAULT_CONF_PATH):
 
 @contextlib.contextmanager
 def cephfs_setup(ctx, config):
+    testdir = teuthology.get_testdir(ctx)
+    coverage_dir = '{tdir}/archive/coverage'.format(tdir=testdir)
+
     first_mon = teuthology.get_first_mon(ctx, config)
     (mon_remote,) = ctx.cluster.only(first_mon).remotes.iterkeys()
     mdss = ctx.cluster.only(teuthology.is_type('mds'))
@@ -447,7 +450,7 @@ def cephfs_setup(ctx, config):
         log.info('Setting up CephFS filesystem...')
 
         proc = mon_remote.run(args=['sudo', 'ceph', '--format=json-pretty', 'osd', 'lspools'],
-                           stdout=StringIO())
+                              stdout=StringIO())
         pools = json.loads(proc.stdout.getvalue())
 
         # In case we are using an older Ceph which creates FS by default
@@ -462,6 +465,16 @@ def cephfs_setup(ctx, config):
             mon_remote.run(args=['sudo', 'ceph', 'mds', 'newfs', '1', '2'])
             # mon_remote.run(args=['sudo', 'ceph', 'fs', 'new', 'default', 'metadata', 'data'])
 
+        is_active_mds = lambda role: role.startswith('mds.') and not role.endswith('-s') and role.find('-s-') == -1
+        all_roles = [item for remote_roles in mdss.remotes.values() for item in remote_roles]
+        num_active = len([r for r in all_roles if is_active_mds(r)])
+        mon_remote.run(args=[
+            'adjust-ulimits',
+            'ceph-coverage',
+            coverage_dir,
+            'ceph',
+            'mds', 'set_max_mds', str(num_active)])
+
     yield
 
 
@@ -1177,14 +1190,10 @@ def run_daemon(ctx, config, type_):
     if config.get('coverage') or config.get('valgrind') is not None:
         daemon_signal = 'term'
 
-    num_active = 0
     for remote, roles_for_host in daemons.remotes.iteritems():
         for id_ in teuthology.roles_of_type(roles_for_host, type_):
             name = '%s.%s' % (type_, id_)
 
-            if not (id_.endswith('-s')) and (id_.find('-s-') == -1):
-                num_active += 1
-
             run_cmd = [
                 'sudo',
                 'adjust-ulimits',
@@ -1221,17 +1230,6 @@ def run_daemon(ctx, config, type_):
                                    wait=False,
                                    )
 
-    if type_ == 'mds':
-        firstmon = teuthology.get_first_mon(ctx, config)
-        (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
-
-        mon0_remote.run(args=[
-            'adjust-ulimits',
-            'ceph-coverage',
-            coverage_dir,
-            'ceph',
-            'mds', 'set_max_mds', str(num_active)])
-
     try:
         yield
     finally: