[blivet][all branches] Round device size down to nearest MiB. (#1257997)

Chris Lumens clumens at redhat.com
Thu Sep 3 20:22:51 UTC 2015


> 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.

- Chris


More information about the anaconda-patches mailing list