task/ansible: mark nodes down on hardware failures - #2236
Open
djgalloway wants to merge 1 commit into
Open
Conversation
We already mark a node down after it fails to reimage 10 times in a row. When ceph-cm-ansible's "Ensure we found enough OSD disks" task fails, though, we know right away that the node is missing a disk, and every job that lands on it until someone notices will fail the same way. Scan the ansible failure log for messages that mean the hardware is broken, and mark the affected nodes down immediately. The lock's description is left alone so the owning job can still unlock the node when it finishes. Fixes: https://tracker.ceph.com/issues/75669 Signed-off-by: David Galloway <david.galloway@ibm.com>
djgalloway
requested review from
deepssin and
kshtsk
and removed request for
a team
July 30, 2026 21:59
Contributor
|
The feature looks interesting, though I haven't read deeply what the criteria of marking host down. |
Contributor
|
Also if we want this mechanism incorporated it is better to put the documentation into teuthology how all the stuff supposed to work, and that it is relied on ansible task or/and on ceph-cm-ansible role task and what format is expected to trigger the node marking down, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: https://tracker.ceph.com/issues/75669
Related: https://tracker.ceph.com/issues/75208
What
We already mark a node down after it fails to reimage 10 times in a row. When ceph-cm-ansible's
Ensure we found enough OSD diskstask fails, though, we know right away that the node is missing a disk — and every job that lands on it until someone notices will fail the same way.This scans the ansible failure log for messages that mean the hardware itself is broken and marks the affected nodes down immediately.
FailureAnalyzer.find_hardware_failures()parses the failure log (keyed by hostname) and returns{hostname: msg}for failures matching a known hardware-failure pattern. The one pattern for now isWanted N disks of ... but only matched M. Whitespace is collapsed before matching because ansible wraps that message across lines.Ansible._handle_failure()feeds the hits to a new_mark_hardware_failures_down()hook — a no-op in the base class, implemented inCephLabaslock_ops.update_lock(hostname, status='down'). This mirrors the existing_set_status()split. It's wrapped in its own try/except so a lock server problem can't disturb the existing failure-reporting path.Notes for reviewers
Two deliberate choices:
The lock description is left untouched. The dispatcher's 10-strikes path sets
description='reimage failed 10 times', but it runs after unlocking. Here the job still holds the lock, andunlock_targets()refuses to unlock a node whose description no longer matchesarchive_path— so setting it would leave the dead node locked forever. Onlyupis flipped; the reason goes to the log.We match on the message, not the task name. ceph-cm-ansible's
callback_plugins/failure_log.pyonly records the result dict (msg,changed, ...), never the task name. Verified against a real ansible_failures.yaml from the tracker and againstroles/testnode/tasks/configure_lvm.yml. Keying off the task name instead would require a callback plugin change in ceph-cm-ansible first.Testing
8 new cases in
tests/task/test_ansible.py: analyzer coverage (the verbatim message from job 116107, a line-wrapped variant, aresultslist, a non-matching failure, an empty log) plus end-to-end checks thatCephLabmarks the node down,Ansibledoes not, and a non-hardware failure does not.tests/task/test_ansible.py: 105 passed, 6 skipped. Full suite: 1222 passed, 3 failed — the 3 are intests/orchestra/test_connection.pyand fail identically on a clean checkout of main.