Repository navigation
mon,qa: fix CRUSH rule handling in osd pool create for multi-zone pools - #51
Merged
Merged
Conversation
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
force-pushed
the
wip-stretchy-C-pr43-07-pool-create-rules
branch
from
October 7, 2026 21:07
5ff6b79 to
8cd867e
Compare
aainscow
marked this pull request as ready for review
October 7, 2026 22:13
7 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seventh PR split out of #43, reworked to follow #35. It does five things:
defaultprofile gets its own CRUSH rule (monitor).osd pool create <pool> erasure --num-zones 2, with no--k/--mand no profile, used the sharederasure-coderule. If that rule already existed, the two-zone pool got a single-zone rule, so its shards were not placedk+mper zone. Otherwiseerasure-codewas built as a two-zone rule, which every later single-zone pool with thedefaultprofile then used. Now only single-zone pools shareerasure-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.num_zones1 uses the default replicated rule, or the rule it is given, so--root,--zone_failure_domain,--osd_failure_domainand--classwere 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.osd pool create(QA only). Callum James's 3861a42 ("mon: fix osd pool create positional argument shift") madeexpected_num_objectsthe seventh positional argument again. This adds the test PR 43 had for it.erasure_code_crushvariant (jerasure-k=2-m=2-crush.yaml, used by thenum_zones/2jobs ofthrash-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.choose firstn 0). Since osd, mon: support per-zone replica min_size for stretch pools #35 the rule takesnum_zonesbuckets (choose firstn <num_zones>).The design doc (sections 2.1.4 and 2.1.5) and
pools.rstare updated for items 1 and 2.Dropped from PR 43's version of this chunk because they contradict #35:
num_zones> 1, which no longer exists.Testing
TEST_multi_zone_pool_default_profileinmon-stretch-pool-create-default-profile.sh: without the fix the first two-zone pool goterasure-code.TEST_single_zone_replicated_placement_optionsinmon-stretch-replicated-placement-options.sh: without the fixosd pool create rep 8 replicated --root defaultcreated the pool.TEST_legacy_positional_pool_createinmon-stretch-pool-create-positional.shpasses.TEST_multi_zone_pool_default_profilechecks that the generated two-zone rule's zone step ischoose_firstnwithnum2.mon-stretchsuites (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.shandmon/osd-crush.sh.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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.
🤖 Generated with Claude Code