From: Vallari Agrawal Date: Thu, 26 Oct 2023 05:46:29 +0000 (+0530) Subject: qa: rewrite "valgrind_post" to use ValgrindScanner X-Git-Tag: v19.0.0~31^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=397e85a5f8ee6b984077e94184404370497237a9;p=ceph.git qa: rewrite "valgrind_post" to use ValgrindScanner previously, valgrind_post() func used grep to find error from valgrind logs. now, it uses ValgrindScanner to log better exceptions with traceback and exception kind, along with creating a more detailed summary in valgrind.yaml in archive. Signed-off-by: Vallari Agrawal --- diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index d487c4296105..a7b3ad4c5eec 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -28,6 +28,7 @@ from teuthology import misc as teuthology 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 @@ -327,38 +328,15 @@ def valgrind_post(ctx, config): 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 '' /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: