|
|
64b87c |
From bfe65f913a4bc6bc5fdb7aa75234c229a2ceef8f Mon Sep 17 00:00:00 2001
|
|
|
64b87c |
From: Harald Hoyer <harald@redhat.com>
|
|
|
64b87c |
Date: Tue, 18 Aug 2015 11:50:15 +0200
|
|
|
64b87c |
Subject: [PATCH] iscsi: handle timeout case better
|
|
|
64b87c |
|
|
|
64b87c |
---
|
|
|
49e6a8 |
modules.d/95iscsi/iscsiroot.sh | 6 ++--
|
|
|
49e6a8 |
modules.d/95iscsi/parse-iscsiroot.sh | 41 ++++++++++++++++------------
|
|
|
64b87c |
2 files changed, 27 insertions(+), 20 deletions(-)
|
|
|
64b87c |
|
|
|
64b87c |
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
|
|
|
1755ca |
index 2ac9ed32..b7370f6f 100755
|
|
|
64b87c |
--- a/modules.d/95iscsi/iscsiroot.sh
|
|
|
64b87c |
+++ b/modules.d/95iscsi/iscsiroot.sh
|
|
|
64b87c |
@@ -108,7 +108,7 @@ handle_netroot()
|
|
|
64b87c |
parse_iscsi_root "$1" || return 1
|
|
|
64b87c |
|
|
|
64b87c |
# Bail out early, if there is no route to the destination
|
|
|
64b87c |
- if is_ip "$iscsi_target_ip" && [ "$netif" != "dummy" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then
|
|
|
64b87c |
+ if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then
|
|
|
64b87c |
ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
|
|
|
64b87c |
fi
|
|
|
64b87c |
|
|
|
64b87c |
@@ -226,11 +226,11 @@ handle_netroot()
|
|
|
64b87c |
|
|
|
64b87c |
ret=0
|
|
|
64b87c |
|
|
|
64b87c |
-if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then
|
|
|
64b87c |
+if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then
|
|
|
64b87c |
all_ifaces_up || exit 0
|
|
|
64b87c |
fi
|
|
|
64b87c |
|
|
|
64b87c |
-if [ "$netif" = "dummy" ] && all_ifaces_up; then
|
|
|
64b87c |
+if [ "$netif" = "timeout" ] && all_ifaces_up; then
|
|
|
64b87c |
# s.th. went wrong and the timeout script hits
|
|
|
64b87c |
# restart
|
|
|
64b87c |
systemctl restart iscsid
|
|
|
64b87c |
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
|
|
|
1755ca |
index 2939e58a..91cd4630 100755
|
|
|
64b87c |
--- a/modules.d/95iscsi/parse-iscsiroot.sh
|
|
|
64b87c |
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
|
|
|
64b87c |
@@ -42,7 +42,11 @@ if [ "${root%%:*}" = "iscsi" ] ; then
|
|
|
64b87c |
fi
|
|
|
64b87c |
|
|
|
64b87c |
# If it's not empty or iscsi we don't continue
|
|
|
64b87c |
-[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return
|
|
|
64b87c |
+for nroot in $(getargs netroot); do
|
|
|
64b87c |
+ [ "${nroot%%:*}" = "iscsi" ] || continue
|
|
|
64b87c |
+ netroot="$nroot"
|
|
|
64b87c |
+ break
|
|
|
64b87c |
+done
|
|
|
64b87c |
|
|
|
64b87c |
if [ -n "$iscsiroot" ] ; then
|
|
|
64b87c |
[ -z "$netroot" ] && netroot=$root
|
|
|
64b87c |
@@ -64,12 +68,16 @@ if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
|
|
|
64b87c |
[ -z "$netroot" ] && netroot=iscsi:
|
|
|
64b87c |
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
|
|
|
64b87c |
modprobe -b -q iscsi_ibft
|
|
|
64b87c |
+ # if no ip= is given, but firmware
|
|
|
64b87c |
+ echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
|
|
64b87c |
+ initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
|
|
64b87c |
+ initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
|
|
64b87c |
fi
|
|
|
64b87c |
|
|
|
64b87c |
-initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
|
|
|
64b87c |
|
|
|
64b87c |
-# If it's not iscsi we don't continue
|
|
|
64b87c |
-[ "${netroot%%:*}" = "iscsi" ] || return
|
|
|
64b87c |
+[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return 1
|
|
|
64b87c |
+
|
|
|
64b87c |
+initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
|
|
64b87c |
|
|
|
64b87c |
modprobe -q qla4xxx
|
|
|
64b87c |
modprobe -q cxgb3i
|
|
|
64b87c |
@@ -77,11 +85,6 @@ modprobe -q cxgb4i
|
|
|
64b87c |
modprobe -q bnx2i
|
|
|
64b87c |
modprobe -q be2iscsi
|
|
|
64b87c |
|
|
|
64b87c |
-if [ -z "$iscsi_firmware" ] ; then
|
|
|
64b87c |
- type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
|
|
64b87c |
- parse_iscsi_root "$netroot" || return
|
|
|
64b87c |
-fi
|
|
|
64b87c |
-
|
|
|
64b87c |
# ISCSI actually supported?
|
|
|
64b87c |
if ! [ -e /sys/module/iscsi_tcp ]; then
|
|
|
64b87c |
modprobe -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
|
|
|
64b87c |
@@ -89,7 +92,7 @@ fi
|
|
|
64b87c |
|
|
|
64b87c |
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
|
|
|
64b87c |
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
|
|
|
64b87c |
- initqueue --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
|
|
64b87c |
+ initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
|
|
64b87c |
fi
|
|
|
64b87c |
fi
|
|
|
64b87c |
|
|
|
64b87c |
@@ -110,17 +113,21 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ]
|
|
|
64b87c |
rm -f /etc/iscsi/initiatorname.iscsi
|
|
|
64b87c |
mkdir -p /etc/iscsi
|
|
|
64b87c |
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
|
|
64b87c |
- systemctl restart iscsid
|
|
|
64b87c |
- sleep 1
|
|
|
64b87c |
> /tmp/iscsi_set_initiator
|
|
|
64b87c |
+ if systemctl --quiet is-active iscsid.service; then
|
|
|
64b87c |
+ systemctl restart iscsid
|
|
|
64b87c |
+ sleep 1
|
|
|
64b87c |
+ fi
|
|
|
64b87c |
fi
|
|
|
64b87c |
|
|
|
64b87c |
-if [ -n "$iscsi_firmware" ] ; then
|
|
|
64b87c |
- echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
|
|
64b87c |
-else
|
|
|
64b87c |
- netroot_enc=$(str_replace "$netroot" '/' '\2f')
|
|
|
64b87c |
+
|
|
|
64b87c |
+for nroot in $(getargs netroot); do
|
|
|
64b87c |
+ [ "${nroot%%:*}" = "iscsi" ] || continue
|
|
|
64b87c |
+ type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
|
|
64b87c |
+ parse_iscsi_root "$nroot" || return 1
|
|
|
64b87c |
+ netroot_enc=$(str_replace "$nroot" '/' '\2f')
|
|
|
64b87c |
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
|
|
64b87c |
-fi
|
|
|
64b87c |
+done
|
|
|
64b87c |
|
|
|
64b87c |
# Done, all good!
|
|
|
64b87c |
rootok=1
|