ceph/teuthology/task/kcon_most.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

65 lines
1.7 KiB
Python

import contextlib
import logging
from teuthology import misc as teuthology
log = logging.getLogger(__name__)
@contextlib.contextmanager
def task(ctx, config):
"""
Enable most ceph console logging
Example that enables logging on all clients::
tasks:
- ceph:
- kclient:
- kcon_most
- interactive:
Example that enables logging only on the client using kclient::
tasks:
- ceph:
- kclient: [client.0]
- kcon_most [client.0]
- interactive:
"""
log.info('Enable additional kernel logging...')
assert config is None or isinstance(config, list), \
"task kcon_most got invalid config"
if config is None:
config = ['client.{id}'.format(id=id_)
for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
clients = list(teuthology.get_clients(ctx=ctx, roles=config))
testdir = teuthology.get_testdir(ctx)
for id_, remote in clients:
# TODO: Don't have to run this more than once per node (remote)
log.info('Enable logging on client.{id} at {remote} ...'.format(
id=id_, remote=remote))
remote.run(
args=[
'sudo',
'{tdir}/kcon_most'.format(tdir=testdir),
'on'
],
)
try:
yield
finally:
log.info('Disable extra kernel logging on clients...')
for id_, remote in clients:
log.debug('Disable extra kernel logging on client.{id}...'.format(id=id_))
remote.run(
args=[
'sudo',
'{tdir}/kcon_most'.format(tdir=testdir),
'off'
],
)