Skip to content

mon: show CRUSH rule name in osd pool ls detail - #68886

Merged
SrinivasaBharath merged 1 commit into
ceph:mainfrom
lumir-sliva:osd-pool-ls-crush-rule-name
Sep 4, 2026
Merged

SrinivasaBharath merged 1 commit into
ceph:mainfrom
lumir-sliva:osd-pool-ls-crush-rule-name

Conversation

@lumir-sliva

@lumir-sliva lumir-sliva commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

ceph osd pool ls detail shows crush_rule <id> for every pool, but
there's no straightforward way to map that id to a rule name from the
same command. ceph osd crush rule dump <id> doesn't accept an id,
so users have to dump every rule and search.

This adds a --show-rule-names flag, paired with detail, that:

  • in the text output, renders the CRUSH rule by name in place of the id;
  • in the JSON output, leaves crush_rule as an int (no schema change)
    and adds a sibling crush_rule_name string field.

Before:

$ ceph osd pool ls detail
pool 3 'pool_named' replicated size 3 min_size 1 crush_rule 1 ...

After (text):

$ ceph osd pool ls detail --show-rule-names
pool 3 'pool_named' replicated size 3 min_size 1 crush_rule replica_hdd ...

After (JSON):

$ ceph osd pool ls detail --show-rule-names --format json
... "crush_rule": 1, "crush_rule_name": "replica_hdd", ...

The JSON shape is additive on purpose. The in-tree balancer and
pg_autoscaler mgr modules pin crush_rule to an int (e.g.
crush.get_rule_by_id(pool['crush_rule'])), so flipping the field's
type under any flag would break them. The opt-in sibling field is
safe for any consumer that already reads the int.

If the referenced rule no longer exists in CRUSH, the text falls back
to the numeric id and the JSON omits crush_rule_name, so the output
is never misleading.

Verified on vstart with a default rule, a named replicated rule, and
pools pointing at each.

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)
    • Includes unit test(s)
    • Includes integration test(s)
    • Includes bug reproducer
    • No tests

Tracker: https://tracker.ceph.com/issues/76401

@lumir-sliva
lumir-sliva requested a review from a team as a code owner May 13, 2026 12:48
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

13 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@djgalloway

Copy link
Copy Markdown
Contributor

jenkins test pr

@anthonyeleven anthonyeleven 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.

I’m not qualified to review the code but this looks awesome

@lumir-sliva

Copy link
Copy Markdown
Contributor Author

@ceph/core mind taking a look when you get a chance? Adds a --show-rule-names flag to osd pool ls detail (text shows the CRUSH rule by name, JSON gets an additive crush_rule_name sibling alongside the int, so balancer/pg_autoscaler stay safe). Anthony D'Atri's tracker enhancement. Only red check is windows tests, which builds clean on both Linux arches here.

@lumir-sliva

Copy link
Copy Markdown
Contributor Author

@rzarzynski mind taking a look when you get a chance, or pointing me to the right person? (the @ceph/core mention above doesn't notify since I'm not in the org)

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Aug 17, 2026
@anthonyeleven

Copy link
Copy Markdown
Contributor

Jenkins retest windows

@anthonyeleven

Copy link
Copy Markdown
Contributor

@rzarzynski ? @adamemerson ? @ljflores ?

@adamemerson adamemerson 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.

I'm not from core, but it looks like a decent, minimal fix.

Needs core QA.

@anthonyeleven

Copy link
Copy Markdown
Contributor

Core however is ignoring this.

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

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

@ronen-fr ronen-fr 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 - but missing a documentation change in ceph.rst (line 1221)

@ronen-fr

Copy link
Copy Markdown
Contributor

Core however is ignoring this.

:-) not anymore.
The extra option should be documented in doc/man/8/ceph.rst.
LGTM otherwise

ceph osd pool ls detail prints crush_rule with the numeric rule id, so
mapping that id back to a name needs a separate ceph osd crush rule
dump and a search through its output.

Add a --show-rule-names flag that, with detail, renders the CRUSH rule
by name in the text output and adds a sibling crush_rule_name string
to the JSON output. The JSON crush_rule field stays an int and the
default output is unchanged, so existing scripts that parse the
integer keep working (in particular the in-tree balancer and
pg_autoscaler that pin to int). When the referenced rule no longer
exists, text falls back to the numeric id and JSON omits the
crush_rule_name field, so the output is never misleading.

Tracker: https://tracker.ceph.com/issues/76401
Signed-off-by: Lumir Sliva <[email protected]>
Reported-by: Anthony D'Atri
Signed-off-by: Lumir Sliva <[email protected]>
@lumir-sliva

Copy link
Copy Markdown
Contributor Author

LGTM - but missing a documentation change in ceph.rst (line 1221)

Done. Thanks for the review.

@JonBailey1993

Copy link
Copy Markdown
Contributor

@SrinivasaBharath
SrinivasaBharath merged commit d7acfc0 into ceph:main Sep 4, 2026
9 checks passed
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/33821838649

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.

9 participants