From 6802cf23499b05544079b26a39e339bb3476d38d 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
---
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 fc62425..ad95812 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -197,13 +197,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 \
@@ -214,7 +215,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}"
@@ -227,6 +228,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