[blivet][rhel7][PATCH] More fixes for alignment-related partition allocation failures.
David Lehman
dlehman at redhat.com
Fri Jan 23 17:29:47 UTC 2015
Commit dcfd06a7cdb7b9 caused an UnboundLocalError, which this fixes.
Also, handle alignment-related failures when no growable requests are
being allocated.
Related: rhbz#1167292
---
blivet/partitioning.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index f33d78d..3f0f15d 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -1122,6 +1122,7 @@ def allocatePartitions(storage, disks, partitions, freespace):
continue
+ temp_part = None
try:
temp_part = addPartition(disklabel,
_free,
@@ -1164,7 +1165,8 @@ def allocatePartitions(storage, disks, partitions, freespace):
sectorsToSize(disk_growth,
disk_sector_size))
- disklabel.partedDisk.removePartition(temp_part)
+ if temp_part:
+ disklabel.partedDisk.removePartition(temp_part)
_part.partedPartition = None
_part.disk = None
@@ -1230,8 +1232,12 @@ def allocatePartitions(storage, disks, partitions, freespace):
raise PartitioningError(_("not enough free space after "
"creating extended partition"))
- partition = addPartition(disklabel, free, part_type, _part.req_size,
- _part.req_start_sector, _part.req_end_sector)
+ try:
+ partition = addPartition(disklabel, free, part_type, _part.req_size,
+ _part.req_start_sector, _part.req_end_sector)
+ except ArithmeticError:
+ raise PartitioningError(_("failed to allocate aligned partition"))
+
log.debug("created partition %s of %s and added it to %s",
partition.getDeviceNodeName(),
Size(partition.getLength(unit="B")),
--
1.9.3
More information about the anaconda-patches
mailing list