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 <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-02-16 23:44:03 -08:00
parent d1d36241b7
commit 88ebc27f16
4 changed files with 45 additions and 38 deletions

View File

@ -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

View File

@ -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),

View File

@ -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
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(

View File

@ -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)