diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index 5261fb1de..78c34d6f8 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -1244,6 +1244,12 @@ def _get_total_space(self): if self.container: space += sum([p.size for p in self.container.parents]) space -= self.container.free_space + # we need to account for the LVM metadata being placed somewhere + space += self.container.lvm_metadata_space + + # we need to account for the LVM metadata being placed on each disk + # (and thus taking up to one extent from each disk) + space += len(self.disks) * lvm.LVM_PE_SIZE elif self.container_size == SIZE_POLICY_MAX: # grow the container as large as possible if self.container: @@ -1257,6 +1263,10 @@ def _get_total_space(self): # XXX: should respect the real extent size space += blockdev.lvm.get_lv_physical_size(self.container_size, lvm.LVM_PE_SIZE) + # we need to account for the LVM metadata being placed on each disk + # (and thus taking up to one extent from each disk) + space += len(self.disks) * lvm.LVM_PE_SIZE + # this does not apply if a specific container size was requested if self.container_size in [SIZE_POLICY_AUTO, SIZE_POLICY_MAX]: space += self._get_device_space()