testdir = misc.get_testdir(ctx)
run.wait(
ctx.cluster.run(
- args=[
- 'mkdir', '-p', '-m0755', '--',
- testdir,
- ],
+ args=['mkdir', '-p', '-m0755', '--', testdir],
wait=False,
- )
)
+ )
try:
yield
finally:
# just cram an rm -rf here
run.wait(
ctx.cluster.run(
- args=[
- 'rmdir',
- '--',
- testdir,
- ],
+ args=['rmdir', '--', testdir],
wait=False,
- ),
- )
+ ),
+ )
@contextlib.contextmanager
with file(os.path.join(ctx.archive, 'config.yaml'), 'w') as f:
yaml.safe_dump(ctx.config, f, default_flow_style=False)
+
def check_lock(ctx, config, check_up=True):
"""
Check lock status of remote machines.
'machine {name} is not locked'.format(name=machine)
assert status['locked_by'] == ctx.owner, \
'machine {name} is locked by {user}, not {owner}'.format(
- name=machine,
- user=status['locked_by'],
- owner=ctx.owner,
+ name=machine,
+ user=status['locked_by'],
+ owner=ctx.owner,
)
)
-
@contextlib.contextmanager
def timer(ctx, config):
"""
"""
log.info('Checking for old /var/lib/ceph...')
processes = ctx.cluster.run(
- args=[
- 'test', '!', '-e', '/var/lib/ceph',
- ],
+ args=['test', '!', '-e', '/var/lib/ceph'],
wait=False,
- )
+ )
failed = False
for proc in processes:
try:
if failed:
raise RuntimeError('Stale /var/lib/ceph detected, aborting.')
+
def check_conflict(ctx, config):
"""
Note directory use conflicts and stale directories.
log.info('Checking for old test directory...')
testdir = misc.get_testdir(ctx)
processes = ctx.cluster.run(
- args=[
- 'test', '!', '-e', testdir,
- ],
+ args=['test', '!', '-e', testdir],
wait=False,
- )
+ )
failed = False
for proc in processes:
try:
archive_dir = misc.get_archive_dir(ctx)
run.wait(
ctx.cluster.run(
- args=[
- 'install', '-d', '-m0755', '--', archive_dir,
- ],
+ args=['install', '-d', '-m0755', '--', archive_dir],
wait=False,
- )
)
+ )
try:
yield
log.info('Removing archive directory...')
run.wait(
ctx.cluster.run(
- args=[
- 'rm',
- '-rf',
- '--',
- archive_dir,
- ],
+ args=['rm', '-rf', '--', archive_dir],
wait=False,
- ),
- )
+ ),
+ )
@contextlib.contextmanager
'{adir}/coredump'.format(adir=archive_dir),
run.Raw('&&'),
'sudo', 'sysctl', '-w', 'kernel.core_pattern={adir}/coredump/%t.%p.core'.format(adir=archive_dir),
- ],
+ ],
wait=False,
- )
)
+ )
try:
yield
'--ignore-fail-on-non-empty',
'--',
'{adir}/coredump'.format(adir=archive_dir),
- ],
+ ],
wait=False,
- )
)
+ )
# set status = 'fail' if the dir is still there = coredumps were
# seen
'if', 'test', '!', '-e', '{adir}/coredump'.format(adir=archive_dir), run.Raw(';'), 'then',
'echo', 'OK', run.Raw(';'),
'fi',
- ],
+ ],
stdout=StringIO(),
- )
+ )
if r.stdout.getvalue() != 'OK\n':
log.warning('Found coredumps on %s, flagging run as failed', rem)
set_status(ctx.summary, 'fail')
ctx.summary['failure_reason'] = \
'Found coredumps on {rem}'.format(rem=rem)
+
@contextlib.contextmanager
def syslog(ctx, config):
"""
log_dir = '{adir}/syslog'.format(adir=archive_dir)
run.wait(
ctx.cluster.run(
- args=[
- 'mkdir', '-p', '-m0755', '--',
- log_dir,
- ],
+ args=['mkdir', '-p', '-m0755', '--', log_dir],
wait=False,
- )
)
+ )
CONF = '/etc/rsyslog.d/80-cephtest.conf'
kern_log = '{log_dir}/kern.log'.format(log_dir=log_dir)
remote=rem,
path=CONF,
data=conf_fp,
- )
+ )
conf_fp.seek(0)
run.wait(
ctx.cluster.run(
# rsyslog open the files
'rsyslog',
'restart',
- ],
+ ],
wait=False,
- ),
- )
+ ),
+ )
yield
finally:
'service',
'rsyslog',
'restart',
- ],
+ ],
wait=False,
- ),
- )
+ ),
+ )
# race condition: nothing actually says rsyslog had time to
# flush the file fully. oh well.
run.Raw('|'),
'grep', '-v', 'CRON', # ignore cron noise
run.Raw('|'),
- 'grep', '-v', 'BUG: bad unlock balance detected', # #6097
+ 'grep', '-v', 'BUG: bad unlock balance detected', # #6097
run.Raw('|'),
- 'grep', '-v', 'inconsistent lock state', # FIXME see #2523
+ 'grep', '-v', 'inconsistent lock state', # FIXME see #2523
run.Raw('|'),
- 'grep', '-v', '*** DEADLOCK ***', # part of lockdep output
+ 'grep', '-v', '*** DEADLOCK ***', # part of lockdep output
run.Raw('|'),
- 'grep', '-v', 'INFO: possible irq lock inversion dependency detected', # FIXME see #2590 and #147
+ 'grep', '-v', 'INFO: possible irq lock inversion dependency detected', # FIXME see #2590 and #147
run.Raw('|'),
'grep', '-v', 'INFO: NMI handler (perf_event_nmi_handler) took too long to run',
run.Raw('|'),
'grep', '-v', 'INFO: recovery required on readonly',
run.Raw('|'),
'head', '-n', '1',
- ],
+ ],
stdout=StringIO(),
- )
+ )
stdout = r.stdout.getvalue()
if stdout != '':
log.error('Error in syslog on %s: %s', rem.name, stdout)
'--',
'gzip',
'--',
- ],
+ ],
wait=False,
- ),
- )
+ ),
+ )
def vm_setup(ctx, config):