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

Anne Mulhern amulhern at redhat.com
Wed Oct 15 13:05:34 UTC 2014





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Wednesday, October 15, 2014 4:15:04 AM
> Subject: Re: [blivet:master 7/7] Rewrite _bound_size()
> 
> 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?
> 

Ok, moved, converted, renamed to bound_size(), since it is no longer internal.

(Pylint had no complaints about the method, but that may be suppressed.)

> > +        """ 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.

Fixed.

> 
> Otherwise this looks good to me.
> 
> --
> Vratislav Podzimek
> 
> Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

- mulhern


More information about the anaconda-patches mailing list