From 398a333833dcced631ddb5ed9feeba4c5141c9c9 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 13 Jun 2011 10:29:22 -0700 Subject: [PATCH] adding radosbench.py to tasks Signed-off-by: Samuel Just --- teuthology/task/radosbench.py | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 teuthology/task/radosbench.py diff --git a/teuthology/task/radosbench.py b/teuthology/task/radosbench.py new file mode 100644 index 0000000000..afa40cc17f --- /dev/null +++ b/teuthology/task/radosbench.py @@ -0,0 +1,66 @@ +import contextlib +import logging +import os + +from teuthology import misc as teuthology +from orchestra import run + +log = logging.getLogger(__name__) + +@contextlib.contextmanager +def task(ctx, config): + """ + Run radosbench + + The config should be as follows: + + radosbench: + clients: [client list] + time: + + example: + + tasks: + - ceph: + - radosbench: + clients: [client.0] + time: 360 + - interactive: + """ + log.info('Beginning radosbench...') + assert isinstance(config, dict), \ + "please list clients to run on" + radosbench = {} + + (mon,) = ctx.cluster.only('mon.0').remotes.iterkeys() + remotes = [] + for role in config.get('clients', ['client.0']): + assert isinstance(role, basestring) + PREFIX = 'client.' + assert role.startswith(PREFIX) + id_ = role[len(PREFIX):] + (remote,) = ctx.cluster.only(role).remotes.iterkeys() + + proc = remote.run( + args= [ + "/bin/sh", "-c", + " ".join(['LD_LIBRARY_PATH=/tmp/cephtest/binary/usr/local/lib', + '/tmp/cephtest/binary/usr/local/bin/rados', + '-c', '/tmp/cephtest/ceph.conf', + '-k', '/tmp/cephtest/data/{role}.keyring'.format(role=role), + '--name', role, + '-p' , 'data', + 'bench', str(config.get('time', 360)), 'write', + ]), + ], + logger=log.getChild('radosbench.{id}'.format(id=id_)), + stdin=run.PIPE, + wait=False + ) + radosbench[id_] = proc + + try: + yield + finally: + log.info('joining radosbench') + run.wait(radosbench.itervalues()) -- 2.39.5