-
Notifications
You must be signed in to change notification settings - Fork 92
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
blockdev: support installing to DM devices #285
Conversation
LGTM. |
Updated. |
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 LGTM, but I did not manually test the logic.
Hadn't paid a lot of attention to this, but coreos/fedora-coreos-config#503 is related here. I think it's possible to support this, but then it's the user's responsibility to make sure they add any necessary kargs (via |
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.
Nice! LGTM though interested in people's thoughts re. #285 (comment) before we commit to supporting this transparently.
FWIW, #91 gives a case where FCOS can support this transparently: a DM device used as the boot disk for a VM. The installer is run from the host, and the target device is non-partitionable from the host's perspective but partitionable from the guest's. See also coreos/fedora-coreos-tracker#321. |
kpartx creates a separate DM device for each partition. Those device nodes aren't real partitions but we can handle them anyway.
The rereadpt ioctl check is safest but it only works on partitionable devices, which excludes device-mapper volumes such as multipath. On DM volumes, rely exclusively on our lsblk and holders checks.
Use kpartx for device-mapper devices and BLKRRPART otherwise. Handle two operations: - Rereading the partition table after changing it. - In the kpartx case, if the partition devices do not already exist at startup, tear them down again on the way out.
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.
FWIW, #91 gives a case where FCOS can support this transparently: a DM device used as the boot disk for a VM. The installer is run from the host, and the target device is non-partitionable from the host's perspective but partitionable from the guest's.
Right, yup. Hmm OK, LGTM as is. I guess we can just expect users doing this to know what they're doing. Maybe in the future we can print a notice or something if some people get confused.
Handle partitioning with
kpartx
, and rely on thelsblk
+holders
busy-partition check to ensure exclusivity.Fixes #91. Alternative to #211.