Blob Blame History Raw
From 543a6d5cab7538cd9cf94b43b97ac96d995c7d2f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 13 Aug 2015 11:53:21 +0200
Subject: [PATCH] iscsi/iscsiroot.sh: handle timeout with all interfaces up

restart iscsid, because it may disbehaved

(cherry picked from commit 6802cf23499b05544079b26a39e339bb3476d38d)
---
 modules.d/95iscsi/iscsiroot.sh | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 68da9dd..9452afe 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -199,13 +199,14 @@ handle_netroot()
                             ${iscsi_in_password:+-W $iscsi_in_password} \
 	                    ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
 	                    ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
-                            ${iscsi_param} >/dev/null 2>&1
+                            ${iscsi_param} >/dev/null 2>&1 \
+	            && { > $hookdir/initqueue/work ; }
             else
-                systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1
+                systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \
+	            && { > $hookdir/initqueue/work ; }
             fi
         fi
     else
-        > $hookdir/initqueue/work
         iscsistart -i $iscsi_initiator -t $iscsi_target_name        \
                    -g $iscsi_target_group -a $iscsi_target_ip      \
                    -p $iscsi_target_port \
@@ -216,7 +217,7 @@ handle_netroot()
 	           ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
 	           ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
                    ${iscsi_param} \
-	    || :
+	    && { > $hookdir/initqueue/work ; }
     fi
     netroot_enc=$(str_replace "$1" '/' '\2f')
     echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
@@ -229,6 +230,14 @@ if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then
     all_ifaces_up || exit 0
 fi
 
+if [ "$netif" = "dummy" ] && all_ifaces_up; then
+    # s.th. went wrong and the timeout script hits
+    # restart
+    systemctl restart iscsid
+    # damn iscsid is not ready after unit says it's ready
+    sleep 2
+fi
+
 # loop over all netroot parameter
 netroot=$(getarg netroot)
 if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then