[PATCH] Avoid exception when aligned start and end are crossed over

David Lehman dlehman at redhat.com
Tue Jan 6 20:17:24 UTC 2015


From: Alexander Lakhin <exclusion at gmail.com>

(cherry picked from commit 178c933748692bfae1134e5db4ade014affabf04)

Resolves: rhbz#1167233
---
 blivet/partitioning.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 9f6eea8..2d2777b 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -1780,9 +1780,13 @@ def getDiskChunks(disk, partitions, free):
         # also check that the resulting aligned geometry has a non-zero length.
         # (It is possible that both will align to the same sector in a small
         #  enough region.)
+        al_start = disk.format.alignment.alignUp(f, f.start)
+        al_end = disk.format.endAlignment.alignDown(f, f.end)
+        if al_start >= al_end:
+            continue
         geom = parted.Geometry(device=f.device,
-                               start=disk.format.alignment.alignUp(f, f.start),
-                               end=disk.format.endAlignment.alignDown(f, f.end))
+                               start=al_start,
+                               end=al_end)
         if geom.length < disk.format.alignment.grainSize:
             continue
 
-- 
1.9.3



More information about the anaconda-patches mailing list