[PATCH rhel6-branch master] Initialize Decimal for partition slices (#602376)

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

 



Some of the values passed to Decimal can be floats,
Decimal needs them as strings for the initializer.

Related: rhbz#599614
Resolves: rhbz#602376
---
 iw/partition_gui.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 4c13a65..62121f2 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -376,10 +376,10 @@ class DiskStripeGraph(StripeGraph):
                 continue
 
             # Create the start and length for the slice.
-            xoffset = (Decimal(part.geometry.start)
-                        / Decimal(drive.partedDevice.length))
-            xlength = (Decimal(part.geometry.length)
-                        / Decimal(drive.partedDevice.length))
+            xoffset = (Decimal(str(part.geometry.start))
+                        / Decimal(str(drive.partedDevice.length)))
+            xlength = (Decimal(str(part.geometry.length))
+                        / Decimal(str(drive.partedDevice.length)))
 
             if part.type == parted.PARTITION_LOGICAL:
                 partstr = "%s\n%.0f MB" % (part.path, float(part.getSize()))
@@ -487,7 +487,7 @@ class LVMStripeGraph(StripeGraph):
 
             #xoffset = float(curr_offset) / float(vg.size)
             xoffset = curr_offset
-            xlength = Decimal(lv.size) / Decimal(vg.size)
+            xlength = Decimal(str(lv.size)) / Decimal(str(vg.size))
 
             slice = Slice(stripe, lvstr, stype, xoffset, xlength,
                     dcCB = self.dcCB, cCB = self.cCB, sel_col = sel_col,
-- 
1.7.0.1

_______________________________________________
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