log.debug('Ceph mon addresses: %s', addresses)
args = [
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
'/tmp/cephtest/archive/coverage',
'/tmp/cephtest/binary/usr/local/bin/monmaptool',
while True:
r = remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
'/tmp/cephtest/archive/coverage',
'/tmp/cephtest/binary/usr/local/bin/ceph',
def write_secret_file(remote, role, filename):
remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
'/tmp/cephtest/archive/coverage',
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
@contextlib.contextmanager
def ship_utilities(ctx, config):
assert config is None
- FILES = ['daemon-helper']
+ FILES = ['daemon-helper', 'enable-coredump']
for filename in FILES:
log.info('Shipping %r...', filename)
src = os.path.join(os.path.dirname(__file__), filename)
log.info('Setting up mon.0...')
ctx.cluster.only('mon.0').run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
)
ctx.cluster.only('mon.0').run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
log.info('Creating admin key on mon.0...')
ctx.cluster.only('mon.0').run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
run.wait(
mons.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/osdmaptool',
for id_ in teuthology.roles_of_type(roles_for_host, 'osd'):
remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
for id_ in teuthology.roles_of_type(roles_for_host, 'mds'):
remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
for id_ in teuthology.roles_of_type(roles_for_host, 'client'):
remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
run.wait(
mons.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cauthtool',
for id_ in teuthology.roles_of_type(roles_for_host, 'mon'):
remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cmon',
)
remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/binary/usr/local/bin/cosd',
for id_ in teuthology.roles_of_type(roles_for_host, 'mon'):
proc = remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/daemon-helper',
for id_ in teuthology.roles_of_type(roles_for_host, 'osd'):
proc = remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/daemon-helper',
for id_ in teuthology.roles_of_type(roles_for_host, 'mds'):
proc = remote.run(
args=[
+ '/tmp/cephtest/enable-coredump',
'/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
coverage_dir,
'/tmp/cephtest/daemon-helper',
+from cStringIO import StringIO
import contextlib
import gevent
import logging
wait=False,
),
)
+
+@contextlib.contextmanager
+def coredump(ctx, config):
+ log.info('Enabling coredump saving...')
+ run.wait(
+ ctx.cluster.run(
+ args=[
+ 'install', '-d', '-m0755', '--',
+ '/tmp/cephtest/archive/coredump',
+ run.Raw('&&'),
+ 'sudo', 'sysctl', '-w', 'kernel.core_pattern=/tmp/cephtest/archive/coredump/%t.%p.core',
+ ],
+ wait=False,
+ )
+ )
+
+ try:
+ yield
+ finally:
+ run.wait(
+ ctx.cluster.run(
+ args=[
+ 'sudo', 'sysctl', '-w', 'kernel.core_pattern=core',
+ run.Raw('&&'),
+ # don't litter the archive dir if there were no cores dumped
+ 'rmdir',
+ '--ignore-fail-on-non-empty',
+ '--',
+ '/tmp/cephtest/archive/coredump',
+ ],
+ wait=False,
+ )
+ )
+
+ # set success=false if the dir is still there = coredumps were
+ # seen
+ processes = ctx.cluster.run(
+ args=[
+ 'if', 'test', '!', '-e', '/tmp/cephtest/archive/coredump', run.Raw(';'), 'then',
+ 'echo', 'OK', run.Raw(';'),
+ 'fi',
+ ],
+ wait=False,
+ stdout=StringIO(),
+ )
+ run.wait(processes)
+ if any(r.stdout.getvalue() != 'OK' for r in processes):
+ log.warning('Found coredumps, flagging run as failed.')
+ ctx.summary['success'] = False