Blame SOURCES/0323-iscsi-parse-iscsiroot.sh-restart-iscsid-with-try-res.patch

64b87c
From a6befb52eb5eeb87c0c41303fe08e50bd2fde0d3 Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Tue, 25 Aug 2015 11:16:46 +0200
64b87c
Subject: [PATCH] iscsi/parse-iscsiroot.sh: restart iscsid with try-restart
64b87c
64b87c
---
64b87c
 modules.d/95iscsi/parse-iscsiroot.sh | 7 ++-----
64b87c
 1 file changed, 2 insertions(+), 5 deletions(-)
64b87c
64b87c
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
64b87c
index 13a9502..6dd929f 100755
64b87c
--- a/modules.d/95iscsi/parse-iscsiroot.sh
64b87c
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
64b87c
@@ -105,7 +105,7 @@ if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; the
64b87c
     fi
64b87c
 fi
64b87c
 
64b87c
-if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then
64b87c
+if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ] ; then
64b87c
     iscsi_initiator=$arg
64b87c
     echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
64b87c
     ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
64b87c
@@ -123,10 +123,7 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ]
64b87c
     mkdir -p /etc/iscsi
64b87c
     ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
64b87c
     > /tmp/iscsi_set_initiator
64b87c
-    if systemctl --quiet is-active iscsid.service; then
64b87c
-        systemctl restart iscsid
64b87c
-        sleep 1
64b87c
-    fi
64b87c
+    systemctl try-restart iscsid && sleep 1
64b87c
 fi
64b87c
 
64b87c