[ewg] [PATCH] Installer: use --allow-unsupported-modules if required by distribution

Yossi Etigin yosefe at Voltaire.COM
Thu Mar 19 10:14:29 PDT 2009


 Some distributions (such as SLES11) refuse to load unsupported modules by
default, unless a flag is specified to modprobe or configuration file changed. 
This patch causes all OFED modules to be load with --allow-unsupported-modules
if required.

Signed-off-by: Yossi Etigin <yosefe at voltaire.com>

--

fix bugzilla #1547.

diff --git a/ofed_scripts/openibd b/ofed_scripts/openibd
index d1e4513..da30c59 100755
--- a/ofed_scripts/openibd
+++ b/ofed_scripts/openibd
@@ -60,7 +60,13 @@ if [ $link == $base ] ; then
 else
     RUNMODE=auto    
 fi
-            
+
+# Allow unsupported modules, if disallowed by current configuration            
+modprobe=/sbin/modprobe
+if ${modprobe} -c | grep -q '^allow_unsupported_modules  *0'; then
+    modprobe="${modprobe} --allow-unsupported-modules"
+fi
+
 ACTION=$1
 shift
 max_ports_num_in_hca=0
@@ -781,7 +787,7 @@ start()
     
     # Load Mellanox HCA driver
     if [ "X${MTHCA_LOAD}" == "Xyes" ]; then
-        /sbin/modprobe ib_mthca > /dev/null 2>&1
+        ${modprobe} ib_mthca > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading Mellanox HCA driver: "
@@ -790,7 +796,7 @@ start()
     fi
 
     if [ "X${MLX4_LOAD}" == "Xyes" ]; then
-        /sbin/modprobe mlx4_core > /dev/null 2>&1
+        ${modprobe} mlx4_core > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading Mellanox MLX4 HCA driver: "
@@ -800,7 +806,7 @@ start()
                          . /etc/infiniband/connectx.conf > /dev/null 2>&1
                 fi
         fi
-        /sbin/modprobe mlx4_ib > /dev/null 2>&1
+        ${modprobe} mlx4_ib > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading Mellanox MLX4_IB HCA driver: "
@@ -810,10 +816,10 @@ start()
 
     if [ "X${MLX4_EN_LOAD}" == "Xyes" ]; then
         if ! is_module mlx4_core; then
-                /sbin/modprobe mlx4_core > /dev/null 2>&1
+                ${modprobe} mlx4_core > /dev/null 2>&1
         fi
 
-        /sbin/modprobe mlx4_en > /dev/null 2>&1
+        ${modprobe} mlx4_en > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading Mellanox MLX4_EN HCA driver: "
@@ -823,7 +829,7 @@ start()
 
     # Load QLogic InfiniPath driver
     if [ "X${IPATH_LOAD}" == "Xyes" ]; then
-        /sbin/modprobe ib_ipath > /dev/null 2>&1
+        ${modprobe} ib_ipath > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading QLogic InfiniPath driver: "
@@ -836,7 +842,7 @@ start()
     # Load eHCA driver
     if [ "X${EHCA_LOAD}" == "Xyes" ]; then
         fix_location_codes
-        /sbin/modprobe ib_ehca > /dev/null 2>&1
+        ${modprobe} ib_ehca > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading eHCA driver: "
@@ -847,7 +853,7 @@ start()
     # Load iw_cxgb3 driver
     if [ "X${CXGB3_LOAD}" == "Xyes" ]; then
         fix_location_codes
-        /sbin/modprobe iw_cxgb3 > /dev/null 2>&1
+        ${modprobe} iw_cxgb3 > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading cxgb3 driver: "
@@ -858,7 +864,7 @@ start()
     # Load iw_nes driver
     if [ "X${NES_LOAD}" == "Xyes" ]; then
         fix_location_codes
-        /sbin/modprobe iw_nes > /dev/null 2>&1
+        ${modprobe} iw_nes > /dev/null 2>&1
         my_rc=$?
         if [ $my_rc -ne 0 ]; then
                 echo_failure $"Loading nes driver: "
@@ -890,13 +896,13 @@ EOF
     chmod 755 /tmp/ib_set_node_desc.sh
     /tmp/ib_set_node_desc.sh > /dev/null 2>&1 &
 
-    /sbin/modprobe ib_umad > /dev/null 2>&1
+    ${modprobe} ib_umad > /dev/null 2>&1
     RC=$[ $RC + $? ]
-    /sbin/modprobe ib_uverbs > /dev/null 2>&1
+    ${modprobe} ib_uverbs > /dev/null 2>&1
     RC=$[ $RC + $? ]
     
     if [ $IPOIB -eq 1 ]; then
-        /sbin/modprobe ib_ipoib > /dev/null 2>&1
+        ${modprobe} ib_ipoib > /dev/null 2>&1
         RC=$[ $RC + $? ]
     fi
 
@@ -997,10 +1003,10 @@ EOF
                 case $mod in
                         ib_iser)
                                 # Voltaire requirement
-                                /sbin/modprobe --force-modversion $mod > /dev/null 2>&1
+                                ${modprobe} --force-modversion $mod > /dev/null 2>&1
                         ;;
                         ib_srp)
-                                /sbin/modprobe $mod > /dev/null 2>&1
+                                ${modprobe} $mod > /dev/null 2>&1
                                 if [ "X${SRPHA_ENABLE}" == "Xyes" ]; then
                                     if [ ! -x /sbin/multipath ]; then
                                         echo "/sbin/multipath is required to enable SRP HA."
@@ -1012,7 +1018,7 @@ EOF
 ACTION=="add", KERNEL=="sd*[!0-9]", RUN+="/sbin/multipath %M:%m"
 EOF
                                         fi
-                                        /sbin/modprobe dm_multipath > /dev/null 2>&1
+                                        ${modprobe} dm_multipath > /dev/null 2>&1
                                         srp_daemon.sh &
                                         srp_daemon_pid=$!
                                         echo ${srp_daemon_pid} > ${srp_daemon_pidfile}
@@ -1024,7 +1030,7 @@ EOF
                                 fi
                         ;;
                         *)
-                                /sbin/modprobe $mod > /dev/null 2>&1
+                                ${modprobe} $mod > /dev/null 2>&1
                         ;;
                 esac
                 RC=$?
@@ -1130,7 +1136,7 @@ unload()
 		case $mod in
 			ib_ipath)
 				# infinipath depends on modprobe.conf remove rule
-				/sbin/modprobe -v -r $mod > /dev/null 2>&1
+				${modprobe} -v -r $mod > /dev/null 2>&1
 				sleep 2
 			;;
 			ib_mthca | mlx4_ib | ib_ehca | iw_cxgb3 |iw_nes)
@@ -1138,8 +1144,8 @@ unload()
 				sleep 2
 			;;
 			*)
-			# is_module ib_ipoib && /sbin/modprobe -r ib_ipoib > /dev/null 2>&1
-                	/sbin/modprobe -r $mod > /dev/null 2>&1
+			# is_module ib_ipoib && ${modprobe} -r ib_ipoib > /dev/null 2>&1
+                	${modprobe} -r $mod > /dev/null 2>&1
                 	if [ $? -ne 0 ] || is_module $mod; then
                 	        # Try rmmod if modprobe failed: case that previous installation included more IB modules.
                 	        rm_mod $mod


-- 
--Yossi



More information about the ewg mailing list