[anaconda:master] Updates for new Size.convertTo() spec.
mulhern
amulhern at redhat.com
Fri Jan 9 16:07:33 UTC 2015
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.
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:
+ # if no requested size, or size less than 1 MB, request maximum size
+ if dialog.size is None or dialog.size < Size("1 MB"):
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)])
self._drivePaths[drive] = diskimage
@property
--
1.9.3
More information about the anaconda-patches
mailing list