Skip to content

doc/dev: ec_stretch_cluster: refactor global stretch mode - #54

Merged
aainscow merged 36 commits into
stretchy-Cfrom
wip-stretchy-C-global-stretch-mode-doc
Oct 13, 2026
Merged

aainscow merged 36 commits into
stretchy-Cfrom
wip-stretchy-C-global-stretch-mode-doc

Conversation

@aainscow

@aainscow aainscow commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Refactors global stretch mode, as agreed: whether a pool is stretched depends only on its own num_zones, every ceph osd pool create parameter takes its default from an osd_pool_default_* option, and ceph mon enable_stretch_mode / disable_stretch_mode become commands that set those defaults and change every pool.

The first commit is the design (doc/dev/osd_internals/erasure_coding/ec_stretch_cluster.rst, Sections 2.3, 11.3, 13.2 and 15). Commits 2–12 implement it. The commits after them answer reviews; each says which commit it will be squashed into before merge, or that it stays on its own.

Commits

  1. doc/dev: ec_stretch_cluster: refactor global stretch mode: the design.
  2. osd: pg_pool_t num_zones and replica in v34, total min_size before.
  3. mon: pool create takes its defaults from osd_pool_default_* options: new osd_pool_default_replica, _num_zones, _zone_failure_domain, _osd_failure_domain, _root, _class.
  4. mon: build and check pool create parameters in four steps: load the defaults, use the erasure code profile, apply the command line, check the result (src/mon/PoolCreateParams.{h,cc}), shared by pool create (command and librados), ceph osd pool default set and the stretch mode commands.
  5. mon: add ceph osd pool default set and get: plus the POOL_DEFAULT_OVERRIDDEN health warning.
  6. mon: replace global stretch mode with per-pool num_zones commands.
  7. mon: wait for the upgrade commit before num_zones can change.
  8. mon,mgr: size new pools as num_zones times the replicas per zone.
  9. doc: stretch mode commands and pool creation defaults.
  10. mon: recompute nonprimary_shards when a pool's num_zones changes.
  11. qa/standalone: test pool creation defaults and stretch mode commands.
  12. mon: use osd_pool_default_crush_rule for every pool it suits.

Review responses (owner review, and an independent review of the PR):

  • Not to be squashed, as they fix stretchy-C behaviour: mon/OSDMonitor: refuse osd pool stretch set for EC pools again (mon: Prevent osd pool stretch set for EC #41's refusal, undone by osd, mon: support per-zone replica min_size for stretch pools #35's merge) and mon/OSDMonitor: keep stretch set's min_size as a total over all zones.
  • Not to be squashed, as it fixes a main defect and will be proposed for main too: mon/ConfigMap: report the section that gives an entity's value (ceph config get <who> named the least specific section that sets an option, not the one whose value is used; POOL_DEFAULT_OVERRIDDEN asks the same question).
  • To be squashed: doc/dev: ec_stretch_cluster: describe entering and leaving stretch mode #57 folded into the design; num_zones 2 checked against stretch mode; duplicate helpers removed or shared; at most two zones and 128 OSDs per pool, and LRC profiles left to their plugin; crimson config getters; default set checks a min_size default only against the replicas per zone, not as an EC pool; disable_stretch_mode resets defaults left without stretch mode; the teuthology task's pool; per-monitor mask checks in POOL_DEFAULT_OVERRIDDEN; design text fixes; standalone test expectations for the four-step order of checks.

Points for reviewers

  1. Release. No Vampire release or feature bit exists yet, so struct version 34 and the upgrade gate (OSDMonitor::NUM_ZONES_RELEASE) use Umbrella. Both move to Vampire together once it is defined.
  2. Open design questions for the design call: min_size across the upgrade; librados (RGW) pool creation in a stretched cluster; EC profiles versus the default CRUSH rule; a repeated enable_stretch_mode; what default set promises; named profiles and the zone type; deleting the user's stretch rule; legacy EC pools blocking enable_stretch_mode.
  3. Known defects still open in this PR, fixes to follow: enable_stretch_mode/disable_stretch_mode do not plug Paxos, so the MonMap can commit before the pools and defaults; default set --rule <EC rule> breaks replicated pool creation; default_rule_suits_pool ignores how many OSDs a rule puts in each zone (to use mon/OSDMonitor: refuse a rule that does not place a full set in each zone #60's check); the commit-time conversion misses a legacy enable or disable in the same epoch.
  4. More than two zones are refused by pool create, default set and num_zones; only main's individual stretch pools (ceph osd pool stretch set) span more sites.
  5. osd_pool_default_replica defaults to 0, meaning "use osd_pool_default_size", because Ceph config has no option aliases.
  6. ceph osd pool default is served by ConfigMonitor (config caps, plus a routing exception in Monitor) and refuses values that a mon section or a monitor's local configuration overrides.

Testing

  • Full build and ninja tests (WITH_CRIMSON=OFF; the crimson getters are not compiled locally).
  • Unit tests: unittest_pool_create_params, unittest_pool_defaults, unittest_osd_monitor, unittest_osd_types, unittest_ecutil, unittest_ecfailover_with_peering, unittest_ecbackend, unittest_osdmap and the stretch EC unit tests.
  • qa/standalone, 19 suites: all of mon-stretch/, crush/crush-stretch.sh, mon/osd-pool-create.sh, mon/misc.sh, mon/osd-erasure-code-profile.sh and erasure-code/test-erasure-code.sh. 16 passed on dccad0b. The other 3 (mon-stretch-pool-defaults.sh, crush-stretch.sh, mon-stretch-replicated-placement-options.sh) failed there and pass with the last three commits. The other 16 have not been rerun since those commits.
  • On a cluster, with the binary from before refuse osd pool stretch set for EC pools again: mon-stretch-commands.sh TEST_stretch_set_ec_pool fails, and it passes with the fix.
  • Not run: teuthology (qa/tasks/stretch_mode_disable_enable.py was updated).

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.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 8, 2026
aainscow added a commit that referenced this pull request Oct 8, 2026
Addresses Bill Scales' review of
#54:

- "I don't think you need ceph osd pool default rm": drop it. Every
  value always has a default and the defaults stay consistent, so
  'set' replaces a value instead. '--rule none' returns to generated
  rules.
- "whether you should only have a command that shows all the pool
  create defaults": Ceph's get commands are not consistent (osd pool
  get, config get, fs get, erasure-code-profile get differ), so
  'ceph osd pool default get' shows everything.
- "Not sure why we are letting you disable stretch mode while in
  recovery": refuse it in recovery stretch mode, as on main;
  'ceph osd force_healthy_stretch_mode' can be run first.
- osd_pool_default_size: a pool must still report its total size,
  and the upgrade must not cause functional problems. Name the
  per-zone default after its parameter, osd_pool_default_replica,
  with osd_pool_default_size as its legacy name, and note that the
  user documentation mentioning it needs updating. State that a pool
  reports its total size (3 per zone with num_zones 2 gives 6), and
  why the per-zone meaning is safe: main does not use
  osd_pool_default_size while stretch mode is enabled. Name the rook
  module as the one functional risk after the upgrade.
- Upgrade: until require_osd_release is raised, the configuration
  holds the old values and monitors of both versions may be in
  quorum. Refuse pool creation (the command and librados) until then,
  and any use of num_zones on 'osd pool set', even 1. The stretch
  mode commands behave as on main. Raising require_osd_release
  commits the upgrade: the behaviour and the configuration values
  change together. Flag for review that this also stops on-demand
  pool creation, for example by RGW.

To be squashed into "doc/dev: ec_stretch_cluster: refactor global
stretch mode" before merge.

Assisted-by: Claude Code
Comment on lines +712 to +720
ceph osd pool default set
[--pool_type <replicated|erasure>]
[--num_zones <num_zones>]
[--rule <rule> |
[--zone_failure_domain <type>] [--osd_failure_domain <type>]
[--root <crush_root>] [--class <device_class>]]
[--replica <replica>] [--min_size <min_size>]
[--erasure_code_profile <profile> | [--k <k>] [--m <m>]]
[--pg_num <pg_num>] [--pgp_num <pgp_num>]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know --replica will change osd_pool_default_size, but should we also add --size just for legacy support?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Agreed, added a legacy --size in 4b72d43: other projects may use it even if nothing here does. It sets the per-zone osd_pool_default_replica (legacy name osd_pool_default_size), so it is refused with --num_zones or --replica, or while the num_zones default is above 1.

Comment on lines +2317 to +2321
a. **Pool Creation Defaults and Global Stretch Mode Commands** (OSDMonitor):
Refactor global stretch mode into configuration option defaults for every
pool creation parameter, ``ceph osd pool default`` to set and clear them, and
``mon enable_stretch_mode``/``disable_stretch_mode`` commands that change
the defaults and every existing pool, replicated and EC (Section 2.3).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Okay so basically if the user wants to enable_stretch_mode for existing EC pools
they need to execute ceph osd pool deafult first.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

No need. Every default has a sensible built-in value, and enable_stretch_mode changes only the stretch ones (replicas 2, num_zones 2, zone failure domain) and stretches existing EC pools itself; FastEC is the only prerequisite. The design now also requires the defaults left by enable to pass the same checks as ceph osd pool default set, so the next create works. Clarified in 2.3.3 and 2.3.4 (4b72d43).

Comment on lines +893 to +895
* Pool behaviour does not change. If global stretch mode was enabled, every pool gets
``num_zones`` 2, with its replicas and ``min_size`` counted per zone, and keeps its CRUSH
rule.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ack!

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Thanks! For reference, this text has since moved: the upgrade is now described in Section 15 (rewritten around encode/decode in 8a01880), and 2.3.5 keeps only the conversion of the pool creation defaults.

2.3.4 Enabling and Disabling Stretch Mode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

``ceph mon enable_stretch_mode [<tiebreaker_mon>] <new_crush_rule> <dividing_bucket>`` and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think BIll and I have discussed removing the [<tiebreaker_mon>] out of the command since there is just 1 tiebreaker monitor and it's simple for us to find out which one

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This would break legacy compatibility, which is why I left it in. @bill-scales @kamoltat Do we think nobody/nothing ever uses this command?

I will update to say it should be marked as legacy in the docs - but happy to remove if @bill-scales agrees.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Marked it as a legacy argument for now (4b72d43). The monitors pick the one monitor outside both zones; the argument is still accepted and used as today, so existing callers keep working and a cluster with more than one monitor outside the zones can still name its tiebreaker.

aainscow added a commit that referenced this pull request Oct 8, 2026
Addresses Kamoltat Sirivadhna's review of
#54:

- #54 (comment)
  "should we also add --size just for legacy support?": yes. Scripts
  and other projects use --size and osd_pool_default_size. 'ceph osd
  pool default set --size' sets osd_pool_default_replica, and is
  refused together with --num_zones or --replica, and while the
  num_zones default is greater than 1.
- #54 (comment)
  "if the user wants to enable_stretch_mode for existing EC pools
  they need to execute ceph osd pool default first": they do not.
  Every default has a sensible built-in value, and
  enable_stretch_mode changes only the stretch defaults (replicas 2,
  num_zones 2, zone failure domain). The resulting defaults must pass
  the checks of 'ceph osd pool default set' so that the next pool
  create works. 2.3.3 now says how pool create uses the defaults:
  options changed directly with 'ceph config' skip those checks, which
  is not blocked, so pool create checks the defaults it uses.
- #54 (comment)
  removing [<tiebreaker_mon>]: mark it as a legacy argument. The
  monitors pick the one monitor outside both zones, and the argument
  is still accepted so that existing callers keep working.

To be squashed into "doc/dev: ec_stretch_cluster: refactor global
stretch mode" before merge.

Assisted-by: Claude Code
@aainscow
aainscow force-pushed the wip-stretchy-C-global-stretch-mode-doc branch from 4b72d43 to 943adea Compare October 9, 2026 07:00
aainscow added a commit that referenced this pull request Oct 9, 2026
Show what the warning looks like, and how to remove an overriding value
from each place it can be set: a section of the configuration database,
a monitor's configuration file, command line or environment, or a
runtime setting. Link the pool creation defaults to it.

Requested in review of #54.
To be squashed into "doc: stretch mode commands and pool creation
defaults" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
Make the resolution steps: find the override, remove it, then set the
default with ceph osd pool default set, which checks it, and confirm
with ceph osd pool default get. Say the same where the pool creation
defaults describe the refusal.

Requested in review of #54.
To be squashed into "doc: stretch mode commands and pool creation
defaults" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
ceph osd pool default get only reads the defaults, so it no longer
waits for require_osd_release to be raised; set still does.
num_zones_committed() becomes num_zones_supported(): it says whether
the cluster's release supports per-pool num_zones, which is not about
a command.

Requested in review of #54.
To be squashed into "mon: wait for the upgrade commit before
num_zones can change" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
ceph osd pool create and ceph osd pool default set now build a pool's
parameters the same way: the osd_pool_default_* options, then the
erasure code profile, named or default, then the command line. One
function, check_pool_params(), checks the values that result, with the
cluster where it needs to: CRUSH types, roots and classes, the plugin,
min_size, pg_num, crimson, and whether the cluster can be stretched.
An error caused by a default names its option. The librados pool
create and the stretch mode commands use the same checks, and the
checks in prepare_new_pool() and in the defaults command that repeated
them are gone.

Which parameters may be given together is still checked on the command
line, and differs only where pool create describes one pool and the
defaults command the defaults of every pool. A profile can be given
with neither k, m nor a CRUSH parameter by either command.

The defaults command checks the defaults as a pool of the default type,
and of each type whose parameters it is given. A min_size default is
not checked, since pool create limits it to the size.

Requested in review of #54.
To be squashed into "mon: check pool create parameters in a function
of their own" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
Describe the four steps that build and check a pool's parameters, the
rules that differ between the two commands, the checks of the defaults
command, the --size and crimson rules, the message for a missing named
profile, and ceph osd pool default get before the upgrade is
committed.

Requested in review of #54.
To be squashed into "doc/dev: ec_stretch_cluster: refactor global
stretch mode" before merge.

Assisted-by: Claude Code
@aainscow
aainscow force-pushed the wip-stretchy-C-global-stretch-mode-doc branch from 8e801f2 to f7d03c0 Compare October 9, 2026 09:27
@aainscow

aainscow commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

@Ericmzhang your #41 ("mon: Prevent osd pool stretch set for EC") was undone on stretchy-C. 8b30768 ("mon: add per-zone replica configuration for stretch pools", from #35) was written before #41 and merged after it, and it brought back the older EC branch in prepare_command_pool_stretch_set. Since 10-07, ceph osd pool stretch set has accepted FastEC pools again, while your change to pools.rst still says the command is for replicated pools only.

I agree with #41, and ed771c7 in this PR restores it:

  • stretch set refuses every EC pool again, with your message and -EOPNOTSUPP.
  • stretch unset refuses an EC pool with num_zones > 1 and points to ceph osd pool set <pool> num_zones 1. It accepts a one-zone EC pool only with size k+m and min_size from k to k+m, as main does in mon/OSDMonitor: add missing checks to the stretch pool and stretch mode commands ceph/ceph#72416, so a pool that an older release stretched can still be cleared.
  • The design (Sections 2.1.5 and 11.4.1) now states this and the reason.

Could you check that ed771c7 matches what you intended? The unit tests pass; the standalone test (TEST_stretch_set_ec_pool in mon-stretch-commands.sh) has not run yet.

aainscow added a commit that referenced this pull request Oct 9, 2026
OSDMapTestHelpers.h and two TestECFailoverWithPeering.cc zone
transitions built a FastEC pool's nonprimary_shards by hand. Use the
ECUtil helper that the monitor uses, so that shared EC geometry lives
in ECUtil.

Owner review of #54: "You created a
nonprimary_shards function - this really sounds like something that
should already exist". Nothing else computes the set; the hand-written
copies in the tests are replaced instead.

To be squashed into "mon: recompute nonprimary_shards when a pool's
num_zones changes" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
Nothing but their own unit tests called them after the pool parameters
were built in four steps; profile values are read from the parsed
profile map instead. include/str_map.h already parses "key=value"
strings where that is needed.

Owner review of #54 (helpers that
duplicate existing code).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
PoolCreateParams read k and m with std::stoll, which stops at the first
character that is not a digit, so a profile with k=3x or m=2.5 was taken
as k=3 or m=2. Use strict_strtoll, as the erasure code plugins do, so
such a value is no value and the checks report the profile.

