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

David Lehman dlehman at redhat.com
Fri Oct 5 14:14:27 UTC 2012


On Thu, 2012-10-04 at 16:52 -0700, Brian C. Lane wrote:
> 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?

A float should be plenty here -- especially since we're truncating it to
an int.

> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches




More information about the anaconda-patches mailing list