Skip to content

ceph-crash: fix the auth name fallback and add tests for it - #72674

Merged
kamoltat merged 5 commits into
ceph:mainfrom
tchaikov:wip-ceph-crash-ping-auth-names
Nov 11, 2026
Merged

kamoltat merged 5 commits into
ceph:mainfrom
tchaikov:wip-ceph-crash-ping-auth-names

Conversation

@tchaikov

@tchaikov tchaikov commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Since 3a0f9ee, ceph-crash gives up on the first auth name unless it fails with EACCES. But a name without a keyring fails with EPERM, so a host without a keyring for client.crash.<host> never posts its crashes. rados/singleton/all/test-crash fails this way on every run, see https://tracker.ceph.com/issues/76470.

With this change, ceph-crash tries the next name after any error, and only stops early if the command itself failed or the cluster rejected the dump. The startup ping uses the same names instead of client.admin. --connect-timeout 5 makes a name the monitors don't know fail within 5 seconds instead of waiting for the 30s timeout(1), and the name that worked last is tried first.

post_crash() and scrape_path() are now covered by unit tests, with subprocess.Popen mocked.

Fixes: https://tracker.ceph.com/issues/76470

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@tchaikov tchaikov changed the title Wip ceph crash ping auth names ceph-crash: fix the auth name fallback and ping with our own key Oct 14, 2026
@tchaikov
tchaikov requested a balanced review from Copilot October 14, 2026 12:47

This comment was marked as resolved.

@tchaikov
tchaikov force-pushed the wip-ceph-crash-ping-auth-names branch 2 times, most recently from b00e8e7 to fd6ea9e Compare October 16, 2026 02:48
@tchaikov tchaikov changed the title ceph-crash: fix the auth name fallback and ping with our own key ceph-crash: fix the auth name fallback and add tests for it Oct 16, 2026
@tchaikov
tchaikov requested a balanced review from Copilot October 16, 2026 02:56

This comment was marked as resolved.

@tchaikov
tchaikov force-pushed the wip-ceph-crash-ping-auth-names branch from fd6ea9e to 629fe07 Compare October 16, 2026 03:03
Since 3a0f9ee, post_crash() moves on to the next auth name only if
ceph exits with EACCES, assuming a missing key fails that way. But a
name without a keyring fails with EPERM, and a name the mon has no key
for may hang until timeout(1) kills it. EACCES only means the mon
rejected the key. So without a keyring for client.crash.<host>,
ceph-crash gives up after the first name and never posts the crash.
rados/singleton/all/test-crash fails this way on every run.

Try the next name after any error, including a timeout, but stop if
ceph exits 0 and still reports a failure (see a77b47e), or exits
with EINVAL, as no other name helps then. Return 1 in the former case,
so scrape_path() keeps the dump instead of moving it to posted/. Stderr
lines starting with a timestamp are log messages, like the librados
warning about experimental features, so do not take them as a failure.
Pass an empty --log-stderr-prefix, so that a log_stderr_prefix set
in the config does not hide the timestamp.

If all names fail, log the error of each. Move the loop into a helper
for the startup ping, and decode stderr with errors='replace'.

Fixes: 3a0f9ee
Fixes: https://tracker.ceph.com/issues/76470
Signed-off-by: Kefu Chai <[email protected]>
84c4562 added a "ceph -s" at startup, so that after a key rotation
ceph-crash uses its new key right away and the mon commits the pending
key. But the ping does not pass -n, so it authenticates as
client.admin. It fails when ceph-crash runs as the ceph user and cannot
read the admin keyring, and when it works, it does not touch the crash
key.

Ping with the same auth names as post_crash(), and discard the output,
as the cluster status is of no use in the ceph-crash log.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
tchaikov force-pushed the wip-ceph-crash-ping-auth-names branch 2 times, most recently from e0f4149 to 78ede4e Compare October 16, 2026 03:33
@tchaikov
tchaikov requested a balanced review from Copilot October 16, 2026 03:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Nothing tested post_crash(), so the regression from 3a0f9ee went
unnoticed until the rados/singleton test-crash job stopped posting
crashes.

Load ceph-crash.in as a module and replace subprocess.Popen with a fake
that returns a canned result per auth name: exit 1 for a missing key,
13 for a rejected key, 124 for a timeout, 22 for a rejected dump, and
exit 0 with either a failure report or a log line on stderr. The tests
check which names post_crash() tries, and that scrape_path() moves a
dump to posted/ only after a successful post, since a moved dump is
never retried.

Register the test under NOT WIN32, as ceph-crash.in imports grp and
pwd.

Assisted-by: Claude Code
Signed-off-by: Kefu Chai <[email protected]>
A name the monitors have no key for does not fail fast. The client
keeps hunting for monitors until timeout(1) kills it after 30 seconds.
With three names, that is 90 seconds for the startup ping and for each
crash dump, longer than rados/singleton/all/test-crash waits after
restarting ceph-crash.

Pass --connect-timeout 5, and keep the 30-second timeout(1) for a
command that hangs after connecting.

Signed-off-by: Kefu Chai <[email protected]>
run_ceph() always starts from the first name. On a host where only
client.admin has a key, every crash dump waits for the two names before
it to fail, 10 seconds with the connect timeout, although the startup
ping already found the name that works.

Remember that name and try it first. If it stops working, the other
names are still tried in their usual order.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
tchaikov force-pushed the wip-ceph-crash-ping-auth-names branch from 78ede4e to 4f56f35 Compare October 16, 2026 03:49
@aainscow
aainscow self-requested a review October 16, 2026 08:19
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath11-testing-20261027.070430-main.

@aainscow aainscow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@connorfawcett

Copy link
Copy Markdown
Contributor

@kamoltat
kamoltat merged commit 8f2669c into ceph:main Nov 11, 2026
19 checks passed
@kamoltat

Copy link
Copy Markdown
Member

Needs backport to umbrella and Tentacle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants