From: "Brian C. Lane" <bcl(a)redhat.com>
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).
(cherry picked from python-blivet commit 1583dcc24dbbfd64cfff1f62339d9eb9e24f38c2)
Resolves: rhbz#1236506
---
storage/devices.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/storage/devices.py b/storage/devices.py
index 139c3e3..21f5da9 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1363,8 +1363,14 @@ def _computeResize(self, partition):
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
+ alignGeom = currentGeom # we can align up into the old geometry
+ else:
+ align = self.disk.format.endAlignment.alignDown
+ alignGeom = newGeometry
+
+ newGeometry.end = align(alignGeom, newGeometry.end)
constraint = parted.Constraint(exactGeom=newGeometry)
return (constraint, newGeometry)
--
To view this commit on github, visit
https://github.com/rhinstaller/anaconda/commit/615c77c5caea6eb139c9007003...