Owner review of #54 (helpers that
duplicate existing code). The new unit test failed before this change.

To be squashed into "mon: build and check pool create parameters in
four steps" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
pool_create_cluster() copied the CRUSH map it was given, by encoding
and decoding it, only because the stretch check needs a non-const map.
Every caller already holds its own copy from _get_pending_crush(), so
take that copy by reference instead. ConfigMonitor now gets one too,
rather than handing over the committed map.

Owner review of #54 (helpers that
duplicate existing code: _get_pending_crush() already makes the copy).

To be squashed into "mon: build and check pool create parameters in
four steps" before merge, except the ConfigMonitor.cc hunk, which goes
into "mon: add ceph osd pool default set and get".

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
ConfigMonitor turned each pool parameter into the string its option
holds twice, once for ceph osd pool default get and once for the
values set writes. pool_default_value() in PoolCreateParams does it
once, with unit tests; get still shows the rule by name, the profile as
the option holds it, and k and m on their own.

Owner review of #54 (code that
duplicates other code).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
enable_stretch_mode, disable_stretch_mode and the conversion at the
upgrade commit each spelled out the pool default options they write.
stretch_pool_defaults() builds them from the zone count, the replicas
per zone and the zone failure domain, with the option names of
pool_default_options(), and has unit tests.

