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

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