[pykickstart][PATCH] Add support for specifying thin pool profile
Vratislav Podzimek
vpodzime at redhat.com
Fri Sep 19 13:46:14 UTC 2014
Related: rhbz#869456
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pykickstart/commands/logvol.py | 30 ++++++++++++++++++++++++++++++
pykickstart/handlers/control.py | 4 ++--
tests/commands/logvol.py | 10 ++++++++++
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/pykickstart/commands/logvol.py b/pykickstart/commands/logvol.py
index 6122f42..eae1f79 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
@@ -473,3 +486,20 @@ class F20_LogVol(F18_LogVol):
raise KickstartParseError(formatErrorMsg(self.lineno, msg=errorMsg))
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)
+
+ if not retval.thin_pool and retval.profile:
+ err = formatErrorMsg(self.lineno,
+ msg=_("--profile can only be used together with --thinpool"))
+ raise KickstartParseError(err)
+
+ return retval
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 53e0378..2738aeb 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -1343,7 +1343,7 @@ commandMap = {
"lang": lang.F19_Lang,
"liveimg": liveimg.F19_Liveimg,
"logging": logging.FC6_Logging,
- "logvol": logvol.F20_LogVol,
+ "logvol": logvol.RHEL7_LogVol,
"mediacheck": mediacheck.FC4_MediaCheck,
"method": method.F19_Method,
"multipath": multipath.FC6_MultiPath,
@@ -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 989ef2c..a3a5ff0 100644
--- a/tests/commands/logvol.py
+++ b/tests/commands/logvol.py
@@ -276,6 +276,16 @@ class F20_TestCase(F18_TestCase):
self.assert_parse_error("logvol none --name=pool1 --vgname=vg "
"--chunksize=512")
+class RHEL7_TestCase(F20_TestCase):
+ def runTest(self):
+ F20_TestCase.runTest(self)
+
+ self.assert_parse("logvol none --name=pool1 --vgname=vg --thinpool --profile=performance",
+ "logvol none --thinpool --profile=performance --name=pool1 --vgname=vg\n")
+
+ # --profile can only be specified for the pool
+ self.assert_parse_error("logvol /home --name=home --vgname=vg "
+ "--thin --poolname=pool1 --profile=performance")
if __name__ == "__main__":
unittest.main()
--
1.9.3
More information about the anaconda-patches
mailing list