summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-07-02 11:31:19 +0200
committerHans de Goede <hdegoede@redhat.com>2009-07-02 22:05:40 +0200
commit81334650378fe67bf9adc22daf67ccf41688be04 (patch)
treefaab618c7164ebd6de2776ca8a58f0b12139636c /storage
parent4031b12d3e59a6904ad3ab8c092c5a101216f2f6 (diff)
downloadanaconda-81334650378fe67bf9adc22daf67ccf41688be04.tar.gz
anaconda-81334650378fe67bf9adc22daf67ccf41688be04.tar.xz
anaconda-81334650378fe67bf9adc22daf67ccf41688be04.zip
Initial FCoE support
This patch adds support for using FCoE during the installation. This patch merely lays the initial ground work, there is more work todo: - The system will not boot without manual help after the install, as dracut / mkinitrd do not support FCoE yet - If FCoE is not used for / but for example for /srv, then information about the nic used for FCoE needs to be written in a to be defined config file in the system, and rc.sysinit needs to be thought to read this file and bring up FCoE SAN's / Fabrics not used for / - kickstart support for FCoE still needs to be done
Diffstat (limited to 'storage')
-rw-r--r--storage/__init__.py5
-rw-r--r--storage/fcoe.py92
2 files changed, 97 insertions, 0 deletions
diff --git a/storage/__init__.py b/storage/__init__.py
index 572c7448e..03b987619 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -46,6 +46,7 @@ from devicelibs.lvm import safeLvmName
from devicelibs.dm import name_from_dm_node
from udev import *
import iscsi
+import fcoe
import zfcp
import gettext
@@ -204,6 +205,7 @@ class Storage(object):
self.__luksDevs = {}
self.iscsi = iscsi.iscsi()
+ self.fcoe = fcoe.fcoe()
self.zfcp = zfcp.ZFCP()
self._nextID = 0
@@ -269,6 +271,7 @@ class Storage(object):
w = self.anaconda.intf.waitWindow(_("Finding Devices"),
_("Finding storage devices..."))
self.iscsi.startup(self.anaconda.intf)
+ self.fcoe.startup(self.anaconda.intf)
self.zfcp.startup()
if self.anaconda.id.getUpgrade():
clearPartType = CLEARPART_TYPE_NONE
@@ -913,6 +916,7 @@ class Storage(object):
def write(self, instPath):
self.fsset.write(instPath)
self.iscsi.write(instPath, self.anaconda)
+ self.fcoe.write(instPath, self.anaconda)
self.zfcp.write(instPath)
def writeKS(self, f):
@@ -980,6 +984,7 @@ class Storage(object):
f.write("\n")
self.iscsi.writeKS(f)
+ self.fcoe.writeKS(f)
self.zfcp.writeKS(f)
diff --git a/storage/fcoe.py b/storage/fcoe.py
new file mode 100644
index 000000000..46c5bcb9c
--- /dev/null
+++ b/storage/fcoe.py
@@ -0,0 +1,92 @@
+#
+# fcoe.py - fcoe class
+#
+# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty 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, see <http://www.gnu.org/licenses/>.
+#
+
+import os
+import iutil
+import logging
+import time
+log = logging.getLogger("anaconda")
+
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+
+_fcoe_module_loaded = False
+
+def has_fcoe():
+ global _fcoe_module_loaded
+ if not _fcoe_module_loaded:
+ iutil.execWithRedirect("modprobe", [ "fcoe" ],
+ stdout = "/dev/tty5", stderr="/dev/tty5",
+ searchPath = 1)
+ _fcoe_module_loaded = True
+
+ return os.access("/sys/module/fcoe", os.X_OK)
+
+class fcoe(object):
+ def __init__(self):
+ self.started = False
+ self.nics = []
+
+ def _stabilize(self, intf = None):
+ if intf:
+ w = intf.waitWindow(_("Connecting to FCoE SAN"),
+ _("Connecting to FCoE SAN"))
+
+ # I have no clue how long we need to wait, this ought to do the trick
+ time.sleep(10)
+ iutil.execWithRedirect("udevadm", [ "settle" ],
+ stdout = "/dev/tty5", stderr="/dev/tty5",
+ searchPath = 1)
+ if intf:
+ w.pop()
+
+ def startup(self, intf = None):
+ if self.started:
+ return
+
+ if not has_fcoe():
+ return
+
+ # Place holder for adding autodetection of FCoE setups based on
+ # firmware tables (like iBFT for iSCSI)
+
+ self.started = True
+
+ def addSan(self, nic, intf=None):
+ if not has_fcoe():
+ raise IOError, _("FCoE not available")
+
+ log.info("Activating FCoE SAN attached to %s" % nic)
+
+ f = open("/sys/module/fcoe/parameters/create", "w")
+ f.write(nic)
+ f.close()
+
+ self._stabilize(intf)
+ self.nics.append(nic)
+
+ def writeKS(self, f):
+ # fixme plenty (including add ks support for fcoe in general)
+ return
+
+ def write(self, instPath, anaconda):
+ # erm, do we need todo anything here ?
+ return
+
+# vim:tw=78:ts=4:et:sw=4