-
Notifications
You must be signed in to change notification settings - Fork 54
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
Fix size calculation for containers without sizeable children [COMPOSER-2086] #293
Conversation
7259743
to
eb6ed2b
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.
Neat. (Container is such an overloaded term).
Yeah and naming is HARD! |
I tested it against my PR, all green here. |
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 catch and great work 👏
I found just one typo, otherwise, this is great 😍
Add some comments to make it easier to follow some functions' logic. COMPOSER-2086
fa31874
eb6ed2b
to
fa31874
Compare
Add LV and VG partition size checks to the LVM custom mountpoint creation test. COMPOSER-2086
If the VG is in a LUKS container, then add the LUKS header to the sum of LVs to verify that the LVs + the header fit on the partition. COMPOSER-2086
The Container size calculation is meant to calculate the size of all the children of a Container + any metadata in order to: 1. Ensure the size of the container itself is big enough, if it is a Sizeable. 2. Send the new desired size up the branch for the ancestor Entity calculations. A problem occurs when a Container doesn't have access to the size information of its descendants. The child size sum is 0, so the container size is calculated as only the size of any metadata it requires. This occurs in the case of a LUKS container with an LVM Volume Group in it. The LUKS container's child size calculation is 0, the containerSize is therefore just the MetadataSize() of the LUKS container and so no decision is made to resize because the containerSize (which is just MetadataSize) is always smaller than the desired size (which is actually the size of the children of the VolumeGroup calculated by the previous recursive execution of the function). Fix this by detecting when the children size calculation is 0 and setting the containerSize to the desired size instead. This changes the logic of the function a bit when it's called directly on such a container. If we now call resizeEntityBranch(pathToLUKS, size) the parent of the LUKS container will be resized to size + 16 MiB (the LUKS metadata size). This makes sense in our context, because it ensures that the partition has enough space for 'size' data + the LUKS metadata. COMPOSER-2086
fa31874
to
054de0d
Compare
The Container size calculation is meant to calculate the size of all the
children of a Container + any metadata in order to:
Sizeable.
calculations.
A problem occurs when a Container doesn't have access to the size
information of its descendants. The child size sum is 0, so the
container size is calculated as only the size of any metadata it
requires.
This occurs in the case of a LUKS container with an LVM Volume Group in
it. The LUKS container's child size calculation is 0, the containerSize
is therefore just the MetadataSize() of the LUKS container and so no
decision is made to resize because the containerSize (which is just
MetadataSize) is always smaller than the desired size (which is actually
the size of the children of the VolumeGroup calculated by the previous
recursive execution of the function).
Fix this by detecting when the children size calculation is 0 and
setting the containerSize to the desired size instead.
This changes the logic of the function a bit when it's called directly
on such a container. If we now call
resizeEntityBranch(pathToLUKS, size)
the parent of the LUKS container will be resized to size + 16 MiB (the
LUKS metadata size). This makes sense in our context, because it
ensures that the partition has enough space for 'size' data + the LUKS
metadata.