Blame 0049-update-systemd-service-files-add-iscsi.service-for-s.patch

6bbb92
From 1c3b1d23e0b3f17399ffd4463cafad813b0444d5 Mon Sep 17 00:00:00 2001
6bbb92
From: Chris Leech <cleech@redhat.com>
6bbb92
Date: Wed, 19 Dec 2012 15:07:36 -0800
6bbb92
Subject: update systemd service files, add iscsi.service for starting
6bbb92
 sessions on boot
6bbb92
6bbb92
Signed-off-by: Chris Leech <cleech@redhat.com>
6bbb92
---
6bbb92
 etc/systemd/iscsi.service         | 19 +++++++++++++++++++
6bbb92
 etc/systemd/iscsi_mark_root_nodes | 14 ++++++++++++++
6bbb92
 etc/systemd/iscsid.service        |  7 +++++--
6bbb92
 etc/systemd/iscsid.socket         |  2 +-
6bbb92
 4 files changed, 39 insertions(+), 3 deletions(-)
6bbb92
 create mode 100644 etc/systemd/iscsi.service
6bbb92
 create mode 100755 etc/systemd/iscsi_mark_root_nodes
6bbb92
6bbb92
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
6bbb92
new file mode 100644
6bbb92
index 0000000..bbd52fd
6bbb92
--- /dev/null
6bbb92
+++ b/etc/systemd/iscsi.service
6bbb92
@@ -0,0 +1,19 @@
6bbb92
+[Unit]
6bbb92
+Description=Login and scanning of iSCSI devices
6bbb92
+Documentation=man:iscsid(8) man:iscsiadm(8)
6bbb92
+DefaultDependencies=no
6bbb92
+Conflicts=shutdown.target
6bbb92
+After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
6bbb92
+Before=remote-fs-pre.target
6bbb92
+ConditionPathExists=/etc/iscsi/initiatorname.iscsi
6bbb92
+
6bbb92
+[Service]
6bbb92
+Type=oneshot
6bbb92
+RemainAfterExit=true
6bbb92
+ExecStart=/usr/libexec/iscsi_mark_root_nodes
6bbb92
+ExecStart=/sbin/iscsiadm -m node --loginall=automatic
6bbb92
+ExecStop=/bin/sync
6bbb92
+ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
6bbb92
+
6bbb92
+[Install]
6bbb92
+WantedBy=sysinit.target
6bbb92
diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes
6bbb92
new file mode 100755
6bbb92
index 0000000..c68475c
6bbb92
--- /dev/null
6bbb92
+++ b/etc/systemd/iscsi_mark_root_nodes
6bbb92
@@ -0,0 +1,14 @@
6bbb92
+#!/bin/bash
6bbb92
+
6bbb92
+ISCSIADM=/sbin/iscsiadm
6bbb92
+SESSION_FILE=/run/initramfs/iscsi.sessions
6bbb92
+
6bbb92
+if [ ! -f $SESSION_FILE ] ; then
6bbb92
+  exit 0
6bbb92
+fi
6bbb92
+
6bbb92
+while read t num i target; do
6bbb92
+  ip=${i%:*}
6bbb92
+  $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot
6bbb92
+done < $SESSION_FILE
6bbb92
+
6bbb92
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
6bbb92
index 028e0b3..653dd08 100644
6bbb92
--- a/etc/systemd/iscsid.service
6bbb92
+++ b/etc/systemd/iscsid.service
6bbb92
@@ -1,7 +1,10 @@
6bbb92
 [Unit]
6bbb92
 Description=Open-iSCSI
6bbb92
-Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
6bbb92
-After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service
6bbb92
+Documentation=man:iscsid(8) man:iscsiadm(8)
6bbb92
+DefaultDependencies=no
6bbb92
+Conflicts=shutdown.target
6bbb92
+After=network.target iscsiuio.service
6bbb92
+Before=remote-fs-pre.target
6bbb92
 
6bbb92
 [Service]
6bbb92
 Type=forking
6bbb92
diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket
6bbb92
index 832451d..58a8d12 100644
6bbb92
--- a/etc/systemd/iscsid.socket
6bbb92
+++ b/etc/systemd/iscsid.socket
6bbb92
@@ -1,6 +1,6 @@
6bbb92
 [Unit]
6bbb92
 Description=Open-iSCSI iscsid Socket
6bbb92
-Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
6bbb92
+Documentation=man:iscsid(8) man:iscsiadm(8)
6bbb92
 
6bbb92
 [Socket]
6bbb92
 ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE
6bbb92
-- 
6bbb92
1.7.11.7
6bbb92