Skip to content

fix: ensure udev sees md raid member formats after array creation - #700

Merged
richm merged 1 commit into
linux-system-roles:mainfrom
richm:test-create-raid-volume-fix
Nov 20, 2026
Merged

richm merged 1 commit into
linux-system-roles:mainfrom
richm:test-create-raid-volume-fix

Conversation

@richm

@richm richm commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Cause: The md member superblocks are written by mdadm when the RAID
array is created, after the blivet module's ensure_udev_update callback
has already triggered udev change events for the members (when the
"create format mdmember" actions executed, before the superblocks
existed). If the kernel-generated change uevents for the members are
lost, the udev database for a member will not show it as a
linux_raid_member, and a subsequent run of the role will not recognize
the member as part of the array. blivet will then treat the member as
an unformatted partition and schedule destructive actions (destroying
and recreating the array), failing with "Partition(s) 1 on /dev/sdb
have been written, but we have been unable to inform the kernel of the
change, probably because it/they are in use."

Consequences: Re-running the role (the idempotence check in
tests_create_raid_volume_then_remove.yml, or a user re-applying a
playbook) intermittently fails on CentOS Stream 9 (blivet 3.6.0). With
storage_safe_mode: false the second run even wipes the md superblock
from the in-use member before failing.

Fix: In the blivet module's ensure_udev_update action callback, when
the action device is an MDRaidArrayDevice, also trigger a udev change
event for each member device after the array is created. blivet >=
3.12.0 does this in MDRaidArrayDevice._create() (upstream commit
8f0585933d); the module now does the equivalent so the role works with
older versions of blivet.

Result: The udev database is updated for all md array members
immediately after the array is created, so subsequent runs recognize
the members as part of the array and remain idempotent.

Assisted-by: goose using model(s) glm-5-3
Signed-off-by: Rich Megginson rmeggins@redhat.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved device change notifications for RAID arrays by also notifying udev about their member devices during creation or configuration. Device paths are resolved before notifications are sent.

Cause: The md member superblocks are written by mdadm when the RAID
array is created, after the blivet module's ensure_udev_update callback
has already triggered udev change events for the members (when the
"create format mdmember" actions executed, before the superblocks
existed). If the kernel-generated change uevents for the members are
lost, the udev database for a member will not show it as a
linux_raid_member, and a subsequent run of the role will not recognize
the member as part of the array. blivet will then treat the member as
an unformatted partition and schedule destructive actions (destroying
and recreating the array), failing with "Partition(s) 1 on /dev/sdb
have been written, but we have been unable to inform the kernel of the
change, probably because it/they are in use."

Consequences: Re-running the role (the idempotence check in
tests_create_raid_volume_then_remove.yml, or a user re-applying a
playbook) intermittently fails on CentOS Stream 9 (blivet 3.6.0). With
storage_safe_mode: false the second run even wipes the md superblock
from the in-use member before failing.

Fix: In the blivet module's ensure_udev_update action callback, when
the action device is an MDRaidArrayDevice, also trigger a udev change
event for each member device after the array is created. blivet >=
3.12.0 does this in MDRaidArrayDevice._create() (upstream commit
8f0585933d); the module now does the equivalent so the role works with
older versions of blivet.

Result: The udev database is updated for all md array members
immediately after the array is created, so subsequent runs recognize
the members as part of the array and remain idempotent.

Assisted-by: goose using model(s) glm-5-3
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a helper that resolves device symlinks before triggering udev change events. For create or configure actions on an MD RAID array, it also triggers events for each array member.

Changes: Udev device updates

Layer / File(s) Summary
Resolve devices and trigger udev events
library/blivet.py
udev_trigger_device resolves device symlinks before triggering block-device change events. ensure_udev_update uses the helper and triggers events for each MD RAID array member during create or configure actions.

Suggested reviewers: dwlehman, vojtechtrefny

Merge Risk: Minimal · up to 2a0e8

After an MD RAID array is created, the module now triggers udev change events for each member. Re-runs then recognize members as array members instead of treating them as unformatted partitions. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its subject: udev seeing md RAID member formats after array creation. The raw summary shows the change does trigger udev change events for each MDRaidArrayDevice member aft…
Description check Passed The description follows the template's intent. It explains the cause, the consequences, the fix, and the result. It also includes an 'Assisted-by' line and a Signed-off-by line. The template's 'Enhanc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix and its subject: udev seeing md RAID member formats after array creation. The raw summary shows the change does trigger udev change events for each MDRaidArrayDevice member after create or configure actions, so the title matches the main change. The title is 65 characters and 11 words, which is concise and specific. It uses a conventional 'fix:' prefix, which is acceptable.

Full details: Description check

Explanation

The description follows the template's intent. It explains the cause, the consequences, the fix, and the result. It also includes an 'Assisted-by' line and a Signed-off-by line. The template's 'Enhancement:' heading is missing. This change is a fix, so the omission is reasonable. The 'Issue Tracker Tickets' section is missing. The description does not list a Jira or BZ ticket, and it does not link the upstream blivet commit 8f0585933d. The description also states the blivet version (3.6.0) and CentOS Stream 9 context, which is useful. Most required information is present. The missing items are non-critical.

Resolution

Optionally add the 'Enhancement:' heading (or confirm it does not apply to this fix), fill in the 'Issue Tracker Tickets' field (or state 'None'), and add a link to upstream commit 8f0585933d if one exists.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 25c3070 and 2a0e88a.

Files selected for processing: 1

  • library/blivet.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@github-actions

Copy link
Copy Markdown

CI tests do not run automatically on pull requests. A role repository
maintainer can start them by posting a /citest slash command in a
pull request comment.

See GitHub CI testing using /citest
for details.

Run every available CI workflow:

/citest all

Run the linting and other lightweight checks:

/citest linters

Run the integration tests (QEMU/container and Testing Farm):

/citest integration

Run one or more selected workflows by separating their names with spaces:

/citest ansible-lint
/citest ansible-lint markdownlint
Command Check name Description
/citest all All checks listed below Run every CI test available for this role
/citest linters Lint and lightweight checks Run ansible-lint, ansible-test, ansible-managed-var-comment, codespell, markdownlint, pr-title-lint, test_converting_readme, and codeql, python-unit-test, and shellcheck when those workflows exist
/citest integration QEMU/container and Testing Farm checks Run qemu-kvm-integration-tests and tft
/citest ansible-lint Ansible Lint / ansible_lint (<ansible-lint>, <ansible>, <python>) (pull_request) Lint Ansible content after converting the role to collection format
/citest ansible-managed-var-comment Check for ansible_managed variable use in comments / ansible_managed_var_comment (pull_request) Fail if ansible_managed is used in comments
/citest ansible-test Ansible Test / ansible_test (<ansible>, <python>) (pull_request) Run ansible-test sanity tests
/citest codespell Codespell / Check for spelling errors (pull_request) Check for spelling errors
/citest markdownlint Markdown Lint / markdownlint (pull_request) Lint Markdown files
/citest pr-title-lint PR Title Lint / commit-checks Check that the pull request title follows the required format
/citest qemu-kvm-integration-tests Test / scenario (<image>, <env>) (pull_request) Run role integration tests in QEMU VMs and containers
/citest test_converting_readme Test converting README.md to README.html / test_converting_readme (pull_request) Convert README.md to HTML
/citest tft <platform>|ansible-<version> Run integration tests in Testing Farm
/citest woke Woke / Detect non-inclusive language (pull_request) Detect non-inclusive language
/citest codeql CodeQL / Analyze (python) (pull_request) CodeQL security and quality analysis for Python
/citest python-unit-test Python Unit Tests / python (<python>, <os>) (pull_request) Run Python unit tests
/citest shellcheck ShellCheck / shellcheck (pull_request) Lint shell scripts

Post another /citest comment at any time to run another selection.

@richm
richm requested a review from vojtechtrefny November 20, 2026 15:00
@richm

richm commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

/citest all

@richm
richm merged commit 8bc3f79 into linux-system-roles:main Nov 20, 2026
41 of 44 checks passed
@richm
richm deleted the test-create-raid-volume-fix branch November 20, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants