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