[PATCH] Round up when aligning to pesize for space used. (#493656)

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

 



---
 storage/devices.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 0aacdaa..36a1c4e 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1787,7 +1787,7 @@ class LVMVolumeGroupDevice(DMDevice):
         log.debug("%s size is %dMB" % (self.name, size))
         for lv in self.lvs:
             log.debug("lv %s (%s) uses %dMB" % (lv.name, lv, lv.size))
-            used += self.align(lv.size)
+            used += self.align(lv.size, roundup=True)
 
         free = self.size - used
         log.debug("vg %s has %dMB free" % (self.name, free))
@@ -1799,14 +1799,19 @@ class LVMVolumeGroupDevice(DMDevice):
         # TODO: just ask lvm if isModified returns False
         return self.freeSpace / self.peSize
 
-    def align(self, size):
+    def align(self, size, roundup=None):
         """ Align a size to a multiple of physical extent size. """
         size = numeric_type(size)
 
+        if roundup:
+            round = math.ceil
+        else:
+            round = math.floor
+
         # we want Kbytes as a float for our math
         size *= 1024.0
         pesize = self.peSize * 1024.0
-        return long((math.floor(size / pesize) * pesize) / 1024)
+        return long((round(size / pesize) * pesize) / 1024)
 
     @property
     def pvs(self):
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux