From: Sage Weil Date: Sun, 17 Feb 2013 07:44:03 +0000 (-0800) Subject: ceph: store logs in normal location X-Git-Tag: 1.1.0~2312^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=88ebc27f16a173f0706b4fbede1e1bcd4e0da701;p=teuthology.git ceph: store logs in normal location We need to switch around how these are compressed and pulled, since they aren't in the regular archive dir anymore. Signed-off-by: Sage Weil --- diff --git a/teuthology/ceph.conf.template b/teuthology/ceph.conf.template index d4689b592..202a24540 100644 --- a/teuthology/ceph.conf.template +++ b/teuthology/ceph.conf.template @@ -1,5 +1,4 @@ [global] - log file = {testdir}/archive/log/$name.log chdir = "" pid file = $name.pid auth supported = cephx @@ -11,12 +10,8 @@ osd crush chooseleaf type = 0 -[mon] - mon cluster log file = {testdir}/archive/log/cluster.mon.$id.log - [osd] osd journal size = 100 - osd class dir = /usr/lib/rados-classes osd scrub load threshold = 5.0 osd scrub max interval = 600 diff --git a/teuthology/misc.py b/teuthology/misc.py index 06bf521f4..35f640ee2 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -293,11 +293,13 @@ def pull_directory(remote, remotedir, localdir): """ Copy a remote directory to a local directory. """ - os.mkdir(localdir) log.debug('Transferring archived files from %s:%s to %s', remote.shortname, remotedir, localdir) + if not os.path.exists(localdir): + os.mkdir(localdir) proc = remote.run( args=[ + 'sudo', 'tar', 'c', '-f', '-', @@ -636,7 +638,7 @@ def get_valgrind_args(testdir, name, v): return [] if not isinstance(v, list): v = [v] - val_path = '{tdir}/archive/log/valgrind'.format(tdir=testdir) + val_path = '/var/log/ceph/valgrind'.format(tdir=testdir) if '--tool=memcheck' in v or '--tool=helgrind' in v: extra_args = [ '{tdir}/chdir-coredump'.format(tdir=testdir), diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 3d75e51e9..e06c58fbd 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -77,17 +77,17 @@ class CephState(object): def iter_daemons_of_role(self, role): return self.daemons.get(role, {}).values() + @contextlib.contextmanager def ceph_log(ctx, config): - log.info('Creating log directories...') - archive_dir = '{tdir}/archive'.format(tdir=teuthology.get_testdir(ctx)) + log.info('Creating extra log directories...') run.wait( ctx.cluster.run( args=[ + 'sudo', 'install', '-d', '-m0755', '--', - '{adir}/log'.format(adir=archive_dir), - '{adir}/log/valgrind'.format(adir=archive_dir), - '{adir}/profiling-logger'.format(adir=archive_dir), + '/var/log/ceph/valgrind', + '/var/log/ceph/profiling-logger', ], wait=False, ) @@ -95,32 +95,9 @@ def ceph_log(ctx, config): try: yield - finally: - if ctx.archive is not None: - log.info('Compressing logs...') - run.wait( - ctx.cluster.run( - args=[ - 'find', - '{adir}/log'.format(adir=archive_dir), - '-name', - '*.log', - '-print0', - run.Raw('|'), - 'xargs', - '-0', - '--no-run-if-empty', - '--', - 'gzip', - '--', - ], - wait=False, - ), - ) - - # log file transfer is done by the generic archive data - # handling + finally: + pass @contextlib.contextmanager def ship_utilities(ctx, config): @@ -908,6 +885,40 @@ def cluster(ctx, config): '/var/lib/ceph/mon', path + '/' + role + '.tgz') + # and logs + log.info('Compressing logs...') + run.wait( + ctx.cluster.run( + args=[ + 'sudo', + 'find', + '/var/log/ceph', + '-name', + '*.log', + '-print0', + run.Raw('|'), + 'sudo', + 'xargs', + '-0', + '--no-run-if-empty', + '--', + 'gzip', + '--', + ], + wait=False, + ), + ) + + log.info('Archiving logs...') + path = os.path.join(ctx.archive, 'remote') + os.makedirs(path) + for remote in ctx.cluster.remotes.iterkeys(): + sub = os.path.join(path, remote.shortname) + os.makedirs(sub) + teuthology.pull_directory(remote, '/var/log/ceph', + os.path.join(sub, 'log')) + + log.info('Cleaning ceph cluster...') run.wait( ctx.cluster.run( diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index cbbb87c48..7195e31cb 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -252,7 +252,6 @@ def archive(ctx, config): if ctx.archive is not None: log.info('Transferring archived files...') logdir = os.path.join(ctx.archive, 'remote') - os.mkdir(logdir) for remote in ctx.cluster.remotes.iterkeys(): path = os.path.join(logdir, remote.shortname) teuthology.pull_directory(remote, archive_dir, path)