[PATCH 1/4] Don't use integer division to calculate a fraction.

David Lehman dlehman at redhat.com
Wed Jul 9 18:08:45 UTC 2014


---
 blivet/partitioning.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 4e3605b..d18e141 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -21,6 +21,7 @@
 #
 
 from operator import gt, lt
+from decimal import Decimal
 
 import parted
 from pykickstart.constants import AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, AUTOPART_TYPE_LVM_THINP, AUTOPART_TYPE_PLAIN
@@ -1488,7 +1489,7 @@ class Chunk(object):
                     # Each request is allocated free units from the pool
                     # based on the relative _base_ sizes of the remaining
                     # growable requests.
-                    share = p.base / self.base
+                    share = Decimal(p.base) / Decimal(self.base)
                     growth = int(share * last_pool) # truncate, don't round
 
                 p.growth += growth
-- 
1.9.3



More information about the anaconda-patches mailing list