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

[rhel6-branch 1/3] fcoe: load bnx2fc if relevant.



Related: rhbz#641420
---
 iutil.py        |    6 ++++++
 storage/fcoe.py |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/iutil.py b/iutil.py
index ff1ef14..80eecc6 100644
--- a/iutil.py
+++ b/iutil.py
@@ -939,3 +939,9 @@ def find_program_in_path(prog, raise_on_error=False):
     if raise_on_error:
         raise RuntimeError("Unable to locate a needed executable: '%s'" % prog)
     return None
+
+def lsmod():
+    """ Returns list of names of all loaded modules. """
+    with open("/proc/modules") as f:
+        lines = f.readlines()
+    return [l.split()[0] for l in lines]
diff --git a/storage/fcoe.py b/storage/fcoe.py
index 8c5d921..4260dbf 100644
--- a/storage/fcoe.py
+++ b/storage/fcoe.py
@@ -36,6 +36,10 @@ def has_fcoe():
         iutil.execWithRedirect("modprobe", [ "fcoe" ],
                                stdout = "/dev/tty5", stderr="/dev/tty5")
         _fcoe_module_loaded = True
+        if "bnx2x" in iutil.lsmod():
+            log.info("fcoe: loading bnx2fc")
+            iutil.execWithRedirect("modprobe", [ "bnx2fc" ],
+                                   stdout = "/dev/tty5", stderr="/dev/tty5")
 
     return os.access("/sys/module/fcoe", os.X_OK)
 
-- 
1.7.6


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