[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Fix: ArithmeticError: Could not align to closest sector (#561278)



Hi,

On 02/03/2010 12:43 PM, Ales Kozumplik wrote:
-  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)


Looks good.
Maybe just one thing: two copies of the same comment. I think a kind
reader will understand if the second comment is left out.


That was my first intention too, but notice that the "ie" part of the
comment is different.

Regards,

Hans


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]