Blame SOURCES/bz1316130-systemd-drop-in-clvmd-LVM.patch

15862b
diff -uNr a/configure.ac b/configure.ac
15862b
--- a/configure.ac	2017-05-03 10:00:54.396040173 +0200
15862b
+++ b/configure.ac	2017-05-03 10:07:28.969236697 +0200
15862b
@@ -65,6 +65,21 @@
15862b
 AM_CONDITIONAL(OCFT_FEDORA_CASES, test "x$OCFT_TEST_CASES" = "xfedora" )
15862b
 AM_CONDITIONAL(OCFT_DEFAULT_CASES, test "x$OCFT_TEST_CASES" = "xdefault" )
15862b
 
15862b
+AC_ARG_WITH([systemdsystemunitdir],
15862b
+     [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
15862b
+     [with_systemdsystemunitdir=auto])
15862b
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
15862b
+     def_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)
15862b
+
15862b
+     AS_IF([test "x$def_systemdsystemunitdir" = "x"],
15862b
+         [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
15862b
+                [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
15862b
+          with_systemdsystemunitdir=no],
15862b
+         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
15862b
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
15862b
+      [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
15862b
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
15862b
+
15862b
 dnl 
15862b
 dnl AM_INIT_AUTOMAKE([1.11.1 foreign dist-bzip2 dist-xz])
15862b
 dnl
15862b
@@ -857,6 +872,7 @@
15862b
    heartbeat/ocf-directories					\
15862b
    heartbeat/ocf-shellfuncs					\
15862b
    heartbeat/shellfuncs						\
15862b
+systemd/Makefile						\
15862b
 tools/Makefile							\
15862b
    tools/ocf-tester						\
15862b
    tools/ocft/Makefile						\
15862b
diff -uNr a/heartbeat/clvm b/heartbeat/clvm
15862b
--- a/heartbeat/clvm	2017-05-03 10:00:54.560038569 +0200
15862b
+++ b/heartbeat/clvm	2017-05-03 10:01:13.309855171 +0200
15862b
@@ -353,6 +353,18 @@
15862b
 		return $?
15862b
 	fi
15862b
 
15862b
+	# systemd drop-in to stop process before storage services during
15862b
+	# shutdown/reboot
15862b
+	if ps -p 1 | grep -q systemd ; then
15862b
+		systemdrundir="/run/systemd/system/resource-agents-deps.target.d"
15862b
+		mkdir "$systemdrundir"
15862b
+		cat > "$systemdrundir/99-clvmd.conf" <
15862b
+[Unit]
15862b
+After=blk-availability.service
15862b
+EOF
15862b
+		systemctl daemon-reload
15862b
+	fi
15862b
+
15862b
 	clvmd_status
15862b
 	if [ $? -eq $OCF_SUCCESS ]; then
15862b
 		ocf_log debug "$DAEMON already started"
15862b
diff -uNr a/heartbeat/LVM b/heartbeat/LVM
15862b
--- a/heartbeat/LVM	2017-05-03 10:00:54.558038589 +0200
15862b
+++ b/heartbeat/LVM	2017-05-03 10:01:13.309855171 +0200
15862b
@@ -452,6 +452,18 @@
15862b
 	local vg=$1
15862b
 	local clvmd=0
15862b
 
15862b
+	# systemd drop-in to stop process before storage services during
15862b
+	# shutdown/reboot
15862b
+	if ps -p 1 | grep -q systemd ; then
15862b
+		systemdrundir="/run/systemd/system/resource-agents-deps.target.d"
15862b
+		mkdir "$systemdrundir"
15862b
+		cat > "$systemdrundir/99-LVM.conf" <
15862b
+[Unit]
15862b
+After=blk-availability.service
15862b
+EOF
15862b
+		systemctl daemon-reload
15862b
+	fi
15862b
+
15862b
 	# TODO: This MUST run vgimport as well
15862b
 	ocf_log info "Activating volume group $vg"
15862b
 	if [ "$LVM_MAJOR" -eq "1" ]; then
15862b
diff -uNr a/Makefile.am b/Makefile.am
15862b
--- a/Makefile.am	2013-06-18 15:22:27.000000000 +0200
15862b
+++ b/Makefile.am	2017-05-03 10:01:13.308855181 +0200
15862b
@@ -37,7 +37,7 @@
15862b
 endif
15862b
 
15862b
 if BUILD_LINUX_HA
15862b
-SUBDIRS	+= include heartbeat tools ldirectord doc
15862b
+SUBDIRS	+= include heartbeat tools ldirectord doc systemd
15862b
 LINUX_HA = without
15862b
 else
15862b
 LINUX_HA = with
15862b
diff -uNr a/resource-agents.spec.in b/resource-agents.spec.in
15862b
--- a/resource-agents.spec.in	2017-05-03 10:00:54.384040291 +0200
15862b
+++ b/resource-agents.spec.in	2017-05-03 10:01:13.309855171 +0200
15862b
@@ -231,6 +231,10 @@
15862b
 /usr/lib/ocf/resource.d/redhat
15862b
 %endif
15862b
 
15862b
+%if %{defined _unitdir}
15862b
+%{_unitdir}/resource-agents-deps.target
15862b
+%endif
15862b
+
15862b
 %dir %{_datadir}/%{name}
15862b
 %dir %{_datadir}/%{name}/ocft
15862b
 %{_datadir}/%{name}/ocft/configs
15862b
diff -uNr a/systemd/Makefile.am b/systemd/Makefile.am
15862b
--- a/systemd/Makefile.am	1970-01-01 01:00:00.000000000 +0100
15862b
+++ b/systemd/Makefile.am	2017-05-03 10:01:13.311855152 +0200
15862b
@@ -0,0 +1,23 @@
15862b
+#
15862b
+# Copyright (C) 2017 Oyvind Albrigtsen
15862b
+#
15862b
+# This program is free software; you can redistribute it and/or
15862b
+# modify it under the terms of the GNU General Public License
15862b
+# as published by the Free Software Foundation; either version 2
15862b
+# of the License, or (at your option) any later version.
15862b
+# 
15862b
+# This program is distributed in the hope that it will be useful,
15862b
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15862b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15862b
+# GNU General Public License for more details.
15862b
+# 
15862b
+# You should have received a copy of the GNU General Public License
15862b
+# along with this program; if not, write to the Free Software
15862b
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15862b
+#
15862b
+
15862b
+MAINTAINERCLEANFILES    = Makefile.in
15862b
+
15862b
+if HAVE_SYSTEMD
15862b
+dist_systemdsystemunit_DATA = resource-agents-deps.target
15862b
+endif
15862b
diff -uNr a/systemd/resource-agents-deps.target b/systemd/resource-agents-deps.target
15862b
--- a/systemd/resource-agents-deps.target	1970-01-01 01:00:00.000000000 +0100
15862b
+++ b/systemd/resource-agents-deps.target	2017-05-03 10:01:13.311855152 +0200
15862b
@@ -0,0 +1,2 @@
15862b
+[Unit]
15862b
+Description=resource-agents dependencies