This is an anaconda only attempt, no accompanying blivet patch.
mulhern (2): Remove too strict condition for changing size (#1076055) Changes for scheduling size change on an existing device (#1076055)
pyanaconda/ui/gui/spokes/custom.py | 41 ++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-)
Related: rhbz#1076055
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 60a1cff..c33d30f 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -1617,7 +1617,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): with ui_storage_logger(): self.__storage.resetDevice(original_device)
- if changed_size and device.resizable: + if changed_size: # If no size was specified, we just want to grow to # the maximum. But resizeDevice doesn't take None for # a value.
Related: rhbz#1076055
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 | 39 ++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index c33d30f..0190cfb 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -1618,36 +1618,44 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): self.__storage.resetDevice(original_device)
if changed_size: + # 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 + # If no size was specified, we just want to grow to # the maximum. But resizeDevice doesn't take None for # a value. - if not size: - size = device.maxSize - elif size < device.minSize: - size = device.minSize - elif size > device.maxSize: - size = device.maxSize + if not use_size: + use_size = use_dev.maxSize + elif use_size < use_dev.minSize: + use_size = use_dev.minSize + elif use_size > use_dev.maxSize: + use_size = use_dev.maxSize
# 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.devicetree.findActions(action_type="resize", - devid=device.id) + devid=use_dev.id) with ui_storage_logger(): for action in reversed(actions): self.__storage.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)
with ui_storage_logger(): try: - self.__storage.resizeDevice(device, size) + self.__storage.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. " "Click for details.")) @@ -1656,10 +1664,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): _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)
On 09/30/2014 12:20 PM, mulhern wrote:
This is an anaconda only attempt, no accompanying blivet patch.
mulhern (2): Remove too strict condition for changing size (#1076055) Changes for scheduling size change on an existing device (#1076055)
pyanaconda/ui/gui/spokes/custom.py | 41 ++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-)
ACK.
anaconda-patches@lists.fedorahosted.org