ceph/teuthology/task/kcon_most.py
Zack Cerza 8a11e4d053 Remove unused variables
(cherry picked from commit 581b6b3e977b99fc58fe25e66c933c65e38dc87c)
2013-09-26 14:01:56 -05:00

64 lines
1.6 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))
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',
'kcon_most',
'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',
'kcon_most',
'off'
],
)