[PATCH 1/2] Only count with the extra metadata extents in new VGs and LVs (#1072999)

Vratislav Podzimek vpodzime at redhat.com
Wed Mar 5 17:12:54 UTC 2014


Existing VGs and LVs were likely created by a code that doesn't use the same
logic for counting with extra metadata for LVM on RAID.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 blivet/devices.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/blivet/devices.py b/blivet/devices.py
index 8742291..0903110 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -2434,10 +2434,11 @@ class LVMVolumeGroupDevice(DMDevice):
         # total the sizes of any LVs
         log.debug("%s size is %dMB" % (self.name, self.size))
         used = sum(lv.vgSpaceUsed for lv in self.lvs) + self.snapshotSpace
-        if raid_disks:
-            # LV on RAID allocates (5 * num_disks) extra extents for metadata
-            # (see the devicefactory.LVMFactory._get_total_space method)
-            used += len(self.lvs) * 5 * raid_disks * self.peSize
+        if not self.exists and raid_disks:
+            # (only) we allocate (5 * num_disks) extra extents for LV metadata
+            # on RAID (see the devicefactory.LVMFactory._get_total_space method)
+            new_lvs = [lv for lv in self.lvs if not lv.exists]
+            used += len(new_lvs) * 5 * raid_disks * self.peSize
         used += self.reservedSpace
         used += self.poolMetaData
         free = self.size - used
-- 
1.8.5.3



More information about the anaconda-patches mailing list