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

[PATCH pykickstart rhel6-branch] iscsi: add support for interface binding (#500273)



iscsi --iface=eth0

Resolves: rhbz#500273
---
 pykickstart/commands/iscsi.py   |   26 ++++++++++++++++++++++++++
 pykickstart/handlers/control.py |    4 ++--
 tests/commands/iscsi.py         |    5 +++++
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/pykickstart/commands/iscsi.py b/pykickstart/commands/iscsi.py
index da5a544..944f13c 100644
--- a/pykickstart/commands/iscsi.py
+++ b/pykickstart/commands/iscsi.py
@@ -77,6 +77,22 @@ class F10_IscsiData(FC6_IscsiData):
 
         return retval
 
+class RHEL6_IscsiData(F10_IscsiData):
+    removedKeywords = F10_IscsiData.removedKeywords
+    removedAttrs = F10_IscsiData.removedAttrs
+
+    def __init__(self, *args, **kwargs):
+        F10_IscsiData.__init__(self, *args, **kwargs)
+        self.iface = kwargs.get("iface", None)
+
+    def _getArgsAsStr(self):
+        retval = F10_IscsiData._getArgsAsStr(self)
+
+        if self.iface is not None:
+            retval += " --iface=%s" % self.iface
+
+        return retval
+
 class FC6_Iscsi(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -131,3 +147,13 @@ class F10_Iscsi(FC6_Iscsi):
         op.add_option("--reverse-password", dest="password_in", action="store",
                       type="string")
         return op
+
+class RHEL6_Iscsi(F10_Iscsi):
+    removedKeywords = F10_Iscsi.removedKeywords
+    removedAttrs = F10_Iscsi.removedAttrs
+
+    def _getParser(self):
+        op = F10_Iscsi._getParser(self)
+        op.add_option("--iface", dest="iface", action="store",
+                      type="string")
+        return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index e89d10c..ec7cf22 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -833,7 +833,7 @@ commandMap = {
         "ignoredisk": ignoredisk.RHEL6_IgnoreDisk,
         "install": upgrade.F11_Upgrade,
         "interactive": interactive.FC3_Interactive,
-        "iscsi": iscsi.F10_Iscsi,
+        "iscsi": iscsi.RHEL6_Iscsi,
         "iscsiname": iscsiname.FC6_IscsiName,
         "key": key.F7_Key,
         "keyboard": keyboard.FC3_Keyboard,
@@ -1067,7 +1067,7 @@ dataMap = {
         "DmRaidData": dmraid.FC6_DmRaidData,
         "FcoeData": fcoe.F13_FcoeData,
         "GroupData": group.F12_GroupData,
-        "IscsiData": iscsi.F10_IscsiData,
+        "IscsiData": iscsi.RHEL6_IscsiData,
         "LogVolData": logvol.F12_LogVolData,
         "MultiPathData": multipath.FC6_MultiPathData,
         "NetworkData": network.RHEL6_NetworkData,
diff --git a/tests/commands/iscsi.py b/tests/commands/iscsi.py
index 6bf312a..7abfea2 100644
--- a/tests/commands/iscsi.py
+++ b/tests/commands/iscsi.py
@@ -65,6 +65,11 @@ class F10_TestCase(FC6_TestCase):
         self.assert_parse_error("iscsi --ipaddr=1.1.1.1 --reverse-user", KickstartParseError)
         self.assert_parse_error("iscsi --ipaddr=1.1.1.1 --reverse-password", KickstartParseError)
 
+class RHEL6_TestCase(F10_TestCase):
+    def runTest(self):
+        F10_TestCase.runTest(self)
+
+        self.assert_parse("iscsi --ipaddr=1.1.1.1 --iface=eth0\n")
 
 if __name__ == "__main__":
     unittest.main()
-- 
1.7.4


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