Owner review of #54 (code that
duplicates other code).

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge, except the
stretch_mode_defaults_at_commit() hunk, which goes into "mon: wait for
the upgrade commit before num_zones can change".

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
ceph osd pool default set copied the size one check of ceph osd pool
set <pool> size: mon_allow_pool_size_one must be set and the command
must pass --yes-i-really-mean-it. Both now call check_size_one() in
PoolCreateParams, which has unit tests. The messages do not change.

Owner review of #54 (code that
duplicates other code).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
…aults()

ceph osd pool set <pool> num_zones and its CRUSH rule read each pool
creation default by its option name. Take them from
load_pool_defaults(), as pool create and ceph osd pool default do, so
that the option names and the replica fallback to osd_pool_default_size
live in one place. The command line is still read as before: a
--replica of 0 or less is refused there, where pool create treats 0 as
not given.

Owner review of #54 (the num_zones
paths read the defaults by hand).

To be squashed into "mon: build and check pool create parameters in
four steps" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
OSDMap.cc and PGMap.cc are also built into crimson-common, where
cct->_conf is crimson::common::ConfigProxy. That proxy lacked
get_osd_pool_default_replica() and get_osd_pool_default_total_size(),
so a WITH_CRIMSON build failed. Add them as the classic ConfigProxy has
them.

Found by an independent review of
#54 (not compiled locally:
the local build has WITH_CRIMSON=OFF).

To be squashed into "mon,mgr: size new pools as num_zones times the
replicas per zone" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
Three fixes from an independent review of
#54, as the owner decided them:

- More than two zones are not supported. ceph osd pool create and ceph
  osd pool default set now refuse num_zones above 2, as ceph osd pool
  set <pool> num_zones already did. PoolCreateCluster::max_num_zones
  lets unit tests raise the limit. A pool created with num_zones 3 had
  no stretch values, so disable_stretch_mode could never unstretch it.
- A pool can have at most 128 OSDs. A FastEC pool with more shards than
  that, such as k=32 m=20 over 3 zones, made ECUtil::nonprimary_shards()
  wrap the 8-bit shard id and hit an assert in the leader, which then
  crashed again on every new leader as the client retried. This was
  already on stretchy-C. check_pool_params() refuses num_zones x (k+m)
  above 128, and prepare_pool_size() refuses any pool size above 128,
  which also covers num_zones changes and LRC's local parity chunks.
- An LRC profile defined with mapping and layers is normalized with
  k=-1 m=-1 l=-1, so the k and m checks refused it, which pool create
  did not do before the four steps. The LRC plugin checks its own k, m
  and l, and its chunk count is more than k+m, so check_pool_params()
  leaves LRC profiles to it. LRC stays a legacy EC plugin: it cannot be
  given FastEC, so it cannot have more than one zone.

New unit tests for each; the two LRC tests failed before this change.

To be squashed into "mon: build and check pool create parameters in
four steps" before merge. The 128 OSD limit fixes a crash that stretchy-C
already had.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
check_pool_defaults() checked a given --min_size as part of each pool
type it checked. With osd_pool_default_type erasure, --min_size 1 was
refused as outside k..k+m, though EC pools never use
osd_pool_default_min_size, and --k 4 --m 2 --min_size 2 was refused in
one command but accepted in two. A replicated --replica 2 --min_size 3
was refused too. The design (Section 2.3.3) says a min_size default is
not checked, because pool create limits it to the pool's size; do
that. The three new unit tests failed before this change.

Found by an independent review of
#54; the owner asked for a fix.

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
ceph osd pool stretch set takes min_size as main documents it, a total
over all zones, but stored it unchanged as the pool's per-zone
min_size. stretch set rep 2 2 datacenter rule 4 2, which on main means
2 of 4, needed 2 in every zone, so a single OSD down stopped I/O, and
nothing checked min_size against the pool size: 6 4 gave PGs that could
never go active.

stretch_set_zone_min_size() refuses a min_size outside 1..size and
stores it per zone, divided by the zone count and rounded up, so that
writes are never accepted with fewer replicas than the total asked for.
The design (Section 11.4.1) and pools.rst say so. Unit tests added.

Found by an independent review of
#54; the owner asked for a fix.
The per-zone meaning came with stretchy-C's per-zone min_size.

Not to be squashed: it fixes stretch set as stretchy-C has it.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
…stretch mode

After enable_stretch_mode, stretch mode leaves with its last stretched
pool (deleted or set to num_zones 1), but the pool creation defaults
stay at two zones with two replicas each. disable_stretch_mode then
refused with "stretch mode is already disabled", so every new pool was
still created stretched and turned stretch mode back on.

