[PATCH] Fix a probably rare traceback in resizing from the custom part UI.

Vratislav Podzimek vpodzime at redhat.com
Thu May 2 08:38:14 UTC 2013


On Tue, 2013-04-30 at 16:47 -0400, Chris Lumens wrote:
> As far as I can tell, this really only happens if you have previous partitions
> taking up the entire disk, blank out the desired capacity for a partition that
> is resizeable, and click the update button.  Since it cannot be resized, we
> hit a traceback that our earlier tests for this condition do not catch.
> ---
>  pyanaconda/ui/gui/spokes/custom.py | 46 +++++++++++++++++++++-----------------
>  1 file changed, 25 insertions(+), 21 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> index 092b9a2..7c4590f 100644
> --- a/pyanaconda/ui/gui/spokes/custom.py
> +++ b/pyanaconda/ui/gui/spokes/custom.py
> @@ -1327,35 +1327,39 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
>                  self.__storage.resetDevice(original_device)
>  
>          if changed_size and device.resizable:
> -            log.debug("scheduling resize of device %s to %s MB"
> -                        % (device.name, 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
>  
> -            with ui_storage_logger():
> -                try:
> -                    self.__storage.resizeDevice(device, size)
> -                except StorageError as e:
> -                    log.error("failed to schedule device resize: %s" % e)
> -                    device.size = old_size
> -                    self._error = e
> -                    self.set_warning(_("Device resize request failed. "
> -                                       "Click for details."))
> -                    self.window.show_all()
> -                else:
> -                    log.debug("%r" % device)
> -                    log.debug("new size: %s" % device.size)
> -                    log.debug("target size: %s" % device.targetSize)
> +            # And then we need to re-check that the max size is actually
> +            # different from the current size.
> +            if size != device.size:
> +                log.debug("scheduling resize of device %s to %s MB"
> +                            % (device.name, size))
>  
> -                    # update the selector's size property
> -                    selectorFromDevice(device, selector=selector)
> +                with ui_storage_logger():
> +                    try:
> +                        self.__storage.resizeDevice(device, size)
> +                    except StorageError as e:
> +                        log.error("failed to schedule device resize: %s" % e)
> +                        device.size = old_size
> +                        self._error = e
> +                        self.set_warning(_("Device resize request failed. "
> +                                           "Click for details."))
> +                        self.window.show_all()
> +                    else:
> +                        log.debug("%r" % device)
> +                        log.debug("new size: %s" % device.size)
> +                        log.debug("target size: %s" % device.targetSize)
>  
> -            # update size props of all btrfs devices' selectors
> -            self._update_selectors()
> -            self._updateSpaceDisplay()
> +                        # update the selector's size property
> +                        selectorFromDevice(device, selector=selector)
> +
> +                # update size props of all btrfs devices' selectors
> +                self._update_selectors()
> +                self._updateSpaceDisplay()
>  
>          # it's possible that reformat is active but fstype is unchanged, in
>          # which case we're not going to schedule another reformat unless
Looks good to me.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list