]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks: add multibench task for testing pool creation
authorSamuel Just <sam.just@inktank.com>
Thu, 19 Jul 2012 22:49:29 +0000 (15:49 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 19 Jul 2012 22:51:55 +0000 (15:51 -0700)
Also adds support for specifying a pool for radosbench
to create and then cleanup instead of "data".

Signed-off-by: Samuel Just <sam.just@inktank.com>
teuthology/task/multibench.py [new file with mode: 0644]
teuthology/task/radosbench.py

diff --git a/teuthology/task/multibench.py b/teuthology/task/multibench.py
new file mode 100644 (file)
index 0000000..7d0199a
--- /dev/null
@@ -0,0 +1,53 @@
+import contextlib
+import logging
+import radosbench
+import time
+import copy
+import gevent
+
+log = logging.getLogger(__name__)
+
+@contextlib.contextmanager
+def task(ctx, config):
+    """
+    Run multibench
+
+    The config should be as follows:
+
+    multibench:
+        time: <seconds to run total>
+        segments: <number of concurrent benches>
+        radosbench: <config for radosbench>
+
+    example:
+
+    tasks:
+    - ceph:
+    - multibench:
+        clients: [client.0]
+        time: 360
+    - interactive:
+    """
+    log.info('Beginning multibench...')
+    assert isinstance(config, dict), \
+        "please list clients to run on"
+
+    def run_one(num):
+        start = time.time()
+        benchcontext = copy.copy(config.get('radosbench'))
+        iterations = 0
+        while time.time() - start < int(config.get('time', 600)):
+            log.info("Starting iteration %s of segment %s"%(iterations, num))
+            benchcontext['pool'] = str(num) + "-" + str(iterations)
+            with radosbench.task(ctx, benchcontext):
+                time.sleep()
+            iterations += 1
+    log.info("Starting %s threads"%(str(config.get('segments', 3)),))
+    segments = [
+        gevent.spawn(run_one, i) 
+        for i in range(0, int(config.get('segments', 3)))]
+
+    try:
+        yield
+    finally:
+        [i.get() for i in segments]
index c0bbbe0f36289f9d360271a75ecd8af9262a72b6..b1b213a383da935db27991f95cc1cafb59018bf4 100644 (file)
@@ -15,6 +15,7 @@ def task(ctx, config):
     radosbench:
         clients: [client list]
         time: <seconds to run>
+        pool: <pool to use>
 
     example:
 
@@ -37,6 +38,27 @@ def task(ctx, config):
         id_ = role[len(PREFIX):]
         (remote,) = ctx.cluster.only(role).remotes.iterkeys()
 
+        if config.get('pool', 'data') is not "data":
+            proc = remote.run(
+                args=[
+                    "/bin/sh", "-c",
+                    " ".join(['LD_LIBRARY_PATH=/tmp/cephtest/binary/usr/local/lib',
+                              '/tmp/cephtest/enable-coredump',
+                              '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                              '/tmp/cephtest/archive/coverage',
+                              '/tmp/cephtest/binary/usr/local/bin/rados',
+                              '-c', '/tmp/cephtest/ceph.conf',
+                              '-k', '/tmp/cephtest/data/{role}.keyring'.format(role=role),
+                              '--name', role,
+                              'mkpool', str(config.get('pool', 'data'))
+                              ]),
+                    ],
+                logger=log.getChild('radosbench.{id}'.format(id=id_)),
+                stdin=run.PIPE,
+                wait=False
+                )
+            run.wait([proc])
+
         proc = remote.run(
             args=[
                 "/bin/sh", "-c",
@@ -48,7 +70,7 @@ def task(ctx, config):
                           '-c', '/tmp/cephtest/ceph.conf',
                           '-k', '/tmp/cephtest/data/{role}.keyring'.format(role=role),
                           '--name', role,
-                          '-p' , 'data',
+                          '-p' , str(config.get('pool', 'data')),
                           'bench', str(config.get('time', 360)), 'write',
                           ]),
                 ],
@@ -63,3 +85,24 @@ def task(ctx, config):
     finally:
         log.info('joining radosbench')
         run.wait(radosbench.itervalues())
+
+        if config.get('pool', 'data') is not "data":
+            proc = remote.run(
+                args=[
+                    "/bin/sh", "-c",
+                    " ".join(['LD_LIBRARY_PATH=/tmp/cephtest/binary/usr/local/lib',
+                              '/tmp/cephtest/enable-coredump',
+                              '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                              '/tmp/cephtest/archive/coverage',
+                              '/tmp/cephtest/binary/usr/local/bin/rados',
+                              '-c', '/tmp/cephtest/ceph.conf',
+                              '-k', '/tmp/cephtest/data/{role}.keyring'.format(role=role),
+                              '--name', role,
+                              'rmpool', str(config.get('pool', 'data'))
+                              ]),
+                    ],
+                logger=log.getChild('radosbench.{id}'.format(id=id_)),
+                stdin=run.PIPE,
+                wait=False
+                )
+            run.wait([proc])