With no stretched pool and stretch mode off, disable_stretch_mode now
sets the one-zone defaults when they are not already in place, and is
refused only when there is nothing to do. It no longer touches the
MonMap in that case. New standalone test
TEST_disable_resets_defaults_without_stretch_mode (not run yet).

Found by an independent review of
#54; the owner asked for a fix.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
…licas

stretch_mode_disable_enable runs after a workunit that enables stretch
mode, which now also sets the pool creation defaults to two zones of
two replicas. setUp deletes every pool, which leaves stretch mode but
not its defaults, so _setup_pool created a two-zone pool and its
osd pool set size 4 was refused, as a stretched pool's size follows
from its zones. Create the pool with --num_zones 2 --replica 2 instead,
which gives the size 4 and stretch rule that the checks expect. Not run:
it needs teuthology.

Found by an independent review of
#54; the owner asked for a fix.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
…text

Comparing the design with stretchy-C found passages that contradict
each other and passages that the code has overtaken. As the owner
asked, fix them in one commit:

- 2.1.1/2.1.4: the syntax lacked --min_size and --force_pg_limit;
  --root is not "R2 only", and its default is osd_pool_default_root.
- 2.1.3/2.2 Example 3: --size is refused for a multi-zone replicated
  pool; the example uses --replica 2.
- 2.1.5: the release gate exists (15.3); FastEC also needs a 4096
  multiple chunk size; m >= 1 is checked by the monitor; LRC profiles
  are checked by their plugin; num_zones is 1 or 2 and a pool has at
  most 128 OSDs.
- 5, 11, 11.1: more than two zones are refused for now; only main's
  individual stretch pools span more sites.
- 7.1.2 title, 7.4 wording, 7.3 note, 7.3.2, 7.5: how localized and
  balanced reads choose zones and replicas today.
- 10.1 note: pg_temp already lists primary-capable shards first.
- 11.2: a replicated min_size is 1..replica, per zone.
- 11.5.1: the zone tie-break order since 20cf19c.
- 11.5.3 agrees with 11.2.1 and 11.3 (per-zone min_size).
- 11.8 is a later-release item, as 14.4 says.
- 13.2: no FastEC side effect; placement parameters default.
- 14.1 items 4 and 7a, 14.4 item 2: numbering and references.
- 18: the --root example is an EC pool, as 2.1.5 allows.

To be squashed into "doc/dev: ec_stretch_cluster: refactor global
stretch mode" before merge.

