[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Round up when aligning to pesize for space used. (#493656)
- From: David Lehman <dlehman redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Round up when aligning to pesize for space used. (#493656)
- Date: Thu, 2 Apr 2009 21:44:13 -0500
---
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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]