open-fcoe/open-fcoe-3.11-add_systemd_service_file.patch

101 lines
3.9 KiB
Diff

From 41e9d79bd4bf9af4aa422615453333e860acabcd Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 6 Dec 2013 19:51:56 +0000
Subject: [PATCH] fcoemon: add systemd service file
Add fcoe.service file to start fcoemon from systemd
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
Makefile.am | 5 +++++
configure.ac | 8 ++++++++
doc/fcoemon.8 | 2 +-
doc/fcoemon.txt | 1 +
etc/systemd/fcoe.service | 13 +++++++++++++
5 files changed, 28 insertions(+), 1 deletions(-)
create mode 100644 etc/systemd/fcoe.service
diff --git a/Makefile.am b/Makefile.am
index ba08924..012b560 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,6 +41,11 @@ noinst_HEADERS = fcoeadm_display.h fcoe_clif.h fcoemon.h \
fcoe_configdir = ${sysconfdir}/fcoe
dist_fcoe_config_DATA = etc/cfg-ethx
+## install systemd service files
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = etc/systemd/fcoe.service
+endif
+
## man pages for fcoeadm and fcoemon
dist_man_MANS = doc/fcoeadm.8 doc/fcoemon.8 doc/fipvlan.8 doc/fcrls.8 \
doc/fcnsq.8 doc/fcping.8
diff --git a/configure.ac b/configure.ac
index bb1385b..107d039 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,14 @@ AC_SUBST([LLDPAD_CFLAGS])
PKG_CHECK_MODULES([LIBHBALINUX], [libhbalinux >= 1.0.13])
AC_SUBST([LIBHBALINUX_CFLAGS])
+PKG_PROG_PKG_CONFIG
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
+ [Directory for systemd service files]), [],
+ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
+
AC_CONFIG_FILES([Makefile fcoe-utils.spec include/fcoe_utils_version.h])
AC_OUTPUT
diff --git a/doc/fcoemon.8 b/doc/fcoemon.8
index e9a045b..020394e 100644
--- a/doc/fcoemon.8
+++ b/doc/fcoemon.8
@@ -358,7 +358,7 @@ indicates whether a FIP responder should be activated on this device to support
Note that the attached Ethernet peer device (e\&.g\&. FCoE capable switch port) must have compatible settings For DCB and FCoE to function properly\&.
.SS "/etc/init\&.d/fcoe"
.sp
-This is the \fBfcoe\fR system service script\&. This script is invoked by the init process or by the service command to start and stop the \fBfcoemon\fR\&.
+This is the \fBfcoe\fR system service script\&. This script is invoked by the init process or by the service command to start and stop the \fBfcoemon\fR\&. On systemd-enabled systems, \fBfcoemon\fR is controlled via the \fBfcoe.service\fR unit.
.SH "VLAN NAMING CONVENTIONS"
.sp
If a new VLAN device is created (see the description of the \fIAUTO_VLAN\fR setting above), it will have the name \fIdev\fR\&.\fIvlan\fR\-fcoe; where \fIdev\fR is the name of the Ethernet parent device and \fIvlan\fR is the discovered VLAN ID number\&.
diff --git a/doc/fcoemon.txt b/doc/fcoemon.txt
index ec15197..09ee5a2 100644
--- a/doc/fcoemon.txt
+++ b/doc/fcoemon.txt
@@ -214,6 +214,7 @@ must have compatible settings For DCB and FCoE to function properly.
~~~~~~~~~~~~~~~~
This is the *fcoe* system service script. This script is invoked by the
init process or by the service command to start and stop the *fcoemon*.
+On systemd-enabled systems, *fcoemon* is controlled via the *fcoe.service* unit.
VLAN NAMING CONVENTIONS
-----------------------
diff --git a/etc/systemd/fcoe.service b/etc/systemd/fcoe.service
new file mode 100644
index 0000000..4834e43
--- /dev/null
+++ b/etc/systemd/fcoe.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Open-FCoE initiator daemon
+After=syslog.target network.target
+
+[Service]
+Type=forking
+EnvironmentFile=/etc/sysconfig/fcoe
+ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
+ExecStart=/usr/sbin/fcoemon $FCOEMON_OPTS
+
+[Install]
+WantedBy=multi-user.target
+Also=lldpad.socket
--
1.7.1