-
Notifications
You must be signed in to change notification settings - Fork 262
#2128 - Fix device mapper partitioning #2129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses an issue with device-mapper partitioning by changing how Ignition determines if a block device is in use. The change removes the check for device 'holders' (blockDevHeld
) and now relies solely on checking if a device is mounted. This is a sensible fix, as the presence of holders doesn't necessarily mean a device is actively in use, which was causing problems for multipath devices. The implementation is straightforward. I've added one comment suggesting a minor code cleanup to remove a redundant variable initialization.
aec2be0
to
427ea10
Compare
|
||
holdersDir := fmt.Sprintf("/sys/class/block/%s/holders/", blockDevNode) | ||
entries, err := os.ReadDir(holdersDir) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I am a little worried about removing this check on holder's I have to imagine there are edge cases that would need us to check. Lets flip this change so we make a more direct alteration when doing multi path explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Let me think and try to implement some checking for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a change to check if the block device is a device mapper, if so, it will skip the blockDevHeld.
When run ignition on a device mapper, ie, multipath, it fails because the function blockDevHeld returns true as the block device contains holders. A block device with holders do not necessary means the block device is in use (like mounted). The function blockDevInUse will not check if it is a device mapper and if so, do not check for blockDevHeld. Signed-off-by: Tiago Bueno <[email protected]>
427ea10
to
e3d639d
Compare
### Bug fixes | ||
|
||
- Fix fetch-offline for Oracle Cloud Infrastructure | ||
- Fix device mapper partitioning ([#2128](https://github.com/coreos/ignition/issues/2128)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we can make this a little better
wdyt
- Fix multipath partitioning: ignore DM holders when no partitions are mounted;continue to refuse if the disk or any partition is active. (#2128)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall lgtm, have you had a change to verify that this fixes the issue?
I am wary of updating the partitioning logic checks simply because these changes will effect all specs as well, but there are a lot of partitioning tests so that makes me feel slightly better.
When run ignition on a device mapper, ie, multipath, it fails because the function blockDevHeld returns true as the block device contains holders. A block device with holders do not necessary means the block device is in use (like mounted).
The function blockDevInUse should look for mounted devices only.
fixes #2128