Blame SOURCES/0294-iscsi-iscsiroot.sh-handle-timeout-with-all-interface.patch

712866
From 543a6d5cab7538cd9cf94b43b97ac96d995c7d2f Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Thu, 13 Aug 2015 11:53:21 +0200
712866
Subject: [PATCH] iscsi/iscsiroot.sh: handle timeout with all interfaces up
712866
712866
restart iscsid, because it may disbehaved
712866
712866
(cherry picked from commit 6802cf23499b05544079b26a39e339bb3476d38d)
712866
---
712866
 modules.d/95iscsi/iscsiroot.sh | 17 +++++++++++++----
712866
 1 file changed, 13 insertions(+), 4 deletions(-)
712866
712866
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
712866
index 68da9dd..9452afe 100755
712866
--- a/modules.d/95iscsi/iscsiroot.sh
712866
+++ b/modules.d/95iscsi/iscsiroot.sh
712866
@@ -199,13 +199,14 @@ handle_netroot()
712866
                             ${iscsi_in_password:+-W $iscsi_in_password} \
712866
 	                    ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
712866
 	                    ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
712866
-                            ${iscsi_param} >/dev/null 2>&1
712866
+                            ${iscsi_param} >/dev/null 2>&1 \
712866
+	            && { > $hookdir/initqueue/work ; }
712866
             else
712866
-                systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1
712866
+                systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \
712866
+	            && { > $hookdir/initqueue/work ; }
712866
             fi
712866
         fi
712866
     else
712866
-        > $hookdir/initqueue/work
712866
         iscsistart -i $iscsi_initiator -t $iscsi_target_name        \
712866
                    -g $iscsi_target_group -a $iscsi_target_ip      \
712866
                    -p $iscsi_target_port \
712866
@@ -216,7 +217,7 @@ handle_netroot()
712866
 	           ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
712866
 	           ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
712866
                    ${iscsi_param} \
712866
-	    || :
712866
+	    && { > $hookdir/initqueue/work ; }
712866
     fi
712866
     netroot_enc=$(str_replace "$1" '/' '\2f')
712866
     echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
712866
@@ -229,6 +230,14 @@ if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then
712866
     all_ifaces_up || exit 0
712866
 fi
712866
 
712866
+if [ "$netif" = "dummy" ] && all_ifaces_up; then
712866
+    # s.th. went wrong and the timeout script hits
712866
+    # restart
712866
+    systemctl restart iscsid
712866
+    # damn iscsid is not ready after unit says it's ready
712866
+    sleep 2
712866
+fi
712866
+
712866
 # loop over all netroot parameter
712866
 netroot=$(getarg netroot)
712866
 if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then