Blame SOURCES/0342-iscsi-iscsiroot.sh-handle-iscsi_firmware-in-online-a.patch

64b87c
From fd3eddf06990a617a2f90b0a699947ab3faf2cc2 Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Thu, 10 Sep 2015 13:25:13 +0200
64b87c
Subject: [PATCH] iscsi/iscsiroot.sh: handle iscsi_firmware in online and
64b87c
 timeout queue
64b87c
64b87c
The return code of iscsi_firmware is broken, so set the marker
64b87c
unconditionally.
64b87c
---
49e6a8
 modules.d/95iscsi/iscsiroot.sh | 43 +++++++++++++++-------------------
64b87c
 1 file changed, 19 insertions(+), 24 deletions(-)
64b87c
64b87c
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
1755ca
index 424d2166..ea1bead7 100755
64b87c
--- a/modules.d/95iscsi/iscsiroot.sh
64b87c
+++ b/modules.d/95iscsi/iscsiroot.sh
64b87c
@@ -45,29 +45,23 @@ fi
64b87c
 
64b87c
 handle_firmware()
64b87c
 {
64b87c
-    if ! [ -e /tmp/iscsistarted-firmware ]; then
64b87c
-        if ! iscsistart -f; then
64b87c
-            warn "iscistart: Could not get list of targets from firmware."
64b87c
-            return 1
64b87c
-        fi
64b87c
+    if ! iscsistart -f; then
64b87c
+        warn "iscistart: Could not get list of targets from firmware."
64b87c
+        return 1
64b87c
+    fi
64b87c
 
64b87c
-        for p in $(getargs rd.iscsi.param -d iscsi_param); do
64b87c
-	    iscsi_param="$iscsi_param --param $p"
64b87c
-        done
64b87c
+    for p in $(getargs rd.iscsi.param -d iscsi_param); do
64b87c
+	iscsi_param="$iscsi_param --param $p"
64b87c
+    done
64b87c
 
64b87c
-        if ! iscsistart -b $iscsi_param; then
64b87c
-            warn "'iscsistart -b $iscsi_param' failed"
64b87c
-        fi
64b87c
+    if ! iscsistart -b $iscsi_param; then
64b87c
+        warn "'iscsistart -b $iscsi_param' failed with return code $?"
64b87c
+    fi
64b87c
 
64b87c
-        if [ -d /sys/class/iscsi_session ]; then
64b87c
-            echo 'started' > "/tmp/iscsistarted-iscsi:"
64b87c
-            echo 'started' > "/tmp/iscsistarted-firmware"
64b87c
-        else
64b87c
-            return 1
64b87c
-        fi
64b87c
+    echo 'started' > "/tmp/iscsistarted-iscsi:"
64b87c
+    echo 'started' > "/tmp/iscsistarted-firmware"
64b87c
 
64b87c
-        need_shutdown
64b87c
-    fi
64b87c
+    need_shutdown
64b87c
     return 0
64b87c
 }
64b87c
 
64b87c
@@ -238,15 +232,16 @@ if [ "$netif" = "timeout" ] && all_ifaces_setup; then
64b87c
     sleep 2
64b87c
 fi
64b87c
 
64b87c
-if [ "$netif" = "online" ]; then
64b87c
-    if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
64b87c
+if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
64b87c
+    if [ "$netif" = "timeout" ] || [ "$netif" = "online" ]; then
64b87c
         handle_firmware
64b87c
         ret=$?
64b87c
     fi
64b87c
-else
64b87c
+fi
64b87c
+
64b87c
+if ! [ "$netif" = "online" ]; then
64b87c
     # loop over all netroot parameter
64b87c
-    nroot=$(getarg netroot)
64b87c
-    if [ $? -eq 0 ] && [ "$nroot" != "dhcp" ]; then
64b87c
+    if nroot=$(getarg netroot) && [ "$nroot" != "dhcp" ]; then
64b87c
         for nroot in $(getargs netroot); do
64b87c
             [ "${nroot%%:*}" = "iscsi" ] || continue
64b87c
             nroot="${nroot##iscsi:}"