[master 18/24] Account for LVM metadata in the LVMFactory

vathpela installerbot-noreply at redhat.com
Fri Nov 6 18:31:13 UTC 2015


From: Vratislav Podzimek <vpodzime at redhat.com>

If we want to have an e.g. 1020 MiB big container (VG), we actually need more
space for it because LVM puts its meta data to the PVs the VG consists of. We
need to account for this meta data otherwise we get less space then requested.
---
 blivet/devicefactory.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index 5261fb1..78c34d6 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()


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/468f33fd96cabb7c7f84957253765fa78cdef728


More information about the anaconda-patches mailing list