Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disk: align LVM2 volumes to the extent size
When the size of a logical volume is not aligned to the extent size of the volume group, LVM2 will automatically align it by rounding up[1]: Rounding up size to full physical extent 29.80 GiB Rounding up size to full physical extent <3.82 GiB Since we don't take that into account when we create a new volume or set the size of an existing one, the size for the whole volume group will be short by that amount and thus the creation of the last volume will fail: Volume group <uuid> has insufficient free space (975 extents): 977 required. To fix this a new `AlignUp` method is added to the `MountpointCreator` creator interface. It will align a given size to the requirements of the implementing container, like e.g. `LVMVolumeGroup`. It is then used by a new `alignEntityBranch` which takes a size and walks the entity path, calling `AlignUp` for all entities that implement said `MountpointCreator` interface; thus the resulting size should fullfil the alignment requirement for all elements in the path. NB: `PartitionTable` already had an `AlignUp` method. Add a corresponding test. [1]: https://github.com/lvmteam/lvm2/blob/868665766491d9d42b8acedaf07cafc7118d165c/lib/metadata/metadata.c#L1072
- Loading branch information
Showing
5 changed files
with
135 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters