Looks good. On 04/02/2009 04:44 PM, David Lehman wrote:
--- 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):
-- David Cantrell <dcantrell@xxxxxxxxxx> Red Hat / Honolulu, HI _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list