From e2ea73d1a5feeaa14977cf5d30bd4bbc0945b276 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 21 Feb 2012 16:08:21 -0800 Subject: [PATCH] rgw: add valgrind support tasks: - ceph: - rgw: client.a: valgrind: [--tool=memcheck] --- teuthology/task/rgw.py | 55 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/teuthology/task/rgw.py b/teuthology/task/rgw.py index ea5350525f..c93e4c3c30 100644 --- a/teuthology/task/rgw.py +++ b/teuthology/task/rgw.py @@ -97,14 +97,21 @@ def start_rgw(ctx, config): rgws = {} for client in config.iterkeys(): (remote,) = ctx.cluster.only(client).remotes.iterkeys() - proc = remote.run( - args=[ + + client_config = config.get(client) + if client_config is None: + client_config = {} + log.info("rgw %s config is %s" % (client, client_config)) + + run_cmd=[ '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/daemon-helper', 'term', + ] + run_cmd_tail=[ '/tmp/cephtest/binary/usr/local/bin/radosgw', '-c', '/tmp/cephtest/ceph.conf', '--log-file', '/tmp/cephtest/archive/log/rgw.log', @@ -113,7 +120,30 @@ def start_rgw(ctx, config): run.Raw('>'), '/tmp/cephtest/archive/log/rgw.stdout', run.Raw('2>&1'), - ], + ] + extra_args = None + if client_config.get('valgrind') is not None: + log.debug('Running {id} rgw under valgrind'.format(id=client)) + val_path = '/tmp/cephtest/archive/log/valgrind' + remote.run( + args=[ + 'mkdir', '-p', '--', val_path, + ], + wait=True, + ) + extra_args = [ + 'valgrind', + '--log-file={vdir}/{id}.log'.format(vdir=val_path, + id=client), + client_config.get('valgrind') + ] + + if extra_args is not None: + run_cmd.extend(extra_args) + run_cmd.extend(run_cmd_tail) + + proc = remote.run( + args=run_cmd, logger=log.getChild(client), stdin=run.PIPE, wait=False, @@ -179,6 +209,25 @@ def task(ctx, config): tasks: - ceph: - rgw: [client.0, client.3] + + or + + tasks: + - ceph: + - rgw: + client.0: + client.3: + + To run radosgw through valgrind: + + tasks: + - ceph: + - rgw: + client.0: + valgrind: [--tool=memcheck] + client.3: + valgrind: [--tool=memcheck] + """ if config is None: config = dict(('client.{id}'.format(id=id_), None) -- 2.39.5