summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-support/tgt/files
diff options
context:
space:
mode:
authorMingli Yu <Mingli.Yu@windriver.com>2018-08-10 15:29:32 +0800
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-08-14 13:03:42 -0400
commita0b99547acd3ab523af1638455e211e876b5c24d (patch)
treec04fd47c043bf8e6a490ca63c722057a6007e161 /meta-openstack/recipes-support/tgt/files
parent5b963d1e391dd822a56678194ff914bbcac83012 (diff)
downloadmeta-cloud-services-a0b99547acd3ab523af1638455e211e876b5c24d.tar.gz
tgt: add systemd service file
Add systemd service file for tgt Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-support/tgt/files')
-rw-r--r--meta-openstack/recipes-support/tgt/files/tgtd5
-rwxr-xr-xmeta-openstack/recipes-support/tgt/files/tgtd.service33
2 files changed, 38 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/tgt/files/tgtd b/meta-openstack/recipes-support/tgt/files/tgtd
new file mode 100644
index 0000000..64df6a3
--- /dev/null
+++ b/meta-openstack/recipes-support/tgt/files/tgtd
@@ -0,0 +1,5 @@
1# options for tgtd
2TGTD_OPTS=""
3
4# configuration file
5TGTD_CONFIG=/etc/tgt/targets.conf
diff --git a/meta-openstack/recipes-support/tgt/files/tgtd.service b/meta-openstack/recipes-support/tgt/files/tgtd.service
new file mode 100755
index 0000000..afbd4b4
--- /dev/null
+++ b/meta-openstack/recipes-support/tgt/files/tgtd.service
@@ -0,0 +1,33 @@
1[Unit]
2Description=tgtd iSCSI target daemon
3After=network.target
4
5[Service]
6EnvironmentFile=@SYSCONFDIR@/sysconfig/tgtd
7
8ExecStart=@SBINDIR@/tgtd -f $TGTD_OPTS
9# see bz 848942. workaround for a race for now.
10ExecStartPost=@BASE_BINDIR@/sleep 5
11# Put tgtd into "offline" state until all the targets are configured.
12# We don't want initiators to (re)connect and fail the connection
13# if it's not ready.
14ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
15# Configure the targets.
16ExecStartPost=@SBINDIR@/tgt-admin -e -c $TGTD_CONFIG
17# Put tgtd into "ready" state.
18ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v ready
19
20# Update configuration for targets. Only targets which
21# are not in use will be updated.
22ExecReload=@SBINDIR@/tgt-admin --update ALL -c $TGTD_CONFIG
23
24# NOTE: Shutdown of the iscsi target may cause data corruption
25# for initiators that are connected.
26ExecStop=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
27# Remove all targets. It only removes targets which are not in use.
28ExecStop=@SBINDIR@/tgt-admin --update ALL -c /dev/null
29# tgtd will exit if all targets were removed
30ExecStop=@SBINDIR@/tgtadm --op delete --mode system
31
32[Install]
33WantedBy=multi-user.target