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

vpodzime installerbot-noreply at redhat.com
Wed Nov 4 19:49:43 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 9132ccb..2dac08a 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -1233,6 +1233,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_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
         elif self.container_size == SIZE_POLICY_MAX:
             # grow the container as large as possible
             if self.container:
@@ -1246,6 +1252,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/9c30318f34093253e0c875ab8b25522069f0e654


More information about the anaconda-patches mailing list