[blivet][all branches] Round device size down to nearest MiB. (#1257997)
Samantha N. Bueno
sbueno+anaconda at redhat.com
Thu Sep 10 16:50:40 UTC 2015
On Thu, Sep 03, 2015 at 04:22:51PM -0400, Chris Lumens wrote:
> > diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
> > index add18e6..ad8d04d 100644
> > --- a/blivet/devices/storage.py
> > +++ b/blivet/devices/storage.py
> > @@ -572,7 +572,7 @@ class StorageDevice(Device):
> > blocks = int(util.get_sysfs_attr(self.sysfsPath, "size"))
> > size = Size(blocks * LINUX_SECTOR_SIZE)
> >
> > - return size
> > + return size.roundToNearest('MiB', 'ROUND_DOWN')
> >
> > @property
> > def currentSize(self):
> > @@ -584,7 +584,7 @@ class StorageDevice(Device):
> > """
> > if self._currentSize == Size(0):
> > self._currentSize = self.readCurrentSize()
> > - return self._currentSize
> > + return self._currentSize.roundToNearest('MiB', 'ROUND_DOWN')
> >
> > def updateSize(self):
> > """ Update size, currentSize, and targetSize to actual size. """
>
> Those should be constants (that you'll have to import), not strings.
You're right; changed to import ROUND_DOWN from blivet.size and so these
are no longer strings in that roundToNearest() call.
Samantha
More information about the anaconda-patches
mailing list