Blame 0145-iscsi-iscsiroot.sh-handle-iscsi_firmware-in-online-a.patch

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