bb31e7fe65
- git snapshot
121 lines
4.6 KiB
Diff
121 lines
4.6 KiB
Diff
From bcbcacb5d66276157274c1e35d1fea2f937c4677 Mon Sep 17 00:00:00 2001
|
|
From: Harald Hoyer <harald@redhat.com>
|
|
Date: Tue, 18 Aug 2015 11:50:15 +0200
|
|
Subject: [PATCH] iscsi: handle timeout case better
|
|
|
|
(cherry picked from commit bfe65f913a4bc6bc5fdb7aa75234c229a2ceef8f)
|
|
---
|
|
modules.d/95iscsi/iscsiroot.sh | 6 +++---
|
|
modules.d/95iscsi/parse-iscsiroot.sh | 41 +++++++++++++++++++++---------------
|
|
2 files changed, 27 insertions(+), 20 deletions(-)
|
|
|
|
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
|
|
index 893f279..e730cb0 100755
|
|
--- a/modules.d/95iscsi/iscsiroot.sh
|
|
+++ b/modules.d/95iscsi/iscsiroot.sh
|
|
@@ -106,7 +106,7 @@ handle_netroot()
|
|
parse_iscsi_root "$1" || return 1
|
|
|
|
# Bail out early, if there is no route to the destination
|
|
- if is_ip "$iscsi_target_ip" && [ "$netif" != "dummy" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then
|
|
+ if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then
|
|
ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
|
|
fi
|
|
|
|
@@ -224,11 +224,11 @@ handle_netroot()
|
|
|
|
ret=0
|
|
|
|
-if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then
|
|
+if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then
|
|
all_ifaces_up || exit 0
|
|
fi
|
|
|
|
-if [ "$netif" = "dummy" ] && all_ifaces_up; then
|
|
+if [ "$netif" = "timeout" ] && all_ifaces_up; then
|
|
# s.th. went wrong and the timeout script hits
|
|
# restart
|
|
systemctl restart iscsid
|
|
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
|
|
index c167dad..35628cc 100755
|
|
--- a/modules.d/95iscsi/parse-iscsiroot.sh
|
|
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
|
|
@@ -47,7 +47,11 @@ if [ "${root%%:*}" = "iscsi" ] ; then
|
|
fi
|
|
|
|
# If it's not empty or iscsi we don't continue
|
|
-[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return
|
|
+for nroot in $(getargs netroot); do
|
|
+ [ "${nroot%%:*}" = "iscsi" ] || continue
|
|
+ netroot="$nroot"
|
|
+ break
|
|
+done
|
|
|
|
if [ -n "$iscsiroot" ] ; then
|
|
[ -z "$netroot" ] && netroot=$root
|
|
@@ -71,19 +75,18 @@ if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
|
|
fi
|
|
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
|
|
modprobe -b -q iscsi_ibft
|
|
+ # if no ip= is given, but firmware
|
|
+ echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
|
+ initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
|
+ initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
|
fi
|
|
|
|
-initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
|
|
|
|
-# If it's not iscsi we don't continue
|
|
-[ "${netroot%%:*}" = "iscsi" ] || return
|
|
+[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return 1
|
|
|
|
-initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
|
|
+initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
|
|
|
|
-if [ -z "$iscsi_firmware" ] ; then
|
|
- type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
|
- parse_iscsi_root "$netroot" || return
|
|
-fi
|
|
+initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
|
|
|
|
# ISCSI actually supported?
|
|
if ! [ -e /sys/module/iscsi_tcp ]; then
|
|
@@ -92,7 +95,7 @@ fi
|
|
|
|
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
|
|
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
|
|
- initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
|
|
+ initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
|
fi
|
|
fi
|
|
|
|
@@ -113,17 +116,21 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ]
|
|
rm -f /etc/iscsi/initiatorname.iscsi
|
|
mkdir -p /etc/iscsi
|
|
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
|
|
- systemctl restart iscsid
|
|
- sleep 1
|
|
> /tmp/iscsi_set_initiator
|
|
+ if systemctl --quiet is-active iscsid.service; then
|
|
+ systemctl restart iscsid
|
|
+ sleep 1
|
|
+ fi
|
|
fi
|
|
|
|
-if [ -n "$iscsi_firmware" ] ; then
|
|
- echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
|
-else
|
|
- netroot_enc=$(str_replace "$netroot" '/' '\2f')
|
|
+
|
|
+for nroot in $(getargs netroot); do
|
|
+ [ "${nroot%%:*}" = "iscsi" ] || continue
|
|
+ type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
|
+ parse_iscsi_root "$nroot" || return 1
|
|
+ netroot_enc=$(str_replace "$nroot" '/' '\2f')
|
|
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
|
-fi
|
|
+done
|
|
|
|
# Done, all good!
|
|
rootok=1
|