-
Notifications
You must be signed in to change notification settings - Fork 521
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 for custom image sizes #1826
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.
This seems OK to me pending testing.
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.
Whew nice work! 🧇
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 like it, it's just clever enough to get the flexibility we need without the logic being too hard to read. The math involved, though, is tough and non-obvious - I think it'd help to have an ASCII/draw.io diagram of an example partition layout with an explanation of MB vs. MiB vs. GiB vs. sectors where appropriate. The old sgdisk
call at least had the partitions laid out next to each other, which helped a bit, even though it was hiding some secrets.
LGTM if upgrade/downgrade testing comes out OK.
59f7c9b
to
0cb08d7
Compare
0cb08d7
to
1c59956
Compare
Fix or selectively disable shellcheck warnings. |
Move all decisions about partition sizes, types, etc into a library so that it's easier to support layouts for different disk sizes. The layout is still essentially static, but can be scaled up as needed to support larger root filesystems. For the 2 GiB OS image layout, the end result is almost identical, except for fixing a longstanding bug where the last two partitions on each disk - PRIVATE and DATA - were (1 MiB + 1 sector) in size, and not 1 MiB as intended. Signed-off-by: Ben Cressey <bcressey@amazon.com>
Add a new structure to variant metadata so the OS and data disk sizes can be overridden. The previous values - 2 GiB for the OS disk, and 1 GIB for the data disk, are promoted to the default values so existing variant definitions continue working. References to "disk image" in `rpm2img` have been changed to refer to "os image" instead, to avoid confusion over which image is meant. The expected sizes for these images are now required parameters. Signed-off-by: Ben Cressey <bcressey@amazon.com>
1c59956
to
0bd6242
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.
🛴
Issue number:
Fixes #1821
Description of changes:
Refactor partition layout code into a helper library, and add support for custom OS and data image sizes in the variant specification.
Fix a bug that affected the last partition on each disk, where it was one sector larger than intended. (The corresponding filesystems were already the correct size.)
Testing done:
Confirmed that the "old" and "new" layouts only differ by one sector in the last partition.
Old layout
New layout
Confirmed that an undersized hash partition is rejected if I reduce
HASH_SCALE_FACTOR
to2
.Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.