dracut/0072-iscsi-parse-iscsiroot.sh-use-iBFT-initiator-name.patch

42 lines
1.7 KiB
Diff
Raw Normal View History

From feb8dc685dca1229c517de9ec9854367b8c49524 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 15:14:11 +0200
Subject: [PATCH] iscsi/parse-iscsiroot.sh: use iBFT initiator name
---
modules.d/95iscsi/parse-iscsiroot.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index 2532ada..a889da1 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -58,7 +58,7 @@ if [ -n "$iscsiroot" ] ; then
fi
# iscsi_firmware does not need argument checking
-if [ -n "$iscsi_firmware" ] ; then
+if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
[ -z "$netroot" ] && netroot=iscsi:
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
modprobe -b -q iscsi_ibft
@@ -97,6 +97,18 @@ if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then
fi
fi
+# If not given on the cmdline and initiator-name available via iBFT
+if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
+ iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
+ 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
+fi
+
if [ -n "$iscsi_firmware" ] ; then
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
else