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")),
On Fri, Jan 23, 2015 at 11:29:47AM -0600, David Lehman wrote:
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(-)
Ack
----- Original Message -----
From: "David Lehman" dlehman@redhat.com To: anaconda-patches@lists.fedorahosted.org Sent: Friday, January 23, 2015 12:29:47 PM Subject: [blivet][rhel7][PATCH] More fixes for alignment-related partition allocation failures.
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):
<-- SNIP -->
The deepest level of nesting in this method is 10 and it seems to be about 300 lines long. The deepest level of nesting in this patch is 8. I don't have any objections to this patch itself, but I do feel that that the level of nesting and the length lead to these kinds of errors, and probably some others, and should be corrected sometime by some (careful) refactoring, if this method is going to stay around.
- mulhern
anaconda-patches@lists.fedorahosted.org