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