[PATCH] Ensure we are specifying sensible target sizes for resize. (#1120964)
David Lehman
dlehman at redhat.com
Thu Oct 30 18:16:01 UTC 2014
---
pyanaconda/kickstart.py | 4 ++++
pyanaconda/ui/gui/spokes/custom.py | 1 +
pyanaconda/ui/gui/spokes/lib/resize.py | 4 ++--
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 27c2a1b..2c09774 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -871,6 +871,7 @@ class LogVolData(commands.logvol.F21_LogVolData):
msg=_("Logical volume \"%s\" given in logvol command does not exist.") % self.name))
if self.resize:
+ size = dev.alignTargetSize(size)
if size < dev.currentSize:
# shrink
try:
@@ -932,6 +933,7 @@ class LogVolData(commands.logvol.F21_LogVolData):
removeExistingFormat(device, storage)
if self.resize:
+ size = device.alignTargetSize(size)
try:
devicetree.registerAction(ActionResizeDevice(device, size))
except ValueError:
@@ -1169,6 +1171,7 @@ class PartitionData(commands.partition.F18_PartData):
msg=_("Partition \"%s\" given in part command does not exist.") % self.onPart))
if self.resize:
+ size = dev.raw_device.alignTargetSize(size)
if size < dev.currentSize:
# shrink
try:
@@ -1261,6 +1264,7 @@ class PartitionData(commands.partition.F18_PartData):
removeExistingFormat(device, storage)
if self.resize:
+ size = device.raw_device.alignTargetSize(size)
try:
devicetree.registerAction(ActionResizeDevice(device, size))
except ValueError:
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 9b01b51..ae7ddd0 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -746,6 +746,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
use_old_size = use_dev.size
# bound size to boundaries given by the device
+ use_size = udev_dev.alignTargetSize(use_size)
size = storage_utils.bound_size(use_size, use_dev, use_old_size)
# And then we need to re-check that the max size is actually
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index ee9c322..0f52f22 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -435,8 +435,8 @@ class ResizeDialog(GUIObject):
return False
elif obj.action == _(SHRINK) and int(device.size) != int(obj.target):
if device.resizable:
- # round this up to nearest MB? MiB? Maybe in targetSize setter.
- self.storage.resizeDevice(device, Size(obj.target))
+ aligned = device.alignTargetSize(Size(obj.target))
+ self.storage.resizeDevice(device, aligned)
else:
self._recursiveRemove(device)
elif obj.action == _(DELETE):
--
1.9.3
More information about the anaconda-patches
mailing list