From 939c3aee7f8c1098cfc64527f9e3d06b0868c4d4 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 8 Oct 2012 17:59:47 -0700 Subject: [PATCH] New kcon_most task that enables most ceph kernel logging Signed-off-by: David Zafman Reviewed-by: Josh Durgin --- teuthology/task/ceph.py | 2 +- teuthology/task/kcon_most | 38 ++++++++++++++++++++++ teuthology/task/kcon_most.py | 63 ++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100755 teuthology/task/kcon_most create mode 100644 teuthology/task/kcon_most.py diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 00ffac109c11b..7e05d837a0ec9 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -122,7 +122,7 @@ def ceph_log(ctx, config): def ship_utilities(ctx, config): assert config is None FILES = ['daemon-helper', 'enable-coredump', 'chdir-coredump', - 'valgrind.supp'] + 'valgrind.supp', 'kcon_most'] for filename in FILES: log.info('Shipping %r...', filename) src = os.path.join(os.path.dirname(__file__), filename) diff --git a/teuthology/task/kcon_most b/teuthology/task/kcon_most new file mode 100755 index 0000000000000..2a288ff046a52 --- /dev/null +++ b/teuthology/task/kcon_most @@ -0,0 +1,38 @@ +#!/bin/sh + +# Adapted from ceph repo src/script/kcon_most.sh + +p() { + echo "$*" > /sys/kernel/debug/dynamic_debug/control +} + +usage() { + echo "usage: $0 [on|off]" + exit 1 +} + +if [ $# != "1" ]; +then + usage +fi + +if [ "$1" != "on" -a "$1" != "off" ]; +then + usage +fi + +if [ $1 = "on" ]; +then + p 'module ceph +p' + p 'module libceph +p' + p 'module rbd +p' + p 'file net/ceph/messenger.c -p' + p 'file' `grep -- --- /sys/kernel/debug/dynamic_debug/control | grep ceph | awk '{print $1}' | sed 's/:/ line /'` '+p' + p 'file' `grep -- === /sys/kernel/debug/dynamic_debug/control | grep ceph | awk '{print $1}' | sed 's/:/ line /'` '+p' +else + p 'module ceph -p' + p 'module libceph -p' + p 'module rbd -p' + p 'file' `grep -- --- /sys/kernel/debug/dynamic_debug/control | grep ceph | awk '{print $1}' | sed 's/:/ line /'` '-p' + p 'file' `grep -- === /sys/kernel/debug/dynamic_debug/control | grep ceph | awk '{print $1}' | sed 's/:/ line /'` '-p' +fi diff --git a/teuthology/task/kcon_most.py b/teuthology/task/kcon_most.py new file mode 100644 index 0000000000000..a831bfad7d461 --- /dev/null +++ b/teuthology/task/kcon_most.py @@ -0,0 +1,63 @@ +import contextlib +import logging +import os + +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', + '/tmp/cephtest/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', + '/tmp/cephtest/kcon_most', + 'off' + ], + ) -- 2.39.5