diff --git a/base/cluster-resource-agents/debian/meta_data.yaml b/base/cluster-resource-agents/debian/meta_data.yaml new file mode 100644 index 000000000..41c26b5bd --- /dev/null +++ b/base/cluster-resource-agents/debian/meta_data.yaml @@ -0,0 +1,10 @@ +--- +debver: 1:4.7.0-1 +debname: resource-agents +dl_path: + name: resource-agents-debian-1%254.7.0-1.tar.gz + url: https://salsa.debian.org/ha-team/resource-agents/-/archive/debian/1%254.7.0-1/resource-agents-debian-1%254.7.0-1.tar.gz + md5sum: 0b11082c28da42bd64c815a755cafc91 +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: diff --git a/base/cluster-resource-agents/debian/patches/Fix-VG-activity-bug-in-heartbeat-LVM-script.patch b/base/cluster-resource-agents/debian/patches/Fix-VG-activity-bug-in-heartbeat-LVM-script.patch new file mode 100644 index 000000000..ff40c97b4 --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/Fix-VG-activity-bug-in-heartbeat-LVM-script.patch @@ -0,0 +1,60 @@ +From 7c181a1afdc85456333f9cbf9c5827ceb0554a91 Mon Sep 17 00:00:00 2001 +From: Chris Friesen +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 + +--- + 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 + diff --git a/base/cluster-resource-agents/debian/patches/copyright.patch b/base/cluster-resource-agents/debian/patches/copyright.patch new file mode 100644 index 000000000..b91b47b49 --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/copyright.patch @@ -0,0 +1,51 @@ +From 81bcbfb829001ccf61b515edb3d53ac8f15df334 Mon Sep 17 00:00:00 2001 +From: Scott Little +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 + # and other Linux-HA contributors ++# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved. + # License: GNU General Public License (GPL) + # + ############################################################################### +-- +1.9.1 + diff --git a/base/cluster-resource-agents/debian/patches/ipaddr2-avoid-failing-svc-if-down.patch b/base/cluster-resource-agents/debian/patches/ipaddr2-avoid-failing-svc-if-down.patch new file mode 100644 index 000000000..60ac5705a --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/ipaddr2-avoid-failing-svc-if-down.patch @@ -0,0 +1,61 @@ +From c3448b1536d50291dc5ca49dce5957c39403cc82 Mon Sep 17 00:00:00 2001 +From: Bin Qian +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 + diff --git a/base/cluster-resource-agents/debian/patches/ipaddr2-use-host-scope-for-addresses-on-loopback.patch b/base/cluster-resource-agents/debian/patches/ipaddr2-use-host-scope-for-addresses-on-loopback.patch new file mode 100644 index 000000000..6980369cc --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/ipaddr2-use-host-scope-for-addresses-on-loopback.patch @@ -0,0 +1,37 @@ +From a39c83dbaf4054cc96cd4a0a2b671509dd10af28 Mon Sep 17 00:00:00 2001 +From: Bart Wensley +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 + diff --git a/base/cluster-resource-agents/debian/patches/ipaddr2_check_if_state.patch b/base/cluster-resource-agents/debian/patches/ipaddr2_check_if_state.patch new file mode 100644 index 000000000..cba203d2d --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/ipaddr2_check_if_state.patch @@ -0,0 +1,58 @@ +From fb5a76d9050c60b601a5dbbad65ed3dbff041af1 Mon Sep 17 00:00:00 2001 +From: Scott Little +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 +@@ -1002,7 +1002,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 +@@ -1061,7 +1066,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() { +@@ -1137,7 +1147,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 + diff --git a/base/cluster-resource-agents/debian/patches/ipaddr2_if_down.patch b/base/cluster-resource-agents/debian/patches/ipaddr2_if_down.patch new file mode 100644 index 000000000..40c10c52f --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/ipaddr2_if_down.patch @@ -0,0 +1,58 @@ +From 573f0835621c5e64c6270260f607624aea29d21a Mon Sep 17 00:00:00 2001 +From: Bin Qian +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 + diff --git a/base/cluster-resource-agents/debian/patches/ipaddr2_ignore_lo_if_state.patch b/base/cluster-resource-agents/debian/patches/ipaddr2_ignore_lo_if_state.patch new file mode 100644 index 000000000..551a2d15c --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/ipaddr2_ignore_lo_if_state.patch @@ -0,0 +1,43 @@ +From 81bb87debd2a683bad2173d6cb16327c776fe3b3 Mon Sep 17 00:00:00 2001 +From: Scott Little +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 + diff --git a/base/cluster-resource-agents/debian/patches/lvm_cleanup_refs_on_stop.patch b/base/cluster-resource-agents/debian/patches/lvm_cleanup_refs_on_stop.patch new file mode 100644 index 000000000..ac5186c83 --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/lvm_cleanup_refs_on_stop.patch @@ -0,0 +1,125 @@ +From 72fcaed4a9cc3c847278dd4fca88ba0bca88125a Mon Sep 17 00:00:00 2001 +From: Vu Tran +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 +--- + 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 + diff --git a/base/cluster-resource-agents/debian/patches/lvm_vg_activation.patch b/base/cluster-resource-agents/debian/patches/lvm_vg_activation.patch new file mode 100644 index 000000000..0cc594b2a --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/lvm_vg_activation.patch @@ -0,0 +1,162 @@ +From 2f1a14bd8e6cc7b5d32c87a2e176567105f4f23d Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Mon, 2 Oct 2017 15:12:54 -0400 +Subject: [PATCH] WRS: Patch1110: lvm_vg_activation.patch + +Porting the patch from StarlingX master branch. + +BTW, change the /bin/sh to /bin/bash to fix syntax error, due to the +/bin/sh in debian links to /bin/dash + +Signed-off-by: Yue Tao +--- + heartbeat/LVM | 119 +++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 117 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/LVM b/heartbeat/LVM +index a9f89a6..38f7c6b 100755 +--- a/heartbeat/LVM ++++ b/heartbeat/LVM +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/bash + # + # + # LVM +@@ -222,6 +222,81 @@ LVM_status() { + return $rc + } + ++# ++# 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 + # +@@ -242,10 +317,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.17.1 + diff --git a/base/cluster-resource-agents/debian/patches/new_ocf_return_codes.patch b/base/cluster-resource-agents/debian/patches/new_ocf_return_codes.patch new file mode 100644 index 000000000..dc078291b --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/new_ocf_return_codes.patch @@ -0,0 +1,62 @@ +From 111343419dd381d81303354dad48cca5095ab080 Mon Sep 17 00:00:00 2001 +From: Scott Little +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 + diff --git a/base/cluster-resource-agents/debian/patches/ocf-shellfuncs_change_logtag.patch b/base/cluster-resource-agents/debian/patches/ocf-shellfuncs_change_logtag.patch new file mode 100644 index 000000000..bce1699b1 --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/ocf-shellfuncs_change_logtag.patch @@ -0,0 +1,28 @@ +From 64f5534579e8f14f723c48f317cd56badca225ee Mon Sep 17 00:00:00 2001 +From: Don Penney +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 + diff --git a/base/cluster-resource-agents/debian/patches/pgsql.patch b/base/cluster-resource-agents/debian/patches/pgsql.patch new file mode 100644 index 000000000..0b7a006b5 --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/pgsql.patch @@ -0,0 +1,88 @@ +From d50bcc4bb667e6b63e55ae4b788391c78a162d9f Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Mon, 2 Oct 2017 15:12:59 -0400 +Subject: [PATCH] WRS: Patch1111: pgsql.patch + +--- + heartbeat/pgsql | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/heartbeat/pgsql b/heartbeat/pgsql +index cce4e1c..38949eb 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 +@@ -79,11 +80,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}} +@@ -182,6 +184,14 @@ Path to PostgreSQL data directory. + + + ++ ++ ++Path to PostgreSQL config directory. ++ ++pgconf ++ ++ ++ + + + User that owns PostgreSQL. +@@ -245,7 +255,7 @@ SQL script that will be used for monitor operations. + Path to the PostgreSQL configuration file for the instance. + + Configuration file +- ++ + + + +@@ -634,6 +644,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 + } +@@ -2150,10 +2166,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]') + USE_STANDBY_SIGNAL=false + +-- +2.17.1 + diff --git a/base/cluster-resource-agents/debian/patches/series b/base/cluster-resource-agents/debian/patches/series new file mode 100644 index 000000000..ba439b4b5 --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/series @@ -0,0 +1,14 @@ +#Backport from StarlingX master branch +new_ocf_return_codes.patch +ipaddr2_check_if_state.patch +copyright.patch +umount-in-namespace.patch +lvm_vg_activation.patch +pgsql.patch +Fix-VG-activity-bug-in-heartbeat-LVM-script.patch +ocf-shellfuncs_change_logtag.patch +lvm_cleanup_refs_on_stop.patch +ipaddr2_if_down.patch +ipaddr2_ignore_lo_if_state.patch +ipaddr2-avoid-failing-svc-if-down.patch +ipaddr2-use-host-scope-for-addresses-on-loopback.patch diff --git a/base/cluster-resource-agents/debian/patches/umount-in-namespace.patch b/base/cluster-resource-agents/debian/patches/umount-in-namespace.patch new file mode 100644 index 000000000..a18d620fa --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/umount-in-namespace.patch @@ -0,0 +1,28 @@ +From 589a7fd77e144f25d905f4af28fa60c844f8d9c1 Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Mon, 2 Oct 2017 15:12:48 -0400 +Subject: [PATCH] WRS: Patch1109: umount-in-namespace.patch + +Signed-off-by: Yue Tao +--- + heartbeat/Filesystem | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem +index 0323dd9..b8c445f 100755 +--- a/heartbeat/Filesystem ++++ b/heartbeat/Filesystem +@@ -622,6 +622,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 "${TAB}${SUB}${TAB}" >/dev/null 2>&1 || { + ocf_log info "unmounted $SUB successfully" +-- +2.17.1 +