Assisted-by: Claude Code
generate_entity_map() walks the sections from the least to the most
specific (global, type, name), and a later section's value replaces an
earlier one in the result. Since e65f676 ("mon/ConfigMap: use
ValueSource type for generate_entity_map()") the value sources were
added with emplace(), which keeps the first, so a value set in both
global and mon was reported as coming from global:

    ceph config set global osd_pool_default_replica 2
    ceph config set mon osd_pool_default_replica 3
    ceph config get mon.a     # WHO global, VALUE 3

Record the source with insert_or_assign(), as the value is recorded.
ceph config get <who> and ceph osd pool default get now name the
section that gives the value, and POOL_DEFAULT_OVERRIDDEN, which asks
the same question, sees a mon section override again. The new unit test
failed before this change. The same code is on main.

Not to be squashed: this is a main defect, to be proposed for main too.

Assisted-by: Claude Code
cef2508 stopped checking a min_size default altogether, but only
its check as an EC pool was wrong: EC pools never use
osd_pool_default_min_size. Keep the check against the replicas per zone,
which TEST_set_checks in mon-stretch-pool-defaults.sh expects, and say
so in the design (Section 2.3.3).

Owner review of #54 (16a).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
Building pool create's parameters in four steps checks everything
before anything is created, so the command-line and stretch mode checks
now come before the CRUSH rule is generated:

- crush-stretch.sh TEST_pool_create_stretch_ec and
  TEST_pool_create_stretch_replica walk through the rule's errors as
  hosts and OSDs are added. Once one zone had an OSD, the zone weight
  check failed first. The OSDs now join with weight 0 until both zones
  have them, and are reweighted before the pool is created.
- crush-stretch.sh TEST_stretch_diff_bucket_barrier and
  TEST_stretch_diff_sites get the stretch mode check's error ("there are
  0/3 datacenters ...") instead of the rule's.
- mon-stretch-replicated-placement-options.sh: with a rule given, the
  placement options conflict with the rule before num_zones is looked at.

All of crush-stretch.sh and the placement options test pass.

To be squashed into "mon: build and check pool create parameters in
four steps" before merge.

Assisted-by: Claude Code
enable_stretch_mode and disable_stretch_mode now keep paxos plugged, so
the MonMap, configuration and OSDMap change in one round, as
MonmapMonitor::clear_stretch_mode_state() asserts since stretchy-C
f4ba9aa. The MonMap change makes every monitor bootstrap, which
retries each command still waiting for its reply. The retried
disable_stretch_mode found stretch mode gone and failed with "stretch
mode is already disabled" although it had succeeded; before the plug the
OSDMap committed a round later, so the retry happened to find the pools
still stretched. mon-stretch-upgrade.sh TEST_legacy_stretch_mode_then_commit
failed this way.

A repeated disable_stretch_mode now succeeds, as a repeated
enable_stretch_mode already does (design Section 2.3.4). The user sees
the retry's reply, so the replies no longer contradict the first run:
"stretch mode is enabled" or "stretch mode is disabled", with the number
of pools changed only when there were any. On a vstart cluster both
commands replied "0 pool(s) changed" or "already disabled" after changing
every pool.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
…eplicas

stretchy-C added TEST_stretch_unstretch_clean after this series was
written. It creates two-zone replicated pools on two hosts per zone, so
it relied on two copies per zone. Pools now default to
osd_pool_default_replica (3) copies per zone, so pool create failed with
"replica 3 per zone requires at least 3 hosts". Ask for two replicas,
as the other tests in this script do.

Squash into: mon,mgr: size new pools as num_zones times the replicas per zone

Assisted-by: Claude Code
@aainscow
aainscow force-pushed the wip-stretchy-C-global-stretch-mode-doc branch from 20d734a to c8a51ec Compare October 13, 2026 12:30

@kamoltat kamoltat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed the global stretch mode and refractor, I'm happy with what Claude is changing here, simplifying big logic like PoolCreateParams and added more encoding guards against old decoder for min_size.

POOL_DEFAULT_OVERRIDDEN sounds a little vague to me so I propose maybe naming it different to something like POOL_DEFAULT_CONFIG_OVERRIDE? since the default changes are conflicting.

Comment thread src/mon/OSDMonitor.h
Comment on lines +970 to +973
static constexpr ceph_release_t NUM_ZONES_RELEASE = ceph_release_t::umbrella;
bool num_zones_supported() const {
return osdmap.require_osd_release >= NUM_ZONES_RELEASE;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is a good addition and correct since we will be supporting this downsteam and in Vampire release

Comment thread src/osd/osd_types.cc
Comment on lines +2049 to +2051
// before v34, min_size counts every zone
const __u8 encoded_min_size = v >= 34 ? min_size : min_size * num_zones;
encode(encoded_min_size, bl);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't see anything wrong with this, I guess it deals with older decoder.

Comment thread src/mon/OSDMonitor.cc
bool force_create = false;
int ret = 0;
// librados creates a single-zone replicated pool from the defaults
PoolCreateParams params = load_pool_defaults(g_conf());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Okay tidied up a lot of things

Comment thread src/mon/HealthMonitor.cc
Comment on lines +714 to +719
// POOL_DEFAULT_OVERRIDDEN
{
const ConfigMap& config_map = mon.configmon()->get_config_map();
auto global_value = [&](const string& name) -> std::optional<string> {
auto [first, last] = config_map.global.options.equal_range(name);
for (auto i = first; i != last; ++i) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah I think this is good but the Warning confused me at first
POOL_DEFAULT_OVERRIDDEN sounds like detects pools whose configurations differ from the defaults, but it actually detects configuration-source conflicts,

Comment thread src/mon/OSDMonitor.cc
Comment on lines +17625 to +17626
// a total over all zones, kept per zone and rounded up
return (min_size + num_zones - 1) / num_zones;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Okay yeah I'm fine with rounding up, but just want to tag this line to make sure this has been discussed.

@aainscow
aainscow merged commit ad5c7b9 into stretchy-C Oct 13, 2026
aainscow added a commit that referenced this pull request Oct 13, 2026
OSDMapTestHelpers.h and two TestECFailoverWithPeering.cc zone
transitions built a FastEC pool's nonprimary_shards by hand. Use the
ECUtil helper that the monitor uses, so that shared EC geometry lives
in ECUtil.

Owner review of #54: "You created a
nonprimary_shards function - this really sounds like something that
should already exist". Nothing else computes the set; the hand-written
copies in the tests are replaced instead.

To be squashed into "mon: recompute nonprimary_shards when a pool's
num_zones changes" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
Nothing but their own unit tests called them after the pool parameters
were built in four steps; profile values are read from the parsed
profile map instead. include/str_map.h already parses "key=value"
strings where that is needed.

Owner review of #54 (helpers that
duplicate existing code).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
PoolCreateParams read k and m with std::stoll, which stops at the first
character that is not a digit, so a profile with k=3x or m=2.5 was taken
as k=3 or m=2. Use strict_strtoll, as the erasure code plugins do, so
such a value is no value and the checks report the profile.

Owner review of #54 (helpers that
duplicate existing code). The new unit test failed before this change.

To be squashed into "mon: build and check pool create parameters in
four steps" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
pool_create_cluster() copied the CRUSH map it was given, by encoding
and decoding it, only because the stretch check needs a non-const map.
Every caller already holds its own copy from _get_pending_crush(), so
take that copy by reference instead. ConfigMonitor now gets one too,
rather than handing over the committed map.

Owner review of #54 (helpers that
duplicate existing code: _get_pending_crush() already makes the copy).

To be squashed into "mon: build and check pool create parameters in
four steps" before merge, except the ConfigMonitor.cc hunk, which goes
into "mon: add ceph osd pool default set and get".

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
ConfigMonitor turned each pool parameter into the string its option
holds twice, once for ceph osd pool default get and once for the
values set writes. pool_default_value() in PoolCreateParams does it
once, with unit tests; get still shows the rule by name, the profile as
the option holds it, and k and m on their own.

Owner review of #54 (code that
duplicates other code).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
enable_stretch_mode, disable_stretch_mode and the conversion at the
upgrade commit each spelled out the pool default options they write.
stretch_pool_defaults() builds them from the zone count, the replicas
per zone and the zone failure domain, with the option names of
pool_default_options(), and has unit tests.

Owner review of #54 (code that
duplicates other code).

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge, except the
stretch_mode_defaults_at_commit() hunk, which goes into "mon: wait for
the upgrade commit before num_zones can change".

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
ceph osd pool default set copied the size one check of ceph osd pool
set <pool> size: mon_allow_pool_size_one must be set and the command
must pass --yes-i-really-mean-it. Both now call check_size_one() in
PoolCreateParams, which has unit tests. The messages do not change.

Owner review of #54 (code that
duplicates other code).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
…aults()

ceph osd pool set <pool> num_zones and its CRUSH rule read each pool
creation default by its option name. Take them from
load_pool_defaults(), as pool create and ceph osd pool default do, so
that the option names and the replica fallback to osd_pool_default_size
live in one place. The command line is still read as before: a
--replica of 0 or less is refused there, where pool create treats 0 as
not given.

Owner review of #54 (the num_zones
paths read the defaults by hand).

To be squashed into "mon: build and check pool create parameters in
four steps" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
OSDMap.cc and PGMap.cc are also built into crimson-common, where
cct->_conf is crimson::common::ConfigProxy. That proxy lacked
get_osd_pool_default_replica() and get_osd_pool_default_total_size(),
so a WITH_CRIMSON build failed. Add them as the classic ConfigProxy has
them.

Found by an independent review of
#54 (not compiled locally:
the local build has WITH_CRIMSON=OFF).

To be squashed into "mon,mgr: size new pools as num_zones times the
replicas per zone" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
Three fixes from an independent review of
#54, as the owner decided them:

- More than two zones are not supported. ceph osd pool create and ceph
  osd pool default set now refuse num_zones above 2, as ceph osd pool
  set <pool> num_zones already did. PoolCreateCluster::max_num_zones
  lets unit tests raise the limit. A pool created with num_zones 3 had
  no stretch values, so disable_stretch_mode could never unstretch it.
- A pool can have at most 128 OSDs. A FastEC pool with more shards than
  that, such as k=32 m=20 over 3 zones, made ECUtil::nonprimary_shards()
  wrap the 8-bit shard id and hit an assert in the leader, which then
  crashed again on every new leader as the client retried. This was
  already on stretchy-C. check_pool_params() refuses num_zones x (k+m)
  above 128, and prepare_pool_size() refuses any pool size above 128,
  which also covers num_zones changes and LRC's local parity chunks.
- An LRC profile defined with mapping and layers is normalized with
  k=-1 m=-1 l=-1, so the k and m checks refused it, which pool create
  did not do before the four steps. The LRC plugin checks its own k, m
  and l, and its chunk count is more than k+m, so check_pool_params()
  leaves LRC profiles to it. LRC stays a legacy EC plugin: it cannot be
  given FastEC, so it cannot have more than one zone.

New unit tests for each; the two LRC tests failed before this change.

To be squashed into "mon: build and check pool create parameters in
four steps" before merge. The 128 OSD limit fixes a crash that stretchy-C
already had.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
check_pool_defaults() checked a given --min_size as part of each pool
type it checked. With osd_pool_default_type erasure, --min_size 1 was
refused as outside k..k+m, though EC pools never use
osd_pool_default_min_size, and --k 4 --m 2 --min_size 2 was refused in
one command but accepted in two. A replicated --replica 2 --min_size 3
was refused too. The design (Section 2.3.3) says a min_size default is
not checked, because pool create limits it to the pool's size; do
that. The three new unit tests failed before this change.

Found by an independent review of
#54; the owner asked for a fix.

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
ceph osd pool stretch set takes min_size as main documents it, a total
over all zones, but stored it unchanged as the pool's per-zone
min_size. stretch set rep 2 2 datacenter rule 4 2, which on main means
2 of 4, needed 2 in every zone, so a single OSD down stopped I/O, and
nothing checked min_size against the pool size: 6 4 gave PGs that could
never go active.

stretch_set_zone_min_size() refuses a min_size outside 1..size and
stores it per zone, divided by the zone count and rounded up, so that
writes are never accepted with fewer replicas than the total asked for.
The design (Section 11.4.1) and pools.rst say so. Unit tests added.

Found by an independent review of
#54; the owner asked for a fix.
The per-zone meaning came with stretchy-C's per-zone min_size.

Not to be squashed: it fixes stretch set as stretchy-C has it.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
…stretch mode

After enable_stretch_mode, stretch mode leaves with its last stretched
pool (deleted or set to num_zones 1), but the pool creation defaults
stay at two zones with two replicas each. disable_stretch_mode then
refused with "stretch mode is already disabled", so every new pool was
still created stretched and turned stretch mode back on.

With no stretched pool and stretch mode off, disable_stretch_mode now
sets the one-zone defaults when they are not already in place, and is
refused only when there is nothing to do. It no longer touches the
MonMap in that case. New standalone test
TEST_disable_resets_defaults_without_stretch_mode (not run yet).

Found by an independent review of
#54; the owner asked for a fix.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
…licas

stretch_mode_disable_enable runs after a workunit that enables stretch
mode, which now also sets the pool creation defaults to two zones of
two replicas. setUp deletes every pool, which leaves stretch mode but
not its defaults, so _setup_pool created a two-zone pool and its
osd pool set size 4 was refused, as a stretched pool's size follows
from its zones. Create the pool with --num_zones 2 --replica 2 instead,
which gives the size 4 and stretch rule that the checks expect. Not run:
it needs teuthology.

Found by an independent review of
#54; the owner asked for a fix.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
Each monitor reports in POOL_DEFAULT_OVERRIDDEN the pool defaults that
are overridden for itself. It used db_pool_default_overrides(), which
counts any masked global value as an override because the set command
must cover every monitor and cannot know the other monitors' hosts. A
monitor knows its own host, so ConfigMonitor::pool_default_db_overrides()
now asks pool_default_source() (ConfigMap::generate_entity_map) for each
option, and a value masked to another host no longer warns. ceph osd
pool default set keeps the conservative check. New standalone test
TEST_health_ignores_mask_of_other_host (not run yet).

