From c088a5a62c4bf133a5e3b00da3803f2f59974a76 Mon Sep 17 00:00:00 2001 From: Vratislav Podzimek Date: Fri, 19 Sep 2014 15:39:46 +0200 Subject: [PATCH] Add support for specifying thin pool profile Related: rhbz#869456 --- pykickstart/commands/logvol.py | 19 +++++++++++++++++++ pykickstart/handlers/control.py | 2 +- tests/commands/logvol.py | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pykickstart/commands/logvol.py b/pykickstart/commands/logvol.py index 1c5af22..cca3dd1 100644 --- a/pykickstart/commands/logvol.py +++ b/pykickstart/commands/logvol.py @@ -261,6 +261,19 @@ class F20_LogVolData(F18_LogVolData): return retval +class RHEL7_LogVolData(F20_LogVolData): + def __init__(self, *args, **kwargs): + F20_LogVolData.__init__(self, *args, **kwargs) + self.profile = kwargs.get("profile", "") + + def _getArgsAsStr(self): + retval = F20_LogVolData._getArgsAsStr(self) + + if self.profile: + retval += "--profile=%s" % self.profile + + return retval + class FC3_LogVol(KickstartCommand): removedKeywords = KickstartCommand.removedKeywords removedAttrs = KickstartCommand.removedAttrs @@ -483,6 +496,12 @@ class F20_LogVol(F18_LogVol): return retval class RHEL7_LogVol(F20_LogVol): + def _getParser(self): + op = F20_LogVol._getParser(self) + op.add_option("--profile") + + return op + def parse(self, args): retval = F20_LogVol.parse(self, args) diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py index 1c54f3e..91b2767 100644 --- a/pykickstart/handlers/control.py +++ b/pykickstart/handlers/control.py @@ -1723,7 +1723,7 @@ dataMap = { "FcoeData": fcoe.F13_FcoeData, "GroupData": group.F12_GroupData, "IscsiData": iscsi.F17_IscsiData, - "LogVolData": logvol.F20_LogVolData, + "LogVolData": logvol.RHEL7_LogVolData, "MultiPathData": multipath.FC6_MultiPathData, "NetworkData": network.RHEL7_NetworkData, "PartData": partition.F18_PartData, diff --git a/tests/commands/logvol.py b/tests/commands/logvol.py index f738ec2..91e3f2a 100644 --- a/tests/commands/logvol.py +++ b/tests/commands/logvol.py @@ -301,6 +301,11 @@ class RHEL7_TestCase(F20_TestCase): def runTest(self): F20_TestCase.runTest(self) + # --profile should work for all logvol commands even though it may be + # implemented only for some types (thin pool,...) + self.assert_parse("logvol none --name=pool1 --vgname=vg --thinpool --profile=performance --size=500") + self.assert_parse("logvol /home --name=homelv --vgname=vg --profile=performance --size=500") + self.assert_parse_error("logvol /home --name=home --vgname=vg --size=2 --percent=30") if __name__ == "__main__": -- 2.11.4.GIT