[pykickstart] [PATCH] Add swap --hibernation to logvol command
Vratislav Podzimek
vpodzime at redhat.com
Fri Aug 17 12:28:29 UTC 2012
Commit 9111f0e491f97f6153bbaf4f2e69d192fbe6b768 adds this for the
part swap command, but expected behaviour is that this option works
also when using LVM for swap.
Resolves: rhbz#848818
---
pykickstart/commands/logvol.py | 28 ++++++++++++++++++++++++++++
pykickstart/commands/partition.py | 2 +-
pykickstart/handlers/control.py | 4 ++--
tests/commands/logvol.py | 12 ++++++++++++
4 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/pykickstart/commands/logvol.py b/pykickstart/commands/logvol.py
index a7ccabc..e40879b 100644
--- a/pykickstart/commands/logvol.py
+++ b/pykickstart/commands/logvol.py
@@ -160,6 +160,23 @@ class F12_LogVolData(F9_LogVolData):
return retval
+class RHEL6_LogVolData(F12_LogVolData):
+ removedKeywords = F12_LogVolData.removedKeywords
+ removedAttrs = F12_LogVolData.removedAttrs
+
+ def __init__(self, *args, **kwargs):
+ F12_LogVolData.__init__(self, *args, **kwargs)
+
+ self.hibernation = kwargs.get("hibernation", False)
+
+ def _getArgsAsStr(self):
+ retval = F12_LogVolData._getArgsAsStr(self)
+
+ if self.hibernation:
+ retval += " --hibernation"
+
+ return retval
+
class FC3_LogVol(KickstartCommand):
removedKeywords = KickstartCommand.removedKeywords
removedAttrs = KickstartCommand.removedAttrs
@@ -266,3 +283,14 @@ class F12_LogVol(F9_LogVol):
op.add_option("--escrowcert")
op.add_option("--backuppassphrase", action="store_true", default=False)
return op
+
+class RHEL6_LogVol(F12_LogVol):
+ removedKeywords = F12_LogVol.removedKeywords
+ removedAttrs = F12_LogVol.removedAttrs
+
+ def _getParser(self):
+ op = F12_LogVol._getParser(self)
+ op.add_option("--hibernation", dest="hibernation", action="store_true",
+ default=False)
+
+ return op
diff --git a/pykickstart/commands/partition.py b/pykickstart/commands/partition.py
index a0357cb..a70fe7e 100644
--- a/pykickstart/commands/partition.py
+++ b/pykickstart/commands/partition.py
@@ -190,7 +190,7 @@ class RHEL6_PartData(F12_PartData):
self.hibernation = kwargs.get("hibernation", False)
def _getArgsAsStr(self):
- retval = F11_PartData._getArgsAsStr(self)
+ retval = F12_PartData._getArgsAsStr(self)
if self.hibernation:
retval += "--hibernation"
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index e347f58..3a4ca1f 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -839,7 +839,7 @@ commandMap = {
"keyboard": keyboard.FC3_Keyboard,
"lang": lang.FC3_Lang,
"logging": logging.FC6_Logging,
- "logvol": logvol.F12_LogVol,
+ "logvol": logvol.RHEL6_LogVol,
"mediacheck": mediacheck.FC4_MediaCheck,
"monitor": monitor.F10_Monitor,
"multipath": multipath.FC6_MultiPath,
@@ -1068,7 +1068,7 @@ dataMap = {
"FcoeData": fcoe.F13_FcoeData,
"GroupData": group.F12_GroupData,
"IscsiData": iscsi.RHEL6_IscsiData,
- "LogVolData": logvol.F12_LogVolData,
+ "LogVolData": logvol.RHEL6_LogVolData,
"MultiPathData": multipath.FC6_MultiPathData,
"NetworkData": network.RHEL6_NetworkData,
"PartData": partition.RHEL6_PartData,
diff --git a/tests/commands/logvol.py b/tests/commands/logvol.py
index ec813b1..abf6128 100644
--- a/tests/commands/logvol.py
+++ b/tests/commands/logvol.py
@@ -234,5 +234,17 @@ class F12_TestCase(F9_TestCase):
self.assert_parse_error("logvol / --backuppassphrase=True --name=NAME "
"--vgname=VGNAME")
+class RHEL6_TestCase(F12_TestCase):
+ def setUp(self):
+ F12_TestCase.setUp(self)
+
+ def runTest(self):
+ F12_TestCase.runTest(self)
+
+ self.assert_parse("logvol swap --hibernation "
+ "--name=NAME --vgname=VGNAME")
+ self.assert_parse("logvol swap --recommended --hibernation "
+ "--name=NAME --vgname=VGNAME")
+
if __name__ == "__main__":
unittest.main()
--
1.7.11.2
More information about the anaconda-patches
mailing list