"""
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', '-',
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),
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,
)
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):
'/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(
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)