[master 6/6] Reserve space for the 'pmspare' LV in a VG

vpodzime installerbot-noreply at redhat.com
Tue Aug 18 08:53:40 UTC 2015


From: Vratislav Podzimek <vpodzime at redhat.com>

The 'pmspare' LV is created by LVM behind our back and it serves as a temporary
space for some metadata reorganizations/cleanup/... so its size is equal to the
size of the biggest metadata LV in the VG. If we ignore it, we lack free space
in the VG later when creating LVs.
---
 blivet/devices/lvm.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
index ada2db8..ae77f93 100644
--- a/blivet/devices/lvm.py
+++ b/blivet/devices/lvm.py
@@ -347,6 +347,9 @@ def reservedSpace(self):
         elif self.reserved_space > Size(0):
             reserved = self.reserved_space
 
+        # reserve space for the pmspare LV LVM creates behind our back
+        reserved += self.pmSpareSize
+
         return self.align(reserved, roundup=True)
 
     @property
@@ -422,6 +425,16 @@ def cachedLVs(self):
         return [l for l in self._lvs if l.cached]
 
     @property
+    def pmSpareSize(self):
+        """Size of the pmspare LV LVM creates in every VG that contains some metadata
+        (even internal) LV. The size of such LV is equal to the size of the
+        biggest metadata LV in the VG.
+
+        """
+        # TODO: report correctly/better for existing VGs
+        return max((lv.metaDataSize for lv in self.lvs), default=Size(0))
+
+    @property
     def complete(self):
         """Check if the vg has all its pvs in the system
         Return True if complete.


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


More information about the anaconda-patches mailing list