[rhel7-branch 5/6] Don't crash when a free region is too small for an aligned partition.

dwlehman installerbot-noreply at redhat.com
Fri May 29 17:35:14 UTC 2015


From: David Lehman <dlehman at redhat.com>

(cherry picked from commit dcfd06a7cdb7b9b2884664435fd775b20b11ccda)

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 ce1e614..4269fb0 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -1096,12 +1096,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)


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/03222fefc45a12166de7d2d70d42ae834bbf3750


More information about the anaconda-patches mailing list