[PATCH] Add --same-as-ram option for swap size specification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(ported dbc26273105573b072aef1001908dfe4ab61d643 from rhel6-branch)

The test case is missing in the rhel6-branch version. Shall I add it
there too?
---
 pykickstart/commands/partition.py |   30 ++++++++++++++
 pykickstart/handlers/control.py   |   81 +++++++++++++++++++++++++++++++++++++
 tests/commands/partition.py       |    9 ++++
 3 files changed, 120 insertions(+), 0 deletions(-)

diff --git a/pykickstart/commands/partition.py b/pykickstart/commands/partition.py
index 8f2ad25..2da519c 100644
--- a/pykickstart/commands/partition.py
+++ b/pykickstart/commands/partition.py
@@ -202,6 +202,20 @@ class F17_PartData(F14_PartData):
 
         return retval
 
+class F18_PartData(F17_PartData):
+    def __init__(self, *args, **kwargs):
+        F17_PartData.__init__(self, *args, **kwargs)
+
+        self.sameAsRam = kwargs.get("sameAsRam", False)
+
+    def _getArgsAsStr(self):
+        retval = F17_PartData._getArgsAsStr(self)
+
+        if self.sameAsRam:
+            retval += "--same-as-ram"
+
+        return retval
+
 class FC3_Partition(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -383,3 +397,19 @@ class F17_Partition(F14_Partition):
             raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("--resize requires --size to specify new size")))
 
         return retval
+
+class F18_Partition(F17_Partition):
+    def _getParser(self):
+        op = F17_Partition._getParser(self)
+        op.add_option("--same-as-ram", dest="sameAsRam", action="store_true", default=False)
+
+        return op
+
+    def parse(self, args):
+        retval = F17_Partition.parse(self, args)
+
+        if retval.recommended and retval.sameAsRam:
+            raise KickstartValueError(formatErrorMsg(self.lineno,
+                  msg=_("Options --recommended and --same-as-ram are mutually exclusive.")))
+
+        return retval
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 7901ce3..375c667 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -884,6 +884,67 @@ commandMap = {
         "zfcp": zfcp.F14_ZFCP,
     },
 
+    #based on F17
+    F18: {
+        "auth": authconfig.FC3_Authconfig,
+        "authconfig": authconfig.FC3_Authconfig,
+        "autopart": autopart.F17_AutoPart,
+        "autostep": autostep.FC3_AutoStep,
+        "bootloader": bootloader.F17_Bootloader,
+        "btrfs": btrfs.F17_BTRFS,
+        "cdrom": method.F14_Method,
+        "clearpart": clearpart.F17_ClearPart,
+        "cmdline": displaymode.FC3_DisplayMode,
+        "device": device.F8_Device,
+        "deviceprobe": deviceprobe.FC3_DeviceProbe,
+        "dmraid": dmraid.FC6_DmRaid,
+        "driverdisk": driverdisk.F14_DriverDisk,
+        "fcoe": fcoe.F13_Fcoe,
+        "firewall": firewall.F14_Firewall,
+        "firstboot": firstboot.FC3_Firstboot,
+        "graphical": displaymode.FC3_DisplayMode,
+        "group": group.F12_Group,
+        "halt": reboot.FC6_Reboot,
+        "harddrive": method.F14_Method,
+        "ignoredisk": ignoredisk.F14_IgnoreDisk,
+        "install": upgrade.F11_Upgrade,
+        "iscsi": iscsi.F17_Iscsi,
+        "iscsiname": iscsiname.FC6_IscsiName,
+        "keyboard": keyboard.FC3_Keyboard,
+        "lang": lang.FC3_Lang,
+        "logging": logging.FC6_Logging,
+        "logvol": logvol.F17_LogVol,
+        "mediacheck": mediacheck.FC4_MediaCheck,
+        "monitor": monitor.F10_Monitor,
+        "multipath": multipath.FC6_MultiPath,
+        "network": network.F16_Network,
+        "nfs": method.F14_Method,
+        "part": partition.F17_Partition,
+        "partition": partition.F18_Partition,
+        "poweroff": reboot.FC6_Reboot,
+        "raid": raid.F15_Raid,
+        "reboot": reboot.FC6_Reboot,
+        "repo": repo.F15_Repo,
+        "rescue": rescue.F10_Rescue,
+        "rootpw": rootpw.F8_RootPw,
+        "selinux": selinux.FC3_SELinux,
+        "services": services.FC6_Services,
+        "shutdown": reboot.FC6_Reboot,
+        "skipx": skipx.FC3_SkipX,
+        "sshpw": sshpw.F13_SshPw,
+        "text": displaymode.FC3_DisplayMode,
+        "timezone": timezone.FC6_Timezone,
+        "updates": updates.F7_Updates,
+        "upgrade": upgrade.F11_Upgrade,
+        "url": method.F14_Method,
+        "user": user.F12_User,
+        "vnc": vnc.F9_Vnc,
+        "volgroup": volgroup.FC16_VolGroup,
+        "xconfig": xconfig.F14_XConfig,
+        "zerombr": zerombr.F9_ZeroMbr,
+        "zfcp": zfcp.F14_ZFCP,
+    },
+
     # based on fc1
     RHEL3: {
         "auth": authconfig.FC3_Authconfig,
@@ -1394,6 +1455,26 @@ dataMap = {
         "VolGroupData": volgroup.FC16_VolGroupData,
         "ZFCPData": zfcp.F14_ZFCPData,
     },
+    #based on F17
+    F18: {
+        "BTRFSData": btrfs.F17_BTRFSData,
+        "DriverDiskData": driverdisk.F14_DriverDiskData,
+        "DeviceData": device.F8_DeviceData,
+        "DmRaidData": dmraid.FC6_DmRaidData,
+        "FcoeData": fcoe.F13_FcoeData,
+        "GroupData": group.F12_GroupData,
+        "IscsiData": iscsi.F17_IscsiData,
+        "LogVolData": logvol.F17_LogVolData,
+        "MultiPathData": multipath.FC6_MultiPathData,
+        "NetworkData": network.F16_NetworkData,
+        "PartData": partition.F18_PartData,
+        "RaidData": raid.F15_RaidData,
+        "RepoData": repo.F15_RepoData,
+        "SshPwData": sshpw.F13_SshPwData,
+        "UserData": user.F12_UserData,
+        "VolGroupData": volgroup.FC16_VolGroupData,
+        "ZFCPData": zfcp.F14_ZFCPData,
+    },
     RHEL3: {
         "DriverDiskData": driverdisk.FC3_DriverDiskData,
         "LogVolData": logvol.FC3_LogVolData,
diff --git a/tests/commands/partition.py b/tests/commands/partition.py
index 979f0ff..28e34a3 100644
--- a/tests/commands/partition.py
+++ b/tests/commands/partition.py
@@ -174,5 +174,14 @@ class F17_TestCase(F14_TestCase):
         # no size
         self.assert_parse_error("part /foo --onpart=LABEL=var --resize")
 
+class F18_TestCase(F17_TestCase):
+    def runTest(self):
+        F17_TestCase.runTest(self)
+        self.assert_parse("part swap --recommended")
+        self.assert_parse("part swap --same-as-ram")
+
+        #recommended and same-as-ram cannot be used together
+        self.assert_parse_error("part swap --recommended --same-as-ram")
+
 if __name__ == "__main__":
     unittest.main()
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux