Skip to content
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

Add support to /dev/disk/by-path device reference #1986

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

fgiudici
Copy link
Member

When using the /dev/disk/by-path symlinks device reference, the partition names there get a "-part${NUM}" suffix.
Same for the /dev/disk/by-id symlinks.

Fixes: rancher/elemental#1140

@fgiudici fgiudici requested a review from a team as a code owner February 29, 2024 18:19
Copy link
Contributor

@davidcassany davidcassany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this approach, at least this is not what I imagined.

/dev/disk/by-path/pci-0000:0a:00.0-nvme-1 is a symlink to an actual device under /dev. I was thinking on simply resolving such a symlink. So in a KVM env this could be resolved to something like /dev/vda and, from there, track partitions as /dev/vda1, etc.

I imagined adding something like (could be added in install action constructor)

spec.Target, _ = utils.ResolveLink(cfg.Fs, spec.Target, "/", constants.MaxLinkDepth)

to actually prevent the use of the symlinks when manipulating devices. This would prevent having to code additional name cases and also not relay on udev daemon creating the links and directly use the device named by the kernel. I'd say the less we have to manipulate the name the better. No strong opinion though.

Thoughts about this?

...and to all the symlinks referencing a disk device.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
@fgiudici
Copy link
Member Author

fgiudici commented Mar 1, 2024

I am not sure about this approach, at least this is not what I imagined.

/dev/disk/by-path/pci-0000:0a:00.0-nvme-1 is a symlink to an actual device under /dev. I was thinking on simply resolving such a symlink. So in a KVM env this could be resolved to something like /dev/vda and, from there, track partitions as /dev/vda1, etc.

I imagined adding something like (could be added in install action constructor)

spec.Target, _ = utils.ResolveLink(cfg.Fs, spec.Target, "/", constants.MaxLinkDepth)

to actually prevent the use of the symlinks when manipulating devices. This would prevent having to code additional name cases and also not relay on udev daemon creating the links and directly use the device named by the kernel. I'd say the less we have to manipulate the name the better. No strong opinion though.

Thoughts about this?

Makes sense, resolving the symlink is a better option.

Copy link
Contributor

@davidcassany davidcassany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@davidcassany davidcassany merged commit ca4f47c into rancher:main Mar 4, 2024
17 of 19 checks passed
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.

[SURE-7283] Wrong partition path when specifying /dev/disk/by-path/...
2 participants