Skip to content

mon/OSDMonitor: read default_crush_zone_failure_domain by its name - #48

Merged
aainscow merged 1 commit into
stretchy-Cfrom
wip-stretchy-C-zone-failure-domain-name
Oct 7, 2026
Merged

aainscow merged 1 commit into
stretchy-Cfrom
wip-stretchy-C-zone-failure-domain-name

Conversation

@aainscow

@aainscow aainscow commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Follow-up to Callum James's "mon: add default_crush_zone_failure_domain config option" (abaef77), for him to review and squash. It should go in before #47, whose tests need it.

That commit defines the option default_crush_zone_failure_domain, but OSDMonitor reads it as osd_pool_default_crush_zone_failure_domain. For an option that does not exist, get_val<std::string>() calls std::get on an empty value and throws std::bad_variant_access. Nothing in the command path catches it, so the monitor aborts on:

  • osd crush rule create-replicated whenever it creates a new rule, because crush_rule_create_replica() is called without a zone failure domain;
  • every osd crush rule create-stretch-replicated, which evaluates the default even when --zone_failure_domain is given;
  • osd pool create with --num_zones greater than 1 and no --zone_failure_domain.

This reads the option by the name it is defined with. Renaming the option to osd_pool_default_crush_zone_failure_domain, beside osd_pool_default_num_zones, would work as well; that is Callum's call.

Testing

  • With a single monitor on stretchy-C, each of the three commands aborted the monitor in std::__throw_bad_variant_access.
  • With this change, the monitor stays up: create-replicated creates the rule, and the other two fail with EINVAL because that cluster has no datacenter buckets.
  • A full ninja -k 0 -j20 built with no errors or warnings.
  • Standalone tests that create rules this way, such as crush-stretch.sh, crush-classes.sh, osd-df.sh and the mon-stretch tests, depend on it. With this change and mon/OSDMonitor: fix the stretch mode a 2-zone pool create enables #47 on top, mon-stretch-failed-create-mons.sh, mon-stretch-failed-pool-create.sh and mon-stretch-ec-pool-create-degraded.sh passed.

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

Follow-up to "mon: add default_crush_zone_failure_domain config
option", for its author to review and squash.

That commit defines the option default_crush_zone_failure_domain, but
OSDMonitor reads it as osd_pool_default_crush_zone_failure_domain. For
an option that does not exist, get_val<std::string>() calls std::get on
an empty value and throws std::bad_variant_access. Nothing in the
command path catches it, so the monitor aborts on:
- 'osd crush rule create-replicated' whenever it creates a new rule,
  because crush_rule_create_replica() is called without a zone failure
  domain;
- every 'osd crush rule create-stretch-replicated', which evaluates the
  default even when --zone_failure_domain is given;
- 'osd pool create' with --num_zones greater than 1 and no
  --zone_failure_domain.

Read the option by the name it is defined with.

With a single monitor, each of the three commands aborted the monitor
in std::__throw_bad_variant_access before this change. With it, the
monitor stays up: create-replicated creates the rule, and the other two
fail with EINVAL because the cluster has no datacenter buckets.
Standalone tests that create rules this way, such as crush-stretch.sh,
crush-classes.sh, osd-df.sh and the mon-stretch tests, depend on it.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow
aainscow force-pushed the wip-stretchy-C-zone-failure-domain-name branch from bafad99 to 51bfa72 Compare October 7, 2026 14:05
@aainscow
aainscow marked this pull request as ready for review October 7, 2026 15:19
@aainscow
aainscow merged commit fee11c1 into stretchy-C Oct 7, 2026
4 of 5 checks passed
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.

1 participant