Skip to content

Mon: Prevent pool creation if it will exceed mon_max_pg_per_osd - #67985

Merged
Ericmzhang merged 2 commits into
ceph:mainfrom
Ericmzhang:wip-respect-mon-max-pg-per-osd-limit
Aug 10, 2026
Merged

Ericmzhang merged 2 commits into
ceph:mainfrom
Ericmzhang:wip-respect-mon-max-pg-per-osd-limit

Conversation

@Ericmzhang

@Ericmzhang Ericmzhang commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem:

  • If pools are already close to mon_max_pg_per_osd, creating a new pool with min_pg_num = 32 may push the total PG count over mon_max_pg_per_osd, resulting in HEALTH_WARN: too many PGs per OSD. Same issue occurs if we increase a pool's replication size.

Solution:

  • Add checks for if the total PG count after creating a new pool or increasing replication size would cause the maximum number of PGs to be exceeded. Stop the operation if so. Change newly created pool pg_num to always be osd_pool_default_pg_num instead of 1 when autoscale mode is on.

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

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.

@github-actions

github-actions Bot commented Mar 25, 2026 •

Copy link
Copy Markdown

Config Diff Tool Output


+ added: mon_min_pool_pg_num (mon.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@github-actions

Copy link
Copy Markdown

Config Diff Tool Output


+ added: mon_min_pg_per_pool (global.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch 2 times, most recently from ddb3491 to 4dde257 Compare March 25, 2026 19:10
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

/config check ok

@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from 4dde257 to f16c349 Compare March 30, 2026 22:39
@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from f16c349 to 79b26e8 Compare April 16, 2026 16:45
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

Fix mypy make error

@Ericmzhang
Ericmzhang marked this pull request as ready for review April 16, 2026 16:46
@Ericmzhang
Ericmzhang requested review from a team as code owners April 16, 2026 16:46
@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from 79b26e8 to 8a0a5e3 Compare April 16, 2026 18:13
@anthonyeleven

Copy link
Copy Markdown
Contributor

One might think that instead the autoscaler should scale down one or more existing pools to accommodate the new pool. It will scale up if pools are deleted, no?

Alternately, perhaps create anyway if a really-mean-it flag is passed?

Also, one might think that osd_max_pg_per_osd_hard_ratio should be factored in.

Comment thread qa/workunits/mon/pg_autoscaler.sh Outdated

echo OK

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.

Newline?

@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from 8a0a5e3 to 19e496c Compare April 17, 2026 22:27
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

Rebase from main

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from 19e496c to 5fbe2dc Compare June 1, 2026 22:41
@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from 5fbe2dc to d26ef8d Compare June 2, 2026 21:25
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

Fix make check errors.

@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from d26ef8d to 45d9ab9 Compare June 3, 2026 17:00
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch from fefff4f to 972c8b4 Compare June 15, 2026 20:38
@Ericmzhang
Ericmzhang force-pushed the wip-respect-mon-max-pg-per-osd-limit branch 4 times, most recently from 33908ee to 6be33ff Compare June 17, 2026 21:22
@Ericmzhang

Copy link
Copy Markdown
Contributor Author


NUM_OSDS=$(ceph osd ls | wc -l)
if [ $NUM_OSDS -lt 6 ]; then
echo "test requires at least 6 OSDs"

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.

@Ericmzhang I'm seeing a new failure in the test batch and I think it might be related to this change. Could you take a look and let me know https://pulpito.ceph.com/skanta-2026-06-25_10:03:14-rados-wip-bharath8-testing-2026-06-25-0632-distro-default-trial/315736/?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted the check to NUM_OSDS less than 6 from NUM_OSDS not equal to 6.

Check if adding a new pool results in max PG allowed to be exceeded
Check if increasing replication size results in max PG allowed to be exceeded

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

Signed-off-by: Eric Zhang <[email protected]>
Added unit tests to check for adding a pool that causes max PG
to be exceeded and increasing replication size that causes max PG to be exceeded

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

Signed-off-by: Eric Zhang <[email protected]>
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath5-testing-20260804.033808-main.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@phlogistonjohn

Copy link
Copy Markdown
Contributor

I'm not sure about this but this PR may have broken my teuthology tests, please refer to https://tracker.ceph.com/issues/79431 - thanks!

Comment thread src/mon/MonCommands.h
"name=target_size_ratio,type=CephFloat,range=0.0,req=false "\
"name=force_pg_limit,type=CephBool,req=false"
"name=yes_i_really_mean_it,type=CephBool,req=false"
"name=crimson,type=CephBool,req=false",

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.

maybe there's supposed to be a space at the end of each line? otherwise c string literals will be concatenated as

name=force_pg_limit,type=CephBool,req=falsename=yes_i_really_mean_it,type=CephBool,req=falsename=crimson,type=CephBool,req=false

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.

@phlogistonjohn would you be willing to help test #71010 as a fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cbodley Thanks for catching this. I just tested the change quickly locally (creating a pool starting with .) and it works afterwards.

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

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants