Use BusPath to resolve dm device paths (backport #130) #140
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.
Problem:
If multipathd is running and has taken over a device,
ResolvePersistentDevPath()
will end up returning a/dev/dm-*
device path, which we don't want. We want the real underyling device (e.g./dev/sda
). If we take a/dev/dm-*
path and later update the blockdevice CR with it, we lose all the interesting DeviceStatus information, like the WWN.Happily, in this case, we can figure out the right path to use by checking
/dev/disk/by-path/
+ the device's bus path. This has the added advantage of also working for block devices that have no WWN.Solution:
This PR.
Note: we're not trying to make NDM support multipath devices here, we're just trying to avoid having it corrupt the blockdevice CRs if multipath happens to be active.
Related Issue:
harvester/harvester#6531
Test plan:
multipath=off
)/dev/sda
, not as/dev/dm-0
as in that bug report.multipath -F
to flush the multipath config. This will remove the device from multipath. It should be automatically formatted shortly afterwards.This is an automatic backport of pull request Use BusPath to resolve dm device paths #130 done by Mergify.