[blivet:master 7/7] Rewrite _bound_size()

Vratislav Podzimek vpodzime at redhat.com
Wed Oct 15 08:15:04 UTC 2014


On Tue, 2014-10-14 at 17:14 -0400, mulhern wrote:
> Fix a bug where the possibility of maxSize() being 0, a value which is used
> to mean no maxSize() given, is not taken into account.
> 
> Since, a fall back is needed in case this happens, pass old_size to
> _bound_size as well.
> 
> Rearrange if statement a bit to make it clearer now that additional
> possibilities are taken into account.
> 
> Do a bit more logging, in case something useful-to-know or bad happens.
> 
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
>  pyanaconda/ui/gui/spokes/custom.py | 47 ++++++++++++++++++++++++++++++--------
>  1 file changed, 38 insertions(+), 9 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> index deffb19..af76d02 100644
> --- a/pyanaconda/ui/gui/spokes/custom.py
> +++ b/pyanaconda/ui/gui/spokes/custom.py
> @@ -722,15 +722,44 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
>          log.debug("resetting device %s", original_device.name)
>          self._storage_playground.resetDevice(original_device)
>  
> -    def _bound_size(self, size, device):
> -        # If no size was specified, we just want to grow to the maximum.
> -        # But resizeDevice doesn't take None for a value.
> +    def _bound_size(self, size, device, old_size):
I think pylint would complain that this should be a function not a
method and it'd be right. Can we move this code to storage_utils.py and
covert it into a function?

> +        """ Returns a size bounded by the maximum and minimum size for
> +            the device.
> +
> +            :param size: the candidate size
> +            :type size: :class:`blivet.size.Size`
> +            :param device: the device being displayed
> +            :type device: :class:`blivet.devices.StorageDevice`
> +            :param size: the fallback size
> +            :type size: :class:`blivet.size.Size`
Missing docs for the old_size parameter.

Otherwise this looks good to me.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list