Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qa: grep kernel logs for kclient warnings/failures to fail a test #42193

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions qa/tasks/ceph.py
Expand Up @@ -1137,6 +1137,43 @@ def first_in_ceph_log(pattern, excludes):
)
break

def first_in_kern_log(pattern, excludes):
"""
Find the first occurrence of the pattern specified in the kern log,
Returns None if none found.

:param pattern: Pattern scanned for.
:param excludes: Patterns to ignore.
:return: First line of text (or None if not found)
"""
args = [
'sudo',
'journalctl', '-k', '--since', 'today', '|', 'egrep', pattern,
]
kotreshhr marked this conversation as resolved.
Show resolved Hide resolved
for exclude in excludes:
args.extend([run.Raw('|'), 'egrep', '-v', exclude])
args.extend([
run.Raw('|'), 'head', '-n', '1',
])
stdout = mon0_remote.sh(args)
return stdout or None

kotreshhr marked this conversation as resolved.
Show resolved Hide resolved
patterns = ['Oops:', 'BUG:', 'INFO: task .+ blocked for more than .+ seconds', 'KASAN', 'WARNING:']

if first_in_kern_log('|'.join(patterns), config['log_ignorelist']) is not None:
log.warning('Found errors (Oops|BUG|blocked|KASAN) in kernel log')
ctx.summary['success'] = False
# use the most severe problem as the failure reason
if 'failure_reason' not in ctx.summary:
for pattern in patterns:
match = first_in_ceph_log(pattern, config['log_ignorelist'])
if match is not None:
ctx.summary['failure_reason'] = \
'"{match}" in kernel log'.format(
match=match.rstrip('\n'),
)
break

for remote, dirs in devs_to_clean.items():
for dir_ in dirs:
log.info('Unmounting %s on %s' % (dir_, remote))
Expand Down