[PATCH 12/12] ntfsresize uses SI (MB) while the rest of us use IEC (MiB). (#862109)

Brian C. Lane bcl at redhat.com
Thu Oct 4 23:52:28 UTC 2012


On Thu, Oct 04, 2012 at 05:10:16PM -0500, David Lehman wrote:
> ---
>  pyanaconda/storage/formats/fs.py |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/pyanaconda/storage/formats/fs.py b/pyanaconda/storage/formats/fs.py
> index 70faf04..472e117 100644
> --- a/pyanaconda/storage/formats/fs.py
> +++ b/pyanaconda/storage/formats/fs.py
> @@ -1370,6 +1370,8 @@ class NTFS(FS):
>      @property
>      def minSize(self):
>          """ The minimum filesystem size in megabytes. """
> +        mb = 1000 * 1000.0
> +        mib = 1024 * 1024.0
>          if self._minInstanceSize is None:
>              # we try one time to determine the minimum size.
>              size = self._minSize
> @@ -1383,8 +1385,8 @@ class NTFS(FS):
>                      if not l.startswith("Minsize"):
>                          continue
>                      try:
> -                        _min = l.split(":")[1].strip()
> -                        minSize = min(self.currentSize, int(_min) + 250)
> +                        minSize = int(l.split(":")[1].strip())  # MB
> +                        minSize *= (mb / mib)                   # MiB
>                      except (IndexError, ValueError) as e:
>                          minSize = None
>                          log.warning("Unable to parse output for minimum size on %s: %s" %(self.device, e))
> @@ -1403,7 +1405,10 @@ class NTFS(FS):
>      def resizeArgs(self):
>          # You must supply at least two '-f' options to ntfsresize or
>          # the proceed question will be presented to you.
> -        argv = ["-ff", "-s", "%dM" % (self.targetSize,), self.device]
> +        mb = 1000 * 1000.0
> +        mib = 1024 * 1024.0
> +        targetSize = (mib / mb) * self.targetSize # convert MiB to MB
> +        argv = ["-ff", "-s", "%dM" % (targetSize,), self.device]

Is a float ok here?

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20121004/b8e58539/attachment-0001.sig>


More information about the anaconda-patches mailing list