Blame SOURCES/bz1602783-dont-use-ocf_attribute_target-for-metadata.patch

7b144c
From 2dbfbd8ee3c1547f941507ab4109aa04eec0ef5a Mon Sep 17 00:00:00 2001
7b144c
From: Michele Baldessari <michele@acksyn.org>
7b144c
Date: Mon, 16 Jul 2018 20:24:04 +0200
7b144c
Subject: [PATCH] Do not call ocf_attribute_target in the meta-data function
7b144c
7b144c
Starting with pacemaker-1.1.19 a "crm_node -n" call triggers
7b144c
a CRM_OP_NODE_INFO cluster operation. If this is called
7b144c
from a bundle with 1.1.19 code (or later) running on a 1.1.18
7b144c
cluster, during a meta-data call we will get the following error in the
7b144c
cluster logs:
7b144c
Jul 14 11:35:27 [20041] controller-0 crmd: error: handle_request: Unexpected request (node-info) sent to non-DC node
7b144c
Jul 14 11:35:27 [20041] controller-0 crmd: error: handle_request: Unexpected <create_request_adv origin="send_node_info_request" t="crmd" version="3.0.14" subt="request" reference="node-info-crm_node-1531568127-1" crm_task="node-info" crm_sys_to="crmd" crm_sys_from="e67698a2-6f50-45fc-b8de-423c94e11c99" acl_target="root" crm_user="root" src="controller-0"/>
7b144c
7b144c
By not calling ocf_attribute_target (which triggers a crm_node -n
7b144c
call) when polling for meta-data we do not run into this issue.
7b144c
7b144c
This can easily get triggered when creating a resource invoking
7b144c
crm_node -n inside a 1.1.19 container with pcs, as that invokes
7b144c
the 'meta-data' action explicitely.
7b144c
7b144c
Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com>
7b144c
Suggested-By: Ken Gaillot <kgaillot@redhat.com>
7b144c
---
7b144c
 heartbeat/galera           | 6 ++++--
7b144c
 heartbeat/rabbitmq-cluster | 4 +++-
7b144c
 heartbeat/redis.in         | 4 +++-
7b144c
 3 files changed, 10 insertions(+), 4 deletions(-)
7b144c
7b144c
diff --git a/heartbeat/galera b/heartbeat/galera
7b144c
index 270bdaf1b..4f341ceef 100755
7b144c
--- a/heartbeat/galera
7b144c
+++ b/heartbeat/galera
7b144c
@@ -66,9 +66,11 @@
7b144c
 
7b144c
 : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
7b144c
 . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
7b144c
-. ${OCF_FUNCTIONS_DIR}/mysql-common.sh
7b144c
 
7b144c
-NODENAME=$(ocf_attribute_target)
7b144c
+if [ "$__OCF_ACTION" != "meta-data" ]; then
7b144c
+    . ${OCF_FUNCTIONS_DIR}/mysql-common.sh
7b144c
+    NODENAME=$(ocf_attribute_target)
7b144c
+fi
7b144c
 
7b144c
 # It is common for some galera instances to store
7b144c
 # check user that can be used to query status
7b144c
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
7b144c
index 9ff49e075..54a16c941 100755
7b144c
--- a/heartbeat/rabbitmq-cluster
7b144c
+++ b/heartbeat/rabbitmq-cluster
7b144c
@@ -37,7 +37,9 @@ RMQ_DATA_DIR="/var/lib/rabbitmq/mnesia"
7b144c
 RMQ_PID_DIR="/var/run/rabbitmq"
7b144c
 RMQ_PID_FILE="/var/run/rabbitmq/rmq.pid"
7b144c
 RMQ_LOG_DIR="/var/log/rabbitmq"
7b144c
-NODENAME=$(ocf_attribute_target)
7b144c
+if [ "$__OCF_ACTION" != "meta-data" ]; then
7b144c
+	NODENAME=$(ocf_attribute_target)
7b144c
+fi
7b144c
 
7b144c
 # this attr represents the current active local rmq node name.
7b144c
 # when rmq stops or the node is fenced, this attr disappears
7b144c
diff --git a/heartbeat/redis.in b/heartbeat/redis.in
7b144c
index d5eb8f664..ddc62d8a7 100644
7b144c
--- a/heartbeat/redis.in
7b144c
+++ b/heartbeat/redis.in
7b144c
@@ -664,7 +664,9 @@ redis_validate() {
7b144c
 	fi
7b144c
 }
7b144c
 
7b144c
-NODENAME=$(ocf_attribute_target)
7b144c
+if [ "$__OCF_ACTION" != "meta-data" ]; then
7b144c
+	NODENAME=$(ocf_attribute_target)
7b144c
+fi
7b144c
 if [ -r "$REDIS_CONFIG" ]; then
7b144c
 	clientpasswd="$(sed -n -e  's/^\s*requirepass\s*\(.*\)\s*$/\1/p' < $REDIS_CONFIG | tail -n 1)"
7b144c
 fi