]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
iscsi/iscsiroot.sh: handle iscsi_firmware in online and timeout queue
authorHarald Hoyer <harald@redhat.com>
Thu, 10 Sep 2015 11:25:13 +0000 (13:25 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 11 Nov 2015 15:44:36 +0000 (16:44 +0100)
The return code of iscsi_firmware is broken, so set the marker
unconditionally.

(cherry picked from commit fd3eddf06990a617a2f90b0a699947ab3faf2cc2)

modules.d/95iscsi/iscsiroot.sh

index b14a71b9ec7ddf7464e2223b94ce330f195362dd..5752cce8e79044b9ee3ca33b68c66ef2f9d273ba 100755 (executable)
@@ -43,29 +43,23 @@ fi
 
 handle_firmware()
 {
-    if ! [ -e /tmp/iscsistarted-firmware ]; then
-        if ! iscsistart -f; then
-            warn "iscistart: Could not get list of targets from firmware."
-            return 1
-        fi
+    if ! iscsistart -f; then
+        warn "iscistart: Could not get list of targets from firmware."
+        return 1
+    fi
 
-        for p in $(getargs rd.iscsi.param -d iscsi_param); do
-           iscsi_param="$iscsi_param --param $p"
-        done
+    for p in $(getargs rd.iscsi.param -d iscsi_param); do
+       iscsi_param="$iscsi_param --param $p"
+    done
 
-        if ! iscsistart -b $iscsi_param; then
-            warn "'iscsistart -b $iscsi_param' failed"
-        fi
+    if ! iscsistart -b $iscsi_param; then
+        warn "'iscsistart -b $iscsi_param' failed with return code $?"
+    fi
 
-        if [ -d /sys/class/iscsi_session ]; then
-            echo 'started' > "/tmp/iscsistarted-iscsi:"
-            echo 'started' > "/tmp/iscsistarted-firmware"
-        else
-            return 1
-        fi
+    echo 'started' > "/tmp/iscsistarted-iscsi:"
+    echo 'started' > "/tmp/iscsistarted-firmware"
 
-        need_shutdown
-    fi
+    need_shutdown
     return 0
 }
 
@@ -236,15 +230,16 @@ if [ "$netif" = "timeout" ] && all_ifaces_setup; then
     sleep 2
 fi
 
-if [ "$netif" = "online" ]; then
-    if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
+if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
+    if [ "$netif" = "timeout" ] || [ "$netif" = "online" ]; then
         handle_firmware
         ret=$?
     fi
-else
+fi
+
+if ! [ "$netif" = "online" ]; then
     # loop over all netroot parameter
-    nroot=$(getarg netroot)
-    if [ $? -eq 0 ] && [ "$nroot" != "dhcp" ]; then
+    if nroot=$(getarg netroot) && [ "$nroot" != "dhcp" ]; then
         for nroot in $(getargs netroot); do
             [ "${nroot%%:*}" = "iscsi" ] || continue
             nroot="${nroot##iscsi:}"