[master 3/4] Account for LVM metadata in the LVMFactory

vpodzime installerbot-noreply at redhat.com
Thu Nov 5 15:47:31 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 4eb345e..92aa2ff 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.freeSpace
+                # 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/b4d674152798bac099684c24c7d1052222907ec4


More information about the anaconda-patches mailing list