ceph/teuthology/task/watch_notify_stress.py
Sam Lang ace4cb07b2 Replace /tmp/cephtest/ with configurable path
Teuthology uses /tmp/cephtest/ as the scratch test directory for
a run.  This patch replaces /tmp/cephtest/ everywhere with a
per-run directory: {basedir}/{rundir} where {basedir} is a directory
configured in .teuthology.yaml (/tmp/cephtest if not specified),
and {rundir} is the name of the run, as given in --name.  If no name
is specified, {user}-{timestamp} is used.

To get the old behavior (/tmp/cephtest), set test_path: /tmp/cephtest
in .teuthology.yaml.

This change was modivated by #3782, which requires a test dir that
survives across reboots, but also resolves #3767.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2013-01-31 08:23:31 -06:00

70 lines
1.8 KiB
Python

import contextlib
import logging
import proc_thrasher
from ..orchestra import run
from teuthology import misc as teuthology
log = logging.getLogger(__name__)
@contextlib.contextmanager
def task(ctx, config):
"""
Run test_stress_watch
The config should be as follows:
test_stress_watch:
clients: [client list]
example:
tasks:
- ceph:
- test_stress_watch:
clients: [client.0]
- interactive:
"""
log.info('Beginning test_stress_watch...')
assert isinstance(config, dict), \
"please list clients to run on"
testwatch = {}
remotes = []
testdir = teuthology.get_testdir(ctx)
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()
remotes.append(remote)
args =['CEPH_CLIENT_ID={id_}'.format(id_=id_),
'CEPH_CONF={tdir}/ceph.conf'.format(tdir=testdir),
'CEPH_ARGS="{flags}"'.format(flags=config.get('flags', '')),
'LD_PRELOAD={tdir}/binary/usr/local/lib/librados.so.2'.format(tdir=testdir),
'{tdir}/daemon-helper'.format(tdir=testdir), 'kill',
'{tdir}/binary/usr/local/bin/multi_stress_watch foo foo'.format(tdir=testdir)
]
log.info("args are %s" % (args,))
proc = proc_thrasher.ProcThrasher({}, remote,
args=[run.Raw(i) for i in args],
logger=log.getChild('testwatch.{id}'.format(id=id_)),
stdin=run.PIPE,
wait=False
)
proc.start()
testwatch[id_] = proc
try:
yield
finally:
log.info('joining watch_notify_stress')
for i in testwatch.itervalues():
i.join()