debian-forge-composer/internal/disk
Christian Kellner 9ea58d1486 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]: 8686657664/lib/metadata/metadata.c (L1072)

Co-authored-by: Achilleas Koutsou <achilleas@koutsou.net>
2022-11-18 18:44:12 +01:00
..
btrfs.go disk: align LVM2 volumes to the extent size 2022-11-18 18:44:12 +01:00
disk.go disk: align LVM2 volumes to the extent size 2022-11-18 18:44:12 +01:00
disk_test.go disk: align LVM2 volumes to the extent size 2022-11-18 18:44:12 +01:00
filesystem.go disk: guard against nil pointer dereferencing 2022-02-22 19:23:41 +00:00
luks.go Simplified installer: add support for encrypted raw images 2022-02-28 23:05:45 +00:00
lvm.go disk: align LVM2 volumes to the extent size 2022-11-18 18:44:12 +01:00
lvm_test.go disk: rename Create{Volume → Mountpoint} 2022-02-28 17:09:30 +01:00
partition.go disk: add partition type helpers 2022-02-27 22:03:36 +01:00
partition_table.go disk: align LVM2 volumes to the extent size 2022-11-18 18:44:12 +01:00
path_policy.go disk: new path policies struct and methods 2022-08-08 18:05:05 +02:00
path_policy_test.go disk: new path policies struct and methods 2022-08-08 18:05:05 +02:00
path_tree_test.go disk: add generic path trie implementation 2022-08-08 18:05:05 +02:00
path_trie.go disk: add generic path trie implementation 2022-08-08 18:05:05 +02:00