[PATCH 1/2] Don't crash when a free region is too small for an aligned partition.

David Lehman dlehman at redhat.com
Tue Jan 6 20:15:34 UTC 2015


Resolves: rhbz#1167292
---
 blivet/partitioning.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index ef4d328..f33d78d 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -1122,12 +1122,18 @@ def allocatePartitions(storage, disks, partitions, freespace):
 
                                     continue
 
-                            temp_part = addPartition(disklabel,
-                                                     _free,
-                                                     _part_type,
-                                                     _part.req_size,
-                                                     _part.req_start_sector,
-                                                     _part.req_end_sector)
+                            try:
+                                temp_part = addPartition(disklabel,
+                                                         _free,
+                                                         _part_type,
+                                                         _part.req_size,
+                                                         _part.req_start_sector,
+                                                         _part.req_end_sector)
+                            except ArithmeticError as e:
+                                log.debug("failed to allocate aligned partition "
+                                         "for growth test")
+                                continue
+
                             _part.partedPartition = temp_part
                             _part.disk = _disk
                             temp_parts.append(_part)
-- 
1.9.3



More information about the anaconda-patches mailing list