Another rebase cherry pick.
From: mulhern amulhern@redhat.com
Related: rhbz#1076055 Related: rhbz#1196721
(cherry-picked from commit d2d01b2d4d217532bae13a39483af9c96855b297)
The condition prohibits changing the size of the device in circumstances when it should be changed, like when it is a non-existant LUKS device on top of a resizable device.
Also, a more correct condition is already checked at the top of the _save_right_side() method to calculate the value of changed_size.
Signed-off-by: mulhern amulhern@redhat.com --- pyanaconda/ui/gui/spokes/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 8ee545d..433fe27 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -1149,7 +1149,7 @@ def _save_right_side(self, selector): self._revert_reformat(device, use_dev)
# Handle size change - if changed_size and device.resizable: + if changed_size: self._handle_size_change(size, old_size, device, use_dev)
# it's possible that reformat is active but fstype is unchanged, in
From: mulhern amulhern@redhat.com
Related: rhbz#1076055 Related: rhbz#1196721
(cherry-picked from commit 092d9dc7b8b156031bf8f8d774bf5a8bf9b4a87a)
Signed-off-by: mulhern amulhern@redhat.com --- pyanaconda/ui/gui/spokes/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 83fd28b..467eec8 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -1020,7 +1020,7 @@ def _save_right_side(self, selector): # If the device is a btrfs volume, the only things we can set/update # are mountpoint and container-wide settings. if device_type == DEVICE_TYPE_BTRFS and hasattr(use_dev, "subvolumes"): - size = 0 + size = Size(0) changed_size = False encrypted = False changed_encryption = False
From: mulhern amulhern@redhat.com
Related: rhbz#1076055 Related: rhbz#1196721
(cherry-picked from commit cb4794835fbf97cd51275f61f82ec428db42f1a4)
When changing size, the device which gets its size changed is always the raw device.
Do a little ad-hoc adjustment of the size in case the raw device and the device that the user sees the size of are different. Since the only situation where these are different is with a LUKS device use crypto constant for the adjustment.
Signed-off-by: mulhern amulhern@redhat.com --- pyanaconda/ui/gui/spokes/custom.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 433fe27..83fd28b 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -728,28 +728,36 @@ def _bound_size(self, size, device):
@ui_storage_logged def _handle_size_change(self, size, old_size, device, use_dev): + # If a LUKS device is being displayed, adjust the size + # to the appropriate size for the raw device. + use_size = size + use_old_size = old_size + if use_dev is not device: + use_size = size + crypto.LUKS_METADATA_SIZE + use_old_size = use_dev.size + # bound size to boundaries given by the device - size = self._bound_size(size, device) - size = device.alignTargetSize(size) + use_size = self._bound_size(use_size, use_dev) + use_size = use_dev.alignTargetSize(use_size)
# And then we need to re-check that the max size is actually # different from the current size. _changed_size = False - if size != device.size and size == device.currentSize: + if use_size != use_dev.size and use_size == use_dev.currentSize: # size has been set back to its original value actions = self._storage_playground.devicetree.findActions(action_type="resize", - devid=device.id) + devid=use_dev.id) for action in reversed(actions): self._storage_playground.devicetree.cancelAction(action) _changed_size = True - elif size != device.size: - log.debug("scheduling resize of device %s to %s", device.name, size) + elif use_size != use_dev.size: + log.debug("scheduling resize of device %s to %s", use_dev.name, use_size)
try: - self._storage_playground.resizeDevice(device, size) + self._storage_playground.resizeDevice(use_dev, use_size) except StorageError as e: log.error("failed to schedule device resize: %s", e) - device.size = old_size + use_dev.size = use_old_size self._error = e self.set_warning(_("Device resize request failed. " "<a href="">Click for details.</a>")) @@ -758,10 +766,13 @@ def _handle_size_change(self, size, old_size, device, use_dev): _changed_size = True
if _changed_size: - log.debug("new size: %s", device.size) - log.debug("target size: %s", device.targetSize) + log.debug("new size: %s", use_dev.size) + log.debug("target size: %s", use_dev.targetSize)
# update the selector's size property + # The selector shows the visible disk, so it is necessary + # to use device and size, which are the values visible to + # the user. for s in self._accordion.allSelectors: if s._device == device: s.size = str(device.size)
Looks good to me.
Added label: ACK.
Closed.
anaconda-patches@lists.fedorahosted.org