Bug 602376

Summary: TypeError: Cannot convert float to Decimal. First convert the float to a string
Product: Red Hat Enterprise Linux 6 Reporter: Brian Lane <bcl>
Component: anacondaAssignee: Brian Lane <bcl>
Status: CLOSED CURRENTRELEASE QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: atodorov, borgan
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: anaconda_trace_hash:e30b2738d9f6ab5d7203a528cf93a8d6a955b6fb0ae55e9b6853f5e680e6a7f3
Fixed In Version: anaconda-13.21.51-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-10 19:47:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Attached traceback automatically from anaconda. none

Description Brian Lane 2010-06-09 18:12:36 UTC
The following was filed automatically by anaconda:
anaconda 13.21.48 exception report
Traceback (most recent call first):
  File "/usr/lib/python2.6/decimal.py", line 653, in __new__
    "First convert the float to a string")
  File "/tmp/updates/partition_gui.py", line 490, in _createStripe
    xlength = Decimal(lv.size) / Decimal(vg.size)
  File "/tmp/updates/partition_gui.py", line 299, in setDisplayed
    self.stripe = self._createStripe(obj)
  File "/tmp/updates/partition_gui.py", line 471, in __init__
    self.setDisplayed(vg)
  File "/tmp/updates/partition_gui.py", line 1259, in treeSelectCB
    dcCB = self.barviewActivateCB)
TypeError: Cannot convert float to Decimal.  First convert the float to a string

Comment 1 Brian Lane 2010-06-09 18:12:41 UTC
Created attachment 422637 [details]
Attached traceback automatically from anaconda.

Comment 2 Brian Lane 2010-06-09 18:15:58 UTC
Looks like there are cases where lv.size and/or vg.size are not integers. Need to convert to a string when passing to Decimal() like so: "%0.4f" % lv.size

Comment 4 RHEL Program Management 2010-06-09 18:33:08 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 5 Brian Lane 2010-06-09 20:49:04 UTC
I have a fix ready for this - https://www.redhat.com/archives/anaconda-devel-list/2010-June/msg00125.html

Comment 6 Brian Lane 2010-06-09 20:50:29 UTC
To be clear: I introduced this with my fix for green partition stripes for bug #599614

Comment 8 Alexander Todorov 2010-07-06 09:22:21 UTC
(In reply to comment #2)
> Looks like there are cases where lv.size and/or vg.size are not integers. Need
> to convert to a string when passing to Decimal() like so: "%0.4f" % lv.size    

Hi Brian,
how can I end up in a situation where those sizes are floats and not integers?

Comment 9 Brian Lane 2010-07-08 15:42:53 UTC
IIRC this was triggered by pre-existing partitions that would trigger bug 599614.

Comment 10 Alexander Todorov 2010-08-10 15:07:48 UTC
In bug 608172 I've tested haveing 3 partitions, /boot, swap and / and on the second install I've chosen to shrink the current system and created default LVM layout. 

There was no traceback. Given that bug 599614 is VERIFIED and the patch from comment #5 is already included I'm moving it to VERIFIED.

Comment 11 releng-rhel@redhat.com 2010-11-10 19:47:31 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.