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

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