[anaconda][PATCH] Adapt to corrected interpetation of logvol --percent.

Anne Mulhern amulhern at redhat.com
Fri Sep 19 13:04:04 UTC 2014





----- Original Message -----
> From: "David Lehman" <dlehman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Thursday, September 18, 2014 5:58:40 PM
> Subject: [anaconda][PATCH] Adapt to corrected interpetation of logvol	--percent.
> 
> logvol --percent and --size are now mutually exclusive. Percent does
> the same thing as size, but in terms of a percentage of the vg's free
> free space (after all requests with sizes have been allocated, and before
> any of them have been grown). A logvol defined with percent can still be
> growable. In fact, that's a good idea since the percentage allocation
> does not make any effort to allocate leftover extents after a
> conservative calculation of the percentage-based sizes.
> 
> Resolves: rhbz#1116435
> ---
>  pyanaconda/kickstart.py | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index 6487f2e..5ced283 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -755,7 +755,7 @@ class Lang(commands.lang.F19_Lang):
>  # no overrides needed here
>  Eula = commands.eula.F20_Eula
>  
> -class LogVol(commands.logvol.F20_LogVol):
> +class LogVol(commands.logvol.F21_LogVol):
>      def execute(self, storage, ksdata, instClass):
>          for l in self.lvList:
>              l.execute(storage, ksdata, instClass)
> @@ -772,13 +772,16 @@ class LogVolData(commands.logvol.F20_LogVolData):
>          # we might have truncated or otherwise changed the specified vg name
>          vgname = ksdata.onPart.get(self.vgname, self.vgname)
>  
> -        try:
> -            size = Size("%d MiB" % self.size)
> -        except ValueError:
> -            raise KickstartValueError(formatErrorMsg(self.lineno,
> -                    msg="The size \"%s\" is invalid." % self.size))
> -        except TypeError:
> -            pass
> +        if self.percent:
> +            size = Size(0)
> +        else:
> +            try:
> +                size = Size("%d MiB" % self.size)
> +            except ValueError:
> +                raise KickstartValueError(formatErrorMsg(self.lineno,
> +                        msg="The size \"%s\" is invalid." % self.size))
> +            except TypeError:
> +                pass

Shouldn't a TypeError be impossible since pykickstart parser defines size as an int?

>  
>          if self.mountpoint == "swap":
>              ty = "swap"
> --
> 1.9.3
> 
> _______________________________________________
> 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