-
Notifications
You must be signed in to change notification settings - Fork 50
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
Partition table helper functions for adding root filesystem and boot partition #1009
Partition table helper functions for adding root filesystem and boot partition #1009
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.
Looks good, some ideas/suggestions inline but no blockers just my usual nitpicky self (but some might still be worthwhile).
a439666
to
ee848d1
Compare
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.
Thank you
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.
I think I found a tiny issue regarding MBR partitions, but I believe that we can fix these in a follow-up since this code isn't actually used anywhere in production yet.
Add a function that takes a partition table and adds a root filesystem, but only if one does not already exist. A root filesystem is any mountable where the mountpoint is `/`. The function decides whether to create a plain partition, a logical volume, or a btrfs subvolume based on existing partitions and volumes in the partition table. This function is not currently used because our base partition tables always have root filesystems, but it will be part of the new custom partition table generator.
ee848d1
to
2ea0951
Compare
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.
Thank you, looks good, there is lint error that probably needs fixing
The merge-base changed after approval.
Add a function that takes a partition table and adds a boot partition, but only if one does not already exist. A boot partition is any mountable where the mountpoint is `/boot`. Although the /boot mountpoint must always be on a plain partition, this is not validated. This function is not currently used because the NewPartitionTable() function handles this automatically during layout conversions (in ensureLVM() and ensureBtrfs()), but it will be part of the new custom partition table generator.
Define a new const string: DosLinuxTypeID, which is used for Linux filesystems on dos/mbr partition tables. In the new helper functions, use the partition table type to determine which ID to use. This means that the functions will return an error when the partition table type is not set (or is set to an unknown value). Update the tests to match the new behaviour and to test the correct ID selection.
2ea0951
to
88d6a6a
Compare
This is part of #926 which I'm slowly splitting into smaller, bite-sized PRs.
The PR introduces two helper functions,
EnsureRootFilesystem()
andEnsureBootPartition()
. These will add, respectively, a root filesystem and a boot partition to a partition table if they don't already exist.