From be104984403efc2719ff06afea67bb13f21b2c82 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 02 2017 15:24:15 +0000 Subject: import resource-agents-3.9.5-82.el7_3.6 --- diff --git a/SOURCES/bz1400103-nova-compute-wait-nova-compute-unfence.patch b/SOURCES/bz1400103-nova-compute-wait-nova-compute-unfence.patch index dbc6526..0901754 100644 --- a/SOURCES/bz1400103-nova-compute-wait-nova-compute-unfence.patch +++ b/SOURCES/bz1400103-nova-compute-wait-nova-compute-unfence.patch @@ -1,6 +1,6 @@ diff -uNr a/heartbeat/nova-compute-wait b/heartbeat/nova-compute-wait ---- a/heartbeat/nova-compute-wait 2016-11-29 12:36:05.437464639 +0100 -+++ b/heartbeat/nova-compute-wait 2016-11-29 12:52:54.790724139 +0100 +--- a/heartbeat/nova-compute-wait 2017-02-02 11:23:38.263510362 +0100 ++++ b/heartbeat/nova-compute-wait 2017-02-02 11:28:27.181650906 +0100 @@ -1,30 +1,15 @@ #!/bin/sh +# Copyright 2015 Red Hat, Inc. @@ -209,8 +209,8 @@ diff -uNr a/heartbeat/nova-compute-wait b/heartbeat/nova-compute-wait exit $rc + diff -uNr a/heartbeat/NovaEvacuate b/heartbeat/NovaEvacuate ---- a/heartbeat/NovaEvacuate 2016-11-29 12:36:05.425464769 +0100 -+++ b/heartbeat/NovaEvacuate 2016-11-29 12:52:38.548900211 +0100 +--- a/heartbeat/NovaEvacuate 2017-02-02 11:23:38.253510461 +0100 ++++ b/heartbeat/NovaEvacuate 2017-02-02 11:28:49.262432371 +0100 @@ -1,30 +1,16 @@ #!/bin/sh # @@ -248,3 +248,12 @@ diff -uNr a/heartbeat/NovaEvacuate b/heartbeat/NovaEvacuate ####################################################################### # Initialization: +@@ -180,7 +166,7 @@ + ocf_log notice "Initiating evacuation of $node" + + fence_compute ${fence_options} -o status -n ${node} +- if [ $? != 0 ]; then ++ if [ $? = 1 ]; then + ocf_log info "Nova does not know about ${node}" + # Dont mark as no because perhaps nova is unavailable right now + continue diff --git a/SOURCES/bz1400103-redis-notify-clients-of-master-being-demoted.patch b/SOURCES/bz1400103-redis-notify-clients-of-master-being-demoted.patch index a8dee96..f7ba67a 100644 --- a/SOURCES/bz1400103-redis-notify-clients-of-master-being-demoted.patch +++ b/SOURCES/bz1400103-redis-notify-clients-of-master-being-demoted.patch @@ -1,22 +1,42 @@ -From 24d8398461592d3bff82851625f21c9531bda8a9 Mon Sep 17 00:00:00 2001 +From f1c2249ef5e8524ddb986f0df879d5f18e935da3 Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen -Date: Tue, 22 Nov 2016 11:17:15 +0100 +Date: Fri, 20 Jan 2017 09:17:15 +0100 Subject: [PATCH] redis: use "CLIENT KILL type normal" to notify clients of master being demoted --- - heartbeat/redis | 1 + - 1 file changed, 1 insertion(+) + heartbeat/redis | 11 +++++++++++ + 1 file changed, 11 insertions(+) diff --git a/heartbeat/redis b/heartbeat/redis -index 1ea0025..296f56a 100755 +index 1ea0025..d08e57a 100755 --- a/heartbeat/redis +++ b/heartbeat/redis -@@ -466,6 +466,7 @@ function demote() { - ocf_log info "demote: Setting master to '$master_host'" +@@ -436,6 +436,11 @@ function demote() { + local master_host + local master_port - redis_client slaveof "$master_host" "$master_port" -+ redis_client CLIENT KILL type normal - - # Wait forever for the slave to connect to the master and finish the - # sync. Timeout is controlled by Pacemaker "op start timeout=XX". ++ # client kill is only supported in Redis 2.8.12 or greater ++ version=$(redis_client -v | awk '{print $NF}') ++ ocf_version_cmp "$version" "2.8.11" ++ client_kill=$? ++ + CHECK_SLAVE_STATE=1 + monitor + status=$? +@@ -478,9 +483,15 @@ function demote() { + while true; do + # Wait infinite if replication is syncing + # Then start/demote operation timeout determines timeout ++ if [ "$client_kill" -eq 2 ]; then ++ redis_client CLIENT PAUSE 2000 ++ fi + monitor + status=$? + if (( status == OCF_SUCCESS )); then ++ if [ "$client_kill" -eq 2 ]; then ++ redis_client CLIENT KILL type normal ++ fi + return $OCF_SUCCESS + fi + diff --git a/SOURCES/bz1402511-rabbitmq-cluster-reset-mnesia-before-join.patch b/SOURCES/bz1402511-rabbitmq-cluster-reset-mnesia-before-join.patch new file mode 100644 index 0000000..3772674 --- /dev/null +++ b/SOURCES/bz1402511-rabbitmq-cluster-reset-mnesia-before-join.patch @@ -0,0 +1,169 @@ +diff -uNr a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster +--- a/heartbeat/rabbitmq-cluster 2017-01-20 15:37:43.698833068 +0100 ++++ b/heartbeat/rabbitmq-cluster 2017-01-20 16:28:56.170739557 +0100 +@@ -1,6 +1,6 @@ + #!/bin/sh + # +-# Copyright (c) 2014 David Vossel ++# Copyright (c) 2014 David Vossel + # All Rights Reserved. + # + # This program is free software; you can redistribute it and/or modify +@@ -52,7 +52,7 @@ + cat < + +- ++ + 1.0 + + +@@ -111,7 +111,7 @@ + + rmq_join_list() + { +- cibadmin -Q 2>/dev/null | grep "$RMQ_CRM_ATTR_COOKIE" | sed -n -e "s/^.*value=.\(.*\)\".*$/\1/p" ++ cibadmin -Q --xpath "//node_state[@crmd='online']//nvpair[@name='$RMQ_CRM_ATTR_COOKIE']" | grep "$RMQ_CRM_ATTR_COOKIE" | sed -n -e "s/^.*value=.\(.*\)\".*$/\1/p" + } + + rmq_write_nodename() +@@ -203,7 +203,7 @@ + + rmq_set_policy() + { +- $RMQ_CTL set_policy $@ > /dev/null 2>&1 ++ $RMQ_CTL set_policy "$@" > /dev/null 2>&1 + } + + rmq_start_first() +@@ -284,7 +284,6 @@ + return $OCF_SUCCESS + } + +- + rmq_forget_cluster_node_remotely() { + local running_cluster_nodes="$1" + local node_to_forget="$2" +@@ -354,26 +353,28 @@ + return $rc + fi + +- # first try to join without wiping mnesia data +- rmq_join_existing "$join_list" +- if [ $? -ne 0 ]; then +- ocf_log info "node failed to join, wiping data directory and trying again" +- local local_rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)" ++ # Try to join existing cluster ++ ocf_log info "wiping data directory before joining" ++ local local_rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)" + +- # if the graceful join fails, use the hammer and reset all the data. +- rmq_stop +- rmq_wipe_data +- rmq_forget_cluster_node_remotely "$join_list" "$local_rmq_node" +- rmq_join_existing "$join_list" +- rc=$? ++ rmq_stop ++ rmq_wipe_data ++ rmq_forget_cluster_node_remotely "$join_list" "$local_rmq_node" ++ rmq_join_existing "$join_list" ++ rc=$? + +- # Restore users (if any) +- BaseDataDir=`dirname $RMQ_DATA_DIR` +- if [ -f $BaseDataDir/users.erl ] ; then +- rabbitmqctl eval " +- %% Run only if Mnesia is ready, otherwise exit. +- lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) orelse halt(), ++ if [ $rc -ne 0 ]; then ++ ocf_log info "node failed to join even after reseting local data. Check SELINUX policy" ++ return $OCF_ERR_GENERIC ++ fi + ++ # Restore users and users' permissions (if any) ++ BaseDataDir=`dirname $RMQ_DATA_DIR` ++ if [ -f $BaseDataDir/users.erl ] ; then ++ rabbitmqctl eval " ++ %% Run only if Mnesia is ready. ++ lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso ++ begin + [WildPattern] = ets:select(mnesia_gvar, [ { {{rabbit_user, wild_pattern}, '\\\$1'}, [], ['\\\$1'] } ]), + + %% Read users first +@@ -400,39 +401,51 @@ + %% Version >= 3.6.0 + {internal_user,'_','_','_','_'} -> + lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user, Upgrade(X)) end, Users) +- end. +- " +- rm -f $BaseDataDir/users.erl +- fi +- +- if [ $rc -ne 0 ]; then +- ocf_log info "node failed to join even after reseting local data. Check SELINUX policy" +- return $OCF_ERR_GENERIC +- fi ++ end, ++ ++ ok = file:delete(\"$BaseDataDir/users.erl\") ++ end. ++ " ++ fi ++ if [ -f $BaseDataDir/users_perms.erl ] ; then ++ rabbitmqctl eval " ++ %% Run only if Mnesia is ready. ++ lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso ++ begin ++ {ok, [UsersPerms]} = file:consult(\"$BaseDataDir/users_perms.erl\"), ++ lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user_permission, X) end, UsersPerms), ++ ++ ok = file:delete(\"$BaseDataDir/users_perms.erl\") ++ end. ++ " + fi + + return $OCF_SUCCESS + } + + rmq_stop() { +- # Backup users ++ # Backup users and users' permissions + BaseDataDir=`dirname $RMQ_DATA_DIR` + rabbitmqctl eval " +- %% Run only if Mnesia is still available, otherwise exit. +- lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) orelse halt(), +- +- [WildPattern] = ets:select(mnesia_gvar, [ { {{rabbit_user, wild_pattern}, '\\\$1'}, [], ['\\\$1'] } ]), +- +- Users = case WildPattern of +- %% Version < 3.6.0 +- {internal_user,'_','_','_'} -> +- mnesia:dirty_select(rabbit_user, [{ {internal_user, '\\\$1', '_', '_'}, [{'/=', '\\\$1', <<\"guest\">>}], ['\\\$_'] } ]); +- %% Version >= 3.6.0 +- {internal_user,'_','_','_','_'} -> +- mnesia:dirty_select(rabbit_user, [{ {internal_user, '\\\$1', '_', '_', '_'}, [{'/=', '\\\$1', <<\"guest\">>}], ['\\\$_'] } ]) +- end, +- +- file:write_file(\"$BaseDataDir/users.erl\", io_lib:fwrite(\"~p.~n\", [Users])). ++ %% Run only if Mnesia is still available. ++ lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso ++ begin ++ [WildPattern] = ets:select(mnesia_gvar, [ { {{rabbit_user, wild_pattern}, '\\\$1'}, [], ['\\\$1'] } ]), ++ ++ Users = case WildPattern of ++ %% Version < 3.6.0 ++ {internal_user,'_','_','_'} -> ++ mnesia:dirty_select(rabbit_user, [{ {internal_user, '\\\$1', '_', '_'}, [{'/=', '\\\$1', <<\"guest\">>}], ['\\\$_'] } ]); ++ %% Version >= 3.6.0 ++ {internal_user,'_','_','_','_'} -> ++ mnesia:dirty_select(rabbit_user, [{ {internal_user, '\\\$1', '_', '_', '_'}, [{'/=', '\\\$1', <<\"guest\">>}], ['\\\$_'] } ]) ++ end, ++ ++ Users /= [] andalso file:write_file(\"$BaseDataDir/users.erl\", io_lib:fwrite(\"~p.~n\", [Users])), ++ ++ UsersPerms = mnesia:dirty_select(rabbit_user_permission, [{{'\\\$1', {'\\\$2', '\\\$3','\\\$4'}, '\\\$5'}, [{'/=', '\\\$3', <<\"guest\">>}], ['\\\$_']}]), ++ UsersPerms /= [] andalso file:write_file(\"$BaseDataDir/users_perms.erl\", io_lib:fwrite(\"~p.~n\", [UsersPerms])) ++ end. + " + + rmq_monitor diff --git a/SPECS/resource-agents.spec b/SPECS/resource-agents.spec index f87e8f1..289a30c 100644 --- a/SPECS/resource-agents.spec +++ b/SPECS/resource-agents.spec @@ -32,7 +32,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 3.9.5 -Release: 82%{?dist}.4 +Release: 82%{?dist}.6 License: GPLv2+, LGPLv2+ and ASL 2.0 URL: https://github.com/ClusterLabs/resource-agents %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} @@ -173,6 +173,7 @@ Patch128: bz1394296-redis-fix-selinux-permissions.patch Patch129: bz1400103-redis-notify-clients-of-master-being-demoted.patch Patch130: bz1400103-nova-compute-wait-nova-compute-unfence.patch Patch131: bz1409513-portblock-wait.patch +Patch132: bz1402511-rabbitmq-cluster-reset-mnesia-before-join.patch Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} @@ -415,6 +416,7 @@ exit 1 %patch129 -p1 %patch130 -p1 %patch131 -p1 +%patch132 -p1 %build if [ ! -f configure ]; then @@ -669,17 +671,22 @@ ccs_update_schema > /dev/null 2>&1 ||: %endif %changelog +* Thu Feb 2 2017 Oyvind Albrigtsen - 3.9.5-82.6 +- redis: notify clients of master being demoted + + Resolves: rhbz#1400103 + +* Fri Jan 20 2017 Oyvind Albrigtsen - 3.9.5-82.5 +- rabbitmq-cluster: reset Mnesia before join + + Resolves: rhbz#1402511 + * Tue Jan 3 2017 Oyvind Albrigtsen - 3.9.5-82.4 - portblock: use iptables wait - Add netstat dependency Resolves: rhbz#1409513 -* Wed Nov 30 2016 Oyvind Albrigtsen - 3.9.5-82.3 -- redis: notify clients of master being demoted - - Resolves: rhbz#1400103 - * Mon Nov 14 2016 Oyvind Albrigtsen - 3.9.5-82.2 - redis: fix SELinux permissions