You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
4.9 KiB

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