[anaconda:master] Updates for new Size.convertTo() spec.
Anne Mulhern
amulhern at redhat.com
Fri Jan 9 16:35:45 UTC 2015
----- Original Message -----
> From: "David Lehman" <dlehman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Friday, January 9, 2015 11:22:24 AM
> Subject: Re: [anaconda:master] Updates for new Size.convertTo() spec.
>
> On 01/09/2015 10:07 AM, mulhern wrote:
> > The occurrance of convertTo() in custom.py is really unnecessary, so it
> > is removed. The comment just above is updated to be consistent with the
> > code below. The if-condition ends up being overall a bit different, but the
> > whole if-statement has just the same effect as before.
>
> I don't see any convertTo call being removed from custom.py in the patch.
>
See below.
> >
> > Signed-off-by: mulhern <amulhern at redhat.com>
> > ---
> > pyanaconda/kickstart.py | 4 ++--
> > pyanaconda/ui/gui/spokes/custom.py | 4 ++--
> > tests/gui/outside/__init__.py | 3 ++-
> > 3 files changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> > index bfb5606..f2999fb 100644
> > --- a/pyanaconda/kickstart.py
> > +++ b/pyanaconda/kickstart.py
> > @@ -28,7 +28,7 @@ from blivet.formats import getFormat
> > from blivet.partitioning import doPartitioning
> > from blivet.partitioning import growLVM
> > from blivet.errors import PartitioningError, StorageError,
> > BTRFSValueError
> > -from blivet.size import Size
> > +from blivet.size import Size, KiB
> > from blivet import udev
> > from blivet.platform import platform
> > import blivet.iscsi
> > @@ -1694,7 +1694,7 @@ class
> > VolGroupData(commands.volgroup.F21_VolGroupData):
> >
> > if self.pesize == 0:
> > # default PE size requested -- we use blivet's default in KiB
> > - self.pesize = LVM_PE_SIZE.convertTo(spec="KiB")
> > + self.pesize = LVM_PE_SIZE.convertTo(KiB)
> >
> > pesize = Size("%d KiB" % self.pesize)
> > possible_extents = getPossiblePhysicalExtents()
> > diff --git a/pyanaconda/ui/gui/spokes/custom.py
> > b/pyanaconda/ui/gui/spokes/custom.py
> > index 2e151b6..dd87a4d 100644
> > --- a/pyanaconda/ui/gui/spokes/custom.py
> > +++ b/pyanaconda/ui/gui/spokes/custom.py
> > @@ -1748,8 +1748,8 @@ class CustomPartitioningSpoke(NormalSpoke,
> > StorageChecker):
> > dev_info["mountpoint"] = dialog.mountpoint
> > log.debug("requested size = %s ; available space = %s",
> > dialog.size, self._free_space)
> >
> > - # if no size was entered, request as much of the free space as
> > possible
> > - if dialog.size is not None and dialog.size.convertTo(spec="mb")
> > 1: Removed: dialog.size.convertTo(spec="mb") < 1
> > + # if no requested size, or size less than 1 MB, request maximum
> > size
> > + if dialog.size is None or dialog.size < Size("1 MB"): Added: dialog.size < Size("1 MiB")
> > dev_info["size"] = None
> > else:
> > dev_info["size"] = dialog.size
> > diff --git a/tests/gui/outside/__init__.py b/tests/gui/outside/__init__.py
> > index 9a38c6a..d69c40a 100644
> > --- a/tests/gui/outside/__init__.py
> > +++ b/tests/gui/outside/__init__.py
> > @@ -20,6 +20,7 @@
> > __all__ = ["Creator", "OutsideMixin"]
> >
> > import blivet
> > +from blivet.size import MB
> >
> > from contextlib import contextmanager
> > from nose.plugins.multiprocess import TimedOutException
> > @@ -116,7 +117,7 @@ class Creator(object):
> > # For now we are using qemu-img to create these files but
> > specifying
> > # sizes in blivet Size objects. Unfortunately, qemu-img
> > wants sizes
> > # as xM or xG, not xMB or xGB. That's what the conversion
> > here is for.
> > - self._call(["/usr/bin/qemu-img", "create", "-f", "raw",
> > diskimage, "%sM" % size.convertTo(spec="MB")])
> > + self._call(["/usr/bin/qemu-img", "create", "-f", "raw",
> > diskimage, "%sM" % size.convertTo(MB)])
>
> I know it's not what you're doing with this patch but, according to
> qemu-img(1) these should be MiB -- not MB. Might as well fix it while
> you're here, IMO.
Done! Commit message updated.
- mulhern
>
> David
>
> > self._drivePaths[drive] = diskimage
> >
> > @property
> >
>
> _______________________________________________
> 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