On Fri, 2010-07-09 at 17:28 -0700, Brian C. Lane wrote: > floats are not suitable for comparisons, especially when comparing > against values from dialog box entries. Makes me a bit nervous, but looks okay. Dave > > Related: rhbz#608172 > --- > storage/deviceaction.py | 10 ++++++---- > 1 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/storage/deviceaction.py b/storage/deviceaction.py > index 4524e7c..3621d50 100644 > --- a/storage/deviceaction.py > +++ b/storage/deviceaction.py > @@ -22,6 +22,7 @@ > # > > from udev import * > +import math > > from devices import StorageDevice, PartitionDevice > from formats import getFormat > @@ -229,14 +230,15 @@ class ActionResizeDevice(DeviceAction): > obj = ACTION_OBJECT_DEVICE > > def __init__(self, device, newsize): > - if device.currentSize == newsize: > + currentSize = long(math.floor(device.currentSize)) > + if currentSize == newsize: > raise ValueError("new size same as old size") > > if not device.resizable: > raise ValueError("device is not resizable") > > DeviceAction.__init__(self, device) > - if newsize > device.currentSize: > + if newsize > currentSize: > self.dir = RESIZE_GROW > else: > self.dir = RESIZE_SHRINK > @@ -337,11 +339,11 @@ class ActionResizeFormat(DeviceAction): > obj = ACTION_OBJECT_FORMAT > > def __init__(self, device, newsize): > - if device.format.targetSize == newsize: > + if long(math.floor(device.format.targetSize)) == newsize: > raise ValueError("new size same as old size") > > DeviceAction.__init__(self, device) > - if newsize > device.format.currentSize: > + if newsize > long(math.floor(device.format.currentSize)): > self.dir = RESIZE_GROW > else: > self.dir = RESIZE_SHRINK _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list