From d9b00731c81fa2facd5c6088a08bdd579d550eba Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 12 Aug 2015 15:14:11 +0200 Subject: [PATCH] iscsi/parse-iscsiroot.sh: use iBFT initiator name (cherry picked from commit feb8dc685dca1229c517de9ec9854367b8c49524) --- 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 6a21b50..2939e58 100755 --- a/modules.d/95iscsi/parse-iscsiroot.sh +++ b/modules.d/95iscsi/parse-iscsiroot.sh @@ -60,7 +60,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 @@ -103,6 +103,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