]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks: generalize config writing for Filesystem
authorJohn Spray <jspray@redhat.com>
Wed, 3 Sep 2014 11:23:13 +0000 (12:23 +0100)
committerJohn Spray <jspray@redhat.com>
Mon, 29 Sep 2014 14:03:17 +0000 (15:03 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/filesystem.py
tasks/mds_journal_migration.py

index 3cd6206dbc63301c53f82c4624869f5a70b2fd3b..df0d2b21a2ba27d6607dda30519f5d2709d33697 100644 (file)
@@ -3,6 +3,7 @@ from StringIO import StringIO
 import json
 import logging
 import time
+from tasks.ceph import write_conf
 
 from teuthology import misc
 from teuthology.nuke import clear_firewall
@@ -49,6 +50,14 @@ class Filesystem(object):
 
         return list(result)
 
+    def set_ceph_conf(self, subsys, key, value):
+        # Set config so that journal will be created in older format
+        if 'mds' not in self._ctx.ceph.conf:
+            self._ctx.ceph.conf['mds'] = {}
+        self._ctx.ceph.conf['mds'][key] = value
+        write_conf(self._ctx)  # XXX because we don't have the ceph task's config object, if they
+                         # used a different config path this won't work.
+
     def are_daemons_healthy(self):
         """
         Return true if all daemons are in one of active, standby, standby-replay
index a3eaca798d2b359e05316058a4706b2118678232..74bf6cb9193f629a4847caad0aac59d601dfc021 100644 (file)
@@ -3,7 +3,6 @@ import contextlib
 import logging
 from teuthology import misc
 
-from tasks.ceph import write_conf
 from cephfs.filesystem import Filesystem
 
 log = logging.getLogger(__name__)
@@ -55,12 +54,7 @@ def task(ctx, config):
     old_journal_version = JOURNAL_FORMAT_LEGACY
     new_journal_version = JOURNAL_FORMAT_RESILIENT
 
-    # Set config so that journal will be created in older format
-    if 'mds' not in ctx.ceph.conf:
-        ctx.ceph.conf['mds'] = {}
-    ctx.ceph.conf['mds']['mds journal format'] = old_journal_version
-    write_conf(ctx)  # XXX because we don't have the ceph task's config object, if they
-                     # used a different config path this won't work.
+    fs.set_ceph_conf('mds', 'mds journal format', old_journal_version)
 
     # Create a filesystem using the older journal format.
     for mount in ctx.mounts.values():
@@ -76,8 +70,7 @@ def task(ctx, config):
         mount.check_files()  # sanity, this should always pass
 
     # Modify the ceph.conf to ask the MDS to use the new journal format.
-    ctx.ceph.conf['mds']['mds journal format'] = new_journal_version
-    write_conf(ctx)
+    fs.set_ceph_conf('mds', 'mds journal format', new_journal_version)
 
     # Restart the MDS.
     fs.mds_fail_restart()