[pykickstart] Do not set default PE size in pykickstart

Vratislav Podzimek vpodzime at redhat.com
Fri May 16 07:02:14 UTC 2014


On Thu, 2014-05-15 at 11:31 -0400, Anne Mulhern wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "Vratislav Podzimek" <vpodzime at redhat.com>
> > To: anaconda-patches at lists.fedorahosted.org
> > Sent: Thursday, May 15, 2014 9:00:24 AM
> > Subject: [pykickstart] Do not set default PE size in pykickstart
> > 
> > It should be left to the users of pykickstart to decide on the default PE
> > size.
> > 
> > Related: rhbz#1098139
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >  pykickstart/commands/volgroup.py | 13 +++++++++++++
> >  pykickstart/handlers/f21.py      |  4 ++--
> >  tests/commands/volgroup.py       | 26 ++++++++++++++++++++++++++
> >  3 files changed, 41 insertions(+), 2 deletions(-)
> > 
> > diff --git a/pykickstart/commands/volgroup.py
> > b/pykickstart/commands/volgroup.py
> > index 9e52a9c..1b06101 100644
> > --- a/pykickstart/commands/volgroup.py
> > +++ b/pykickstart/commands/volgroup.py
> > @@ -84,6 +84,11 @@ class FC16_VolGroupData(FC3_VolGroupData):
> >  
> >          return retval
> >  
> > +class F21_VolGroupData(FC16_VolGroupData):
> > +    def __init__(self, *args, **kwargs):
> > +        FC16_VolGroupData.__init__(self, *args, **kwargs)
> > +        self.pesize = kwargs.get("pesize", 0)
> > +
> >  class FC3_VolGroup(KickstartCommand):
> >      removedKeywords = KickstartCommand.removedKeywords
> >      removedAttrs = KickstartCommand.removedAttrs
> > @@ -190,3 +195,11 @@ class F20_VolGroup(FC16_VolGroup):
> >              raise KickstartParseError(formatErrorMsg(self.lineno,
> >              msg=errorMsg))
> >  
> >          return retval
> > +
> > +class F21_VolGroup(F20_VolGroup):
> > +    def _getParser(self):
> > +        op = F20_VolGroup._getParser(self)
> > +        op.add_option("--pesize", dest="pesize", type="int", nargs=1,
> > +                      default=0)
> > +
> > +        return op
> > diff --git a/pykickstart/handlers/f21.py b/pykickstart/handlers/f21.py
> > index 177c255..57eeb34 100644
> > --- a/pykickstart/handlers/f21.py
> > +++ b/pykickstart/handlers/f21.py
> > @@ -84,7 +84,7 @@ class F21Handler(BaseHandler):
> >          "url": commands.url.F18_Url,
> >          "user": commands.user.F19_User,
> >          "vnc": commands.vnc.F9_Vnc,
> > -        "volgroup": commands.volgroup.F20_VolGroup,
> > +        "volgroup": commands.volgroup.F21_VolGroup,
> >          "xconfig": commands.xconfig.F14_XConfig,
> >          "zerombr": commands.zerombr.F9_ZeroMbr,
> >          "zfcp": commands.zfcp.F14_ZFCP,
> > @@ -106,6 +106,6 @@ class F21Handler(BaseHandler):
> >          "RepoData": commands.repo.F15_RepoData,
> >          "SshPwData": commands.sshpw.F13_SshPwData,
> >          "UserData": commands.user.F19_UserData,
> > -        "VolGroupData": commands.volgroup.FC16_VolGroupData,
> > +        "VolGroupData": commands.volgroup.F21_VolGroupData,
> >          "ZFCPData": commands.zfcp.F14_ZFCPData,
> >      }
> > diff --git a/tests/commands/volgroup.py b/tests/commands/volgroup.py
> > index 46462a4..1142b9d 100644
> > --- a/tests/commands/volgroup.py
> > +++ b/tests/commands/volgroup.py
> > @@ -57,5 +57,31 @@ class F16_TestCase(FC3_TestCase):
> >          self.assert_parse_error("volgroup vg.01 pv.01 --reserved-percent=0",
> >          KickstartValueError)
> >          self.assert_parse_error("volgroup vg.01 pv.01
> >          --reserved-percent=100", KickstartValueError)
> >  
> > +class F21_TestCase(F16_TestCase):
> > +    def runTest(self):
> > +        # cannot run F16_TestCase due to the change of the default PE size
> > +        self.assert_parse("volgroup vg.01 pv.01",
> > +                          "volgroup vg.01 pv.01\n")
> > +
> > +        # Pass - correct usage.
> > +        self.assert_parse("volgroup vg.01 pv.01 --reserved-space=1000",
> > +                          "volgroup vg.01 --reserved-space=1000 pv.01\n")
> > +        self.assert_parse("volgroup vg.01 pv.01 --reserved-percent=50",
> > +                          "volgroup vg.01 --reserved-percent=50 pv.01\n")
> > +
> > +        # --pesize
> > +        self.assert_parse("volgroup vg.01 pv.01 --pesize=70000",
> > +                          "volgroup vg.01 --pesize=70000 pv.01\n")
> > +
> > +        # Fail - missing required argument.
> > +        self.assert_parse_error("volgroup vg.01 pv.01 --reserved-space",
> > KickstartParseError)
> > +        self.assert_parse_error("volgroup vg.01 pv.01 --reserved-percent",
> > KickstartParseError)
> > +
> > +        # Fail - incorrect values.
> > +        self.assert_parse_error("volgroup vg.01 pv.01 --reserved-space=-1",
> > KickstartValueError)
> > +        self.assert_parse_error("volgroup vg.01 pv.01 --reserved-percent=0",
> > KickstartValueError)
> > +        self.assert_parse_error("volgroup vg.01 pv.01
> > --reserved-percent=100", KickstartValueError)
> > +
> > +
> >  if __name__ == "__main__":
> >      unittest.main()
> > --
> > 1.9.0
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
> 
> The patch looks fine, but the commit message doesn't seem to match, since a default is
> being set for --pesize.
Well, it sets the default to 0 which means "choose your own default" for
the users of that data. But I'll add that note to the commit message.

-- 
Vratislav Podzimek

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




More information about the anaconda-patches mailing list