[rhel7-branch 2/5] Work with free region sizes instead of parted.Geometry objects
vpodzime
installerbot-noreply at redhat.com
Wed Jun 3 07:20:38 UTC 2015
From: Vratislav Podzimek <vpodzime at redhat.com>
Related: rhbz#1202877
(cherry picked from commit 792afe681d9950c31a869a4ef826da4472fd0105)
---
blivet/partitioning.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 50cfcb5..8b52692 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -138,17 +138,17 @@ def _schedulePartitions(storage, disks, min_luks_entropy=0, requests=None):
# basis for requests with requiredSpace is the sum of the sizes of the
# two largest free regions
- all_free = getFreeRegions(disks)
- all_free.sort(key=lambda f: f.length, reverse=True)
+ all_free = (Size(reg.getLength(unit="B")) for reg in getFreeRegions(disks))
+ all_free = sorted(all_free, reverse=True)
if not all_free:
# this should never happen since we've already filtered the disks
# to those with at least 500MiB free
log.error("no free space on disks %s", [d.name for d in disks])
return
- free = Size(all_free[0].getLength(unit="B"))
+ free = all_free[0]
if len(all_free) > 1:
- free += Size(all_free[1].getLength(unit="B"))
+ free += all_free[1]
# The boot disk must be set at this point. See if any platform-specific
# stage1 device we might allocate already exists on the boot disk.
@@ -204,7 +204,7 @@ def _schedulePartitions(storage, disks, min_luks_entropy=0, requests=None):
log.debug("%s", stage1_device)
continue
- if request.size > Size(all_free[0].getLength("B")):
+ if request.size > all_free[0]:
# no big enough free space for the requested partition
raise NotEnoughFreeSpaceError(_("No big enough free space on disks for "
"automatic partitioning"))
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/71344c61a0255c1deb2bed41b7ce58e3b39831cc
More information about the anaconda-patches
mailing list