diff --git a/SOURCES/bz1363902-SAPHanaSR-monitor-fix-tolower-error.patch b/SOURCES/bz1363902-SAPHanaSR-monitor-fix-tolower-error.patch new file mode 100644 index 0000000..57e0a6f --- /dev/null +++ b/SOURCES/bz1363902-SAPHanaSR-monitor-fix-tolower-error.patch @@ -0,0 +1,23 @@ +From 9eafa6e3dd9735bdd1e4e447d9e8c3d4da1e9c30 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 27 Jun 2019 10:38:46 +0200 +Subject: [PATCH] SAPHanaSR-monitor: fix tolower() issue, which seems to be an + artifact from a2p (Awk to Perl) + +--- + SAPHana/bin/SAPHanaSR-monitor | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor b/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor +index 737545c..da6bf08 100755 +--- a/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor ++++ b/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor +@@ -219,7 +219,7 @@ sub processMonitor() { + # + $sid=$sids[0]; # currently ony one sid is supported + ( $sid, $ino ) = split(":", $sid); +- $sid=tolower("$sid"); ++ $sid=lc("$sid"); + get_hana_attributes($sid, \%Host, \%HName, \%Global, \%GName, \%Site, \%SName); + if ( keys(%Host) == 0 ) { + printf "No attributes found for SID=%s\n", $sid; diff --git a/SOURCES/bz1504055-IPsrcaddr-fix-regression-without-NetworkManager.patch b/SOURCES/bz1504055-IPsrcaddr-fix-regression-without-NetworkManager.patch new file mode 100644 index 0000000..ed60aca --- /dev/null +++ b/SOURCES/bz1504055-IPsrcaddr-fix-regression-without-NetworkManager.patch @@ -0,0 +1,75 @@ +From 6052e8fd37d23f46db217f915b445c7e67dccb34 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 4 Apr 2019 13:31:27 +0200 +Subject: [PATCH] IPsrcaddr: make proto optional to fix regression when used + without NetworkManager + +--- + heartbeat/IPsrcaddr | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr +index 4ca3d2364..5a447196e 100755 +--- a/heartbeat/IPsrcaddr ++++ b/heartbeat/IPsrcaddr +@@ -50,12 +50,17 @@ + + ####################################################################### + # Initialization: +- + : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} + . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs + ++# Defaults ++OCF_RESKEY_proto_default="" ++ ++: ${OCF_RESKEY_proto=${OCF_RESKEY_proto_default}} + ####################################################################### + ++[ -z "$OCF_RESKEY_proto" ] && PROTO="" || PROTO="proto $OCF_RESKEY_proto" ++ + USAGE="usage: $0 {start|stop|status|monitor|validate-all|meta-data}"; + + CMDSHOW="$IP2UTIL route show to exact 0.0.0.0/0" +@@ -97,6 +102,14 @@ dotted quad notation 255.255.255.0). + Netmask + + ++ ++ ++ ++Proto to match when finding network. E.g. "kernel". ++ ++Proto ++ ++ + + + +@@ -172,7 +185,7 @@ srca_start() { + rc=$OCF_SUCCESS + ocf_log info "The ip route has been already set.($NETWORK, $INTERFACE, $ROUTE_WO_SRC)" + else +- ip route replace $NETWORK dev $INTERFACE src $1 || \ ++ $IP2UTIL route replace $NETWORK dev $INTERFACE src $1 || \ + errorexit "command 'ip route replace $NETWORK dev $INTERFACE src $1' failed" + + $CMDCHANGE $ROUTE_WO_SRC src $1 || \ +@@ -204,7 +217,7 @@ srca_stop() { + + [ $rc = 2 ] && errorexit "The address you specified to stop does not match the preferred source address" + +- ip route replace $NETWORK dev $INTERFACE || \ ++ $IP2UTIL route replace $NETWORK dev $INTERFACE || \ + errorexit "command 'ip route replace $NETWORK dev $INTERFACE' failed" + + $CMDCHANGE $ROUTE_WO_SRC || \ +@@ -473,7 +486,7 @@ rc=$? + } + + INTERFACE=`echo $findif_out | awk '{print $1}'` +-NETWORK=`ip route list dev $INTERFACE scope link proto kernel match $ipaddress|grep -o '^[^ ]*'` ++NETWORK=`$IP2UTIL route list dev $INTERFACE scope link $PROTO match $ipaddress|grep -m 1 -o '^[^ ]*'` + + case $1 in + start) srca_start $ipaddress diff --git a/SOURCES/bz1549579-1-clvm-exclusive-mode-support.patch b/SOURCES/bz1549579-1-clvm-exclusive-mode-support.patch new file mode 100644 index 0000000..df7ac6f --- /dev/null +++ b/SOURCES/bz1549579-1-clvm-exclusive-mode-support.patch @@ -0,0 +1,53 @@ +From fa434dc0f5a40ebd371874744174defa11407a5f Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Tue, 30 Oct 2018 13:39:38 +0100 +Subject: [PATCH] clvm: support exclusive mode + +--- + heartbeat/clvm.in | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/clvm.in b/heartbeat/clvm.in +index 5197b50f4..3ab196199 100644 +--- a/heartbeat/clvm.in ++++ b/heartbeat/clvm.in +@@ -72,6 +72,15 @@ is set to. + + + ++ ++ ++If set, only exclusive volume groups will be monitored. ++ ++Only monitor exclusive volume groups ++ ++ ++ ++ + + + +@@ -215,7 +224,13 @@ clvmd_status() + + # NOTE: replace this with vgs, once display filter per attr is implemented. + clustered_vgs() { +- ${LVM_VGDISPLAY} 2>/dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}' ++ if ! ocf_is_true "$OCF_RESKEY_exclusive"; then ++ ${LVM_VGDISPLAY} 2>/dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}' ++ else ++ for vg in $(vgs --select "clustered=yes" -o name --noheadings); do ++ lvs --select lv_active=~'local.*exclusive' -o vg_name --noheadings $vg 2> /dev/null | awk '!seen[$1]++ {print $1}' ++ done ++ fi + } + + wait_for_process() +@@ -374,7 +389,7 @@ clvmd_start() + return $?; + fi + +- # autoset locking type to clusted when lvmconf tool is available ++ # autoset locking type to clustered when lvmconf tool is available + if [ -x "$LVMCONF" ]; then + $LVMCONF --enable-cluster > /dev/null 2>&1 + fi diff --git a/SOURCES/bz1549579-2-ocf_is_true-add-True-to-regexp.patch b/SOURCES/bz1549579-2-ocf_is_true-add-True-to-regexp.patch new file mode 100644 index 0000000..00e34b8 --- /dev/null +++ b/SOURCES/bz1549579-2-ocf_is_true-add-True-to-regexp.patch @@ -0,0 +1,22 @@ +From 73b35b74b743403aeebab43205475be6f2938cd5 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Wed, 12 Jun 2019 10:11:07 +0200 +Subject: [PATCH] ocf_is_true: add True to regexp + +--- + heartbeat/ocf-shellfuncs.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in +index b17297e1a..7a97558a5 100644 +--- a/heartbeat/ocf-shellfuncs.in ++++ b/heartbeat/ocf-shellfuncs.in +@@ -101,7 +101,7 @@ ocf_is_decimal() { + + ocf_is_true() { + case "$1" in +- yes|true|1|YES|TRUE|ja|on|ON) true ;; ++ yes|true|1|YES|TRUE|True|ja|on|ON) true ;; + *) false ;; + esac + } diff --git a/SOURCES/bz1575095-rabbitmq-cluster-retry-start-cluster-join-fails.patch b/SOURCES/bz1575095-rabbitmq-cluster-retry-start-cluster-join-fails.patch new file mode 100644 index 0000000..80fe18b --- /dev/null +++ b/SOURCES/bz1575095-rabbitmq-cluster-retry-start-cluster-join-fails.patch @@ -0,0 +1,83 @@ +From 63c9449bfa9a7fecbc0f00394699a475a384671d Mon Sep 17 00:00:00 2001 +From: Damien Ciabrini +Date: Thu, 9 Aug 2018 16:33:26 +0200 +Subject: [PATCH] rabbitmq-cluster: retry start when cluster join fails + +When a node tries to join an existing cluster, it fetches a node +list to try to connect from any of those running nodes. + +If the nodes from this list become unavailable while we're joining +the cluster, the rabbitmq server will fail to get clustered and +make the start operation fail. + +Give the resource a chance to start anyway by retrying the entire +start actions until it succeeds or until the start timeout is +reached and pacemaker stops the start operation. + +Co-Authored-by: +Suggested-by: +--- + heartbeat/rabbitmq-cluster | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) + +diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster +index 9ff49e075..84f383460 100755 +--- a/heartbeat/rabbitmq-cluster ++++ b/heartbeat/rabbitmq-cluster +@@ -31,6 +31,12 @@ + + ####################################################################### + ++# This arbitrary value here is used by the rmq_start action to ++# signify that the resource agent must retry the start process ++# It might potentially conflict with OCF assigned error code ++# in the future. ++RMQ_TRY_RESTART_ERROR_CODE=126 ++ + RMQ_SERVER=/usr/sbin/rabbitmq-server + RMQ_CTL=/usr/sbin/rabbitmqctl + RMQ_DATA_DIR="/var/lib/rabbitmq/mnesia" +@@ -354,7 +360,7 @@ rmq_notify() { + return $OCF_SUCCESS + } + +-rmq_start() { ++rmq_try_start() { + local join_list="" + local rc + +@@ -384,8 +390,16 @@ rmq_start() { + rc=$? + + if [ $rc -ne 0 ]; then +- ocf_log info "node failed to join even after reseting local data. Check SELINUX policy" +- return $OCF_ERR_GENERIC ++ # we could not join the rabbitmq cluster from any of the running nodes ++ # this might be due to a unexpected reset of those nodes. Give ourself ++ # a chance to start by retrying the entire start sequence. ++ ++ ocf_log warn "Failed to join the RabbitMQ cluster from nodes ${join_list}. Stopping local unclustered rabbitmq" ++ rmq_stop ++ ++ ocf_log warn "Re-detect available rabbitmq nodes and try to start again" ++ # return an unused OCF value to signify a "retry" condition ++ return $RMQ_TRY_RESTART_ERROR_CODE + fi + + # Restore users, user permissions, and policies (if any) +@@ -443,6 +457,15 @@ rmq_start() { + return $OCF_SUCCESS + } + ++rmq_start() { ++ local rc=$RMQ_TRY_RESTART_ERROR_CODE ++ while [ $rc -eq $RMQ_TRY_RESTART_ERROR_CODE ]; do ++ rmq_try_start ++ rc=$? ++ done ++ return $rc ++} ++ + rmq_stop() { + # Backup users, user permissions, and policies + BaseDataDir=`dirname $RMQ_DATA_DIR` diff --git a/SOURCES/bz1598969-iSCSILogicalUnit-create-iqn-when-it-doesnt-exist.patch b/SOURCES/bz1598969-iSCSILogicalUnit-create-iqn-when-it-doesnt-exist.patch new file mode 100644 index 0000000..d50b231 --- /dev/null +++ b/SOURCES/bz1598969-iSCSILogicalUnit-create-iqn-when-it-doesnt-exist.patch @@ -0,0 +1,31 @@ +From 9273b83edf6ee72a59511f307e168813ca3d31fd Mon Sep 17 00:00:00 2001 +From: colttt +Date: Fri, 12 Oct 2018 15:29:48 +0200 +Subject: [PATCH] possible fix for #1026 + +add an if-condition and remove an useless 'targetcli create' +--- + heartbeat/iSCSITarget.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/heartbeat/iSCSITarget.in b/heartbeat/iSCSITarget.in +index e49a79016..9128fdc55 100644 +--- a/heartbeat/iSCSITarget.in ++++ b/heartbeat/iSCSITarget.in +@@ -340,13 +340,13 @@ iSCSITarget_start() { + ocf_take_lock $TARGETLOCKFILE + ocf_release_lock_on_exit $TARGETLOCKFILE + ocf_run targetcli /iscsi set global auto_add_default_portal=false || exit $OCF_ERR_GENERIC +- ocf_run targetcli /iscsi create ${OCF_RESKEY_iqn} || exit $OCF_ERR_GENERIC ++ if ! [ -d /sys/kernel/config/target/iscsi/${OCF_RESKEY_iqn} ] ; then ++ ocf_run targetcli /iscsi create ${OCF_RESKEY_iqn} || exit $OCF_ERR_GENERIC ++ fi + for portal in ${OCF_RESKEY_portals}; do + if [ $portal != ${OCF_RESKEY_portals_default} ] ; then + IFS=':' read -a sep_portal <<< "$portal" + ocf_run targetcli /iscsi/${OCF_RESKEY_iqn}/tpg1/portals create "${sep_portal[0]}" "${sep_portal[1]}" || exit $OCF_ERR_GENERIC +- else +- ocf_run targetcli /iscsi create ${OCF_RESKEY_iqn} || exit $OCF_ERR_GENERIC + fi + done + # in lio, we can set target parameters by manipulating diff --git a/SOURCES/bz1629357-docker-fix-stop-issues.patch b/SOURCES/bz1629357-docker-fix-stop-issues.patch new file mode 100644 index 0000000..d4e6f16 --- /dev/null +++ b/SOURCES/bz1629357-docker-fix-stop-issues.patch @@ -0,0 +1,88 @@ +From 5949405d0031a4aba91c81cb28c24821ad2d439a Mon Sep 17 00:00:00 2001 +From: Reid Wahl +Date: Thu, 3 Jan 2019 15:05:20 -0800 +Subject: [PATCH] docker: Fix issues with stop operation + +The docker RA's stop operation doesn't behave properly in some cases. + 1. It returns a false success code in case of an error response from + the daemon. + 2. It fails at `remove_container()` if the container does not exist + but another docker object of the same name does exist. + +In case #1, the `container_exists()` function returns the same exit code +(1) if the container is not found (an expected error) or if there is an +error response from the docker daemon (an unexpected error). These types +of errors should be handled differently. + +In case #2, the `docker inspect` calls do not limit their search to +containers. So if a non-container object is found with a matching name, +the RA attempts to remove a container by that name. Such a container may +not exist. + +This patch fixes these issues as follows: + 1. Match an error response in `container_exists()` against the string + "No such container". + 2. Add `--type=container` to the `docker inspect` calls to restrict + the match. +--- + heartbeat/docker | 26 ++++++++++++++++++++++---- + 1 file changed, 22 insertions(+), 4 deletions(-) + +diff --git a/heartbeat/docker b/heartbeat/docker +index f5ba83ff2..c206344ad 100755 +--- a/heartbeat/docker ++++ b/heartbeat/docker +@@ -215,7 +215,7 @@ monitor_cmd_exec() + out=$(docker exec ${CONTAINER} $OCF_RESKEY_monitor_cmd 2>&1) + rc=$? + else +- out=$(echo "$OCF_RESKEY_monitor_cmd" | nsenter --target $(docker inspect --format {{.State.Pid}} ${CONTAINER}) --mount --uts --ipc --net --pid 2>&1) ++ out=$(echo "$OCF_RESKEY_monitor_cmd" | nsenter --target $(docker inspect --type=container --format {{.State.Pid}} ${CONTAINER}) --mount --uts --ipc --net --pid 2>&1) + rc=$? + fi + +@@ -236,7 +236,25 @@ monitor_cmd_exec() + + container_exists() + { +- docker inspect --format {{.State.Running}} $CONTAINER | egrep '(true|false)' >/dev/null 2>&1 ++ local err ++ ++ err=$(docker inspect --type=container $CONTAINER 2>&1 >/dev/null) ++ ++ if [ $? -ne $OCF_SUCCESS ]; then ++ case $err in ++ *"No such container"*) ++ # Return failure instead of exiting if container does not exist ++ return 1 ++ ;; ++ *) ++ # Exit if error running command ++ ocf_exit_reason "$err" ++ exit $OCF_ERR_GENERIC ++ ;; ++ esac ++ fi ++ ++ return $OCF_SUCCESS + } + + remove_container() +@@ -265,7 +283,7 @@ docker_simple_status() + fi + + # retrieve the 'Running' attribute for the container +- val=$(docker inspect --format {{.State.Running}} $CONTAINER 2>/dev/null) ++ val=$(docker inspect --type=container --format {{.State.Running}} $CONTAINER 2>/dev/null) + if [ $? -ne 0 ]; then + #not running as a result of container not being found + return $OCF_NOT_RUNNING +@@ -295,7 +313,7 @@ docker_health_status() + # if starting takes longer than monitor timeout then upstream will make this fail. + while + +- val=$(docker inspect --format {{.State.Health.Status}} $CONTAINER 2>/dev/null) ++ val=$(docker inspect --type=container --format {{.State.Health.Status}} $CONTAINER 2>/dev/null) + if [ $? -ne 0 ]; then + #not healthy as a result of container not being found + return $OCF_NOT_RUNNING diff --git a/SOURCES/bz1639826-rabbitmq-cluster-fix-stop-regression.patch b/SOURCES/bz1639826-rabbitmq-cluster-fix-stop-regression.patch new file mode 100644 index 0000000..8b422eb --- /dev/null +++ b/SOURCES/bz1639826-rabbitmq-cluster-fix-stop-regression.patch @@ -0,0 +1,63 @@ +From 19ee29342f8bb573722991b8cbe4503309ad0bf9 Mon Sep 17 00:00:00 2001 +From: John Eckersberg +Date: Fri, 2 Nov 2018 13:12:53 -0400 +Subject: [PATCH] rabbitmq-cluster: fix regression in rmq_stop + +This regression was introduced in PR#1249 (cc23c55). The stop action +was modified to use rmq_app_running in order to check the service +status, which allows for the following sequence of events: + +- service is started, unclustered +- stop_app is called +- cluster_join is attempted and fails +- stop is called + +Because stop_app was called, rmq_app_running returns $OCF_NOT_RUNNING +and the stop action is a no-op. This means the erlang VM continues +running. + +When the start action is attempted again, a new erlang VM is launched, +but this VM fails to boot because the old one is still running and is +registered with the same name (rabbit@nodename). + +This adds a new function, rmq_node_alive, which does a simple eval to +test whether the erlang VM is up, independent of the rabbit app. The +stop action now uses rmq_node_alive to check the service status, so +even if stop_app was previously called, the erlang VM will be stopped +properly. + +Resolves: RHBZ#1639826 +--- + heartbeat/rabbitmq-cluster | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster +index 78b2bbadf..a2de9dc20 100755 +--- a/heartbeat/rabbitmq-cluster ++++ b/heartbeat/rabbitmq-cluster +@@ -188,6 +188,16 @@ rmq_app_running() { + fi + } + ++rmq_node_alive() { ++ if $RMQ_CTL eval 'ok.'; then ++ ocf_log debug "RabbitMQ node is alive" ++ return $OCF_SUCCESS ++ else ++ ocf_log debug "RabbitMQ node is down" ++ return $OCF_NOT_RUNNING ++ fi ++} ++ + rmq_monitor() { + local rc + +@@ -514,7 +524,7 @@ rmq_stop() { + end. + " + +- rmq_app_running ++ rmq_node_alive + if [ $? -eq $OCF_NOT_RUNNING ]; then + return $OCF_SUCCESS + fi diff --git a/SOURCES/bz1641946-1-rabbitmq-cluster-fail-in-minority-partition.patch b/SOURCES/bz1641946-1-rabbitmq-cluster-fail-in-minority-partition.patch deleted file mode 100644 index 72f5ff6..0000000 --- a/SOURCES/bz1641946-1-rabbitmq-cluster-fail-in-minority-partition.patch +++ /dev/null @@ -1,96 +0,0 @@ -From cc23c5523a0185fa557a5ab9056d50a60300d12a Mon Sep 17 00:00:00 2001 -From: John Eckersberg -Date: Tue, 16 Oct 2018 16:21:25 -0400 -Subject: [PATCH] rabbitmq-cluster: fail monitor when node is in minority - partition - -It's possible for mnesia to still be running, but for mnesia to be -partitioned. And it's also possible to get into this state without -pacemaker seeing the node go down so no corrective action is taken. - -When monitoring, check the number of nodes that pacemaker thinks is -running, and compare to the number of nodes that mnesia thinks is -running. If mnesia only sees a minority of the total nodes, fail it -so corrective action can be taken to rejoin the cluster. - -This also adds a new function, rmq_app_running, which simply checks -whether the app is running or not and does not care about the -partition status. This is now used instead of the full monitor in a -few places where we don't care about partition state. - -Resolves: RHBZ#1639826 ---- - heartbeat/rabbitmq-cluster | 28 +++++++++++++++++++++++++--- - 1 file changed, 25 insertions(+), 3 deletions(-) - -diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster -index 204917475..78b2bbadf 100755 ---- a/heartbeat/rabbitmq-cluster -+++ b/heartbeat/rabbitmq-cluster -@@ -178,10 +178,31 @@ remove_pid () { - rm -f ${RMQ_PID_FILE} > /dev/null 2>&1 - } - -+rmq_app_running() { -+ if $RMQ_CTL eval 'application:which_applications().' | grep -q '{rabbit,'; then -+ ocf_log debug "RabbitMQ application is running" -+ return $OCF_SUCCESS -+ else -+ ocf_log debug "RabbitMQ application is stopped" -+ return $OCF_NOT_RUNNING -+ fi -+} -+ - rmq_monitor() { - local rc - - if $RMQ_CTL eval 'rabbit_mnesia:cluster_status_from_mnesia().' | grep -q '^{ok'; then -+ pcs_running=$(rmq_join_list | wc -w) -+ ocf_log debug "Pacemaker thinks ${pcs_running} RabbitMQ nodes are running" -+ rmq_running=$($RMQ_CTL eval 'length(mnesia:system_info(running_db_nodes)).') -+ ocf_log debug "RabbitMQ thinks ${rmq_running} RabbitMQ nodes are running" -+ -+ if [ $(( $rmq_running * 2 )) -lt $pcs_running ]; then -+ ocf_log info "RabbitMQ is a minority partition, failing monitor" -+ rmq_delete_nodename -+ return $OCF_ERR_GENERIC -+ fi -+ - ocf_log debug "RabbitMQ server is running normally" - rmq_write_nodename - -@@ -215,7 +236,7 @@ rmq_init_and_wait() - return $OCF_ERR_GENERIC - fi - -- rmq_monitor -+ rmq_app_running - return $? - } - -@@ -236,6 +257,7 @@ rmq_start_first() - if [ $rc -eq 0 ]; then - rc=$OCF_SUCCESS - ocf_log info "cluster bootstrapped" -+ rmq_write_nodename - - if [ -n "$OCF_RESKEY_set_policy" ]; then - # do not quote set_policy, we are passing in arguments -@@ -492,7 +514,7 @@ rmq_stop() { - end. - " - -- rmq_monitor -+ rmq_app_running - if [ $? -eq $OCF_NOT_RUNNING ]; then - return $OCF_SUCCESS - fi -@@ -508,7 +530,7 @@ rmq_stop() { - #TODO add kill logic - stop_wait=1 - while [ $stop_wait = 1 ]; do -- rmq_monitor -+ rmq_app_running - rc=$? - if [ "$rc" -eq $OCF_NOT_RUNNING ]; then - stop_wait=0 diff --git a/SOURCES/bz1641946-2-rabbitmq-cluster-fix-stop-regression.patch b/SOURCES/bz1641946-2-rabbitmq-cluster-fix-stop-regression.patch deleted file mode 100644 index 8b422eb..0000000 --- a/SOURCES/bz1641946-2-rabbitmq-cluster-fix-stop-regression.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 19ee29342f8bb573722991b8cbe4503309ad0bf9 Mon Sep 17 00:00:00 2001 -From: John Eckersberg -Date: Fri, 2 Nov 2018 13:12:53 -0400 -Subject: [PATCH] rabbitmq-cluster: fix regression in rmq_stop - -This regression was introduced in PR#1249 (cc23c55). The stop action -was modified to use rmq_app_running in order to check the service -status, which allows for the following sequence of events: - -- service is started, unclustered -- stop_app is called -- cluster_join is attempted and fails -- stop is called - -Because stop_app was called, rmq_app_running returns $OCF_NOT_RUNNING -and the stop action is a no-op. This means the erlang VM continues -running. - -When the start action is attempted again, a new erlang VM is launched, -but this VM fails to boot because the old one is still running and is -registered with the same name (rabbit@nodename). - -This adds a new function, rmq_node_alive, which does a simple eval to -test whether the erlang VM is up, independent of the rabbit app. The -stop action now uses rmq_node_alive to check the service status, so -even if stop_app was previously called, the erlang VM will be stopped -properly. - -Resolves: RHBZ#1639826 ---- - heartbeat/rabbitmq-cluster | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster -index 78b2bbadf..a2de9dc20 100755 ---- a/heartbeat/rabbitmq-cluster -+++ b/heartbeat/rabbitmq-cluster -@@ -188,6 +188,16 @@ rmq_app_running() { - fi - } - -+rmq_node_alive() { -+ if $RMQ_CTL eval 'ok.'; then -+ ocf_log debug "RabbitMQ node is alive" -+ return $OCF_SUCCESS -+ else -+ ocf_log debug "RabbitMQ node is down" -+ return $OCF_NOT_RUNNING -+ fi -+} -+ - rmq_monitor() { - local rc - -@@ -514,7 +524,7 @@ rmq_stop() { - end. - " - -- rmq_app_running -+ rmq_node_alive - if [ $? -eq $OCF_NOT_RUNNING ]; then - return $OCF_SUCCESS - fi diff --git a/SOURCES/bz1641946-rabbitmq-cluster-fail-when-in-minority-partition.patch b/SOURCES/bz1641946-rabbitmq-cluster-fail-when-in-minority-partition.patch new file mode 100644 index 0000000..72f5ff6 --- /dev/null +++ b/SOURCES/bz1641946-rabbitmq-cluster-fail-when-in-minority-partition.patch @@ -0,0 +1,96 @@ +From cc23c5523a0185fa557a5ab9056d50a60300d12a Mon Sep 17 00:00:00 2001 +From: John Eckersberg +Date: Tue, 16 Oct 2018 16:21:25 -0400 +Subject: [PATCH] rabbitmq-cluster: fail monitor when node is in minority + partition + +It's possible for mnesia to still be running, but for mnesia to be +partitioned. And it's also possible to get into this state without +pacemaker seeing the node go down so no corrective action is taken. + +When monitoring, check the number of nodes that pacemaker thinks is +running, and compare to the number of nodes that mnesia thinks is +running. If mnesia only sees a minority of the total nodes, fail it +so corrective action can be taken to rejoin the cluster. + +This also adds a new function, rmq_app_running, which simply checks +whether the app is running or not and does not care about the +partition status. This is now used instead of the full monitor in a +few places where we don't care about partition state. + +Resolves: RHBZ#1639826 +--- + heartbeat/rabbitmq-cluster | 28 +++++++++++++++++++++++++--- + 1 file changed, 25 insertions(+), 3 deletions(-) + +diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster +index 204917475..78b2bbadf 100755 +--- a/heartbeat/rabbitmq-cluster ++++ b/heartbeat/rabbitmq-cluster +@@ -178,10 +178,31 @@ remove_pid () { + rm -f ${RMQ_PID_FILE} > /dev/null 2>&1 + } + ++rmq_app_running() { ++ if $RMQ_CTL eval 'application:which_applications().' | grep -q '{rabbit,'; then ++ ocf_log debug "RabbitMQ application is running" ++ return $OCF_SUCCESS ++ else ++ ocf_log debug "RabbitMQ application is stopped" ++ return $OCF_NOT_RUNNING ++ fi ++} ++ + rmq_monitor() { + local rc + + if $RMQ_CTL eval 'rabbit_mnesia:cluster_status_from_mnesia().' | grep -q '^{ok'; then ++ pcs_running=$(rmq_join_list | wc -w) ++ ocf_log debug "Pacemaker thinks ${pcs_running} RabbitMQ nodes are running" ++ rmq_running=$($RMQ_CTL eval 'length(mnesia:system_info(running_db_nodes)).') ++ ocf_log debug "RabbitMQ thinks ${rmq_running} RabbitMQ nodes are running" ++ ++ if [ $(( $rmq_running * 2 )) -lt $pcs_running ]; then ++ ocf_log info "RabbitMQ is a minority partition, failing monitor" ++ rmq_delete_nodename ++ return $OCF_ERR_GENERIC ++ fi ++ + ocf_log debug "RabbitMQ server is running normally" + rmq_write_nodename + +@@ -215,7 +236,7 @@ rmq_init_and_wait() + return $OCF_ERR_GENERIC + fi + +- rmq_monitor ++ rmq_app_running + return $? + } + +@@ -236,6 +257,7 @@ rmq_start_first() + if [ $rc -eq 0 ]; then + rc=$OCF_SUCCESS + ocf_log info "cluster bootstrapped" ++ rmq_write_nodename + + if [ -n "$OCF_RESKEY_set_policy" ]; then + # do not quote set_policy, we are passing in arguments +@@ -492,7 +514,7 @@ rmq_stop() { + end. + " + +- rmq_monitor ++ rmq_app_running + if [ $? -eq $OCF_NOT_RUNNING ]; then + return $OCF_SUCCESS + fi +@@ -508,7 +530,7 @@ rmq_stop() { + #TODO add kill logic + stop_wait=1 + while [ $stop_wait = 1 ]; do +- rmq_monitor ++ rmq_app_running + rc=$? + if [ "$rc" -eq $OCF_NOT_RUNNING ]; then + stop_wait=0 diff --git a/SOURCES/bz1642069-1-SAPInstance-add-reload-action.patch b/SOURCES/bz1642069-1-SAPInstance-add-reload-action.patch new file mode 100644 index 0000000..9f036c0 --- /dev/null +++ b/SOURCES/bz1642069-1-SAPInstance-add-reload-action.patch @@ -0,0 +1,92 @@ +From 70a28e8130be863a9073b0a80e0511e971e205c4 Mon Sep 17 00:00:00 2001 +From: Fabian Herschel +Date: Fri, 27 Jul 2018 12:33:19 +0200 +Subject: [PATCH 1/2] SAPInstance: implemeted reload method The reload method + is needed to avoid resource restarts after a non-unique parameter has been + changed. This is in special for interest of the MONITOR_SERVICES parameter. + +--- + heartbeat/SAPInstance | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance +index 8de7cee8c..c25839f0c 100755 +--- a/heartbeat/SAPInstance ++++ b/heartbeat/SAPInstance +@@ -61,6 +61,7 @@ sapinstance_usage() { + The 'monitor' operation reports whether the instance seems to be working + The 'promote' operation starts the primary instance in a Master/Slave configuration + The 'demote' operation stops the primary instance and starts the ERS instance ++ The 'reload' operation allows changed parameters (non-unique only) without restarting the service + The 'notify' operation always returns SUCCESS + The 'validate-all' operation reports whether the parameters are valid + The 'methods' operation reports on the methods $0 supports +@@ -224,6 +225,7 @@ The name of the SAP START profile. Specify this parameter, if you have changed t + + + ++ + + + +@@ -244,6 +246,7 @@ sapinstance_methods() { + monitor + promote + demote ++ reload + notify + validate-all + methods +@@ -965,6 +968,9 @@ case "$ACTION" in + exit $?;; + validate-all) sapinstance_validate + exit $?;; ++ reload ) ++ ocf_log info "reloading SAPInstance parameters" ++ exit $OCF_SUCCESS;; + *) sapinstance_methods + exit $OCF_ERR_UNIMPLEMENTED;; + esac + +From ee529b088cc1111656e94dea56b9fcfa6d813313 Mon Sep 17 00:00:00 2001 +From: Fabian Herschel +Date: Fri, 27 Jul 2018 13:02:39 +0200 +Subject: [PATCH 2/2] SAPInstance: Improved indents + +--- + heartbeat/SAPInstance | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance +index c25839f0c..174ea36ef 100755 +--- a/heartbeat/SAPInstance ++++ b/heartbeat/SAPInstance +@@ -61,7 +61,7 @@ sapinstance_usage() { + The 'monitor' operation reports whether the instance seems to be working + The 'promote' operation starts the primary instance in a Master/Slave configuration + The 'demote' operation stops the primary instance and starts the ERS instance +- The 'reload' operation allows changed parameters (non-unique only) without restarting the service ++ The 'reload' operation allows changed parameters (non-unique only) without restarting the service + The 'notify' operation always returns SUCCESS + The 'validate-all' operation reports whether the parameters are valid + The 'methods' operation reports on the methods $0 supports +@@ -246,7 +246,7 @@ sapinstance_methods() { + monitor + promote + demote +- reload ++ reload + notify + validate-all + methods +@@ -969,8 +969,8 @@ case "$ACTION" in + validate-all) sapinstance_validate + exit $?;; + reload ) +- ocf_log info "reloading SAPInstance parameters" +- exit $OCF_SUCCESS;; ++ ocf_log info "reloading SAPInstance parameters" ++ exit $OCF_SUCCESS;; + *) sapinstance_methods + exit $OCF_ERR_UNIMPLEMENTED;; + esac diff --git a/SOURCES/bz1642069-2-SAPInstance-improve-profile-detection.patch b/SOURCES/bz1642069-2-SAPInstance-improve-profile-detection.patch new file mode 100644 index 0000000..e21e2da --- /dev/null +++ b/SOURCES/bz1642069-2-SAPInstance-improve-profile-detection.patch @@ -0,0 +1,26 @@ +From 8eda4725a946ca669df035ed0ffdf053a65e1258 Mon Sep 17 00:00:00 2001 +From: Fabian Herschel +Date: Thu, 2 Aug 2018 15:36:31 +0200 +Subject: [PATCH] SAPInstance: Improved SAP instance profile detection + +--- + heartbeat/SAPInstance | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance +index 174ea36ef..eb058cccf 100755 +--- a/heartbeat/SAPInstance ++++ b/heartbeat/SAPInstance +@@ -371,7 +371,11 @@ sapinstance_init() { + + if [ -z "$currentSTART_PROFILE" ] + then +- SAPSTARTPROFILE="$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}" ++ if [ ! -r "$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}" -a -r "$DIR_PROFILE/${SID}_${InstanceName}_${SAPVIRHOST}" ]; then ++ SAPSTARTPROFILE="$DIR_PROFILE/${SID}_${InstanceName}_${SAPVIRHOST}" ++ else ++ SAPSTARTPROFILE="$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}" ++ fi + else + SAPSTARTPROFILE="$currentSTART_PROFILE" + fi diff --git a/SOURCES/bz1642069-3-SAPInstance-metadata-improvements.patch b/SOURCES/bz1642069-3-SAPInstance-metadata-improvements.patch new file mode 100644 index 0000000..7421431 --- /dev/null +++ b/SOURCES/bz1642069-3-SAPInstance-metadata-improvements.patch @@ -0,0 +1,37 @@ +--- a/heartbeat/SAPInstance 2019-02-20 12:42:55.655819263 +0100 ++++ b/heartbeat/SAPInstance 2019-02-08 10:57:02.281048136 +0100 +@@ -159,14 +159,14 @@ + + + +- Usual a SAP Instance is stopped by the command 'sapcontrol -nr InstanceNr -function Stop'. SHUTDOWN_METHOD=KILL means to kill the SAP Instance using OS commands. SAP processes of the instance are terminated with 'kill -9', shared memory is deleted with 'cleanipc' and the 'kill.sap' file will be deleted. That method is much faster than the gracefull stop, but the instance does not have the chance to say goodbye to other SAPinstances in the same system. USE AT YOUR OWN RISK !! ++ Usually a SAP Instance is stopped by the command 'sapcontrol -nr InstanceNr -function Stop'. SHUTDOWN_METHOD=KILL means to kill the SAP Instance using OS commands. SAP processes of the instance are terminated with 'kill -9', shared memory is deleted with 'cleanipc' and the 'kill.sap' file will be deleted. That method is much faster than the graceful stop, but the instance does not have the chance to say goodbye to other SAPinstances in the same system. USE AT YOUR OWN RISK !! + Shutdown graceful or kill a SAP instance by terminating the processes. (normal|KILL) + + + + Only used in a Master/Slave resource configuration: + The full qualified SAP enqueue replication instance name. e.g. P01_ERS02_sapp01ers. Usually this is the name of the SAP instance profile. +-The enqueue replication instance must be installed, before you want to configure a master-slave cluster recource. ++The enqueue replication instance must be installed, before you want to configure a master-slave cluster resource. + + The master-slave configuration in the cluster must use this properties: + clone_max = 2 +@@ -209,7 +209,7 @@ + Only used for ASCS/ERS SAP Netweaver installations without implementing a master/slave resource to + allow the ASCS to 'find' the ERS running on another cluster node after a resource failure. This parameter should be set + to true 'only' for the ERS instance for implementations following the SAP NetWeaver 7.40 HA certification (NW-HA-CLU-740). This includes also +- systems for NetWeaver less than 7.40, if you like to impelemnt the NW-HA-CLU-740 scenario. ++ systems for NetWeaver less than 7.40, if you like to implement the NW-HA-CLU-740 scenario. + + Mark SAPInstance as ERS instance + +@@ -225,7 +225,7 @@ + + + +- ++ + + + diff --git a/SOURCES/bz1643306-LVM-activate-dont-fail-initial-probe.patch b/SOURCES/bz1643306-LVM-activate-dont-fail-initial-probe.patch new file mode 100644 index 0000000..0b7d485 --- /dev/null +++ b/SOURCES/bz1643306-LVM-activate-dont-fail-initial-probe.patch @@ -0,0 +1,24 @@ +From 848d62c32b355a03c2ad8d246eb3e34b04af07ca Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Wed, 9 Jan 2019 16:49:41 +0100 +Subject: [PATCH] LVM-activate: dont fail initial probe + +--- + heartbeat/LVM-activate | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate +index f46932c1c..49ab717a3 100755 +--- a/heartbeat/LVM-activate ++++ b/heartbeat/LVM-activate +@@ -323,6 +323,10 @@ lvmlockd_check() + + # Good: lvmlockd is running, and clvmd is not running + if ! pgrep lvmlockd >/dev/null 2>&1 ; then ++ if ocf_is_probe; then ++ exit $OCF_NOT_RUNNING ++ fi ++ + ocf_exit_reason "lvmlockd daemon is not running!" + exit $OCF_ERR_CONFIGURED + fi diff --git a/SOURCES/bz1646770-tomcat-use-systemd-when-catalina.sh-unavailable.patch b/SOURCES/bz1646770-tomcat-use-systemd-when-catalina.sh-unavailable.patch new file mode 100644 index 0000000..571196b --- /dev/null +++ b/SOURCES/bz1646770-tomcat-use-systemd-when-catalina.sh-unavailable.patch @@ -0,0 +1,59 @@ +From b42ef7555de86cc29d165ae17682c223bfb23b6e Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Mon, 5 Nov 2018 16:38:01 +0100 +Subject: [PATCH 1/2] tomcat: use systemd on RHEL when catalina.sh is + unavailable + +--- + heartbeat/tomcat | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/heartbeat/tomcat b/heartbeat/tomcat +index 4812a0133..833870038 100755 +--- a/heartbeat/tomcat ++++ b/heartbeat/tomcat +@@ -613,7 +613,6 @@ TOMCAT_NAME="${OCF_RESKEY_tomcat_name-tomcat}" + TOMCAT_CONSOLE="${OCF_RESKEY_script_log-/var/log/$TOMCAT_NAME.log}" + RESOURCE_TOMCAT_USER="${OCF_RESKEY_tomcat_user-root}" + RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}" +-OCF_RESKEY_force_systemd_default=0 + + JAVA_HOME="${OCF_RESKEY_java_home}" + JAVA_OPTS="${OCF_RESKEY_java_opts}" +@@ -630,6 +629,13 @@ if [ -z "$CATALINA_PID" ]; then + CATALINA_PID="${HA_RSCTMP}/${TOMCAT_NAME}_tomcatstate/catalina.pid" + fi + ++# Only default to true for RedHat systems without catalina.sh ++if [ -e "$CATALINA_HOME/bin/catalina.sh" ] || ! is_redhat_based; then ++ OCF_RESKEY_force_systemd_default=0 ++else ++ OCF_RESKEY_force_systemd_default=1 ++fi ++ + MAX_STOP_TIME="${OCF_RESKEY_max_stop_time}" + + : ${OCF_RESKEY_force_systemd=${OCF_RESKEY_force_systemd_default}} + +From 9cb2b142a9ecb3a2d5a51cdd51b4005f08b9a97b Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Mon, 5 Nov 2018 17:09:43 +0100 +Subject: [PATCH 2/2] ocf-distro: add regex for RedHat version + +--- + heartbeat/ocf-distro | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/ocf-distro b/heartbeat/ocf-distro +index 530ee57ed..f69910c98 100644 +--- a/heartbeat/ocf-distro ++++ b/heartbeat/ocf-distro +@@ -39,7 +39,7 @@ get_os_ver() { + VER=$(cat $_DEBIAN_VERSION_FILE) + elif [ -f $_REDHAT_RELEASE_FILE ]; then + OS=RedHat # redhat or similar +- VER= # here some complex sed script ++ VER=$(sed "s/.* release \([^ ]\+\).*/\1/" $_REDHAT_RELEASE_FILE) + else + OS=$(uname -s) + VER=$(uname -r) diff --git a/SOURCES/bz1647252-vdo-vol-fix-monitor-action.patch b/SOURCES/bz1647252-vdo-vol-fix-monitor-action.patch new file mode 100644 index 0000000..58b13ce --- /dev/null +++ b/SOURCES/bz1647252-vdo-vol-fix-monitor-action.patch @@ -0,0 +1,12 @@ +diff -uNr a/heartbeat/vdo-vol b/heartbeat/vdo-vol +--- a/heartbeat/vdo-vol 2018-11-07 09:11:23.037835110 +0100 ++++ b/heartbeat/vdo-vol 2018-11-07 09:12:41.322373901 +0100 +@@ -145,7 +145,7 @@ + + vdo_monitor(){ + status=$(vdo status $OPTIONS 2>&1) +- MODE=$(vdostats vdo_vol --verbose | grep "operating mode" | awk '{print $NF}') ++ MODE=$(vdostats --verbose ${OCF_RESKEY_volume} | grep "operating mode" | awk '{print $NF}') + + case "$status" in + *"Device mapper status: not available"*) diff --git a/SOURCES/bz1651790-1-CTDB-explicitly-use-bash-shell.patch b/SOURCES/bz1651790-1-CTDB-explicitly-use-bash-shell.patch new file mode 100644 index 0000000..cb13c0a --- /dev/null +++ b/SOURCES/bz1651790-1-CTDB-explicitly-use-bash-shell.patch @@ -0,0 +1,39 @@ +From 1ff4ce7cbe58b5309f00ac1bbe124c562b6dcaf6 Mon Sep 17 00:00:00 2001 +From: David Disseldorp +Date: Fri, 27 Jul 2018 16:02:26 +0200 +Subject: [PATCH] CTDB: explicitly use bash shell + +Upcoming recovery lock substring processing is bash specific. + +Signed-off-by: David Disseldorp +--- + configure.ac | 1 + + heartbeat/{CTDB => CTDB.in} | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + rename heartbeat/{CTDB => CTDB.in} (99%) + +diff --git a/configure.ac b/configure.ac +index 039b4942c..10f5314da 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -978,6 +978,7 @@ AC_CONFIG_FILES([heartbeat/slapd], [chmod +x heartbeat/slapd]) + AC_CONFIG_FILES([heartbeat/sybaseASE], [chmod +x heartbeat/sybaseASE]) + AC_CONFIG_FILES([heartbeat/syslog-ng], [chmod +x heartbeat/syslog-ng]) + AC_CONFIG_FILES([heartbeat/vsftpd], [chmod +x heartbeat/vsftpd]) ++AC_CONFIG_FILES([heartbeat/CTDB], [chmod +x heartbeat/CTDB]) + AC_CONFIG_FILES([rgmanager/src/resources/ASEHAagent.sh], [chmod +x rgmanager/src/resources/ASEHAagent.sh]) + AC_CONFIG_FILES([rgmanager/src/resources/apache.sh], [chmod +x rgmanager/src/resources/apache.sh]) + AC_CONFIG_FILES([rgmanager/src/resources/bind-mount.sh], [chmod +x rgmanager/src/resources/bind-mount.sh]) +diff --git a/heartbeat/CTDB b/heartbeat/CTDB.in +similarity index 99% +rename from heartbeat/CTDB +rename to heartbeat/CTDB.in +index 28e58cea0..7d87a4ef7 100755 +--- a/heartbeat/CTDB ++++ b/heartbeat/CTDB.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BASH_SHELL@ + # + # OCF Resource Agent for managing CTDB + # diff --git a/SOURCES/bz1651790-2-CTDB-add-ctdb_max_open_files-parameter.patch b/SOURCES/bz1651790-2-CTDB-add-ctdb_max_open_files-parameter.patch new file mode 100644 index 0000000..c30bfee --- /dev/null +++ b/SOURCES/bz1651790-2-CTDB-add-ctdb_max_open_files-parameter.patch @@ -0,0 +1,40 @@ +From 61f7cb5954d1727f58fab6d642a124ef342c8641 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Wed, 20 Feb 2019 11:24:28 +0100 +Subject: [PATCH] CTDB: add ctdb_max_open_files parameter + +--- + heartbeat/CTDB.in | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/heartbeat/CTDB.in b/heartbeat/CTDB.in +index 0d58c850a..bbf8ef627 100755 +--- a/heartbeat/CTDB.in ++++ b/heartbeat/CTDB.in +@@ -288,6 +288,14 @@ What debug level to run at (0-10). Higher means more verbose. + + + ++ ++ ++Maximum number of open files (for ulimit -n) ++ ++Max open files ++ ++ ++ + + + Path to default samba config file. Only necessary if CTDB +@@ -611,6 +619,11 @@ ctdb_start() { + start_as_disabled="--start-as-disabled" + ocf_is_true "$OCF_RESKEY_ctdb_start_as_disabled" || start_as_disabled="" + ++ # set nofile ulimit for ctdbd process ++ if [ -n "$OCF_RESKEY_ctdb_max_open_files" ]; then ++ ulimit -n "$OCF_RESKEY_ctdb_max_open_files" ++ fi ++ + # Start her up + "$OCF_RESKEY_ctdbd_binary" \ + --reclock="$OCF_RESKEY_ctdb_recovery_lock" \ diff --git a/SOURCES/bz1655655-ocf_log-do-not-log-debug-when-HA_debug-unset.patch b/SOURCES/bz1655655-ocf_log-do-not-log-debug-when-HA_debug-unset.patch new file mode 100644 index 0000000..4de33f1 --- /dev/null +++ b/SOURCES/bz1655655-ocf_log-do-not-log-debug-when-HA_debug-unset.patch @@ -0,0 +1,32 @@ +From aae26ca70ef910e83485778c1fb450941fe79e8a Mon Sep 17 00:00:00 2001 +From: Michele Baldessari +Date: Mon, 3 Dec 2018 16:48:14 +0100 +Subject: [PATCH] Do not log at debug log level when HA_debug is unset + +There might be situations (e.g. bundles) where the HA_debug variable +is unset. It makes little sense to enable debug logging when the HA_debug env +variable is unset. +So let's skip debug logs when HA_debug is set to 0 or is unset. + +Tested inside a bundle and observed that previously seen 'ocf_log debug' +calls are now correctly suppressed (w/ HA_debug being unset inside the +container) + +Signed-off-by: Michele Baldessari +--- + heartbeat/ocf-shellfuncs.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in +index 043ab9bf2..b17297e1a 100644 +--- a/heartbeat/ocf-shellfuncs.in ++++ b/heartbeat/ocf-shellfuncs.in +@@ -257,7 +257,7 @@ ha_log() + + ha_debug() { + +- if [ "x${HA_debug}" = "x0" ] ; then ++ if [ "x${HA_debug}" = "x0" ] || [ -z "${HA_debug}" ] ; then + return 0 + fi + if tty >/dev/null; then diff --git a/SOURCES/bz1656368-rabbitmq-cluster-ensure-node-attribures-removed.patch b/SOURCES/bz1656368-rabbitmq-cluster-ensure-node-attribures-removed.patch new file mode 100644 index 0000000..0a25333 --- /dev/null +++ b/SOURCES/bz1656368-rabbitmq-cluster-ensure-node-attribures-removed.patch @@ -0,0 +1,42 @@ +From 8ed87936e9ad06318cc49ea767885a405dfde11e Mon Sep 17 00:00:00 2001 +From: John Eckersberg +Date: Wed, 5 Dec 2018 11:45:43 -0500 +Subject: [PATCH] rabbitmq-cluster: better ensure node attributes are removed + +Ensure that the attribute is removed at the end of the stop action. +Also if rmq_app_running or rmq_node_alive shows the service as down, +ensure the attribute is deleted as well. + +Resolves: RHBZ#1656368 +--- + heartbeat/rabbitmq-cluster | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster +index 1643dd1e7..2dca3e216 100755 +--- a/heartbeat/rabbitmq-cluster ++++ b/heartbeat/rabbitmq-cluster +@@ -184,6 +184,7 @@ rmq_app_running() { + return $OCF_SUCCESS + else + ocf_log debug "RabbitMQ application is stopped" ++ rmq_delete_nodename + return $OCF_NOT_RUNNING + fi + } +@@ -194,6 +195,7 @@ rmq_node_alive() { + return $OCF_SUCCESS + else + ocf_log debug "RabbitMQ node is down" ++ rmq_delete_nodename + return $OCF_NOT_RUNNING + fi + } +@@ -554,6 +556,7 @@ rmq_stop() { + sleep 1 + done + ++ rmq_delete_nodename + remove_pid + return $OCF_SUCCESS + } diff --git a/SOURCES/bz1656733-rabbitmq-cluster-retry-start-cluster-join-fails.patch b/SOURCES/bz1656733-rabbitmq-cluster-retry-start-cluster-join-fails.patch deleted file mode 100644 index 80fe18b..0000000 --- a/SOURCES/bz1656733-rabbitmq-cluster-retry-start-cluster-join-fails.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 63c9449bfa9a7fecbc0f00394699a475a384671d Mon Sep 17 00:00:00 2001 -From: Damien Ciabrini -Date: Thu, 9 Aug 2018 16:33:26 +0200 -Subject: [PATCH] rabbitmq-cluster: retry start when cluster join fails - -When a node tries to join an existing cluster, it fetches a node -list to try to connect from any of those running nodes. - -If the nodes from this list become unavailable while we're joining -the cluster, the rabbitmq server will fail to get clustered and -make the start operation fail. - -Give the resource a chance to start anyway by retrying the entire -start actions until it succeeds or until the start timeout is -reached and pacemaker stops the start operation. - -Co-Authored-by: -Suggested-by: ---- - heartbeat/rabbitmq-cluster | 29 ++++++++++++++++++++++++++--- - 1 file changed, 26 insertions(+), 3 deletions(-) - -diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster -index 9ff49e075..84f383460 100755 ---- a/heartbeat/rabbitmq-cluster -+++ b/heartbeat/rabbitmq-cluster -@@ -31,6 +31,12 @@ - - ####################################################################### - -+# This arbitrary value here is used by the rmq_start action to -+# signify that the resource agent must retry the start process -+# It might potentially conflict with OCF assigned error code -+# in the future. -+RMQ_TRY_RESTART_ERROR_CODE=126 -+ - RMQ_SERVER=/usr/sbin/rabbitmq-server - RMQ_CTL=/usr/sbin/rabbitmqctl - RMQ_DATA_DIR="/var/lib/rabbitmq/mnesia" -@@ -354,7 +360,7 @@ rmq_notify() { - return $OCF_SUCCESS - } - --rmq_start() { -+rmq_try_start() { - local join_list="" - local rc - -@@ -384,8 +390,16 @@ rmq_start() { - rc=$? - - if [ $rc -ne 0 ]; then -- ocf_log info "node failed to join even after reseting local data. Check SELINUX policy" -- return $OCF_ERR_GENERIC -+ # we could not join the rabbitmq cluster from any of the running nodes -+ # this might be due to a unexpected reset of those nodes. Give ourself -+ # a chance to start by retrying the entire start sequence. -+ -+ ocf_log warn "Failed to join the RabbitMQ cluster from nodes ${join_list}. Stopping local unclustered rabbitmq" -+ rmq_stop -+ -+ ocf_log warn "Re-detect available rabbitmq nodes and try to start again" -+ # return an unused OCF value to signify a "retry" condition -+ return $RMQ_TRY_RESTART_ERROR_CODE - fi - - # Restore users, user permissions, and policies (if any) -@@ -443,6 +457,15 @@ rmq_start() { - return $OCF_SUCCESS - } - -+rmq_start() { -+ local rc=$RMQ_TRY_RESTART_ERROR_CODE -+ while [ $rc -eq $RMQ_TRY_RESTART_ERROR_CODE ]; do -+ rmq_try_start -+ rc=$? -+ done -+ return $rc -+} -+ - rmq_stop() { - # Backup users, user permissions, and policies - BaseDataDir=`dirname $RMQ_DATA_DIR` diff --git a/SOURCES/bz1657138-rabbitmq-cluster-ensure-node-attribures-removed.patch b/SOURCES/bz1657138-rabbitmq-cluster-ensure-node-attribures-removed.patch deleted file mode 100644 index 0a25333..0000000 --- a/SOURCES/bz1657138-rabbitmq-cluster-ensure-node-attribures-removed.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 8ed87936e9ad06318cc49ea767885a405dfde11e Mon Sep 17 00:00:00 2001 -From: John Eckersberg -Date: Wed, 5 Dec 2018 11:45:43 -0500 -Subject: [PATCH] rabbitmq-cluster: better ensure node attributes are removed - -Ensure that the attribute is removed at the end of the stop action. -Also if rmq_app_running or rmq_node_alive shows the service as down, -ensure the attribute is deleted as well. - -Resolves: RHBZ#1656368 ---- - heartbeat/rabbitmq-cluster | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster -index 1643dd1e7..2dca3e216 100755 ---- a/heartbeat/rabbitmq-cluster -+++ b/heartbeat/rabbitmq-cluster -@@ -184,6 +184,7 @@ rmq_app_running() { - return $OCF_SUCCESS - else - ocf_log debug "RabbitMQ application is stopped" -+ rmq_delete_nodename - return $OCF_NOT_RUNNING - fi - } -@@ -194,6 +195,7 @@ rmq_node_alive() { - return $OCF_SUCCESS - else - ocf_log debug "RabbitMQ node is down" -+ rmq_delete_nodename - return $OCF_NOT_RUNNING - fi - } -@@ -554,6 +556,7 @@ rmq_stop() { - sleep 1 - done - -+ rmq_delete_nodename - remove_pid - return $OCF_SUCCESS - } diff --git a/SOURCES/bz1659072-1-rabbitmq-cluster-debug-log-mnesia-query-fails.patch b/SOURCES/bz1659072-1-rabbitmq-cluster-debug-log-mnesia-query-fails.patch new file mode 100644 index 0000000..b39150a --- /dev/null +++ b/SOURCES/bz1659072-1-rabbitmq-cluster-debug-log-mnesia-query-fails.patch @@ -0,0 +1,32 @@ +From 2b6e4a94c847129dd014a1efa733cd1b4a2448e6 Mon Sep 17 00:00:00 2001 +From: John Eckersberg +Date: Fri, 2 Nov 2018 10:11:41 -0400 +Subject: [PATCH] rabbitmq-cluster: debug log detailed output when mnesia query + fails + +--- + heartbeat/rabbitmq-cluster | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster +index 78b2bbadf..fabfeedfb 100755 +--- a/heartbeat/rabbitmq-cluster ++++ b/heartbeat/rabbitmq-cluster +@@ -191,7 +191,8 @@ rmq_app_running() { + rmq_monitor() { + local rc + +- if $RMQ_CTL eval 'rabbit_mnesia:cluster_status_from_mnesia().' | grep -q '^{ok'; then ++ status=$($RMQ_CTL eval 'rabbit_mnesia:cluster_status_from_mnesia().' 2>&1) ++ if echo "${status}" | grep -q '^{ok'; then + pcs_running=$(rmq_join_list | wc -w) + ocf_log debug "Pacemaker thinks ${pcs_running} RabbitMQ nodes are running" + rmq_running=$($RMQ_CTL eval 'length(mnesia:system_info(running_db_nodes)).') +@@ -209,6 +210,7 @@ rmq_monitor() { + return $OCF_SUCCESS + else + ocf_log info "RabbitMQ server could not get cluster status from mnesia" ++ ocf_log debug "${status}" + rmq_delete_nodename + return $OCF_NOT_RUNNING + fi diff --git a/SOURCES/bz1659072-2-rabbitmq-cluster-suppress-additional-output.patch b/SOURCES/bz1659072-2-rabbitmq-cluster-suppress-additional-output.patch new file mode 100644 index 0000000..8b58191 --- /dev/null +++ b/SOURCES/bz1659072-2-rabbitmq-cluster-suppress-additional-output.patch @@ -0,0 +1,87 @@ +From 5a33171b2c40e2e1587e82aad0cb7e39abcf615d Mon Sep 17 00:00:00 2001 +From: John Eckersberg +Date: Thu, 13 Dec 2018 12:58:43 -0500 +Subject: [PATCH] rabbitmq-cluster: always use quiet flag for eval calls + +On older rabbitmq versions, rabbitmqctl appends "...done." at the end +of the output. However we expect eval without this extra output so it +can be used for further processing. The -q option to rabbitmqctl +suppresses the extra output, so ensure we always pass that when +calling eval. + +Resolves: RHBZ#1659072 +--- + heartbeat/rabbitmq-cluster | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster +index 2dca3e216..e82ac2399 100755 +--- a/heartbeat/rabbitmq-cluster ++++ b/heartbeat/rabbitmq-cluster +@@ -39,6 +39,7 @@ RMQ_TRY_RESTART_ERROR_CODE=126 + + RMQ_SERVER=/usr/sbin/rabbitmq-server + RMQ_CTL=/usr/sbin/rabbitmqctl ++RMQ_EVAL="${RMQ_CTL} eval -q" + RMQ_DATA_DIR="/var/lib/rabbitmq/mnesia" + RMQ_PID_DIR="/var/run/rabbitmq" + RMQ_PID_FILE="/var/run/rabbitmq/rmq.pid" +@@ -179,7 +180,7 @@ remove_pid () { + } + + rmq_app_running() { +- if $RMQ_CTL eval 'application:which_applications().' | grep -q '{rabbit,'; then ++ if $RMQ_EVAL 'application:which_applications().' | grep -q '{rabbit,'; then + ocf_log debug "RabbitMQ application is running" + return $OCF_SUCCESS + else +@@ -190,7 +191,7 @@ rmq_app_running() { + } + + rmq_node_alive() { +- if $RMQ_CTL eval 'ok.'; then ++ if $RMQ_EVAL 'ok.'; then + ocf_log debug "RabbitMQ node is alive" + return $OCF_SUCCESS + else +@@ -203,11 +204,11 @@ rmq_node_alive() { + rmq_monitor() { + local rc + +- status=$($RMQ_CTL eval 'rabbit_mnesia:cluster_status_from_mnesia().' 2>&1) ++ status=$($RMQ_EVAL 'rabbit_mnesia:cluster_status_from_mnesia().' 2>&1) + if echo "${status}" | grep -q '^{ok'; then + pcs_running=$(rmq_join_list | wc -w) + ocf_log debug "Pacemaker thinks ${pcs_running} RabbitMQ nodes are running" +- rmq_running=$($RMQ_CTL eval 'length(mnesia:system_info(running_db_nodes)).') ++ rmq_running=$($RMQ_EVAL 'length(mnesia:system_info(running_db_nodes)).') + ocf_log debug "RabbitMQ thinks ${rmq_running} RabbitMQ nodes are running" + + if [ $(( $rmq_running * 2 )) -lt $pcs_running ]; then +@@ -294,7 +295,7 @@ rmq_start_first() + + rmq_is_clustered() + { +- $RMQ_CTL eval 'rabbit_mnesia:is_clustered().' | grep -q true ++ $RMQ_EVAL 'rabbit_mnesia:is_clustered().' | grep -q true + } + + rmq_join_existing() +@@ -432,7 +433,7 @@ rmq_try_start() { + + # Restore users, user permissions, and policies (if any) + BaseDataDir=`dirname $RMQ_DATA_DIR` +- $RMQ_CTL eval " ++ $RMQ_EVAL " + %% Run only if Mnesia is ready. + lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso + begin +@@ -497,7 +498,7 @@ rmq_start() { + rmq_stop() { + # Backup users, user permissions, and policies + BaseDataDir=`dirname $RMQ_DATA_DIR` +- $RMQ_CTL eval " ++ $RMQ_EVAL " + %% Run only if Mnesia is still available. + lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso + begin diff --git a/SOURCES/bz1667413-1-LVM-activate-support-LVs-from-same-VG.patch b/SOURCES/bz1667413-1-LVM-activate-support-LVs-from-same-VG.patch new file mode 100644 index 0000000..af1974c --- /dev/null +++ b/SOURCES/bz1667413-1-LVM-activate-support-LVs-from-same-VG.patch @@ -0,0 +1,23 @@ +From 13511f843b2b0fa1b8b306beac041e0855be05a6 Mon Sep 17 00:00:00 2001 +From: Valentin Vidic +Date: Tue, 15 Jan 2019 15:45:03 +0100 +Subject: [PATCH] LVM-activate: make vgname not uniqe + +If activating one lvname at a time, vgname will not be unique. +--- + heartbeat/LVM-activate | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate +index f46932c1c..bc448c9c1 100755 +--- a/heartbeat/LVM-activate ++++ b/heartbeat/LVM-activate +@@ -102,7 +102,7 @@ because some DLM lockspaces might be in use and cannot be closed automatically. + This agent activates/deactivates logical volumes. + + +- ++ + + The volume group name. + diff --git a/SOURCES/bz1667413-2-LVM-activate-only-count-volumes.patch b/SOURCES/bz1667413-2-LVM-activate-only-count-volumes.patch new file mode 100644 index 0000000..5911e0e --- /dev/null +++ b/SOURCES/bz1667413-2-LVM-activate-only-count-volumes.patch @@ -0,0 +1,29 @@ +From ee9a47f97dd8b0cb51033db7879a79588aab409c Mon Sep 17 00:00:00 2001 +From: Valentin Vidic +Date: Tue, 15 Jan 2019 15:40:01 +0100 +Subject: [PATCH] LVM-activate: fix dmsetup check + +When there are no devices in the system dmsetup outputs one line: + + # dmsetup info -c + No devices found +--- + heartbeat/LVM-activate | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate +index f46932c1c..c3225e1cb 100755 +--- a/heartbeat/LVM-activate ++++ b/heartbeat/LVM-activate +@@ -715,9 +715,9 @@ lvm_status() { + if [ -n "${LV}" ]; then + # dmsetup ls? It cannot accept device name. It's + # too heavy to list all DM devices. +- dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG} && lvname=${LV}" | wc -l ) ++ dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG} && lvname=${LV}" | grep -c -v '^No devices found') + else +- dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG}" 2>/dev/null | wc -l ) ++ dm_count=$(dmsetup info --noheadings --noflush -c -S "vgname=${VG}" | grep -c -v '^No devices found') + fi + + if [ $dm_count -eq 0 ]; then diff --git a/SOURCES/bz1669137-Route-make-family-parameter-optional.patch b/SOURCES/bz1669137-Route-make-family-parameter-optional.patch new file mode 100644 index 0000000..81ab09d --- /dev/null +++ b/SOURCES/bz1669137-Route-make-family-parameter-optional.patch @@ -0,0 +1,31 @@ +From d95765aba205ea59dcb99378bed4c6d0593ebdb4 Mon Sep 17 00:00:00 2001 +From: fpicot +Date: Fri, 11 Jan 2019 11:38:18 -0500 +Subject: [PATCH] Route: make family parameter optional + +--- + heartbeat/Route | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/Route b/heartbeat/Route +index 67bdf6bfc..2da58bce1 100755 +--- a/heartbeat/Route ++++ b/heartbeat/Route +@@ -124,7 +124,7 @@ The routing table to be configured for the route. + + + +- ++ + + The address family to be used for the route + ip4 IP version 4 +@@ -132,7 +132,7 @@ ip6 IP version 6 + detect Detect from 'destination' address. + + Address Family +- ++ + + + diff --git a/SOURCES/bz1692890-ocf_log-do-not-log-debug-when-HA_debug-unset.patch b/SOURCES/bz1692890-ocf_log-do-not-log-debug-when-HA_debug-unset.patch deleted file mode 100644 index 4de33f1..0000000 --- a/SOURCES/bz1692890-ocf_log-do-not-log-debug-when-HA_debug-unset.patch +++ /dev/null @@ -1,32 +0,0 @@ -From aae26ca70ef910e83485778c1fb450941fe79e8a Mon Sep 17 00:00:00 2001 -From: Michele Baldessari -Date: Mon, 3 Dec 2018 16:48:14 +0100 -Subject: [PATCH] Do not log at debug log level when HA_debug is unset - -There might be situations (e.g. bundles) where the HA_debug variable -is unset. It makes little sense to enable debug logging when the HA_debug env -variable is unset. -So let's skip debug logs when HA_debug is set to 0 or is unset. - -Tested inside a bundle and observed that previously seen 'ocf_log debug' -calls are now correctly suppressed (w/ HA_debug being unset inside the -container) - -Signed-off-by: Michele Baldessari ---- - heartbeat/ocf-shellfuncs.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in -index 043ab9bf2..b17297e1a 100644 ---- a/heartbeat/ocf-shellfuncs.in -+++ b/heartbeat/ocf-shellfuncs.in -@@ -257,7 +257,7 @@ ha_log() - - ha_debug() { - -- if [ "x${HA_debug}" = "x0" ] ; then -+ if [ "x${HA_debug}" = "x0" ] || [ -z "${HA_debug}" ] ; then - return 0 - fi - if tty >/dev/null; then diff --git a/SOURCES/bz1692973-tomcat-use-systemd-when-catalina.sh-unavailable.patch b/SOURCES/bz1692973-tomcat-use-systemd-when-catalina.sh-unavailable.patch deleted file mode 100644 index 571196b..0000000 --- a/SOURCES/bz1692973-tomcat-use-systemd-when-catalina.sh-unavailable.patch +++ /dev/null @@ -1,59 +0,0 @@ -From b42ef7555de86cc29d165ae17682c223bfb23b6e Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Mon, 5 Nov 2018 16:38:01 +0100 -Subject: [PATCH 1/2] tomcat: use systemd on RHEL when catalina.sh is - unavailable - ---- - heartbeat/tomcat | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/heartbeat/tomcat b/heartbeat/tomcat -index 4812a0133..833870038 100755 ---- a/heartbeat/tomcat -+++ b/heartbeat/tomcat -@@ -613,7 +613,6 @@ TOMCAT_NAME="${OCF_RESKEY_tomcat_name-tomcat}" - TOMCAT_CONSOLE="${OCF_RESKEY_script_log-/var/log/$TOMCAT_NAME.log}" - RESOURCE_TOMCAT_USER="${OCF_RESKEY_tomcat_user-root}" - RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}" --OCF_RESKEY_force_systemd_default=0 - - JAVA_HOME="${OCF_RESKEY_java_home}" - JAVA_OPTS="${OCF_RESKEY_java_opts}" -@@ -630,6 +629,13 @@ if [ -z "$CATALINA_PID" ]; then - CATALINA_PID="${HA_RSCTMP}/${TOMCAT_NAME}_tomcatstate/catalina.pid" - fi - -+# Only default to true for RedHat systems without catalina.sh -+if [ -e "$CATALINA_HOME/bin/catalina.sh" ] || ! is_redhat_based; then -+ OCF_RESKEY_force_systemd_default=0 -+else -+ OCF_RESKEY_force_systemd_default=1 -+fi -+ - MAX_STOP_TIME="${OCF_RESKEY_max_stop_time}" - - : ${OCF_RESKEY_force_systemd=${OCF_RESKEY_force_systemd_default}} - -From 9cb2b142a9ecb3a2d5a51cdd51b4005f08b9a97b Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Mon, 5 Nov 2018 17:09:43 +0100 -Subject: [PATCH 2/2] ocf-distro: add regex for RedHat version - ---- - heartbeat/ocf-distro | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/heartbeat/ocf-distro b/heartbeat/ocf-distro -index 530ee57ed..f69910c98 100644 ---- a/heartbeat/ocf-distro -+++ b/heartbeat/ocf-distro -@@ -39,7 +39,7 @@ get_os_ver() { - VER=$(cat $_DEBIAN_VERSION_FILE) - elif [ -f $_REDHAT_RELEASE_FILE ]; then - OS=RedHat # redhat or similar -- VER= # here some complex sed script -+ VER=$(sed "s/.* release \([^ ]\+\).*/\1/" $_REDHAT_RELEASE_FILE) - else - OS=$(uname -s) - VER=$(uname -r) diff --git a/SOURCES/bz1693658-aws-vpc-move-ip-avoid-possible-race-condition.patch b/SOURCES/bz1693658-aws-vpc-move-ip-avoid-possible-race-condition.patch new file mode 100644 index 0000000..8899055 --- /dev/null +++ b/SOURCES/bz1693658-aws-vpc-move-ip-avoid-possible-race-condition.patch @@ -0,0 +1,104 @@ +From 57f695d336cab33c61e754e463654ad6400f7b58 Mon Sep 17 00:00:00 2001 +From: gguifelixamz +Date: Tue, 27 Nov 2018 17:06:05 +0000 +Subject: [PATCH 1/4] Enable --query flag in DescribeRouteTable API call to + avoid race condition with grep + +--- + heartbeat/aws-vpc-move-ip | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index 9b2043aca..d2aed7490 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -167,9 +167,10 @@ ec2ip_validate() { + ec2ip_monitor() { + if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then + ocf_log info "monitor: check routing table (API call)" +- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table" ++ cmd=''$OCF_RESKEY_awscli' --profile '$OCF_RESKEY_profile' --output text ec2 describe-route-tables --route-table-ids '$OCF_RESKEY_routing_table' --query 'RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId'' + ocf_log debug "executing command: $cmd" +- ROUTE_TO_INSTANCE="$($cmd | grep $OCF_RESKEY_ip | awk '{ print $3 }')" ++ ROUTE_TO_INSTANCE=$($cmd) ++ ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" + if [ -z "$ROUTE_TO_INSTANCE" ]; then + ROUTE_TO_INSTANCE="" + fi + +From 4d6371aca5dca35b902a480e07a08c1dc3373ca5 Mon Sep 17 00:00:00 2001 +From: gguifelixamz +Date: Thu, 29 Nov 2018 11:39:26 +0000 +Subject: [PATCH 2/4] aws-vpc-move-ip: Fixed outer quotes and removed inner + quotes + +--- + heartbeat/aws-vpc-move-ip | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index d2aed7490..ced69bd13 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -167,7 +167,7 @@ ec2ip_validate() { + ec2ip_monitor() { + if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then + ocf_log info "monitor: check routing table (API call)" +- cmd=''$OCF_RESKEY_awscli' --profile '$OCF_RESKEY_profile' --output text ec2 describe-route-tables --route-table-ids '$OCF_RESKEY_routing_table' --query 'RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId'' ++ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" + ocf_log debug "executing command: $cmd" + ROUTE_TO_INSTANCE=$($cmd) + ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" + +From 09f4b061690a0e681aaf7314f1fc3e6f4e597cc8 Mon Sep 17 00:00:00 2001 +From: gguifelixamz +Date: Thu, 29 Nov 2018 11:55:05 +0000 +Subject: [PATCH 3/4] aws-vpc-move-ip: Replaced indentation spaces with tabs + for consistency with the rest of the code + +--- + heartbeat/aws-vpc-move-ip | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index ced69bd13..3e827283e 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -167,10 +167,10 @@ ec2ip_validate() { + ec2ip_monitor() { + if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then + ocf_log info "monitor: check routing table (API call)" +- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" ++ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" + ocf_log debug "executing command: $cmd" +- ROUTE_TO_INSTANCE=$($cmd) +- ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" ++ ROUTE_TO_INSTANCE=$($cmd) ++ ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" + if [ -z "$ROUTE_TO_INSTANCE" ]; then + ROUTE_TO_INSTANCE="" + fi + +From fcf85551ce70cb4fb7ce24e21c361fdbe6fcce6b Mon Sep 17 00:00:00 2001 +From: gguifelixamz +Date: Thu, 29 Nov 2018 13:07:32 +0000 +Subject: [PATCH 4/4] aws-vpc-move-ip: In cmd variable on ec2ip_monitor(): + replaced _address with _ip and modified to use single quotes + +--- + heartbeat/aws-vpc-move-ip | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index 3e827283e..331ee184f 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -167,7 +167,7 @@ ec2ip_validate() { + ec2ip_monitor() { + if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then + ocf_log info "monitor: check routing table (API call)" +- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" ++ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock=='$OCF_RESKEY_ip/32'].InstanceId" + ocf_log debug "executing command: $cmd" + ROUTE_TO_INSTANCE=$($cmd) + ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" diff --git a/SOURCES/bz1697558-aws-vpc-move-ip-1-multi-route-table-support.patch b/SOURCES/bz1697558-aws-vpc-move-ip-1-multi-route-table-support.patch new file mode 100644 index 0000000..b724aa3 --- /dev/null +++ b/SOURCES/bz1697558-aws-vpc-move-ip-1-multi-route-table-support.patch @@ -0,0 +1,122 @@ +--- a/heartbeat/aws-vpc-move-ip 2019-05-20 10:54:01.527329668 +0200 ++++ b/heartbeat/aws-vpc-move-ip 2019-05-20 11:33:35.386089091 +0200 +@@ -93,11 +93,19 @@ + + + ++ ++ ++Deprecated IP address param. Use the ip param instead. ++ ++Deprecated VPC private IP Address ++ ++ ++ + + +-Name of the routing table, where the route for the IP address should be changed, i.e. rtb-... ++Name of the routing table(s), where the route for the IP address should be changed. If declaring multiple routing tables they should be separated by comma. Example: rtb-XXXXXXXX,rtb-YYYYYYYYY + +-routing table name ++routing table name(s) + + + +@@ -129,6 +137,13 @@ + END + } + ++ec2ip_set_address_param_compat(){ ++ # Include backward compatibility for the deprecated address parameter ++ if [ -z "$OCF_RESKEY_ip" ] && [ -n "$OCF_RESKEY_address" ]; then ++ OCF_RESKEY_ip="$OCF_RESKEY_address" ++ fi ++} ++ + ec2ip_validate() { + for cmd in aws ip curl; do + check_binary "$cmd" +@@ -150,20 +165,29 @@ + } + + ec2ip_monitor() { +- if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ]; then +- ocf_log info "monitor: check routing table (API call)" +- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock=='$OCF_RESKEY_ip/32'].InstanceId" +- ocf_log debug "executing command: $cmd" +- ROUTE_TO_INSTANCE=$($cmd) +- ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" +- if [ -z "$ROUTE_TO_INSTANCE" ]; then +- ROUTE_TO_INSTANCE="" +- fi ++ MON_RES="" ++ if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then ++ for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do ++ ocf_log info "monitor: check routing table (API call) - $rtb" ++ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $rtb --query RouteTables[*].Routes[?DestinationCidrBlock=='$OCF_RESKEY_ip/32'].InstanceId" ++ ocf_log debug "executing command: $cmd" ++ ROUTE_TO_INSTANCE="$($cmd)" ++ ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" ++ if [ -z "$ROUTE_TO_INSTANCE" ]; then ++ ROUTE_TO_INSTANCE="" ++ fi ++ ++ if [ "$EC2_INSTANCE_ID" != "$ROUTE_TO_INSTANCE" ]; then ++ ocf_log warn "not routed to this instance ($EC2_INSTANCE_ID) but to instance $ROUTE_TO_INSTANCE on $rtb" ++ MON_RES="$MON_RES $rtb" ++ fi ++ sleep 1 ++ done + +- if [ "$EC2_INSTANCE_ID" != "$ROUTE_TO_INSTANCE" ];then +- ocf_log warn "not routed to this instance ($EC2_INSTANCE_ID) but to instance $ROUTE_TO_INSTANCE" ++ if [ ! -z "$MON_RES" ]; then + return $OCF_NOT_RUNNING + fi ++ + else + ocf_log debug "monitor: Enhanced Monitoring disabled - omitting API call" + fi +@@ -195,19 +219,23 @@ + } + + ec2ip_get_and_configure() { +- # Adjusting the routing table +- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile ec2 replace-route --route-table-id $OCF_RESKEY_routing_table --destination-cidr-block ${OCF_RESKEY_ip}/32 --instance-id $EC2_INSTANCE_ID" +- ocf_log debug "executing command: $cmd" +- $cmd +- rc=$? +- if [ "$rc" != 0 ]; then +- ocf_log warn "command failed, rc: $rc" +- return $OCF_ERR_GENERIC +- fi ++ for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do ++ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --instance-id $EC2_INSTANCE_ID" ++ ocf_log debug "executing command: $cmd" ++ $cmd ++ rc=$? ++ if [ "$rc" != 0 ]; then ++ ocf_log warn "command failed, rc: $rc" ++ return $OCF_ERR_GENERIC ++ fi ++ sleep 1 ++ done + + # Reconfigure the local ip address + ec2ip_drop +- ip addr add "${OCF_RESKEY_ip}/32" dev $OCF_RESKEY_interface ++ cmd="ip addr add ${OCF_RESKEY_ip}/32 dev $OCF_RESKEY_interface" ++ ocf_log debug "executing command: $cmd" ++ $cmd + rc=$? + if [ $rc != 0 ]; then + ocf_log warn "command failed, rc: $rc" +@@ -289,6 +317,8 @@ + exit $OCF_ERR_PERM + fi + ++ec2ip_set_address_param_compat ++ + ec2ip_validate + + case $__OCF_ACTION in diff --git a/SOURCES/bz1697558-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch b/SOURCES/bz1697558-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch new file mode 100644 index 0000000..c283801 --- /dev/null +++ b/SOURCES/bz1697558-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch @@ -0,0 +1,221 @@ +From 9f2b9cc09f7e2df163ff95585374f860f3dc58eb Mon Sep 17 00:00:00 2001 +From: Tomas Krojzl +Date: Tue, 16 Apr 2019 18:40:29 +0200 +Subject: [PATCH 1/6] Fix for VM having multiple network interfaces + +--- + heartbeat/aws-vpc-move-ip | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index 090956434..a91c2dd11 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -219,8 +219,28 @@ ec2ip_drop() { + } + + ec2ip_get_and_configure() { ++ cmd="ip -br link show dev $OCF_RESKEY_interface | tr -s ' ' | cut -d' ' -f3" ++ ocf_log debug "executing command: $cmd" ++ MAC_ADDR="$(eval $cmd)" ++ rc=$? ++ if [ $rc != 0 ]; then ++ ocf_log warn "command failed, rc: $rc" ++ return $OCF_ERR_GENERIC ++ fi ++ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" ++ ++ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-instances --instance-ids $EC2_INSTANCE_ID --query 'Reservations[*].Instances[*].NetworkInterfaces[*].[NetworkInterfaceId,MacAddress]' | grep ${MAC_ADDR} | cut -f1" ++ ocf_log debug "executing command: $cmd" ++ EC2_NETWORK_INTERFACE_ID="$(eval $cmd)" ++ rc=$? ++ if [ $rc != 0 ]; then ++ ocf_log warn "command failed, rc: $rc" ++ return $OCF_ERR_GENERIC ++ fi ++ ocf_log debug "network interface id associated MAC address ${MAC_ADDR}: ${EC2_NETWORK_INTERFACE_ID}" ++ + for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do +- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --instance-id $EC2_INSTANCE_ID" ++ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --network-interface-id $EC2_NETWORK_INTERFACE_ID" + ocf_log debug "executing command: $cmd" + $cmd + rc=$? + +From a871a463134ebb2456b5f37a343bf9034f5f4074 Mon Sep 17 00:00:00 2001 +From: krojzl +Date: Tue, 16 Apr 2019 18:49:32 +0200 +Subject: [PATCH 2/6] Fixing indentation + +--- + heartbeat/aws-vpc-move-ip | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index a91c2dd11..a46d10d30 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -227,7 +227,7 @@ ec2ip_get_and_configure() { + ocf_log warn "command failed, rc: $rc" + return $OCF_ERR_GENERIC + fi +- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" ++ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" + + cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-instances --instance-ids $EC2_INSTANCE_ID --query 'Reservations[*].Instances[*].NetworkInterfaces[*].[NetworkInterfaceId,MacAddress]' | grep ${MAC_ADDR} | cut -f1" + ocf_log debug "executing command: $cmd" +@@ -237,7 +237,7 @@ ec2ip_get_and_configure() { + ocf_log warn "command failed, rc: $rc" + return $OCF_ERR_GENERIC + fi +- ocf_log debug "network interface id associated MAC address ${MAC_ADDR}: ${EC2_NETWORK_INTERFACE_ID}" ++ ocf_log debug "network interface id associated MAC address ${MAC_ADDR}: ${EC2_NETWORK_INTERFACE_ID}" + + for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do + cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --network-interface-id $EC2_NETWORK_INTERFACE_ID" + +From 068680427dff620a948ae25f090bc154b02f17b9 Mon Sep 17 00:00:00 2001 +From: krojzl +Date: Wed, 17 Apr 2019 14:22:31 +0200 +Subject: [PATCH 3/6] Requested fix to avoid using AWS API + +--- + heartbeat/aws-vpc-move-ip | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index a46d10d30..2910552f2 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -229,7 +229,7 @@ ec2ip_get_and_configure() { + fi + ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" + +- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-instances --instance-ids $EC2_INSTANCE_ID --query 'Reservations[*].Instances[*].NetworkInterfaces[*].[NetworkInterfaceId,MacAddress]' | grep ${MAC_ADDR} | cut -f1" ++ cmd="curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/interface-id" + ocf_log debug "executing command: $cmd" + EC2_NETWORK_INTERFACE_ID="$(eval $cmd)" + rc=$? + +From 207a2ba66ba7196180d27674aa204980fcd25de2 Mon Sep 17 00:00:00 2001 +From: krojzl +Date: Fri, 19 Apr 2019 11:14:21 +0200 +Subject: [PATCH 4/6] More robust approach of getting MAC address + +--- + heartbeat/aws-vpc-move-ip | 29 +++++++++++++++++++++-------- + 1 file changed, 21 insertions(+), 8 deletions(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index 2910552f2..3a848b7e3 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -219,15 +219,28 @@ ec2ip_drop() { + } + + ec2ip_get_and_configure() { +- cmd="ip -br link show dev $OCF_RESKEY_interface | tr -s ' ' | cut -d' ' -f3" +- ocf_log debug "executing command: $cmd" +- MAC_ADDR="$(eval $cmd)" +- rc=$? +- if [ $rc != 0 ]; then +- ocf_log warn "command failed, rc: $rc" +- return $OCF_ERR_GENERIC ++ MAC_FILE="/sys/class/net/${OCF_RESKEY_interface}/address" ++ if [ -f $MAC_FILE ]; then ++ cmd="cat ${MAC_FILE}" ++ ocf_log debug "executing command: $cmd" ++ MAC_ADDR="$(eval $cmd)" ++ rc=$? ++ if [ $rc != 0 ]; then ++ ocf_log warn "command failed, rc: $rc" ++ return $OCF_ERR_GENERIC ++ fi ++ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" ++ else ++ cmd="ip -br link show dev ${OCF_RESKEY_interface} | tr -s ' ' | cut -d' ' -f3" ++ ocf_log debug "executing command: $cmd" ++ MAC_ADDR="$(eval $cmd)" ++ rc=$? ++ if [ $rc != 0 ]; then ++ ocf_log warn "command failed, rc: $rc" ++ return $OCF_ERR_GENERIC ++ fi ++ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" + fi +- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" + + cmd="curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/interface-id" + ocf_log debug "executing command: $cmd" + +From cdcc12a9c1431125b0d5298176e5242bfc9fbe29 Mon Sep 17 00:00:00 2001 +From: krojzl +Date: Fri, 19 Apr 2019 11:20:09 +0200 +Subject: [PATCH 5/6] Moving shared part outside if + +--- + heartbeat/aws-vpc-move-ip | 25 +++++++++---------------- + 1 file changed, 9 insertions(+), 16 deletions(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index 3a848b7e3..bfe23e5bf 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -222,26 +222,19 @@ ec2ip_get_and_configure() { + MAC_FILE="/sys/class/net/${OCF_RESKEY_interface}/address" + if [ -f $MAC_FILE ]; then + cmd="cat ${MAC_FILE}" +- ocf_log debug "executing command: $cmd" +- MAC_ADDR="$(eval $cmd)" +- rc=$? +- if [ $rc != 0 ]; then +- ocf_log warn "command failed, rc: $rc" +- return $OCF_ERR_GENERIC +- fi +- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" + else + cmd="ip -br link show dev ${OCF_RESKEY_interface} | tr -s ' ' | cut -d' ' -f3" +- ocf_log debug "executing command: $cmd" +- MAC_ADDR="$(eval $cmd)" +- rc=$? +- if [ $rc != 0 ]; then +- ocf_log warn "command failed, rc: $rc" +- return $OCF_ERR_GENERIC +- fi +- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" + fi + ++ ocf_log debug "executing command: $cmd" ++ MAC_ADDR="$(eval $cmd)" ++ rc=$? ++ if [ $rc != 0 ]; then ++ ocf_log warn "command failed, rc: $rc" ++ return $OCF_ERR_GENERIC ++ fi ++ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" ++ + cmd="curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/interface-id" + ocf_log debug "executing command: $cmd" + EC2_NETWORK_INTERFACE_ID="$(eval $cmd)" + +From c3fc114fc64f6feb015c5342923fd2afc367ae28 Mon Sep 17 00:00:00 2001 +From: krojzl +Date: Fri, 19 Apr 2019 11:22:55 +0200 +Subject: [PATCH 6/6] Linting adjustment + +--- + heartbeat/aws-vpc-move-ip | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip +index bfe23e5bf..2757c27d0 100755 +--- a/heartbeat/aws-vpc-move-ip ++++ b/heartbeat/aws-vpc-move-ip +@@ -225,7 +225,6 @@ ec2ip_get_and_configure() { + else + cmd="ip -br link show dev ${OCF_RESKEY_interface} | tr -s ' ' | cut -d' ' -f3" + fi +- + ocf_log debug "executing command: $cmd" + MAC_ADDR="$(eval $cmd)" + rc=$? diff --git a/SOURCES/bz1711165-aws-vpc-move-ip-avoid-possible-race-condition.patch b/SOURCES/bz1711165-aws-vpc-move-ip-avoid-possible-race-condition.patch deleted file mode 100644 index 8899055..0000000 --- a/SOURCES/bz1711165-aws-vpc-move-ip-avoid-possible-race-condition.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 57f695d336cab33c61e754e463654ad6400f7b58 Mon Sep 17 00:00:00 2001 -From: gguifelixamz -Date: Tue, 27 Nov 2018 17:06:05 +0000 -Subject: [PATCH 1/4] Enable --query flag in DescribeRouteTable API call to - avoid race condition with grep - ---- - heartbeat/aws-vpc-move-ip | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index 9b2043aca..d2aed7490 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -167,9 +167,10 @@ ec2ip_validate() { - ec2ip_monitor() { - if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then - ocf_log info "monitor: check routing table (API call)" -- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table" -+ cmd=''$OCF_RESKEY_awscli' --profile '$OCF_RESKEY_profile' --output text ec2 describe-route-tables --route-table-ids '$OCF_RESKEY_routing_table' --query 'RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId'' - ocf_log debug "executing command: $cmd" -- ROUTE_TO_INSTANCE="$($cmd | grep $OCF_RESKEY_ip | awk '{ print $3 }')" -+ ROUTE_TO_INSTANCE=$($cmd) -+ ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" - if [ -z "$ROUTE_TO_INSTANCE" ]; then - ROUTE_TO_INSTANCE="" - fi - -From 4d6371aca5dca35b902a480e07a08c1dc3373ca5 Mon Sep 17 00:00:00 2001 -From: gguifelixamz -Date: Thu, 29 Nov 2018 11:39:26 +0000 -Subject: [PATCH 2/4] aws-vpc-move-ip: Fixed outer quotes and removed inner - quotes - ---- - heartbeat/aws-vpc-move-ip | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index d2aed7490..ced69bd13 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -167,7 +167,7 @@ ec2ip_validate() { - ec2ip_monitor() { - if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then - ocf_log info "monitor: check routing table (API call)" -- cmd=''$OCF_RESKEY_awscli' --profile '$OCF_RESKEY_profile' --output text ec2 describe-route-tables --route-table-ids '$OCF_RESKEY_routing_table' --query 'RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId'' -+ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" - ocf_log debug "executing command: $cmd" - ROUTE_TO_INSTANCE=$($cmd) - ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" - -From 09f4b061690a0e681aaf7314f1fc3e6f4e597cc8 Mon Sep 17 00:00:00 2001 -From: gguifelixamz -Date: Thu, 29 Nov 2018 11:55:05 +0000 -Subject: [PATCH 3/4] aws-vpc-move-ip: Replaced indentation spaces with tabs - for consistency with the rest of the code - ---- - heartbeat/aws-vpc-move-ip | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index ced69bd13..3e827283e 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -167,10 +167,10 @@ ec2ip_validate() { - ec2ip_monitor() { - if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then - ocf_log info "monitor: check routing table (API call)" -- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" -+ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" - ocf_log debug "executing command: $cmd" -- ROUTE_TO_INSTANCE=$($cmd) -- ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" -+ ROUTE_TO_INSTANCE=$($cmd) -+ ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" - if [ -z "$ROUTE_TO_INSTANCE" ]; then - ROUTE_TO_INSTANCE="" - fi - -From fcf85551ce70cb4fb7ce24e21c361fdbe6fcce6b Mon Sep 17 00:00:00 2001 -From: gguifelixamz -Date: Thu, 29 Nov 2018 13:07:32 +0000 -Subject: [PATCH 4/4] aws-vpc-move-ip: In cmd variable on ec2ip_monitor(): - replaced _address with _ip and modified to use single quotes - ---- - heartbeat/aws-vpc-move-ip | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index 3e827283e..331ee184f 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -167,7 +167,7 @@ ec2ip_validate() { - ec2ip_monitor() { - if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then - ocf_log info "monitor: check routing table (API call)" -- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock==\`$OCF_RESKEY_address/32\`].InstanceId" -+ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock=='$OCF_RESKEY_ip/32'].InstanceId" - ocf_log debug "executing command: $cmd" - ROUTE_TO_INSTANCE=$($cmd) - ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" diff --git a/SOURCES/bz1711925-aws-vpc-move-ip-1-multi-route-table-support.patch b/SOURCES/bz1711925-aws-vpc-move-ip-1-multi-route-table-support.patch deleted file mode 100644 index b724aa3..0000000 --- a/SOURCES/bz1711925-aws-vpc-move-ip-1-multi-route-table-support.patch +++ /dev/null @@ -1,122 +0,0 @@ ---- a/heartbeat/aws-vpc-move-ip 2019-05-20 10:54:01.527329668 +0200 -+++ b/heartbeat/aws-vpc-move-ip 2019-05-20 11:33:35.386089091 +0200 -@@ -93,11 +93,19 @@ - - - -+ -+ -+Deprecated IP address param. Use the ip param instead. -+ -+Deprecated VPC private IP Address -+ -+ -+ - - --Name of the routing table, where the route for the IP address should be changed, i.e. rtb-... -+Name of the routing table(s), where the route for the IP address should be changed. If declaring multiple routing tables they should be separated by comma. Example: rtb-XXXXXXXX,rtb-YYYYYYYYY - --routing table name -+routing table name(s) - - - -@@ -129,6 +137,13 @@ - END - } - -+ec2ip_set_address_param_compat(){ -+ # Include backward compatibility for the deprecated address parameter -+ if [ -z "$OCF_RESKEY_ip" ] && [ -n "$OCF_RESKEY_address" ]; then -+ OCF_RESKEY_ip="$OCF_RESKEY_address" -+ fi -+} -+ - ec2ip_validate() { - for cmd in aws ip curl; do - check_binary "$cmd" -@@ -150,20 +165,29 @@ - } - - ec2ip_monitor() { -- if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ]; then -- ocf_log info "monitor: check routing table (API call)" -- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $OCF_RESKEY_routing_table --query RouteTables[*].Routes[?DestinationCidrBlock=='$OCF_RESKEY_ip/32'].InstanceId" -- ocf_log debug "executing command: $cmd" -- ROUTE_TO_INSTANCE=$($cmd) -- ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" -- if [ -z "$ROUTE_TO_INSTANCE" ]; then -- ROUTE_TO_INSTANCE="" -- fi -+ MON_RES="" -+ if ocf_is_true ${OCF_RESKEY_monapi} || [ "$__OCF_ACTION" = "start" ] || ocf_is_probe; then -+ for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do -+ ocf_log info "monitor: check routing table (API call) - $rtb" -+ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-route-tables --route-table-ids $rtb --query RouteTables[*].Routes[?DestinationCidrBlock=='$OCF_RESKEY_ip/32'].InstanceId" -+ ocf_log debug "executing command: $cmd" -+ ROUTE_TO_INSTANCE="$($cmd)" -+ ocf_log debug "Overlay IP is currently routed to ${ROUTE_TO_INSTANCE}" -+ if [ -z "$ROUTE_TO_INSTANCE" ]; then -+ ROUTE_TO_INSTANCE="" -+ fi -+ -+ if [ "$EC2_INSTANCE_ID" != "$ROUTE_TO_INSTANCE" ]; then -+ ocf_log warn "not routed to this instance ($EC2_INSTANCE_ID) but to instance $ROUTE_TO_INSTANCE on $rtb" -+ MON_RES="$MON_RES $rtb" -+ fi -+ sleep 1 -+ done - -- if [ "$EC2_INSTANCE_ID" != "$ROUTE_TO_INSTANCE" ];then -- ocf_log warn "not routed to this instance ($EC2_INSTANCE_ID) but to instance $ROUTE_TO_INSTANCE" -+ if [ ! -z "$MON_RES" ]; then - return $OCF_NOT_RUNNING - fi -+ - else - ocf_log debug "monitor: Enhanced Monitoring disabled - omitting API call" - fi -@@ -195,19 +219,23 @@ - } - - ec2ip_get_and_configure() { -- # Adjusting the routing table -- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile ec2 replace-route --route-table-id $OCF_RESKEY_routing_table --destination-cidr-block ${OCF_RESKEY_ip}/32 --instance-id $EC2_INSTANCE_ID" -- ocf_log debug "executing command: $cmd" -- $cmd -- rc=$? -- if [ "$rc" != 0 ]; then -- ocf_log warn "command failed, rc: $rc" -- return $OCF_ERR_GENERIC -- fi -+ for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do -+ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --instance-id $EC2_INSTANCE_ID" -+ ocf_log debug "executing command: $cmd" -+ $cmd -+ rc=$? -+ if [ "$rc" != 0 ]; then -+ ocf_log warn "command failed, rc: $rc" -+ return $OCF_ERR_GENERIC -+ fi -+ sleep 1 -+ done - - # Reconfigure the local ip address - ec2ip_drop -- ip addr add "${OCF_RESKEY_ip}/32" dev $OCF_RESKEY_interface -+ cmd="ip addr add ${OCF_RESKEY_ip}/32 dev $OCF_RESKEY_interface" -+ ocf_log debug "executing command: $cmd" -+ $cmd - rc=$? - if [ $rc != 0 ]; then - ocf_log warn "command failed, rc: $rc" -@@ -289,6 +317,8 @@ - exit $OCF_ERR_PERM - fi - -+ec2ip_set_address_param_compat -+ - ec2ip_validate - - case $__OCF_ACTION in diff --git a/SOURCES/bz1711925-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch b/SOURCES/bz1711925-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch deleted file mode 100644 index c283801..0000000 --- a/SOURCES/bz1711925-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch +++ /dev/null @@ -1,221 +0,0 @@ -From 9f2b9cc09f7e2df163ff95585374f860f3dc58eb Mon Sep 17 00:00:00 2001 -From: Tomas Krojzl -Date: Tue, 16 Apr 2019 18:40:29 +0200 -Subject: [PATCH 1/6] Fix for VM having multiple network interfaces - ---- - heartbeat/aws-vpc-move-ip | 22 +++++++++++++++++++++- - 1 file changed, 21 insertions(+), 1 deletion(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index 090956434..a91c2dd11 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -219,8 +219,28 @@ ec2ip_drop() { - } - - ec2ip_get_and_configure() { -+ cmd="ip -br link show dev $OCF_RESKEY_interface | tr -s ' ' | cut -d' ' -f3" -+ ocf_log debug "executing command: $cmd" -+ MAC_ADDR="$(eval $cmd)" -+ rc=$? -+ if [ $rc != 0 ]; then -+ ocf_log warn "command failed, rc: $rc" -+ return $OCF_ERR_GENERIC -+ fi -+ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" -+ -+ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-instances --instance-ids $EC2_INSTANCE_ID --query 'Reservations[*].Instances[*].NetworkInterfaces[*].[NetworkInterfaceId,MacAddress]' | grep ${MAC_ADDR} | cut -f1" -+ ocf_log debug "executing command: $cmd" -+ EC2_NETWORK_INTERFACE_ID="$(eval $cmd)" -+ rc=$? -+ if [ $rc != 0 ]; then -+ ocf_log warn "command failed, rc: $rc" -+ return $OCF_ERR_GENERIC -+ fi -+ ocf_log debug "network interface id associated MAC address ${MAC_ADDR}: ${EC2_NETWORK_INTERFACE_ID}" -+ - for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do -- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --instance-id $EC2_INSTANCE_ID" -+ cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --network-interface-id $EC2_NETWORK_INTERFACE_ID" - ocf_log debug "executing command: $cmd" - $cmd - rc=$? - -From a871a463134ebb2456b5f37a343bf9034f5f4074 Mon Sep 17 00:00:00 2001 -From: krojzl -Date: Tue, 16 Apr 2019 18:49:32 +0200 -Subject: [PATCH 2/6] Fixing indentation - ---- - heartbeat/aws-vpc-move-ip | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index a91c2dd11..a46d10d30 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -227,7 +227,7 @@ ec2ip_get_and_configure() { - ocf_log warn "command failed, rc: $rc" - return $OCF_ERR_GENERIC - fi -- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" -+ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" - - cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-instances --instance-ids $EC2_INSTANCE_ID --query 'Reservations[*].Instances[*].NetworkInterfaces[*].[NetworkInterfaceId,MacAddress]' | grep ${MAC_ADDR} | cut -f1" - ocf_log debug "executing command: $cmd" -@@ -237,7 +237,7 @@ ec2ip_get_and_configure() { - ocf_log warn "command failed, rc: $rc" - return $OCF_ERR_GENERIC - fi -- ocf_log debug "network interface id associated MAC address ${MAC_ADDR}: ${EC2_NETWORK_INTERFACE_ID}" -+ ocf_log debug "network interface id associated MAC address ${MAC_ADDR}: ${EC2_NETWORK_INTERFACE_ID}" - - for rtb in $(echo $OCF_RESKEY_routing_table | sed -e 's/,/ /g'); do - cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 replace-route --route-table-id $rtb --destination-cidr-block ${OCF_RESKEY_ip}/32 --network-interface-id $EC2_NETWORK_INTERFACE_ID" - -From 068680427dff620a948ae25f090bc154b02f17b9 Mon Sep 17 00:00:00 2001 -From: krojzl -Date: Wed, 17 Apr 2019 14:22:31 +0200 -Subject: [PATCH 3/6] Requested fix to avoid using AWS API - ---- - heartbeat/aws-vpc-move-ip | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index a46d10d30..2910552f2 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -229,7 +229,7 @@ ec2ip_get_and_configure() { - fi - ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" - -- cmd="$OCF_RESKEY_awscli --profile $OCF_RESKEY_profile --output text ec2 describe-instances --instance-ids $EC2_INSTANCE_ID --query 'Reservations[*].Instances[*].NetworkInterfaces[*].[NetworkInterfaceId,MacAddress]' | grep ${MAC_ADDR} | cut -f1" -+ cmd="curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/interface-id" - ocf_log debug "executing command: $cmd" - EC2_NETWORK_INTERFACE_ID="$(eval $cmd)" - rc=$? - -From 207a2ba66ba7196180d27674aa204980fcd25de2 Mon Sep 17 00:00:00 2001 -From: krojzl -Date: Fri, 19 Apr 2019 11:14:21 +0200 -Subject: [PATCH 4/6] More robust approach of getting MAC address - ---- - heartbeat/aws-vpc-move-ip | 29 +++++++++++++++++++++-------- - 1 file changed, 21 insertions(+), 8 deletions(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index 2910552f2..3a848b7e3 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -219,15 +219,28 @@ ec2ip_drop() { - } - - ec2ip_get_and_configure() { -- cmd="ip -br link show dev $OCF_RESKEY_interface | tr -s ' ' | cut -d' ' -f3" -- ocf_log debug "executing command: $cmd" -- MAC_ADDR="$(eval $cmd)" -- rc=$? -- if [ $rc != 0 ]; then -- ocf_log warn "command failed, rc: $rc" -- return $OCF_ERR_GENERIC -+ MAC_FILE="/sys/class/net/${OCF_RESKEY_interface}/address" -+ if [ -f $MAC_FILE ]; then -+ cmd="cat ${MAC_FILE}" -+ ocf_log debug "executing command: $cmd" -+ MAC_ADDR="$(eval $cmd)" -+ rc=$? -+ if [ $rc != 0 ]; then -+ ocf_log warn "command failed, rc: $rc" -+ return $OCF_ERR_GENERIC -+ fi -+ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" -+ else -+ cmd="ip -br link show dev ${OCF_RESKEY_interface} | tr -s ' ' | cut -d' ' -f3" -+ ocf_log debug "executing command: $cmd" -+ MAC_ADDR="$(eval $cmd)" -+ rc=$? -+ if [ $rc != 0 ]; then -+ ocf_log warn "command failed, rc: $rc" -+ return $OCF_ERR_GENERIC -+ fi -+ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" - fi -- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" - - cmd="curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/interface-id" - ocf_log debug "executing command: $cmd" - -From cdcc12a9c1431125b0d5298176e5242bfc9fbe29 Mon Sep 17 00:00:00 2001 -From: krojzl -Date: Fri, 19 Apr 2019 11:20:09 +0200 -Subject: [PATCH 5/6] Moving shared part outside if - ---- - heartbeat/aws-vpc-move-ip | 25 +++++++++---------------- - 1 file changed, 9 insertions(+), 16 deletions(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index 3a848b7e3..bfe23e5bf 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -222,26 +222,19 @@ ec2ip_get_and_configure() { - MAC_FILE="/sys/class/net/${OCF_RESKEY_interface}/address" - if [ -f $MAC_FILE ]; then - cmd="cat ${MAC_FILE}" -- ocf_log debug "executing command: $cmd" -- MAC_ADDR="$(eval $cmd)" -- rc=$? -- if [ $rc != 0 ]; then -- ocf_log warn "command failed, rc: $rc" -- return $OCF_ERR_GENERIC -- fi -- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" - else - cmd="ip -br link show dev ${OCF_RESKEY_interface} | tr -s ' ' | cut -d' ' -f3" -- ocf_log debug "executing command: $cmd" -- MAC_ADDR="$(eval $cmd)" -- rc=$? -- if [ $rc != 0 ]; then -- ocf_log warn "command failed, rc: $rc" -- return $OCF_ERR_GENERIC -- fi -- ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" - fi - -+ ocf_log debug "executing command: $cmd" -+ MAC_ADDR="$(eval $cmd)" -+ rc=$? -+ if [ $rc != 0 ]; then -+ ocf_log warn "command failed, rc: $rc" -+ return $OCF_ERR_GENERIC -+ fi -+ ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" -+ - cmd="curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/interface-id" - ocf_log debug "executing command: $cmd" - EC2_NETWORK_INTERFACE_ID="$(eval $cmd)" - -From c3fc114fc64f6feb015c5342923fd2afc367ae28 Mon Sep 17 00:00:00 2001 -From: krojzl -Date: Fri, 19 Apr 2019 11:22:55 +0200 -Subject: [PATCH 6/6] Linting adjustment - ---- - heartbeat/aws-vpc-move-ip | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip -index bfe23e5bf..2757c27d0 100755 ---- a/heartbeat/aws-vpc-move-ip -+++ b/heartbeat/aws-vpc-move-ip -@@ -225,7 +225,6 @@ ec2ip_get_and_configure() { - else - cmd="ip -br link show dev ${OCF_RESKEY_interface} | tr -s ' ' | cut -d' ' -f3" - fi -- - ocf_log debug "executing command: $cmd" - MAC_ADDR="$(eval $cmd)" - rc=$? diff --git a/SOURCES/bz1721274-SAPHanaSR-monitor-fix-tolower-error.patch b/SOURCES/bz1721274-SAPHanaSR-monitor-fix-tolower-error.patch deleted file mode 100644 index 57e0a6f..0000000 --- a/SOURCES/bz1721274-SAPHanaSR-monitor-fix-tolower-error.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 9eafa6e3dd9735bdd1e4e447d9e8c3d4da1e9c30 Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Thu, 27 Jun 2019 10:38:46 +0200 -Subject: [PATCH] SAPHanaSR-monitor: fix tolower() issue, which seems to be an - artifact from a2p (Awk to Perl) - ---- - SAPHana/bin/SAPHanaSR-monitor | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor b/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor -index 737545c..da6bf08 100755 ---- a/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor -+++ b/SAPHanaSR-ScaleOut-a77e8c6/SAPHana/bin/SAPHanaSR-monitor -@@ -219,7 +219,7 @@ sub processMonitor() { - # - $sid=$sids[0]; # currently ony one sid is supported - ( $sid, $ino ) = split(":", $sid); -- $sid=tolower("$sid"); -+ $sid=lc("$sid"); - get_hana_attributes($sid, \%Host, \%HName, \%Global, \%GName, \%Site, \%SName); - if ( keys(%Host) == 0 ) { - printf "No attributes found for SID=%s\n", $sid; diff --git a/SPECS/resource-agents.spec b/SPECS/resource-agents.spec index 0c717c3..44c4e6c 100644 --- a/SPECS/resource-agents.spec +++ b/SPECS/resource-agents.spec @@ -95,7 +95,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.1.1 -Release: 12%{?dist}.19 +Release: 30%{?dist} License: GPLv2+ and LGPLv2+ and ASL 2.0 URL: https://github.com/ClusterLabs/resource-agents %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} @@ -146,18 +146,34 @@ Patch25: bz1619428-2-LVM-activate-parameters-access-mode-fixes.patch Patch26: bz1637823-1-nfsserver-mount-rpc_pipefs.patch Patch27: bz1637823-2-nfsserver-var-lib-nfs-fix.patch Patch28: bz1641944-rabbitmq-cluster-monitor-mnesia-status.patch -Patch29: bz1641946-1-rabbitmq-cluster-fail-in-minority-partition.patch -Patch30: bz1641946-2-rabbitmq-cluster-fix-stop-regression.patch -Patch31: bz1657138-rabbitmq-cluster-ensure-node-attribures-removed.patch -Patch32: bz1656733-rabbitmq-cluster-retry-start-cluster-join-fails.patch -#Patch33: bz1692889-1-rabbitmq-cluster-debug-log-mnesia-query-fails.patch -#Patch34: bz1692889-2-rabbitmq-cluster-suppress-additional-output.patch -Patch35: bz1692890-ocf_log-do-not-log-debug-when-HA_debug-unset.patch -Patch36: bz1692973-tomcat-use-systemd-when-catalina.sh-unavailable.patch -Patch37: bz1711165-aws-vpc-move-ip-avoid-possible-race-condition.patch -Patch38: bz1711925-aws-vpc-move-ip-1-multi-route-table-support.patch -Patch39: bz1711925-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch -Patch40: bz1721274-SAPHanaSR-monitor-fix-tolower-error.patch +Patch29: bz1641946-rabbitmq-cluster-fail-when-in-minority-partition.patch +Patch30: bz1639826-rabbitmq-cluster-fix-stop-regression.patch +Patch31: bz1647252-vdo-vol-fix-monitor-action.patch +Patch32: bz1646770-tomcat-use-systemd-when-catalina.sh-unavailable.patch +Patch33: bz1656368-rabbitmq-cluster-ensure-node-attribures-removed.patch +Patch34: bz1655655-ocf_log-do-not-log-debug-when-HA_debug-unset.patch +Patch35: bz1643306-LVM-activate-dont-fail-initial-probe.patch +Patch36: bz1575095-rabbitmq-cluster-retry-start-cluster-join-fails.patch +Patch37: bz1659072-1-rabbitmq-cluster-debug-log-mnesia-query-fails.patch +Patch38: bz1659072-2-rabbitmq-cluster-suppress-additional-output.patch +Patch39: bz1629357-docker-fix-stop-issues.patch +Patch40: bz1669137-Route-make-family-parameter-optional.patch +Patch41: bz1549579-1-clvm-exclusive-mode-support.patch +Patch42: bz1642069-1-SAPInstance-add-reload-action.patch +Patch43: bz1642069-2-SAPInstance-improve-profile-detection.patch +Patch44: bz1642069-3-SAPInstance-metadata-improvements.patch +Patch45: bz1667413-1-LVM-activate-support-LVs-from-same-VG.patch +Patch46: bz1667413-2-LVM-activate-only-count-volumes.patch +Patch47: bz1651790-1-CTDB-explicitly-use-bash-shell.patch +Patch48: bz1651790-2-CTDB-add-ctdb_max_open_files-parameter.patch +Patch49: bz1504055-IPsrcaddr-fix-regression-without-NetworkManager.patch +Patch50: bz1598969-iSCSILogicalUnit-create-iqn-when-it-doesnt-exist.patch +Patch51: bz1693658-aws-vpc-move-ip-avoid-possible-race-condition.patch +Patch52: bz1697558-aws-vpc-move-ip-1-multi-route-table-support.patch +Patch53: bz1697558-aws-vpc-move-ip-2-fix-route-update-multi-NICs.patch +Patch54: bz1549579-2-ocf_is_true-add-True-to-regexp.patch +Patch55: bz1363902-SAPHanaSR-monitor-fix-tolower-error.patch + # bundle patches Patch1000: bz1568588-7-gcp-bundled.patch Patch1001: bz1568588-8-google-cloud-sdk-fixes.patch @@ -351,13 +367,13 @@ SAP instances to be managed in a cluster environment. License: GPLv2+ Summary: SAP HANA Scale-Out cluster resource agents Version: 0.163.2 -Release: 1%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}.5 +Release: 7%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} Group: System Environment/Base %else Group: Productivity/Clustering/HA %endif -Requires: resource-agents >= 4.1.1-12 +Requires: resource-agents >= 4.1.1-25 Requires: perl %description sap-hana-scaleout @@ -371,13 +387,13 @@ environment. License: GPLv2+ Summary: SAP cluster connector script Version: 3.0.1 -Release: 1%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}.5 +Release: 7%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} Group: System Environment/Base %else Group: Productivity/Clustering/HA %endif -Requires: resource-agents-sap >= 4.1.1-12 +Requires: resource-agents-sap >= 4.1.1-25 Requires: perl %description -n sap-cluster-connector @@ -428,14 +444,29 @@ exit 1 %patch30 -p1 %patch31 -p1 %patch32 -p1 -#%patch33 -p1 -#%patch34 -p1 +%patch33 -p1 +%patch34 -p1 %patch35 -p1 %patch36 -p1 -%patch37 -p1 -F2 +%patch37 -p1 %patch38 -p1 %patch39 -p1 %patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 -F2 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 # add SAPHana agents to Makefile.am mv %{saphana_prefix}-%{saphana_hash}/SAPHana/ra/SAPHana* heartbeat @@ -469,11 +500,12 @@ rm -rf %{googlecloudsdk_dir}/bin/{bootstrapping,bq,dev_appserver.py,docker-crede rm -rf %{googlecloudsdk_dir}/lib/third_party/*/python3 # remove python-rsa rm -rf %{googlecloudsdk_dir}/lib/third_party/rsa +# remove grpc +rm -rf %{googlecloudsdk_dir}/lib/third_party/grpc # docs/licenses cp %{googlecloudsdk_dir}/README %{googlecloudsdk}_README cp %{googlecloudsdk_dir}/lib/third_party/argparse/README.txt %{googlecloudsdk}_argparse_README.txt cp %{googlecloudsdk_dir}/LICENSE %{googlecloudsdk}_LICENSE -cp %{googlecloudsdk_dir}/lib/third_party/grpc/LICENSE %{googlecloudsdk}_grpc_LICENSE cp %{googlecloudsdk_dir}/lib/third_party/httplib2/LICENSE %{googlecloudsdk}_httplib2_LICENSE cp %{googlecloudsdk_dir}/lib/third_party/contextlib2/LICENSE %{googlecloudsdk}_contextlib2_LICENSE cp %{googlecloudsdk_dir}/lib/third_party/concurrent/LICENSE %{googlecloudsdk}_concurrent_LICENSE @@ -1065,44 +1097,90 @@ ccs_update_schema > /dev/null 2>&1 ||: %endif %changelog -* Thu Jun 27 2019 Oyvind Albrigtsen - 4.1.1-12.19 +* Thu Jun 27 2019 Oyvind Albrigtsen - 4.1.1-30 - resource-agents-sap-hana-scaleout: new subpackage - Resolves: rhbz#1721274 + Resolves: rhbz#1363902 -* Tue Jun 25 2019 Oyvind Albrigtsen - 4.1.1-12.17 +* Tue Jun 25 2019 Oyvind Albrigtsen - 4.1.1-27 - sap-cluster-connector: new subpackage - Resolves: rhbz#1721412 + Resolves: rhbz#1710956 -* Tue May 21 2019 Oyvind Albrigtsen - 4.1.1-12.13 -- aws-vpc-move-ip: use "--query" to avoid a possible race condition +* Tue Jun 18 2019 Oyvind Albrigtsen - 4.1.1-24 +- clvm: support exclusive mode + + Resolves: rhbz#1549579 + +* Mon May 20 2019 Oyvind Albrigtsen - 4.1.1-23 - aws-vpc-move-ip: add multi route-table support and fix issue w/multiple NICs - Resolves: rhbz#1711165 - Resolves: rhbz#1711925 + Resolves: rhbz#1697558 -* Thu Apr 11 2019 Oyvind Albrigtsen - 4.1.1-12.10 -- ocf_log: do not log debug messages when HA_debug unset -- tomcat: use systemd when catalina.sh is unavailable +* Fri Apr 5 2019 Oyvind Albrigtsen - 4.1.1-22 +- IPsrcaddr: make proto optional to fix regression when used without + NetworkManager - Resolves: rhbz#1655655 - Resolves: rhbz#1646770 + Resolves: rhbz#1504055 -* Thu Jan 17 2019 Oyvind Albrigtsen - 4.1.1-12.8 -- rabbitmq-cluster: retry start when cluster join fails - Resolves: rhbz#1656733 +* Thu Mar 28 2019 Oyvind Albrigtsen - 4.1.1-21 +- aws-vpc-move-ip: use "--query" to avoid a possible race condition + + Resolves: rhbz#1693658 + +* Tue Mar 26 2019 Oyvind Albrigtsen - 4.1.1-20 +- IPsrcaddr: add proto and table parameters +- iSCSILogicalUnit: only create iqn when it doesnt exist + + Resolves: rhbz#1504055 + Resolves: rhbz#1598969 + +* Thu Feb 28 2019 Oyvind Albrigtsen - 4.1.1-19 +- CTDB: add ctdb_max_open_files parameter -* Fri Dec 7 2018 Oyvind Albrigtsen - 4.1.1-12.7 + Resolves: rhbz#1651790 + +* Wed Feb 27 2019 Oyvind Albrigtsen - 4.1.1-18 +- SAPInstance: add reload-action +- LVM-activate: support LVs from same VG +- Remove grpc from bundle + + Resolves: rhbz#1642069 + Resolves: rhbz#1667413 + Resolves: rhbz#1683629 + +* Thu Jan 24 2019 Oyvind Albrigtsen - 4.1.1-17 +- Route: make family parameter optional + + Resolves: rhbz#1669137 + +* Thu Jan 17 2019 Oyvind Albrigtsen - 4.1.1-16 +- rabbitmq-cluster: suppress additional output +- docker: fix stop issues + + Resolves: rhbz#1659072 + Resolves: rhbz#1629357 + +* Thu Jan 17 2019 Oyvind Albrigtsen - 4.1.1-15 - rabbitmq-cluster: ensure node attributes are removed +- ocf_log: do not log debug messages when HA_debug unset +- LVM-activate: dont fail initial probe +- rabbitmq-cluster: retry start when cluster join fails - Resolves: rhbz#1657138 + Resolves: rhbz#1656368 + Resolves: rhbz#1655655 + Resolves: rhbz#1643306 + Resolves: rhbz#1575095 -* Wed Nov 7 2018 Oyvind Albrigtsen - 4.1.1-12.6 +* Wed Nov 7 2018 Oyvind Albrigtsen - 4.1.1-14 - rabbitmq-cluster: fix stop regression +- vdo-vol: fix monitor-action +- tomcat: use systemd when catalina.sh is unavailable - Resolves: rhbz#1641946 + Resolves: rhbz#1639826 + Resolves: rhbz#1647252 + Resolves: rhbz#1646770 * Tue Oct 23 2018 Oyvind Albrigtsen - 4.1.1-12.5 - rabbitmq-cluster: get cluster status from mnesia during monitor