]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
ceph: support tmpfs_journal option to put journal on tmpfs
authorMike Ryan <mike.ryan@inktank.com>
Thu, 16 Aug 2012 22:50:10 +0000 (15:50 -0700)
committerMike Ryan <mike.ryan@inktank.com>
Thu, 16 Aug 2012 22:50:10 +0000 (15:50 -0700)
Signed-off-by: Mike Ryan <mike.ryan@inktank.com>
teuthology/nuke.py
teuthology/task/ceph.py

index 6bb0166e9c76d04985a84fbf481ce512712eacae..73e3e11d503dcd05d7721b0d9e18f07a43f98e96 100644 (file)
@@ -158,6 +158,21 @@ def remove_osd_mounts(ctx, log):
             ],
         )
 
+def remove_osd_tmpfs(ctx, log):
+    """
+    unmount tmpfs mounts
+    """
+    from .orchestra import run
+    ctx.cluster.run(
+        args=[
+            'grep', '/mnt', '/etc/mtab', run.Raw('|'),
+            'awk', '{print $2}', run.Raw('|'),
+            'xargs', '-r',
+            'sudo', 'umount', run.Raw(';'),
+            'true'
+            ],
+        )
+
 def reboot(ctx, remotes, log):
     import time
     nodes = {}
@@ -345,6 +360,9 @@ def nuke_helper(ctx, log):
     log.info('Unmount any osd data directories...')
     remove_osd_mounts(ctx, log)
 
+    log.info('Unmount any osd tmpfs dirs...')
+    remove_osd_tmpfs(ctx, log)
+
     log.info('Dealing with any kernel mounts...')
     kernel_mounts = find_kernel_mounts(ctx, log)
     #remove_kernel_mounts(ctx, kernel_mounts, log)
index 9be7fc53ed2882bbc61ae73ad591da72c364f070..81d376a08dcf57457cf14dc043642208ae326916 100644 (file)
@@ -343,6 +343,17 @@ def cluster(ctx, config):
                 teuthology.roles_of_type(roles_for_host, 'osd'), devs
                 )
             log.info('journal map: %s', roles_to_journals)
+
+        if config.get('tmpfs_journal'):
+            log.info('tmpfs journal enabled')
+            roles_to_journals = {}
+            remote.run( args=[ 'sudo', 'mount', '-t', 'tmpfs', 'tmpfs', '/mnt' ] )
+            for osd in teuthology.roles_of_type(roles_for_host, 'osd'):
+                tmpfs = '/mnt/osd.%s' % osd
+                roles_to_journals[osd] = tmpfs
+                remote.run( args=[ 'truncate', '-s', '1500M', tmpfs ] )
+            log.info('journal map: %s', roles_to_journals)
+
         remote_to_roles_to_devs[remote] = roles_to_devs
         remote_to_roles_to_journals[remote] = roles_to_journals
 
@@ -365,6 +376,9 @@ def cluster(ctx, config):
                 conf[section] = {}
             conf[section][key] = value
 
+    if config.get('tmpfs_journal'):
+        conf['journal dio'] = False
+
     ctx.ceph = argparse.Namespace()
     ctx.ceph.conf = conf
 
@@ -759,6 +773,12 @@ def cluster(ctx, config):
                         ]
                     )
 
+        for remote, roles_for_host in osds.remotes.iteritems():
+            remote.run(
+                args=[ 'sudo', 'umount', '-f', '/mnt' ],
+                check_status=False,
+            )
+
         if ctx.archive is not None:
             # archive mon data, too
             log.info('Archiving mon data...')
@@ -1041,6 +1061,7 @@ def task(ctx, config):
                 mkfs_options=config.get('mkfs_options', None),
                 mount_options=config.get('mount_options',None),
                 block_journal=config.get('block_journal', None),
+                tmpfs_journal=config.get('tmpfs_journal', None),
                 log_whitelist=config.get('log-whitelist', []),
                 )),
         lambda: run_daemon(ctx=ctx, config=config, type_='mon'),