summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-02-03 01:10:12 +0100
committerHans de Goede <hdegoede@redhat.com>2010-02-03 01:10:12 +0100
commit95689fad1283f762b37461104ad3626d85fc90fc (patch)
tree45091caa5814b66d89062a09cd2e2165a6334888 /storage
parent6217d83bb4958e31142e16b95387f8f0f8bb3761 (diff)
downloadanaconda-95689fad1283f762b37461104ad3626d85fc90fc.tar.gz
anaconda-95689fad1283f762b37461104ad3626d85fc90fc.tar.xz
anaconda-95689fad1283f762b37461104ad3626d85fc90fc.zip
Fix: ArithmeticError: Could not align to closest sector (#561278)
Given a partition layout like this: partition startsector endsector /boot 2048 1026047 PV 1026048 xxxxxxxxxx Then when we call getFreeRegions() parted gives us a free region with a geometry starting at sector 63 and ending at sector 2047, which we then try to align to our 2048 grain, which fails for the starting sector. When we fail to align, this means that the free region is too small to create an aligned partition in there, and we should just skip it.
Diffstat (limited to 'storage')
-rw-r--r--storage/partitioning.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/storage/partitioning.py b/storage/partitioning.py
index d548cdbe1..b9a55929f 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -725,10 +725,22 @@ def getFreeRegions(disks):
for f in disk.format.partedDisk.getFreeSpaceRegions():
# device alignment fixups
if not disk.format.alignment.isAligned(f, f.start):
- f.start = disk.format.alignment.alignNearest(f, f.start)
+ try:
+ f.start = disk.format.alignment.alignNearest(f, f.start)
+ except ArithmeticError, e:
+ # This happens when the free region is too small to create
+ # an aligned partition in it, ie the freespace between the
+ # mbr and the first aligned partition
+ continue
if not disk.format.endAlignment.isAligned(f, f.end):
- f.end = disk.format.endAlignment.alignNearest(f, f.end)
+ try:
+ f.end = disk.format.endAlignment.alignNearest(f, f.end)
+ except ArithmeticError, e:
+ # This happens when the free region is too small to create
+ # an aligned partition in it, ie the freespace after the
+ # last aligned partition
+ continue
if f.length > 0:
free.append(f)