from paramiko import SSHException
from ceph_manager import CephManager, write_conf
+from tarfile import ReadError
from tasks.cephfs.filesystem import Filesystem
from teuthology import misc as teuthology
from teuthology import contextutil
yield capability
+@contextlib.contextmanager
+def ceph_crash(ctx, config):
+ """
+ Gather crash dumps from /var/lib/crash
+ """
+ try:
+ yield
+
+ finally:
+ if ctx.archive is not None:
+ log.info('Archiving crash dumps...')
+ path = os.path.join(ctx.archive, 'remote')
+ try:
+ os.makedirs(path)
+ except OSError as e:
+ pass
+ for remote in ctx.cluster.remotes.iterkeys():
+ sub = os.path.join(path, remote.shortname)
+ try:
+ os.makedirs(sub)
+ except OSError as e:
+ pass
+ try:
+ teuthology.pull_directory(remote, '/var/lib/ceph/crash',
+ os.path.join(sub, 'crash'))
+ except ReadError as e:
+ pass
+
+
@contextlib.contextmanager
def ceph_log(ctx, config):
"""
log.info('Archiving logs...')
path = os.path.join(ctx.archive, 'remote')
- os.makedirs(path)
+ try:
+ os.makedirs(path)
+ except OSError as e:
+ pass
for remote in ctx.cluster.remotes.iterkeys():
sub = os.path.join(path, remote.shortname)
- os.makedirs(sub)
+ try:
+ os.makedirs(sub)
+ except OSError as e:
+ pass
teuthology.pull_directory(remote, '/var/log/ceph',
os.path.join(sub, 'log'))
# so they should only be run once
subtasks = [
lambda: ceph_log(ctx=ctx, config=None),
+ lambda: ceph_crash(ctx=ctx, config=None),
lambda: valgrind_post(ctx=ctx, config=config),
]