Blame 0139-iscsi-parse-iscsiroot.sh-only-set-initiator-name-if-.patch

Harald Hoyer bb31e7
From e803d076f8689a92ae42de4f5675c51e8a9c492d Mon Sep 17 00:00:00 2001
Harald Hoyer bb31e7
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer bb31e7
Date: Thu, 3 Sep 2015 12:41:06 +0200
Harald Hoyer bb31e7
Subject: [PATCH] iscsi/parse-iscsiroot.sh: only set initiator-name, if not
Harald Hoyer bb31e7
 empty
Harald Hoyer bb31e7
Harald Hoyer bb31e7
(cherry picked from commit eb87dc91d078ee942ef9c8bbc8e82f4ee4ccf0c6)
Harald Hoyer bb31e7
---
Harald Hoyer bb31e7
 modules.d/95iscsi/parse-iscsiroot.sh | 14 ++++++++------
Harald Hoyer bb31e7
 1 file changed, 8 insertions(+), 6 deletions(-)
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 dab58db..81be6a9 100755
Harald Hoyer bb31e7
--- a/modules.d/95iscsi/parse-iscsiroot.sh
Harald Hoyer bb31e7
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
Harald Hoyer bb31e7
@@ -112,12 +112,14 @@ fi
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
-    > /tmp/iscsi_set_initiator
Harald Hoyer bb31e7
-    systemctl try-restart iscsid && sleep 1
Harald Hoyer bb31e7
+    if [ -n "$iscsi_initiator" ]; then
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
+        > /tmp/iscsi_set_initiator
Harald Hoyer bb31e7
+        systemctl try-restart iscsid && sleep 1
Harald Hoyer bb31e7
+    fi
Harald Hoyer bb31e7
 fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7