]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
New kcon_most task that enables most ceph kernel logging
authorDavid Zafman <david.zafman@inktank.com>
Tue, 9 Oct 2012 00:59:47 +0000 (17:59 -0700)
committerDavid Zafman <david.zafman@inktank.com>
Thu, 11 Oct 2012 01:18:14 +0000 (18:18 -0700)
Signed-off-by: David Zafman <david.zafman@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
teuthology/task/ceph.py
teuthology/task/kcon_most [new file with mode: 0755]
teuthology/task/kcon_most.py [new file with mode: 0644]

index 00ffac109c11be020771582d915bb7a4636a0d4b..7e05d837a0ec945191c53d40c32ee8fe7ec0000c 100644 (file)
@@ -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 (executable)
index 0000000..2a288ff
--- /dev/null
@@ -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 (file)
index 0000000..a831bfa
--- /dev/null
@@ -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'
+                    ],
+                )