File 0309-95iscsi-Do-not-require-network-for-qla4xxx-flash-ses.patch of Package dracut.4406

From: Hannes Reinecke <hare@suse.de>
Date: Mon, 19 Oct 2015 14:02:19 +0200
Subject: 95iscsi: Do not require network for qla4xxx flash sessions

qla4xxx can store boot sessions in flash, which will then
not show up with iBFT. These boot sesssions will be maintained
by the driver; no specific network configuration is required
here. So suppress network setup for these cases.

References: bsc#935320

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 modules.d/95iscsi/module-setup.sh | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 53179d1..276d1ce 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -45,7 +45,7 @@ install_ibft() {
 
 install_iscsiroot() {
     local devpath=$1
-    local scsi_path iscsi_lun session c d conn
+    local scsi_path iscsi_lun session c d conn host flash
     local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
 
     scsi_path=${devpath%%/block*}
@@ -56,6 +56,19 @@ install_iscsiroot() {
     [ "$session" = "$devpath" ] && return 1
     iscsi_session=${session##*/}
     [ "$iscsi_session" = "$session" ] && return 1
+    host=${session%%/session*}
+    [ "$host" = "$session" ] && return 1
+    iscsi_host=${host##*/}
+
+    for flash in ${host}/flashnode_sess-* ; do
+        is_boot=$(cat $flash/is_boot_target)
+        if [ $is_boot -eq 1 ] ; then
+            # qla4xxx flashnode session; skip iBFT discovery
+            iscsi_initiator=$(cat /sys/class/iscsi_host/${iscsi_host}/initiatorname)
+            echo "rd.iscsi.initiator=${iscsi_initiator}"
+            return;
+        fi
+    done
 
     for d in ${session}/* ; do
         case $d in
@@ -110,6 +123,7 @@ install_iscsiroot() {
         # can sort out rd.iscsi.initiator= duplicates
         echo "rd.iscsi.initiator=${iscsi_initiator}"
         echo "netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
+        echo "rd.neednet=1"
     fi
     return 0
 }
@@ -244,8 +258,6 @@ install() {
         [[ $_iscsiconf ]] && printf "%s\n" "$_iscsiconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
     fi
 
-    echo 'rd.neednet=1' >> "${initdir}/etc/cmdline.d/95iscsi.conf"
-
     inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
     inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
     inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
-- 
1.8.4.5

openSUSE Build Service is sponsored by