disk: check all partitions for boot partition requirement#2459
Conversation
Function needsBoot exited early if it found a plain root or boot partition or a
btrfs root with a boot subvolume. This was not correct, we need to check all
partitions to avoid:
panic: the device name "boot" has been generated for two different devices
Example customization that caused the panic:
[[customizations.disk.partitions]]
type = "plain"
fs_type = "vfat"
minsize = "1 GiB"
mountpoint = "/boot/efi"
[[customizations.disk.partitions]]
name = "vg"
type = "lvm"
minsize = "1 GiB"
[[customizations.disk.partitions.logical_volumes]]
name = "lv_root"
fs_type = "xfs"
minsize = "20 GiB"
mountpoint = "/"
[[customizations.disk.partitions]]
type = "plain"
fs_type = "xfs"
minsize = "2 GiB"
mountpoint = "/boot"
Reordering the partitions would fix the problem, but this was a insights
customer who were running into this.
achilleas-k
left a comment
There was a problem hiding this comment.
Nice work. LGTM.
That function is getting a bit complicated but the disk package has always been a place that requires some complex logic.
One small note: Does the function docstring cover everything still or should we expand it to more clearly describe all scenarios?
I think it's clear-ish; from the current docstring for the function it just says that it will find out if there's a boot thingy nothing about the ordering 🙂 |
|
Also, do we later re-order the partitions at all? Having |
For disk customizations, we explicitly made it so the user defined order is respected and documented it as such: https://osbuild.org/docs/user-guide/partitioning/#general-principles and https://osbuild.org/docs/user-guide/partitioning/#order. Yes, that would interfere with resize tooling, but when we were designing the customizations we were always thinking about it in terms of "user makes their own PT", as long as it's valid. Breaking cloud-init and repart is a valid concern, but I also think there are valid use cases for letting users lay things out exactly the way they want them, for whatever reason they need. |
Function needsBoot exited early if it found a plain root or boot partition or a btrfs root with a boot subvolume. This was not correct, we need to check all partitions to avoid:
panic: the device name "boot" has been generated for two different devices
Example customization that caused the panic:
Reordering the partitions would fix the problem, but this was a insights customer who were running into this.
https://redhat.atlassian.net/browse/HMS-10805