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

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