[PATCH 1/2] pykickstart: Add fcoe command (take 2)

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

 



Add an command to activate FCoE attached SAN's from kickstart
---
 pykickstart/commands/__init__.py |    4 +-
 pykickstart/commands/fcoe.py     |   73 ++++++++++++++++++++++++++++++++++++++
 pykickstart/handlers/control.py  |    2 +
 3 files changed, 77 insertions(+), 2 deletions(-)
 create mode 100644 pykickstart/commands/fcoe.py

diff --git a/pykickstart/commands/__init__.py b/pykickstart/commands/__init__.py
index 7ce21f7..0952bf8 100644
--- a/pykickstart/commands/__init__.py
+++ b/pykickstart/commands/__init__.py
@@ -18,8 +18,8 @@
 # with the express permission of Red Hat, Inc. 
 #
 import authconfig, autopart, autostep, bootloader, clearpart, device
-import deviceprobe, displaymode, dmraid, driverdisk, firewall, firstboot, group
-import ignoredisk, interactive, iscsi, iscsiname, key, keyboard, lang
+import deviceprobe, displaymode, dmraid, driverdisk, fcoe, firewall, firstboot
+import group, ignoredisk, interactive, iscsi, iscsiname, key, keyboard, lang
 import langsupport, lilocheck, logging, logvol, mediacheck, method, monitor
 import mouse, multipath, network, partition, raid, reboot, repo, rescue, rootpw
 import selinux, services, skipx, timezone, updates, upgrade, user, vnc
diff --git a/pykickstart/commands/fcoe.py b/pykickstart/commands/fcoe.py
new file mode 100644
index 0000000..e3ffce8
--- /dev/null
+++ b/pykickstart/commands/fcoe.py
@@ -0,0 +1,73 @@
+#
+# Hans de Goede <hdegoede@xxxxxxxxxx>
+#
+# Copyright 2009 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the GNU
+# General Public License v.2.  This program is distributed in the hope that it
+# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
+# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
+# trademarks that are incorporated in the source code or documentation are not
+# subject to the GNU General Public License and may only be used or replicated
+# with the express permission of Red Hat, Inc. 
+#
+from pykickstart.base import *
+from pykickstart.options import *
+
+class F12_FcoeData(BaseData):
+    removedKeywords = BaseData.removedKeywords
+    removedAttrs = BaseData.removedAttrs
+
+    def __init__(self, *args, **kwargs):
+        BaseData.__init__(self, *args, **kwargs)
+        self.nic = kwargs.get("nic", None)
+
+    def __str__(self):
+        retval = BaseData.__str__(self)
+        retval += "fcoe"
+
+        if self.nic:
+            retval += " --nic=%s" % self.nic
+
+        return retval + "\n"
+
+
+class F12_Fcoe(KickstartCommand):
+    removedKeywords = KickstartCommand.removedKeywords
+    removedAttrs = KickstartCommand.removedAttrs
+
+    def __init__(self, writePriority=71, *args, **kwargs):
+        KickstartCommand.__init__(self, writePriority, *args, **kwargs)
+        self.op = self._getParser()
+        self.fcoe = kwargs.get("fcoe", [])
+
+    def __str__(self):
+        retval = ""
+        for fcoe in self.fcoe:
+            retval += fcoe.__str__()
+
+        return retval
+
+    def _getParser(self):
+        op = KSOptionParser()
+        op.add_option("--nic", dest="nic", required=1)
+        return op
+
+    def parse(self, args):
+        zd = self.handler.FcoeData()
+        (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
+        if len(extra) > 0:
+            mapping = {"command": "fcoe", "options": extra}
+            raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping)
+
+        self._setToObj(self.op, opts, zd)
+        return zd
+
+    def dataList(self):
+        return self.fcoe
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 8e1ab66..8f78c3e 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -541,6 +541,7 @@ commandMap = {
         "deviceprobe": deviceprobe.FC3_DeviceProbe,
         "dmraid": dmraid.FC6_DmRaid,
         "driverdisk": driverdisk.FC3_DriverDisk,
+        "fcoe": fcoe.F12_Fcoe,
         "firewall": firewall.F10_Firewall,
         "firstboot": firstboot.FC3_Firstboot,
         "graphical": displaymode.FC3_DisplayMode,
@@ -873,6 +874,7 @@ dataMap = {
         "DriverDiskData": driverdisk.F12_DriverDiskData,
         "DeviceData": device.F8_DeviceData,
         "DmRaidData": dmraid.FC6_DmRaidData,
+        "FcoeData": fcoe.F12_FcoeData,
         "GroupData": group.F12_GroupData,
         "IscsiData": iscsi.F10_IscsiData,
         "LogVolData": logvol.F9_LogVolData,
-- 
1.6.2.2

_______________________________________________
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