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