Skip to content

mgr/DaemonServer: Aggregate and globally sort OSDs for ok-to-upgrade - #69366

Merged
sseshasa merged 1 commit into
ceph:mainfrom
sseshasa:wip-fix-ok-to-upgrade-osd-sort-order
Jun 16, 2026
Merged

sseshasa merged 1 commit into
ceph:mainfrom
sseshasa:wip-fix-ok-to-upgrade-osd-sort-order

Conversation

@sseshasa

@sseshasa sseshasa commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

The 'ok-to-upgrade' command output sorting did not scale accurately when target CRUSH buckets contained multiple child buckets (e.g., a chassis containing multiple hosts). OSDs were previously sorted individually per child bucket and appended sequentially. This created fragmented, per-host sort segments rather than a globally sorted list for the parent bucket.

Changes:

  1. Fix the issue above by aggregating all child OSDs into a single vector prior to executing a single, global sort operation based on PG counts. Additionally, optimize memory efficiency and future-proof the logic by reserving continuous vector blocks to avoid dynamic heap reallocations.

  2. Add integration tests with chassis and rack based CRUSH hierarchies which verifies the ok-to-upgrade functionality. In addition, the tests crucially verify the order of OSDs returned is according to the ascending order of acting PG count.

Fixes: https://tracker.ceph.com/issues/77272
Signed-off-by: Sridhar Seshasayee [email protected]

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.

@sseshasa
sseshasa requested a review from a team as a code owner June 9, 2026 13:01
@sseshasa
sseshasa requested review from NitzanMordhai, kamoltat and rzarzynski and removed request for a team June 9, 2026 13:02
Comment thread src/mgr/DaemonServer.cc Resolved

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

@sseshasa, please see my comments

Comment thread src/mgr/DaemonServer.cc Resolved
Comment thread qa/standalone/misc/ok-to-upgrade.sh Resolved
Comment thread qa/standalone/misc/ok-to-upgrade.sh Resolved
Comment thread qa/standalone/misc/ok-to-upgrade.sh Resolved
Comment thread src/mgr/DaemonServer.cc Resolved
The 'ok-to-upgrade' command output sorting did not scale accurately
when target CRUSH buckets contained multiple child buckets (e.g., a
chassis containing multiple hosts). OSDs were previously sorted
individually per child bucket and appended sequentially. This created
fragmented, per-host sort segments rather than a globally sorted list
for the parent bucket.

Changes:

1. Fix the issue above by aggregating all child OSDs into a single vector prior
to executing a single, global sort operation based on PG counts. Additionally,
optimize memory efficiency and future-proof the logic by reserving continuous
vector blocks to avoid dynamic heap reallocations.

2. Add integration tests with chassis and rack based CRUSH hierarchies which
verifies the ok-to-upgrade functionality. In addition, the tests crucially
verify the order of OSDs returned is according to the ascending order of
acting PG count. Additionally, make minor fix-ups to lines that determine the
length of a list in JSON response by removing the redundant "| bc".

Fixes: https://tracker.ceph.com/issues/77272
Signed-off-by: Sridhar Seshasayee <[email protected]>
@sseshasa
sseshasa force-pushed the wip-fix-ok-to-upgrade-osd-sort-order branch from 587ab55 to 6761549 Compare June 11, 2026 12:13

@NitzanMordhai NitzanMordhai 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!

@sseshasa

Copy link
Copy Markdown
Contributor Author

jenkins test api

1 similar comment
@sseshasa

Copy link
Copy Markdown
Contributor Author

jenkins test api

@sseshasa

Copy link
Copy Markdown
Contributor Author

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.

4 participants