Owner review of #54 (override
detection by ConfigMap::generate_entity_map).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
cef2508 stopped checking a min_size default altogether, but only
its check as an EC pool was wrong: EC pools never use
osd_pool_default_min_size. Keep the check against the replicas per zone,
which TEST_set_checks in mon-stretch-pool-defaults.sh expects, and say
so in the design (Section 2.3.3).

Owner review of #54 (16a).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 14, 2026
ceph osd pool default set --k/--m wrote osd_pool_default_erasure_code_profile,
but a pool created without --k/--m or a profile used the default profile in
the OSDMap, which the option only creates when the cluster is created. So
the k and m defaults never reached pool creation, and every such pool
shared the default profile, which changed under them if it was edited.

As the design says (Section 4.2):

- A pool that names no profile, or names default, gets its own
  <pool>-k<k>-m<m>, built from the default profile, --k/--m and the CRUSH
  options given, then normalized. An existing profile of that name is
  used only if every key matches; otherwise pool create fails with EEXIST
  and says how to fix it. This replaces the k/m-only and CRUSH option
  comparisons. CRUSH options no longer need --k/--m.
- Plain single-zone pools still share the erasure-code rule.
- ceph osd pool default set --k/--m set k and m in the default profile,
  in the same Paxos proposal as the options, or on their own when no
  option changes. default get shows them with source osdmap, and
  default set loses --erasure_code_profile.
  osd_pool_default_erasure_code_profile keeps its role on main.
- Before the upgrade commit, a pool created without a profile (only
  possible with mon_debug_allow_pool_create_before_commit) still uses
  default, as in earlier releases.

Owner review of #54 (item 17).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 14, 2026
… commit

With every pool that names no profile having one of its own, the default
profile is a template that ceph osd pool default set changes. Pools from
earlier releases still refer to it. When the upgrade is committed, give
each EC pool that refers to default a verbatim copy, <pool>-k<k>-m<m>,
in the same OSDMap update as the pool's new erasure_code_profile, and log
it to the cluster log. The copy is not normalized, so the OSDs build the
same EC backend from it and the pool does not change. A name holding other
contents gets a suffix -<n>; if the plugin cannot be loaded to count the
chunks, the copy is named <pool>-default (design Section 13.5). default
and osd_pool_default_erasure_code_profile are not changed.

Owner review of #54 (item 17).

To be squashed into "mon: create pools only once the upgrade is committed"
before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 14, 2026
… own

ceph osd pool default set --k/--m wrote osd_pool_default_erasure_code_profile,
but a pool created without --k/--m or a profile used the default profile in
the OSDMap, which the option only creates when the cluster is created. So
the k and m defaults never reached pool creation, and every such pool
shared the default profile, which changed under them if it was edited.

As the design says (Section 4.2):

- A pool that names no profile, or names default, gets its own
  <pool>-k<k>-m<m>, built from the default profile, --k/--m and the CRUSH
  options given, then normalized. An existing profile of that name is
  used only if every key matches; otherwise pool create fails with EEXIST
  and says how to fix it. This replaces the k/m-only and CRUSH option
  comparisons. CRUSH options no longer need --k/--m.
- Plain single-zone pools still share the erasure-code rule.
- ceph osd pool default set --k/--m set k and m in the default profile,
  in the same Paxos proposal as the options, or on their own when no
  option changes. default get shows them with source osdmap, and
  default set loses --erasure_code_profile.
  osd_pool_default_erasure_code_profile keeps its role on main.
- Before the upgrade commit, a pool created without a profile (only
  possible with mon_debug_allow_pool_create_before_commit) still uses
  default, as in earlier releases.

Owner review of #54 (item 17).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 14, 2026
…e commit

With every pool that names no profile having one of its own, the default
profile is a template that ceph osd pool default set changes. Pools from
earlier releases still refer to it. When the upgrade is committed, give
each EC pool that refers to default a verbatim copy, <pool>-k<k>-m<m>,
in the same OSDMap update as the pool's new erasure_code_profile, and log
it to the cluster log. The copy is not normalized, so the OSDs build the
same EC backend from it and the pool does not change. A name holding other
contents gets a suffix -<n>; if the plugin cannot be loaded to count the
chunks, the copy is named <pool>-default (design Section 13.5). default
and osd_pool_default_erasure_code_profile are not changed.

Owner review of #54 (item 17).

To be squashed into "mon: create pools only once the upgrade is committed"
before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 14, 2026
… own

ceph osd pool default set --k/--m wrote osd_pool_default_erasure_code_profile,
but a pool created without --k/--m or a profile used the default profile in
the OSDMap, which the option only creates when the cluster is created. So
the k and m defaults never reached pool creation, and every such pool
shared the default profile, which changed under them if it was edited.

As the design says (Section 4.2):

- A pool that names no profile, or names default, gets its own
  <pool>-k<k>-m<m>, built from the default profile, --k/--m and the CRUSH
  options given, then normalized. An existing profile of that name is
  used only if every key matches; otherwise pool create fails with EEXIST
  and says how to fix it. This replaces the k/m-only and CRUSH option
  comparisons. CRUSH options no longer need --k/--m.
- Plain single-zone pools still share the erasure-code rule.
- ceph osd pool default set --k/--m set k and m in the default profile,
  in the same Paxos proposal as the options, or on their own when no
  option changes. default get shows them with source osdmap, and
  default set loses --erasure_code_profile.
  osd_pool_default_erasure_code_profile keeps its role on main.
- Before the upgrade commit, a pool created without a profile (only
  possible with mon_debug_allow_pool_create_before_commit) still uses
  default, as in earlier releases.

Owner review of #54 (item 17).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants