from teuthology import contextutil
from teuthology import exceptions
from teuthology.orchestra import run
+from teuthology.util.scanner import ValgrindScanner
from tasks import ceph_client as cclient
from teuthology.orchestra.daemon import DaemonGroup
from tasks.daemonwatchdog import DaemonWatchdog
try:
yield
finally:
- lookup_procs = list()
- log.info('Checking for errors in any valgrind logs...')
- for remote in ctx.cluster.remotes.keys():
- # look at valgrind logs for each node
- proc = remote.run(
- args="sudo zgrep '<kind>' /var/log/ceph/valgrind/* "
- # include a second file so that we always get
- # a filename prefix on the output
- "/dev/null | sort | uniq",
- wait=False,
- check_status=False,
- stdout=StringIO(),
- )
- lookup_procs.append((proc, remote))
-
valgrind_exception = None
- for (proc, remote) in lookup_procs:
- proc.wait()
- out = proc.stdout.getvalue()
- for line in out.split('\n'):
- if line == '':
- continue
- try:
- (file, kind) = line.split(':')
- except Exception:
- log.error('failed to split line %s', line)
- raise
- log.debug('file %s kind %s', file, kind)
- if (file.find('mds') >= 0) and kind.find('Lost') > 0:
- continue
- log.error('saw valgrind issue %s in %s', kind, file)
- valgrind_exception = Exception('saw valgrind issues')
+ valgrind_yaml = os.path.join(ctx.archive, 'valgrind.yaml')
+ for remote in ctx.cluster.remotes.keys():
+ scanner = ValgrindScanner(remote)
+ errors = scanner.scan_all_files('/var/log/ceph/valgrind/*')
+ scanner.write_summary(valgrind_yaml)
+ if errors and not valgrind_exception:
+ log.debug('valgrind exception message: %s', errors[0])
+ valgrind_exception = Exception(errors[0])
if config.get('expect_valgrind_errors'):
if not valgrind_exception: