[pykickstart] [PATCH] Add swap --hibernation to logvol command

Vratislav Podzimek vpodzime at redhat.com
Tue Aug 21 12:42:54 UTC 2012


(port of 644da54ac194b0489440aa85c9985735361f7570 from rhel6-branch)
---
 pykickstart/commands/logvol.py  | 20 ++++++++++++++++++++
 pykickstart/handlers/control.py |  4 ++--
 tests/commands/logvol.py        |  8 ++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/pykickstart/commands/logvol.py b/pykickstart/commands/logvol.py
index 82e349e..1e6579e 100644
--- a/pykickstart/commands/logvol.py
+++ b/pykickstart/commands/logvol.py
@@ -196,6 +196,19 @@ class F17_LogVolData(F15_LogVolData):
 
         return retval
 
+class F18_LogVolData(F17_LogVolData):
+    def __init__(self, *args, **kwargs):
+        F17_LogVolData.__init__(self, *args, **kwargs)
+        self.hibernation = kwargs.get("hibernation", False)
+
+    def _getArgsAsStr(self):
+        retval = F17_LogVolData._getArgsAsStr(self)
+
+        if self.hibernation:
+            retval += " --hibernation"
+
+        return retval
+
 class FC3_LogVol(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -337,3 +350,10 @@ class F17_LogVol(F15_LogVol):
             raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("--resize requires --size to indicate new size")))
 
         return retval
+
+class F18_LogVol(F17_LogVol):
+    def _getParser(self):
+        op = F17_LogVol._getParser(self)
+        op.add_option("--hibernation", action="store_true", default=False)
+        return op
+
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 6ffaff0..ad55906 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -913,7 +913,7 @@ commandMap = {
         "keyboard": keyboard.F18_Keyboard,
         "lang": lang.FC3_Lang,
         "logging": logging.FC6_Logging,
-        "logvol": logvol.F17_LogVol,
+        "logvol": logvol.F18_LogVol,
         "mediacheck": mediacheck.FC4_MediaCheck,
         "multipath": multipath.FC6_MultiPath,
         "network": network.F16_Network,
@@ -1461,7 +1461,7 @@ dataMap = {
         "FcoeData": fcoe.F13_FcoeData,
         "GroupData": group.F12_GroupData,
         "IscsiData": iscsi.F17_IscsiData,
-        "LogVolData": logvol.F17_LogVolData,
+        "LogVolData": logvol.F18_LogVolData,
         "MultiPathData": multipath.FC6_MultiPathData,
         "NetworkData": network.F16_NetworkData,
         "PartData": partition.F18_PartData,
diff --git a/tests/commands/logvol.py b/tests/commands/logvol.py
index 97ab01b..e255faf 100644
--- a/tests/commands/logvol.py
+++ b/tests/commands/logvol.py
@@ -207,6 +207,14 @@ class F17_TestCase(F15_TestCase):
         # no size
         self.assert_parse_error("logvol /x --name=NAME --vgname=VGNAME --resize --useexisting")
 
+class F18_TestCase(F17_TestCase):
+    def runTest(self):
+        F17_TestCase.runTest(self)
+
+        self.assert_parse("logvol swap --name=NAME --vgname=VGNAME "\
+                          "--hibernation")
+        self.assert_parse("logvol swap --name=NAME --vgname=VGNAME "\
+                          "--recommended --hibernation")
 
 if __name__ == "__main__":
     unittest.main()
-- 
1.7.11.2



More information about the anaconda-patches mailing list