Blame 0073-iscsi-iscsiroot.sh-handle-timeout-with-all-interface.patch

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