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