[PATCH 5/5] Align end sector in the appropriate direction for resize. (#1120964)
David Lehman
dlehman at redhat.com
Thu Oct 9 22:04:40 UTC 2014
On 10/09/2014 04:53 PM, David Lehman wrote:
> When shrinking, align the end sector up to ensure the aligned partition
> is still larger than the formatting's minimum size.
>
> When growing, align the end sector down to ensure the aligned partition
> is completely within the free region (and not larger than the formatting's
> maximum size).
> ---
> blivet/devices/partition.py | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
> index b86eabd..71323b0 100644
> --- a/blivet/devices/partition.py
> +++ b/blivet/devices/partition.py
> @@ -585,8 +585,12 @@ class PartitionDevice(StorageDevice):
> start=currentGeom.start,
> length=newLen)
> # and align the end sector
> - newGeometry.end = self.disk.format.endAlignment.alignDown(newGeometry,
> - newGeometry.end)
> + if newGeometry.length < currentGeom.length:
> + align = self.disk.format.endAlignment.alignUp
> + else:
> + align = self.disk.format.endAlignment.alignDown
> +
> + newGeometry.end = align(newGeometry, newGeometry.end)
> constraint = parted.Constraint(exactGeom=newGeometry)
>
> return (constraint, newGeometry)
>
Bah, this won't work for shink because the end sector is already the end
of the geometry, making it impossible for that align call to align it
up. I'm withdrawing this patch for now.
David
More information about the anaconda-patches
mailing list