--- /dev/null
+From f46352af3ad505830d14b016bc48310fd1c3cea5 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Mon, 27 Apr 2020 11:51:58 +0800
+Subject: [PATCH 1/4] disable doc build
+
+Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
+
+Rebase for 4.1.1
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index fccaca4..afd8fa5 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -37,7 +37,7 @@ RGMANAGER = with
+ endif
+
+ if BUILD_LINUX_HA
+-SUBDIRS += include heartbeat tools ldirectord doc systemd
++SUBDIRS += include heartbeat tools ldirectord systemd
+ LINUX_HA = without
+ else
+ LINUX_HA = with
+--
+2.7.4
+
-Set OCF_ROOT_DIR to ${libdir}/ocf
+From 09c0d3deaed7aa4aa6ec07dd89c4233833133c72 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Mon, 27 Apr 2020 11:53:02 +0800
+Subject: [PATCH 2/4] Set OCF_ROOT_DIR to ${libdir}/ocf
Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
+
+Rebase for 4.1.1
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
-index bb45717..3326b53 100644
+index 113503e..e1ed2e8 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -406,7 +406,7 @@ dnl Variables needed for substitution
+@@ -413,7 +413,7 @@ dnl Variables needed for substitution
AC_CHECK_HEADERS(heartbeat/glue_config.h)
if test "$ac_cv_header_heartbeat_glue_config_h" = "yes"; then
enable_libnet=no
fi
--
-1.8.3.1
+2.7.4
-fix header defs lookup
+From 6f3f2d6c129577f8666aee7b506d0b52a58bba0e Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Mon, 27 Apr 2020 11:53:55 +0800
+Subject: [PATCH 3/4] fix header defs lookup
Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
+
+Rebase for 4.1.1
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
configure.ac | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
-index 3326b53..8b5706a 100644
+index e1ed2e8..4d5fb96 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -140,9 +140,8 @@ extract_header_define() {
+@@ -148,9 +148,8 @@ extract_header_define() {
Cfile=$srcdir/extract_define.$2.${$}
printf "#include <stdio.h>\n" > ${Cfile}.c
printf "#include <%s>\n" $1 >> ${Cfile}.c
printf $value
rm -f ${Cfile}.c ${Cfile}
--
-1.8.3.1
+2.7.4
-configure.ac: fix install-sh not found
+From e2dff24c2d99e91c88a5532405a668f995b24a86 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Mon, 27 Apr 2020 11:55:33 +0800
+Subject: [PATCH 4/4] configure.ac: fix install-sh not found
Fix configure.ac to cope with new autoconf.
Recent autoconfs generate a bad configure when AM_INIT_AUTOMAKE is
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=724116
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+
+Rebase for 4.1.1
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
configure.ac | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
-index e8e2a7b..f3c8b9f 100644
+index 4d5fb96..af7f646 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,13 +23,20 @@ AC_INIT([resource-agents],
AC_CANONICAL_HOST
dnl Where #defines go (e.g. `AC_CHECK_HEADERS' below)
-@@ -76,12 +83,6 @@ AC_ARG_WITH(pkg-name,
- [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
- AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
+@@ -84,12 +91,6 @@ AC_ARG_WITH([systemdtmpfilesdir],
+ fi
+ AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdtmpfilesdir" -a "x$with_systemdtmpfilesdir" != xno ])
-dnl
-dnl AM_INIT_AUTOMAKE([1.11.1 foreign dist-bzip2 dist-xz])
CC_IN_CONFIGURE=yes
--
-1.8.1.2
+2.7.4
+++ /dev/null
-disable doc build
-
-Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
----
- Makefile.am | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 1769c6e..d66b2ae 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -37,7 +37,7 @@ RGMANAGER = with
- endif
-
- if BUILD_LINUX_HA
--SUBDIRS += include heartbeat tools ldirectord doc
-+SUBDIRS += include heartbeat tools ldirectord
- LINUX_HA = without
- else
- LINUX_HA = with
---
-1.8.3.1
-
+++ /dev/null
-From 5b7a84dbb9d06112c4b2804223163d91ba8ab786 Mon Sep 17 00:00:00 2001
-From: Jackie Huang <jackie.huang@windriver.com>
-Date: Thu, 1 Jun 2017 10:34:38 +0800
-Subject: [PATCH] fs.sh: fix builds when srcdir and builddir are seperated
-
-It fails to find fs.sh.in when srddir and builddir are not the same:
-
-make[5]: Entering directory '/path/to/builddir/rgmanager/src/resources'
-cat fs.sh.in | sed \
- -e 's#@''LOGDIR@#/var/log/cluster#g' \
- > fs.sh.out
- cat: fs.sh.in: No such file or directorychmod +x fs.sh.out
- mv fs.sh.out fs.sh
-
-Add abs_srcdir to fix this.
-
-Upstream-Status: Submitted [https://github.com/ClusterLabs/resource-agents/pull/986]
-
-Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
----
- rgmanager/src/resources/Makefile.am | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/rgmanager/src/resources/Makefile.am b/rgmanager/src/resources/Makefile.am
-index de88c69..30b3be9 100644
---- a/rgmanager/src/resources/Makefile.am
-+++ b/rgmanager/src/resources/Makefile.am
-@@ -68,7 +68,7 @@ rngdir = ${CLUSTERDATA}/relaxng
- rng_DATA = $(DTD) $(XSL) $(RESRNG)
-
- $(TARGET):
-- cat $@.in | sed \
-+ cat $(abs_srcdir)/$@.in | sed \
- -e 's#@''LOGDIR@#${LOGDIR}#g' \
- > $@.out
- chmod +x $@.out
---
-2.11.0
-
--- /dev/null
+From 7c181a1afdc85456333f9cbf9c5827ceb0554a91 Mon Sep 17 00:00:00 2001
+From: Chris Friesen <chris.friesen@windriver.com>
+Date: Fri, 24 Aug 2018 03:51:37 +0800
+Subject: [PATCH] Fix VG activity bug in heartbeat/LVM script
+
+There is currently an issue in the lvm2 package where if you create an LVM thin
+pool, then create a thin volume in the pool, then the udev rule doesn't think
+there should be a /dev// symlink for the thin pool, but "vgmknodes" and
+"vgscan --mknodes" both think that there should be such a symlink. This is a
+bug, but it's in the field in CentOS 7 at least and likely elsewhere.
+
+The end result of this is that on such a system running either "vgscan
+--mknodes" or "vgmknodes" and then running "vgchange -an " will
+leave the /dev/ directory with a dangling symlink in it.
+
+This breaks the LVM_status() function in this OCF script, since the
+/dev/ directory exists and is not empty even though the volume
+group is not active.
+
+This commit changes the code to directly query lvm about the volume group
+activity rather than relying on side effects.
+
+Signed-off-by: zhipengl <zhipengs.liu@intel.com>
+
+---
+ heartbeat/LVM | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/heartbeat/LVM b/heartbeat/LVM
+index 893ece8..1efb207 100755
+--- a/heartbeat/LVM
++++ b/heartbeat/LVM
+@@ -191,18 +191,15 @@ LVM_status() {
+ fi
+ fi
+
+- if [ -d /dev/$1 ]; then
+- test "`cd /dev/$1 && ls`" != ""
+- rc=$?
+- if [ $rc -ne 0 ]; then
+- ocf_exit_reason "VG $1 with no logical volumes is not supported by this RA!"
+- fi
+- fi
+-
+- if [ $rc -ne 0 ]; then
++ # Ask lvm whether the volume group is active. This maps to
++ # the question "Are there any logical volumes that are active in
++ # the specified volume group?".
++ lvs --noheadings -o selected -S lv_active=active,vg_name=${1}|grep -q 1
++ if [ $? -ne 0 ]; then
+ ocf_log $loglevel "LVM Volume $1 is not available (stopped)"
+ rc=$OCF_NOT_RUNNING
+ else
++ rc=0
+ lvm_status
+ rc=$?
+ fi
+--
+2.7.4
+
--- /dev/null
+From 81bcbfb829001ccf61b515edb3d53ac8f15df334 Mon Sep 17 00:00:00 2001
+From: Scott Little <scott.little@windriver.com>
+Date: Fri, 26 Aug 2016 15:06:10 -0400
+Subject: [PATCH 04/12] WRS: Patch108: copyright.patch
+
+---
+ heartbeat/Filesystem | 2 ++
+ heartbeat/LVM | 1 +
+ heartbeat/pgsql | 1 +
+ 3 files changed, 4 insertions(+)
+
+diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
+index 27f03d2..af821b2 100755
+--- a/heartbeat/Filesystem
++++ b/heartbeat/Filesystem
+@@ -2,6 +2,8 @@
+ #
+ # Support: users@clusterlabs.org
+ # License: GNU General Public License (GPL)
++#
++# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
+ #
+ # Filesystem
+ # Description: Manages a Filesystem on a shared storage medium.
+diff --git a/heartbeat/LVM b/heartbeat/LVM
+index e435e7b..c11fed7 100755
+--- a/heartbeat/LVM
++++ b/heartbeat/LVM
+@@ -10,6 +10,7 @@
+ # Support: users@clusterlabs.org
+ # License: GNU General Public License (GPL)
+ # Copyright: (C) 2002 - 2005 International Business Machines, Inc.
++# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
+ #
+ # This code significantly inspired by the LVM resource
+ # in FailSafe by Lars Marowsky-Bree
+diff --git a/heartbeat/pgsql b/heartbeat/pgsql
+index 794f85e..b176b1d 100755
+--- a/heartbeat/pgsql
++++ b/heartbeat/pgsql
+@@ -10,6 +10,7 @@
+ #
+ # Copyright: 2006-2012 Serge Dubrouski <sergeyfd@gmail.com>
+ # and other Linux-HA contributors
++# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
+ # License: GNU General Public License (GPL)
+ #
+ ###############################################################################
+--
+1.9.1
+
--- /dev/null
+From c3448b1536d50291dc5ca49dce5957c39403cc82 Mon Sep 17 00:00:00 2001
+From: Bin Qian <bin.qian@windriver.com>
+Date: Wed, 29 Aug 2018 11:00:22 -0400
+Subject: [PATCH 1/1] avoid failing service when I/F is down
+
+---
+ heartbeat/IPaddr2 | 24 ++++++------------------
+ 1 file changed, 6 insertions(+), 18 deletions(-)
+
+diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
+index 86009b9..2da5c5e 100755
+--- a/heartbeat/IPaddr2
++++ b/heartbeat/IPaddr2
+@@ -968,12 +968,8 @@ ip_start() {
+ then
+ exit $OCF_SUCCESS
+ else
+- if [ "$OCF_RESKEY_dc" = "yes" ]; then
+- ocf_log info "NIC $NIC is DOWN..."
+- exit $OCF_SUCCESS
+- else
+- exit $OCF_ERR_GENERIC
+- fi
++ ocf_log info "NIC $NIC is DOWN..."
++ exit $OCF_SUCCESS
+ fi
+ fi
+
+@@ -1037,12 +1033,8 @@ ip_start() {
+ then
+ exit $OCF_SUCCESS
+ else
+- if [ "$OCF_RESKEY_dc" = "yes" ]; then
+- ocf_log info "NIC $NIC is DOWN"
+- exit $OCF_SUCCESS
+- else
+- exit $OCF_ERR_GENERIC
+- fi
++ ocf_log info "NIC $NIC is DOWN"
++ exit $OCF_SUCCESS
+ fi
+ }
+
+@@ -1123,12 +1115,8 @@ ip_monitor() {
+ then
+ return $OCF_SUCCESS
+ else
+- if [ "$OCF_RESKEY_dc" = "yes" ]; then
+- ocf_log info "NIC $NIC is DOWN"
+- return $OCF_SUCCESS
+- else
+- return $OCF_NOT_RUNNING
+- fi
++ ocf_log info "NIC $NIC is DOWN"
++ exit $OCF_SUCCESS
+ fi
+ ;;
+ partial|no|partial2)
+--
+1.8.3.1
+
--- /dev/null
+From a39c83dbaf4054cc96cd4a0a2b671509dd10af28 Mon Sep 17 00:00:00 2001
+From: Bart Wensley <barton.wensley@windriver.com>
+Date: Wed, 21 Nov 2018 12:14:20 -0600
+Subject: [PATCH 1/1] ipaddr2 use host scope for addresses on loopback
+
+---
+ heartbeat/IPaddr2 | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
+index 2da5c5e..79dbdcf 100755
+--- a/heartbeat/IPaddr2
++++ b/heartbeat/IPaddr2
+@@ -622,10 +622,18 @@ add_interface () {
+ add_ipv6_addrlabel $ipaddr
+ fi
+
+- cmd="$IP2UTIL -f $FAMILY addr add $ipaddr/$netmask dev $iface"
++ # Addresses assigned to the loopback interfaces must be assigned
++ # using the host scope or assignment is prevented (can't have
++ # multiple global scope addresses on the loopback interface).
++ if [ "$iface" = "lo" ] ;then
++ option="scope host"
++ else
++ option=""
++ fi
++ cmd="$IP2UTIL -f $FAMILY addr add $ipaddr/$netmask dev $iface $option"
+ msg="Adding $FAMILY address $ipaddr/$netmask to device $iface"
+ if [ "$broadcast" != "none" ]; then
+- cmd="$IP2UTIL -f $FAMILY addr add $ipaddr/$netmask brd $broadcast dev $iface"
++ cmd="$IP2UTIL -f $FAMILY addr add $ipaddr/$netmask brd $broadcast dev $iface $option"
+ msg="Adding $FAMILY address $ipaddr/$netmask with broadcast address $broadcast to device $iface"
+ fi
+
+--
+1.8.3.1
+
--- /dev/null
+From fb5a76d9050c60b601a5dbbad65ed3dbff041af1 Mon Sep 17 00:00:00 2001
+From: Scott Little <scott.little@windriver.com>
+Date: Mon, 2 Oct 2017 15:12:36 -0400
+Subject: [PATCH 03/13] WRS: Patch1107: ipaddr2_check_if_state.patch
+
+---
+ heartbeat/IPaddr2 | 21 ++++++++++++++++++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
+index aef6dc7..67a7ca3 100755
+--- a/heartbeat/IPaddr2
++++ b/heartbeat/IPaddr2
+@@ -964,7 +964,12 @@ ip_start() {
+ local ip_status=`ip_served`
+
+ if [ "$ip_status" = "ok" ]; then
+- exit $OCF_SUCCESS
++ if [ -n "`ip link show $NIC | grep \"state UP\"`" ]
++ then
++ exit $OCF_SUCCESS
++ else
++ exit $OCF_ERR_GENERIC
++ fi
+ fi
+
+ if [ -n "$IP_CIP" ] && ([ $ip_status = "no" ] || [ $ip_status = "partial2" ]); then
+@@ -1023,7 +1028,12 @@ ip_start() {
+ fi
+ ;;
+ esac
+- exit $OCF_SUCCESS
++ if [ -n "`ip link show $NIC | grep \"state UP\"`" ]
++ then
++ exit $OCF_SUCCESS
++ else
++ exit $OCF_ERR_GENERIC
++ fi
+ }
+
+ ip_stop() {
+@@ -1099,7 +1109,12 @@ ip_monitor() {
+ case $ip_status in
+ ok)
+ run_arp_sender refresh
+- return $OCF_SUCCESS
++ if [ -n "`ip link show $NIC | grep \"state UP\"`" ]
++ then
++ return $OCF_SUCCESS
++ else
++ return $OCF_NOT_RUNNING
++ fi
+ ;;
+ partial|no|partial2)
+ exit $OCF_NOT_RUNNING
+--
+1.9.1
+
--- /dev/null
+From 573f0835621c5e64c6270260f607624aea29d21a Mon Sep 17 00:00:00 2001
+From: Bin Qian <bin.qian@windriver.com>
+Date: Sat, 21 Jan 2017 02:36:39 -0500
+Subject: [PATCH 1/1] ipaddr2_if_down
+
+---
+ heartbeat/IPaddr2 | 21 ++++++++++++++++++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
+index 67a7ca3..2cd822d 100755
+--- a/heartbeat/IPaddr2
++++ b/heartbeat/IPaddr2
+@@ -968,7 +968,12 @@ ip_start() {
+ then
+ exit $OCF_SUCCESS
+ else
+- exit $OCF_ERR_GENERIC
++ if [ "$OCF_RESKEY_dc" = "yes" ]; then
++ ocf_log info "NIC $NIC is DOWN..."
++ exit $OCF_SUCCESS
++ else
++ exit $OCF_ERR_GENERIC
++ fi
+ fi
+ fi
+
+@@ -1032,7 +1037,12 @@ ip_start() {
+ then
+ exit $OCF_SUCCESS
+ else
+- exit $OCF_ERR_GENERIC
++ if [ "$OCF_RESKEY_dc" = "yes" ]; then
++ ocf_log info "NIC $NIC is DOWN"
++ exit $OCF_SUCCESS
++ else
++ exit $OCF_ERR_GENERIC
++ fi
+ fi
+ }
+
+@@ -1113,7 +1123,12 @@ ip_monitor() {
+ then
+ return $OCF_SUCCESS
+ else
+- return $OCF_NOT_RUNNING
++ if [ "$OCF_RESKEY_dc" = "yes" ]; then
++ ocf_log info "NIC $NIC is DOWN"
++ return $OCF_SUCCESS
++ else
++ return $OCF_NOT_RUNNING
++ fi
+ fi
+ ;;
+ partial|no|partial2)
+--
+1.9.1
+
--- /dev/null
+From 81bb87debd2a683bad2173d6cb16327c776fe3b3 Mon Sep 17 00:00:00 2001
+From: Scott Little <scott.little@windriver.com>
+Date: Mon, 2 Oct 2017 15:13:46 -0400
+Subject: [PATCH 13/13] WRS: Patch1119: ipaddr2_ignore_lo_if_state.patch
+
+---
+ heartbeat/IPaddr2 | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
+index 2cd822d..59620d2 100755
+--- a/heartbeat/IPaddr2
++++ b/heartbeat/IPaddr2
+@@ -964,7 +964,7 @@ ip_start() {
+ local ip_status=`ip_served`
+
+ if [ "$ip_status" = "ok" ]; then
+- if [ -n "`ip link show $NIC | grep \"state UP\"`" ]
++ if [ -n "`ip link show $NIC | grep \"state UP\"`" ] || [ "$NIC" = "lo" ]
+ then
+ exit $OCF_SUCCESS
+ else
+@@ -1033,7 +1033,7 @@ ip_start() {
+ fi
+ ;;
+ esac
+- if [ -n "`ip link show $NIC | grep \"state UP\"`" ]
++ if [ -n "`ip link show $NIC | grep \"state UP\"`" ] || [ "$NIC" = "lo" ]
+ then
+ exit $OCF_SUCCESS
+ else
+@@ -1119,7 +1119,7 @@ ip_monitor() {
+ case $ip_status in
+ ok)
+ run_arp_sender refresh
+- if [ -n "`ip link show $NIC | grep \"state UP\"`" ]
++ if [ -n "`ip link show $NIC | grep \"state UP\"`" ] || [ "$NIC" = "lo" ]
+ then
+ return $OCF_SUCCESS
+ else
+--
+1.9.1
+
--- /dev/null
+From 72fcaed4a9cc3c847278dd4fca88ba0bca88125a Mon Sep 17 00:00:00 2001
+From: Vu Tran <vu.tran@windriver.com>
+Date: Thu Sep 29 19:07:25 2016 -0400
+Subject: CGTS-5173: LVM ocf cleanup refs on stop
+
+In LVM ocf script, LVM_stop() fails if any of the created logical volume
+dm block devices are being held by any process with the following error
+
+err ERROR: Logical volume cinder-volumes/volume-96a8becd-a1c1-4508-8b25-9bcbcfeff2fa
+contains a filesystem in use. Can't deactivate volume group "cinder-volumes"
+with 1 open logical volume(s)
+
+So here we want to have defensive code to scan through any process that
+holds what dm block devices and causes LVM_stop() to fail. There are
+2 cases:
+
+* dm block devices are mounted and processes are accessing files located
+in this mount point. We first need to kill all the processes which are
+opening files and then umount the dm block devices.
+
+* processes just hold/open dm block devices directly. We need to kill
+these processes.
+
+Signed-off-by: Sun Austin <austin.sun@intel.com>
+---
+ heartbeat/LVM | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 76 insertions(+)
+
+diff --git a/heartbeat/LVM b/heartbeat/LVM
+index 1efb207..bde381c 100755
+--- a/heartbeat/LVM
++++ b/heartbeat/LVM
+@@ -367,6 +367,81 @@ LVM_start() {
+ }
+
+ #
++# Kill provided process that holds lv
++#
++log_and_kill_process_hold_lv() {
++ p_info=$(ps -lfLp ${1} | tail -1)
++ ocf_log warn "lv ${2} is being held by this process (will be forced killed):"
++ ocf_log warn ${p_info}
++ kill -s KILL ${1}
++}
++
++#
++# Scan for processes that hold any lvs and kill them
++#
++scan_and_kill_processes_hold_lv() {
++ vg_name=${1}
++
++ # Get list of logical volumes which are busy
++ lv_paths=$(lvdisplay -c ${vg_name} | awk -F ":" '{print $1}')
++ for lv_path in ${lv_paths}; do
++ open_num=$(lvdisplay ${lv_path} | grep "# open" | awk '{print $3}')
++ if [ ${open_num} -gt 0 ]; then
++ lv_name=$(lvdisplay ${lv_path} | grep "LV Name" | awk '{print $3}')
++ lv_block=$(lvdisplay ${lv_path} | grep "Block device" | awk '{print $3}')
++
++ lv_list="${lv_list}
++${lv_name}|${lv_block}"
++ lv_block_list="${lv_block_list} ${lv_block}"
++ fi
++ done
++
++ # Exit if there is no busy logical volume
++ [ -z "${lv_list}" ] && exit 0
++
++ # Checking to see if any of these busy logical volumes are caused by mount
++ mountinfo=$(cat /proc/1/mountinfo)
++ while read -r line; do
++ mount_majorminor=$(echo ${line} | awk '{print $3}')
++ mount_point=$(echo ${line} | awk '{print $5}')
++
++ for lv in ${lv_block_list}; do
++ if [ "${lv}" == "${mount_majorminor}" ]; then
++ lv_name=$(echo "${lv_list}" | grep ${lv} | awk -F "|" '{print $1}')
++ ocf_log warn "lv ${lv_name} is busy mounted at ${mount_point} (will be forced unmounted)"
++ processes_holding_mount_point=$(fuser -m ${mount_point} 2>/dev/null)
++ if [ -n "${processes_holding_mount_point}" ]; then
++ for p in ${processes_holding_mount_point}; do
++ log_and_kill_process_hold_lv "${p}" "${lv_name}"
++ done
++ fi
++ umount ${mount_point}
++ [ $? -ne 0 ] && ocf_log warn "Cannot umount ${mount_point}"
++ fi
++ done
++ done <<< "${mountinfo}"
++
++ # Now checking to see if any process holding these logical volumes
++ all_processes=$(ps -e | awk '{print $1}')
++ for p in ${all_processes}; do
++ [ ! -d /proc/${p}/fd ] && continue
++ opened_file_list=$(ls -l /proc/${p}/fd | awk -F "->" '{print $2}')
++
++ for f in ${opened_file_list}; do
++ [ ! -b "${f}" ] && continue
++ f_majorminor=$(printf "%d:%d" $(stat -c '0x%t 0x%T' ${f}))
++
++ for lv in ${lv_block_list}; do
++ if [ "${lv}" == "${f_majorminor}" ]; then
++ lv_name=$(echo "${lv_list}" | grep ${lv} | awk -F "|" '{print $1}')
++ log_and_kill_process_hold_lv "${p}" "${lv_name}"
++ fi
++ done
++ done
++ done
++}
++
++#
+ # Disable the LVM volume
+ #
+ LVM_stop() {
+@@ -395,6 +470,7 @@ LVM_stop() {
+ break
+ fi
+
++ scan_and_kill_processes_hold_lv $vg
+ res=$OCF_ERR_GENERIC
+ ocf_log warn "$vg still Active"
+ ocf_log info "Retry deactivating volume group $vg"
+--
+2.7.4
+
--- /dev/null
+From 577055560d55b388d479ef398ffd839792dc1996 Mon Sep 17 00:00:00 2001
+From: Scott Little <scott.little@windriver.com>
+Date: Mon, 2 Oct 2017 15:12:54 -0400
+Subject: [PATCH 06/13] WRS: Patch1110: lvm_vg_activation.patch
+
+---
+ heartbeat/LVM | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 116 insertions(+), 1 deletion(-)
+
+diff --git a/heartbeat/LVM b/heartbeat/LVM
+index b0ca87a..38092f9 100755
+--- a/heartbeat/LVM
++++ b/heartbeat/LVM
+@@ -222,6 +222,81 @@ LVM_status() {
+ }
+
+ #
++# Activate one volume explicitly.
++#
++activate_volume() {
++ ocf_run lvchange $1 /dev/${2}/$3
++ if [ $? -eq 0 ] ; then
++ ocf_log info "Succesfully activated $LV."
++ else
++ ocf_log err "Problem activating $LV."
++ fi
++}
++
++#
++# Kick off parallel activation of all volumes
++#
++activate_all_volumes() {
++ VG=$1
++ shift
++ lvchange_args="$*"
++
++ # Get the list of volumes, without the first line which is column headings.
++ VOLS=`lvs $VG |tail -n +2`
++
++ while read -r LINE; do
++ # Convert the line into an array.
++ LINE_ARRAY=($LINE)
++
++ # First array element is the volume/snapshot name.
++ LV=${LINE_ARRAY[0]}
++
++ # Third array element is the attributes.
++ ATTR=${LINE_ARRAY[2]}
++
++ # Fifth character in the attributes is "a" if it's active.
++ ACTIVE=${ATTR:4:1}
++ if [ "$ACTIVE" == "a" ]; then
++ ocf_log info "$LV is already active."
++ continue
++ fi
++
++ SNAPSHOT_ORIGIN=${LINE_ARRAY[4]}
++ if [ "$SNAPSHOT_ORIGIN" != "" ] ; then
++ # If this is a snapshot, don't activate it.
++ continue
++ fi
++
++ ( activate_volume "$*" $VG $LV ) &
++ done <<< "$VOLS"
++}
++
++#
++# Scan for inactive volumes and log any that are found.
++#
++log_inactive_volumes() {
++ # Get the list of volumes, without the first line which is column headings.
++ VOLS=`lvs $1 |tail -n +2`
++
++ while read -r LINE; do
++ # Convert the line into an array.
++ LINE_ARRAY=($LINE)
++
++ # First array element is the volume/snapshot name.
++ LV=${LINE_ARRAY[0]}
++
++ # Third array element is the attributes.
++ ATTR=${LINE_ARRAY[2]}
++
++ # Fifth character in the attributes is "a" if it's active.
++ ACTIVE=${ATTR:4:1}
++ if [ "$ACTIVE" != "a" ]; then
++ ocf_log err "Volume $LV is not active after expiry of timeout."
++ fi
++ done <<< "$VOLS"
++}
++
++#
+ # Enable LVM volume
+ #
+ LVM_start() {
+@@ -241,10 +316,50 @@ LVM_start() {
+ ocf_run vgscan
+ fi
+
++ # Kick off activation of all volumes. If it doesn't complete within
++ # the timeout period, then we'll log the not-yet-activated volumes and
++ # continue on.
+ lvm_pre_activate || exit
+- ocf_run vgchange $vgchange_activate_options $vg
++ (ocf_run vgchange $vgchange_activate_options $1) & PID=$!
+ lvm_post_activate $?
+
++ # Check every second for up to TIMEOUT seconds whether the vgchange has
++ # completed.
++ TIMEOUT=300
++ TIMED_OUT=true
++ SECONDS=0;
++ PARALLEL_ACTIVATE_DELAY=10
++ PARALLEL_ACTIVATE_DONE=false
++ while [ $SECONDS -lt $TIMEOUT ] ; do
++ kill -0 $PID &> /dev/null
++ if [ $? -eq 1 ] ; then
++ # process with pid of $PID doesn't exist, vgchange command completed
++ TIMED_OUT=false
++ break
++ fi
++ if [ $SECONDS -ge $PARALLEL_ACTIVATE_DELAY ] && \
++ [ "$PARALLEL_ACTIVATE_DONE" != true ] && \
++ [ "$1" == "cinder-volumes" ] ; then
++ # This will kick off parallel activation of all LVs in the VG.
++ # The delay is to ensure the VG is activated first.
++ PARALLEL_ACTIVATE_DONE=true
++ ocf_log info Explicitly activating all volumes in $1 with: $vgchange_activate_options
++ activate_all_volumes $1 $vgchange_activate_options
++ fi
++ sleep 1
++ done
++
++ if [ "$TIMED_OUT" = true ] ; then
++ ocf_log err "Timed out running ocf_run vgchange $vgchange_activate_options $1"
++ log_inactive_volumes $1
++ else
++ # Child process completed, get its status.
++ wait $PID
++ if [ $? -ne 0 ] ; then
++ return $OCF_ERR_GENERIC
++ fi
++ fi
++
+ if LVM_status $vg; then
+ : OK Volume $vg activated just fine!
+ return $OCF_SUCCESS
+--
+2.7.4
+
--- /dev/null
+From 111343419dd381d81303354dad48cca5095ab080 Mon Sep 17 00:00:00 2001
+From: Scott Little <scott.little@windriver.com>
+Date: Fri, 26 Aug 2016 15:06:02 -0400
+Subject: [PATCH 02/12] WRS: Patch106: new_ocf_return_codes.patch
+
+---
+ heartbeat/ocf-returncodes | 35 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 35 insertions(+)
+
+diff --git a/heartbeat/ocf-returncodes b/heartbeat/ocf-returncodes
+index dd5f017..9200889 100644
+--- a/heartbeat/ocf-returncodes
++++ b/heartbeat/ocf-returncodes
+@@ -4,6 +4,7 @@
+ #
+ # Copyright (c) 2004 SUSE LINUX AG, Andrew Beekhof
+ # All Rights Reserved.
++# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
+ #
+ #
+ # This library is free software; you can redistribute it and/or
+@@ -53,3 +54,37 @@ OCF_NOT_RUNNING=7
+ #
+ OCF_RUNNING_MASTER=8
+ OCF_FAILED_MASTER=9
++
++# Non-standard values particular to Wind River deployments.
++#
++# OCF does not include the concept of data sync states for master/slave
++# resources.
++#
++# OCF_DATA_INCONSISTENT:
++# The resource's data is not useable.
++#
++# OCF_DATA_OUTDATED:
++# The resource's data is consistent, but a peer with more recent data
++# has been seen.
++#
++# OCF_DATA_CONSISTENT:
++# The resource's data is consistent, but it is unsure that this is the
++# most recent data.
++#
++# OCF_SYNC:
++# The resource is syncing data.
++#
++# OCF_STANDALONE:
++# The resource is operating as standalone. No peer is available or
++# syncing is not possible (i.e. split brain fencing).
++#
++OCF_DATA_INCONSISTENT=32
++OCF_DATA_OUTDATED=33
++OCF_DATA_CONSISTENT=34
++OCF_DATA_SYNC=35
++OCF_DATA_STANDALONE=36
++OCF_RUNNING_MASTER_DATA_INCONSISTENT=37
++OCF_RUNNING_MASTER_DATA_OUTDATED=38
++OCF_RUNNING_MASTER_DATA_CONSISTENT=39
++OCF_RUNNING_MASTER_DATA_SYNC=40
++OCF_RUNNING_MASTER_DATA_STANDALONE=41
+--
+1.9.1
+
--- /dev/null
+From 64f5534579e8f14f723c48f317cd56badca225ee Mon Sep 17 00:00:00 2001
+From: Don Penney <don.penney@windriver.com>
+Date: Thu, 25 Aug 2016 13:07:16 -0400
+Subject: [PATCH 1/1] Set OCF_ prefix in logs for syslog destination sorting
+
+---
+ heartbeat/ocf-shellfuncs.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
+index 3565e20..688c150 100644
+--- a/heartbeat/ocf-shellfuncs.in
++++ b/heartbeat/ocf-shellfuncs.in
+@@ -176,9 +176,9 @@ hadate() {
+ set_logtag() {
+ if [ -z "$HA_LOGTAG" ]; then
+ if [ -n "$OCF_RESOURCE_INSTANCE" ]; then
+- HA_LOGTAG="$__SCRIPT_NAME($OCF_RESOURCE_INSTANCE)[$$]"
++ HA_LOGTAG="OCF_$__SCRIPT_NAME($OCF_RESOURCE_INSTANCE)[$$]"
+ else
+- HA_LOGTAG="$__SCRIPT_NAME[$$]"
++ HA_LOGTAG="OCF_$__SCRIPT_NAME[$$]"
+ fi
+ fi
+ }
+--
+2.7.4
+
--- /dev/null
+From 386e3919b703c5a3d06edfc5b078ab67604139ab Mon Sep 17 00:00:00 2001
+From: Scott Little <scott.little@windriver.com>
+Date: Mon, 2 Oct 2017 15:12:59 -0400
+Subject: [PATCH 07/13] WRS: Patch1111: pgsql.patch
+
+---
+ heartbeat/pgsql | 23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/heartbeat/pgsql b/heartbeat/pgsql
+index 768608e..28cc046 100755
+--- a/heartbeat/pgsql
++++ b/heartbeat/pgsql
+@@ -46,6 +46,7 @@ get_pgsql_param() {
+ OCF_RESKEY_pgctl_default=/usr/bin/pg_ctl
+ OCF_RESKEY_psql_default=/usr/bin/psql
+ OCF_RESKEY_pgdata_default=/var/lib/pgsql/data
++OCF_RESKEY_pgconf_default=/etc/postgresql
+ OCF_RESKEY_pgdba_default=postgres
+ OCF_RESKEY_pghost_default=""
+ OCF_RESKEY_pgport_default=5432
+@@ -78,11 +79,12 @@ OCF_RESKEY_replication_slot_name_default=""
+ : ${OCF_RESKEY_pgctl=${OCF_RESKEY_pgctl_default}}
+ : ${OCF_RESKEY_psql=${OCF_RESKEY_psql_default}}
+ : ${OCF_RESKEY_pgdata=${OCF_RESKEY_pgdata_default}}
++: ${OCF_RESKEY_pgconf=${OCF_RESKEY_pgconf_default}}
+ : ${OCF_RESKEY_pgdba=${OCF_RESKEY_pgdba_default}}
+ : ${OCF_RESKEY_pghost=${OCF_RESKEY_pghost_default}}
+ : ${OCF_RESKEY_pgport=${OCF_RESKEY_pgport_default}}
+ : ${OCF_RESKEY_pglibs=${OCF_RESKEY_pglibs_default}}
+-: ${OCF_RESKEY_config=${OCF_RESKEY_pgdata}/postgresql.conf}
++: ${OCF_RESKEY_config=${OCF_RESKEY_pgconf}/postgresql.conf}
+ : ${OCF_RESKEY_start_opt=${OCF_RESKEY_start_opt_default}}
+ : ${OCF_RESKEY_ctl_opt=${OCF_RESKEY_ctl_opt_default}}
+ : ${OCF_RESKEY_pgdb=${OCF_RESKEY_pgdb_default}}
+@@ -180,6 +182,14 @@ Path to PostgreSQL data directory.
+ <content type="string" default="${OCF_RESKEY_pgdata_default}" />
+ </parameter>
+
++<parameter name="pgconf" unique="0" required="0">
++<longdesc lang="en">
++Path to PostgreSQL config directory.
++</longdesc>
++<shortdesc lang="en">pgconf</shortdesc>
++<content type="string" default="${OCF_RESKEY_pgconf_default}" />
++</parameter>
++
+ <parameter name="pgdba" unique="0" required="0">
+ <longdesc lang="en">
+ User that owns PostgreSQL.
+@@ -243,7 +253,7 @@ SQL script that will be used for monitor operations.
+ Path to the PostgreSQL configuration file for the instance.
+ </longdesc>
+ <shortdesc lang="en">Configuration file</shortdesc>
+-<content type="string" default="${OCF_RESKEY_pgdata}/postgresql.conf" />
++<content type="string" default="${OCF_RESKEY_pgconf}/postgresql.conf" />
+ </parameter>
+
+ <parameter name="pgdb" unique="0" required="0">
+@@ -630,6 +640,12 @@ pgsql_real_start() {
+ fi
+ fi
+
++ # WRS: Create an unversioned symlink under /var/run so SM can easily
++ # find the PID file.
++ if [ ! -h $PIDFILE_SYMLINK ]; then
++ /bin/ln -s $PIDFILE $PIDFILE_SYMLINK
++ fi
++
+ ocf_log info "PostgreSQL is started."
+ return $rc
+ }
+@@ -2078,10 +2094,11 @@ then
+ fi
+
+ PIDFILE=${OCF_RESKEY_pgdata}/postmaster.pid
++PIDFILE_SYMLINK=/var/run/postmaster.pid
+ BACKUPLABEL=${OCF_RESKEY_pgdata}/backup_label
+ RESOURCE_NAME=`echo $OCF_RESOURCE_INSTANCE | cut -d ":" -f 1`
+ PGSQL_WAL_RECEIVER_STATUS_ATTR="${RESOURCE_NAME}-receiver-status"
+-RECOVERY_CONF=${OCF_RESKEY_pgdata}/recovery.conf
++RECOVERY_CONF=${OCF_RESKEY_pgconf}/recovery.conf
+ NODENAME=$(ocf_local_nodename | tr '[A-Z]' '[a-z]')
+
+ case "$1" in
+--
+1.9.1
+
--- /dev/null
+From eb45b8271ce64a046d41c93b1cffd641245ce55f Mon Sep 17 00:00:00 2001
+From: Scott Little <scott.little@windriver.com>
+Date: Mon, 2 Oct 2017 15:12:48 -0400
+Subject: [PATCH 05/13] WRS: Patch1109: umount-in-namespace.patch
+
+---
+ heartbeat/Filesystem | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
+index f536298..05e4097 100755
+--- a/heartbeat/Filesystem
++++ b/heartbeat/Filesystem
+@@ -503,6 +503,10 @@ signal_processes() {
+ }
+ try_umount() {
+ local SUB=$1
++
++ # We need to ensure we umount in namespaces, too
++ /usr/sbin/umount-in-namespace $SUB
++
+ $UMOUNT $umount_force $SUB
+ list_mounts | grep -q " $SUB " >/dev/null 2>&1 || {
+ ocf_log info "unmounted $SUB successfully"
+--
+1.9.1
+
+++ /dev/null
-#
-# Copyright (C) 2019 Wind River Systems, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-SUMMARY = "OCF resource agents for use by compatible cluster managers"
-DESCRIPTION = "A set of scripts to interface with several services \
-to operate in a High Availability environment for both Pacemaker and \
-rgmanager service managers."
-HOMEPAGE = "http://sources.redhat.com/cluster/wiki/"
-
-LICENSE = "GPLv2+ & LGPLv2+ & GPLv3"
-LICENSE_${PN} = "GPLv2+ & LGPLv2+"
-LICENSE_${PN}-dev = "GPLv2+ & LGPLv2+"
-LICENSE_${PN}-staticdev = "GPLv2+ & LGPLv2+"
-LICENSE_${PN}-dbg = "GPLv2+ & LGPLv2+"
-LICENSE_${PN}-doc = "GPLv2+ & LGPLv2+"
-LICENSE_${PN}-extra = "GPLv3"
-LICENSE_${PN}-extra-dbg = "GPLv3"
-LICENSE_ldirectord = "GPLv2+"
-
-SRC_URI = "https://codeload.github.com/ClusterLabs/resource-agents/tar.gz/v${PV};downloadfilename=${BPN}-${PV}.tar.gz \
- file://01-disable-doc-build.patch \
- file://02-set-OCF_ROOT_DIR-to-libdir-ocf.patch \
- file://03-fix-header-defs-lookup.patch \
- file://fix-install-sh-not-found.patch \
- file://fs.sh-fix-builds-when-srcdir-and-builddir-are-sepera.patch \
- "
-
-SRC_URI[md5sum] = "8530431861e659d4ce2f04afcc4efc03"
-SRC_URI[sha256sum] = "863f83c724bad3a8bcff12b9c8712406c43e010041868826cad7b78fd8cfb9fb"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
- file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c \
- file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504"
-
-DEPENDS = "cluster-glue"
-
-# There are many tools and scripts that need bash and perl.
-# lvm.sh requires: lvm2
-# ip.sh requires: ethtool iproute2 iputils-arping
-# fs.sh requires: e2fsprogs-e2fsck util-linux quota
-# netfs.sh requires: procps util-linux nfs-utils
-RDEPENDS_${PN} += "bash perl lvm2 \
- ethtool iproute2 iputils-arping \
- e2fsprogs-e2fsck util-linux quota \
- procps nfs-utils \
-"
-
-inherit autotools systemd pkgconfig
-
-EXTRA_OECONF += "--disable-fatal-warnings \
- --with-rsctmpdir=/var/run/heartbeat/rsctmp"
-
-do_install_append() {
- rm -rf "${D}${localstatedir}/run"
- rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
-}
-
-# tickle_tcp is published under GPLv3, we just split it into ${PN}-extra,
-# and it's required by portblock, so move portblock into ${PN}-extra together.
-PACKAGES_prepend = "${PN}-extra ${PN}-extra-dbg ldirectord "
-FILES_${PN}-extra = "${libdir}/resource-agents/heartbeat/tickle_tcp \
- ${libdir}/ocf/resource.d/heartbeat/portblock \
- ${datadir}/resource-agents/ocft/configs/portblock \
- "
-FILES_${PN}-extra-dbg += "${libdir}/resource-agents/heartbeat/.debug/tickle_tcp"
-
-FILES_ldirectord = " \
- ${sbindir}/ldirectord \
- ${sysconfdir}/ha.d/resource.d/ldirectord \
- ${sysconfdir}/init.d/ldirectord \
- ${sysconfdir}/logrotate.d/ldirectord \
- ${libdir}/ocf/resource.d/heartbeat/ldirectord \
- "
-FILES_ldirectord-doc = "${mandir}/man8/ldirectord.8*"
-
-RDEPENDS_ldirectord += " \
- ipvsadm \
- libdbi-perl \
- libdigest-hmac-perl \
- libmailtools-perl \
- libnet-dns-perl \
- libsocket6-perl \
- libwww-perl \
- perl \
- perl-module-getopt-long \
- perl-module-net-ftp \
- perl-module-net-smtp \
- perl-module-pod-usage \
- perl-module-posix \
- perl-module-socket \
- perl-module-strict \
- perl-module-sys-hostname \
- perl-module-sys-syslog \
- perl-module-vars \
- "
-
-SYSTEMD_PACKAGES = "ldirectord"
-SYSTEMD_SERVICE_ldirectord += "ldirectord.service"
-
-FILES_${PN} += "${datadir}/cluster/* \
- ${libdir}/ocf/resource.d/heartbeat/ \
- ${libdir}/ocf/lib/heartbeat/* \
- ${libdir}/ocf/resource.d/redhat \
- "
-
-FILES_${PN}-dbg += "${libdir}/ocf/resource.d/heartbeat/.debug \
- ${libdir}/resource-agents/heartbeat/.debug "
+++ /dev/null
-#
-## Copyright (C) 2019 Wind River Systems, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-inherit update-alternatives
-ALTERNATIVE_PRIORITY = "70"
-ALTERNATIVE_${PN} = "drbd.sh"
-ALTERNATIVE_LINK_NAME[drbd.sh] = "${datadir}/cluster/drbd.sh"
-
-do_install_append() {
- mv ${D}${datadir}/cluster/drbd.sh ${D}${datadir}/cluster/drbd.sh.${PN}
-}
--- /dev/null
+#
+# Copyright (C) 2019 Wind River Systems, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SUMMARY = "OCF resource agents for use by compatible cluster managers"
+
+DESCRIPTION = "A set of scripts to interface with several services \
+to operate in a High Availability environment for both Pacemaker and \
+rgmanager service managers. \
+"
+HOMEPAGE = "http://sources.redhat.com/cluster/wiki/"
+
+LICENSE = "GPLv2+ & LGPLv2+ & GPLv3"
+LIC_FILES_CHKSUM = " \
+ file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
+ file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c \
+ file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
+"
+
+SRC_URI = " \
+ https://codeload.github.com/ClusterLabs/${BPN}/tar.gz/v${PV};downloadfilename=${BPN}-${PV}.tar.gz \
+ file://0001-disable-doc-build.patch \
+ file://0002-Set-OCF_ROOT_DIR-to-libdir-ocf.patch \
+ file://0003-fix-header-defs-lookup.patch \
+ file://0004-configure.ac-fix-install-sh-not-found.patch \
+ \
+ file://stx/new_ocf_return_codes.patch \
+ file://stx/ipaddr2_check_if_state.patch \
+ file://stx/copyright.patch \
+ file://stx/umount-in-namespace.patch \
+ file://stx/lvm_vg_activation.patch \
+ file://stx/pgsql.patch \
+ file://stx/Fix-VG-activity-bug-in-heartbeat-LVM-script.patch \
+ file://stx/ocf-shellfuncs_change_logtag.patch \
+ file://stx/lvm_cleanup_refs_on_stop.patch \
+ file://stx/ipaddr2_if_down.patch \
+ file://stx/ipaddr2_ignore_lo_if_state.patch \
+ file://stx/ipaddr2-avoid-failing-svc-if-down.patch \
+ file://stx/ipaddr2-use-host-scope-for-addresses-on-loopback.patch \
+"
+
+SRC_URI[md5sum] = "82e3a335f942347f1b7c27b9f8e8e984"
+SRC_URI[sha256sum] = "decc370bce20ee7a034886eb19ddb54d823f5e95c58f4d121f53cc965147f736"
+
+DEPENDS = "cluster-glue"
+
+inherit autotools systemd pkgconfig
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "70"
+ALTERNATIVE_${PN} = "drbd.sh"
+ALTERNATIVE_LINK_NAME[drbd.sh] = "${datadir}/cluster/drbd.sh"
+
+EXTRA_OECONF += " \
+ --disable-fatal-warnings \
+ --with-rsctmpdir=/var/run/heartbeat/rsctmp \
+"
+
+do_install_append() {
+ rm -rf "${D}${localstatedir}/run"
+ rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
+
+ mv ${D}${datadir}/cluster/drbd.sh ${D}${datadir}/cluster/drbd.sh.${PN}
+
+ # Create symbolic link between IPAddr and IPAddr2
+ rm -f ${D}${libdir}/ocf/resource.d/heartbeat/IPaddr
+ ln -s ${libdir}/ocf/resource.d/heartbeat/IPaddr2 ${D}${libdir}/ocf/resource.d/heartbeat/IPaddr
+}
+
+PACKAGES_prepend = " \
+ ldirectord \
+"
+
+FILES_ldirectord = " \
+ ${sbindir}/ldirectord \
+ ${sysconfdir}/ha.d/resource.d/ldirectord \
+ ${sysconfdir}/init.d/ldirectord \
+ ${sysconfdir}/logrotate.d/ldirectord \
+ ${libdir}/ocf/resource.d/heartbeat/ldirectord \
+"
+
+FILES_${PN} += " \
+ ${datadir}/cluster/* \
+ ${datadir}/${BPN}/ocft/configs/portblock \
+ ${libdir}/ocf/resource.d/heartbeat/ \
+ ${libdir}/ocf/lib/heartbeat/* \
+ ${libdir}/ocf/resource.d/redhat \
+ ${libdir}/tmpfiles.d/ \
+"
+
+FILES_${PN}-dbg += " \
+ ${libdir}/ocf/resource.d/heartbeat/.debug \
+ ${libdir}/${BPN}/heartbeat/.debug \
+"
+
+# There are many tools and scripts that need bash and perl.
+# lvm.sh requires: lvm2
+# ip.sh requires: ethtool iproute2 iputils-arping
+# fs.sh requires: e2fsprogs-e2fsck util-linux quota
+# netfs.sh requires: procps util-linux nfs-utils
+RDEPENDS_${PN} += " \
+ bash perl lvm2 \
+ ethtool iproute2 iputils-arping \
+ e2fsprogs-e2fsck util-linux quota \
+ procps nfs-utils \
+"
+
+RDEPENDS_ldirectord += " \
+ ipvsadm \
+ libdbi-perl \
+ libdigest-hmac-perl \
+ libmailtools-perl \
+ libnet-dns-perl \
+ libsocket6-perl \
+ libwww-perl \
+ perl \
+ perl-module-getopt-long \
+ perl-module-net-ftp \
+ perl-module-net-smtp \
+ perl-module-pod-usage \
+ perl-module-posix \
+ perl-module-socket \
+ perl-module-strict \
+ perl-module-sys-hostname \
+ perl-module-sys-syslog \
+ perl-module-vars \
+"
+
+SYSTEMD_PACKAGES += "ldirectord"
+SYSTEMD_SERVICE_${PN} += "resource-agents-deps.target"
+SYSTEMD_SERVICE_ldirectord += "ldirectord.service"