[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH][rhel6-branch] Align lv sizes when adding to vg total space used.



This is for rhel6-branch and for master.

Go back to using lv.vgSpaceUsed instead of lv.size, which will
take into account striped lvs. Also, remove snapshots from
vgSpaceUsed since they are tracked all together in vg.snapshotSpace.

Resolves: rhbz#682156
---
 storage/devices.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index e6b7087..4b89901 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2164,7 +2164,7 @@ class LVMVolumeGroupDevice(DMDevice):
 
         # total the sizes of any LVs
         log.debug("%s size is %dMB" % (self.name, self.size))
-        used = sum(lv.size for lv in self.lvs) + self.snapshotSpace
+        used = sum(lv.vgSpaceUsed for lv in self.lvs) + self.snapshotSpace
         free = self.size - used
         log.debug("vg %s has %dMB free" % (self.name, free))
         return free
@@ -2347,7 +2347,9 @@ class LVMLogicalVolumeDevice(DMDevice):
 
     @property
     def vgSpaceUsed(self):
-        return self.size * self.stripes + self.logSize + self.snapshotSpace
+        """ Space occupied by this LV, not including snapshots. """
+        return (self.vg.align(self.size, roundup=True) * self.stripes
+                + self.logSize)
 
     @property
     def vg(self):
-- 
1.7.3.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]