Skip to content

mon,qa: fix CRUSH rule handling in osd pool create for multi-zone pools - #51

Merged
aainscow merged 5 commits into
stretchy-Cfrom
wip-stretchy-C-pr43-07-pool-create-rules
Oct 7, 2026
Merged

aainscow merged 5 commits into
stretchy-Cfrom
wip-stretchy-C-pr43-07-pool-create-rules

Conversation

@aainscow

@aainscow aainscow commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Seventh PR split out of #43, reworked to follow #35. It does five things:

  1. A multi-zone EC pool created from the default profile gets its own CRUSH rule (monitor). osd pool create <pool> erasure --num-zones 2, with no --k/--m and no profile, used the shared erasure-code rule. If that rule already existed, the two-zone pool got a single-zone rule, so its shards were not placed k+m per zone. Otherwise erasure-code was built as a two-zone rule, which every later single-zone pool with the default profile then used. Now only single-zone pools share erasure-code. A multi-zone pool gets a rule named after the pool, as with any other profile, and the rule is deleted with the pool. PR 43 refused this create; as Eric asked (comment), it now works.
  2. Placement options are refused for a single-zone replicated pool (monitor). A replicated pool with num_zones 1 uses the default replicated rule, or the rule it is given, so --root, --zone_failure_domain, --osd_failure_domain and --class were accepted and ignored. They are now refused with EINVAL. Multi-zone replicated pools and EC pools, whose rules are built from these options, are not affected.
  3. A test for the legacy positional osd pool create (QA only). Callum James's 3861a42 ("mon: fix osd pool create positional argument shift") made expected_num_objects the seventh positional argument again. This adds the test PR 43 had for it.
  4. teuthology: a two-zone custom rule for a multi-zone EC pool (QA only). The erasure_code_crush variant (jerasure-k=2-m=2-crush.yaml, used by the num_zones/2 jobs of thrash-erasure-code-big) built its custom rule with one zone, so a two-zone pool's shards were placed anywhere. The rule is now built with --num_zones.
  5. A correction to section 2.1.5 of the design (docs only), which doc,qa: describe the erasure code profile lifecycle #50 added. It said the stretch EC rule takes every zone bucket (choose firstn 0). Since osd, mon: support per-zone replica min_size for stretch pools #35 the rule takes num_zones buckets (choose firstn <num_zones>).

The design doc (sections 2.1.4 and 2.1.5) and pools.rst are updated for items 1 and 2.

Dropped from PR 43's version of this chunk because they contradict #35:

  • "use the stretch rule for a pool created in global stretch mode": PR 35 builds a per-pool rule for such a pool, from these options.
  • "qa/tasks/ceph_manager: create multi-zone EC pools from k and m": it worked around the refusal of a profile with num_zones > 1, which no longer exists.

Testing

  • Built with ninja, no warnings.
  • New tests, each failing without its fix:
    • TEST_multi_zone_pool_default_profile in mon-stretch-pool-create-default-profile.sh: without the fix the first two-zone pool got erasure-code.
    • TEST_single_zone_replicated_placement_options in mon-stretch-replicated-placement-options.sh: without the fix osd pool create rep 8 replicated --root default created the pool.
  • TEST_legacy_positional_pool_create in mon-stretch-pool-create-positional.sh passes.
  • Item 5: TEST_multi_zone_pool_default_profile checks that the generated two-zone rule's zone step is choose_firstn with num 2.
  • Regression runs, one at a time on this branch, all passed: the 8 other mon-stretch suites (mon-stretch-commands.sh, mon-stretch-ec-pool-create-degraded.sh, mon-stretch-failed-create-mons.sh, mon-stretch-failed-pool-create.sh, mon-stretch-fail-recovery.sh, mon-stretch-pool-create-degraded.sh, mon-stretch-uneven-crush-weights.sh, osd-pool-set-replica.sh), crush/crush-stretch.sh, mon/osd-pool-create.sh and mon/osd-crush.sh.
  • The teuthology change was not run in teuthology. Its commands were replayed on a standalone cluster with two datacenters of four OSDs: with the old rule, 15 of the 16 PGs mixed the datacenters within a zone's block of four shards; with the new rule none did, and the pool went clean.

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 core documentation Improvements or additions to documentation mon tests labels Oct 7, 2026
Section 2.1.5 says the rule of a multi-zone EC pool takes every zone
bucket under the root with "choose firstn 0". Since "mon: add per-zone
replica configuration for stretch pools" the rule takes num_zones
buckets, "choose firstn <num_zones>", as crush-stretch.sh checks.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
3861a42 ("mon: fix osd pool create positional argument shift")
put expected_num_objects back as the seventh argument of osd pool
create, after the stretch parameters had pushed it back. Add a test for
it: TEST_legacy_positional_pool_create in
mon-stretch-pool-create-positional.sh creates an erasure and a
replicated pool with the legacy positional syntax and checks that both
get expected_num_objects. Before 3861a42 the erasure one failed.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
…own rule

An erasure pool created without --k/--m, a profile or a rule uses the
default profile and the shared erasure-code rule. With --num_zones 2
that went wrong either way: if erasure-code already existed, the
two-zone pool used that single-zone rule, so its shards were not placed
k+m per zone; otherwise erasure-code was built as a two-zone rule, which
every later single-zone default pool then used.

Share erasure-code only between single-zone pools. A multi-zone pool
with the default profile gets a rule named after the pool, as a pool
with any other profile does, and the rule is deleted with the pool.
Update design section 2.1.5 and the pool docs.

TEST_multi_zone_pool_default_profile in
mon-stretch-pool-create-default-profile.sh creates single-zone and
two-zone pools with the default profile and checks their rules; without
the fix the first two-zone pool gets erasure-code.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
… pool

A replicated pool with num_zones 1 uses the default replicated rule, or
the rule it is given, so --root, --zone_failure_domain,
--osd_failure_domain and --class were accepted and ignored. Refuse them
with -EINVAL. Multi-zone replicated pools, whose rule is built from
these options, and EC pools are not affected. Sections 2.1.4 and 2.1.5
of the design describe the refusal.

TEST_single_zone_replicated_placement_options in
mon-stretch-replicated-placement-options.sh expects each option to be
refused without --num-zones, with --num-zones 1 and with a positional
rule, and no pool to be created; without the fix the pool is created.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
The custom-rule variant (erasure_code_crush, as in
jerasure-k=2-m=2-crush.yaml) creates its rule with
'osd crush rule create-erasure <rule>' before creating the pool with
--rule. The rule is built from the default profile with one zone, so in
the num_zones 2 suite the 2-zone pool got a rule that chooses its 8
shards anywhere: each zone's block of k+m shards was spread over both
datacenters.

When num_zones > 1, build the rule from the pool's profile with
--num_zones, which gives the stretch rule that places k+m shards in each
zone, as pool create builds without --rule. Other pools keep the
existing rule.

Checked by replaying the commands on a standalone cluster with two
datacenters of four OSDs and the jerasure-k=2-m=2-crush profile: with
the old rule, 15 of the 16 PGs' up sets mixed the datacenters within a
zone's block of four shards; with the new rule none did, and the pool
went clean.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow
aainscow force-pushed the wip-stretchy-C-pr43-07-pool-create-rules branch from 5ff6b79 to 8cd867e Compare October 7, 2026 21:07
@aainscow
aainscow marked this pull request as ready for review October 7, 2026 22:13
@aainscow
aainscow merged commit 9af382e into stretchy-C Oct 7, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation mon tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant