disk: honour the fact that some containers have metadata
Re-introduce the VolumeContainer interface but with a different meaning: it is supposed to be implemented by all container that contain volumes and as a result have themselves a size, like eg LVM2, LUKS2 and PartitionTable (the latter is not yet included). The sole method on the interface for now is MetadataSize, which should return the metadata for the container itself. Use that new `VolumeContainer.MetadataSize` method when we up- date the sizes of elements in `resizeEntitybranch`.
This commit is contained in:
parent
17fa96b84a
commit
ed4e0a94a4
4 changed files with 33 additions and 0 deletions
|
|
@ -105,6 +105,18 @@ func (vg *LVMVolumeGroup) CreateMountpoint(mountpoint string, size uint64) (Enti
|
|||
return &vg.LogicalVolumes[len(vg.LogicalVolumes)-1], nil
|
||||
}
|
||||
|
||||
func (vg *LVMVolumeGroup) MetadataSize() uint64 {
|
||||
if vg == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
// LVM2 allows for a lot of customizations that will affect the size
|
||||
// of the metadata and its location and thus the start of the physical
|
||||
// extent. For now we assume the default which results in a start of
|
||||
// the physical extent 1 MiB
|
||||
return 1024 * 1024
|
||||
}
|
||||
|
||||
type LVMLogicalVolume struct {
|
||||
Name string
|
||||
Size uint64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue