Blame SOURCES/0373-95iscsi-Autodetect-iSCSI-firmware.patch

18971c
From f31220ec883956f459bc227d6fe35d3a581eb369 Mon Sep 17 00:00:00 2001
18971c
From: Hannes Reinecke <hare@suse.de>
18971c
Date: Thu, 25 Feb 2016 20:58:09 +0800
18971c
Subject: [PATCH] 95iscsi: Autodetect iSCSI firmware
18971c
18971c
Some iSCSI initiator present firmware information in
18971c
/sys/firmware/ibft or /sys/firmware/iscsi_bootX
18971c
18971c
Whenever we detect one of those directories we should assume
18971c
that the iSCSI devices should be activated.
18971c
18971c
Also incorporates SUSE patches:
18971c
0049:
18971c
95iscsi: Use 'ip=ibft' for ibft autoconfiguration
18971c
18971c
For iBFT autoconfiguration we should be setting 'ip=ibft'
18971c
instead of rd.neednet. This should instruct dracut to only
18971c
enable the iBFT interfaces and leave the rest alone.
18971c
18971c
References: bnc#879038
18971c
18971c
0054:
18971c
95iscsi: update commandline printing
18971c
18971c
dracut has a separate callout 'cmdline' which should be used
18971c
for printing out the generated commandline.
18971c
18971c
Signed-off-by: Pavel Wieczorkiewicz <pwieczorkiewicz@suse.com>
18971c
Signed-off-by: Hannes Reinecke <hare@suse.de>
18971c
Signed-off-by: Thomas Renninger <trenn@suse.de>
18971c
---
18971c
 modules.d/95iscsi/module-setup.sh | 26 ++++++++++++++++++++++++++
18971c
 1 file changed, 26 insertions(+)
18971c
18971c
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
18971c
index 4ecba05e..7ef0caa6 100755
18971c
--- a/modules.d/95iscsi/module-setup.sh
18971c
+++ b/modules.d/95iscsi/module-setup.sh
18971c
@@ -29,6 +29,21 @@ check() {
18971c
     return 0
18971c
 }
18971c
 
18971c
+install_ibft() {
18971c
+    # When iBFT / iscsi_boot is detected:
18971c
+    # - Use 'ip=ibft' to set up iBFT network interface
18971c
+    # - specify firmware booting cmdline parameter
18971c
+
18971c
+    for d in /sys/firmware/* ; do
18971c
+        if [ -d ${d}/initiator ] ; then
18971c
+            if [ ${d##*/} = "ibft" ] ; then
18971c
+                echo -n "ip=ibft "
18971c
+            fi
18971c
+            echo -n "rd.iscsi.firmware=1"
18971c
+        fi
18971c
+    done
18971c
+}
18971c
+
18971c
 depends() {
18971c
     echo network rootfs-block
18971c
 }
18971c
@@ -36,6 +51,12 @@ depends() {
18971c
 installkernel() {
18971c
     local _arch=$(uname -m)
18971c
 
18971c
+    # Detect iBFT and perform mandatory steps
18971c
+    if [[ $hostonly_cmdline == "yes" ]] ; then
18971c
+        install_ibft > "${initdir}/etc/cmdline.d/95iscsi.conf"
18971c
+        echo >> "${initdir}/etc/cmdline.d/95iscsi.conf"
18971c
+    fi
18971c
+
18971c
     instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
18971c
     hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
18971c
     iscsi_module_filter() {
18971c
@@ -75,6 +96,11 @@ installkernel() {
18971c
     | iscsi_module_filter  |  instmods
18971c
 }
18971c
 
18971c
+cmdline() {
18971c
+    install_ibft
18971c
+}
18971c
+
18971c
+# called by dracut
18971c
 install() {
18971c
     inst_multiple umount iscsistart hostname iscsi-iname
18971c
     inst_multiple -o iscsiuio