Blob Blame Raw
From 55a9d630239bebbc5410f3d2f2485ff8f82873a3 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 13 Jan 2015 16:30:01 -0800
Subject: [PATCH 17/22] make-session-shutdown-a-seperate-service.patch

---
 etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++
 etc/systemd/iscsi.service          |  3 +--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 etc/systemd/iscsi-shutdown.service

diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service
new file mode 100644
index 000000000000..23758e959ff2
--- /dev/null
+++ b/etc/systemd/iscsi-shutdown.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Logout off all iSCSI sessions on shutdown
+Documentation=man:iscsid(8) man:iscsiadm(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStop=-/sbin/iscsiadm -m node --logoutall=all
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index ad7be34d5918..27369568bf35 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -5,7 +5,7 @@ DefaultDependencies=no
 Conflicts=shutdown.target
 After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
 Before=remote-fs-pre.target
-Wants=remote-fs-pre.target
+Wants=remote-fs-pre.target iscsi-shutdown.service
 ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes
 ConditionDirectoryNotEmpty=|/sys/class/iscsi_session
 
@@ -14,7 +14,6 @@ Type=oneshot
 RemainAfterExit=true
 ExecStart=-/usr/libexec/iscsi-mark-root-nodes
 ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
-ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic
 ExecReload=-/sbin/iscsiadm -m node --loginall=automatic
 
 [Install]
-- 
2.14.3