|
|
3052fb |
From 9bd94137d77f770967d35db5de716590cfaf0435 Mon Sep 17 00:00:00 2001
|
|
|
3052fb |
From: Michele Baldessari <michele@acksyn.org>
|
|
|
3052fb |
Date: Thu, 7 Sep 2017 21:07:45 +0200
|
|
|
3052fb |
Subject: [PATCH 2/2] Make use of ocf_attribute_target in rabbitmq/redis/galera
|
|
|
3052fb |
|
|
|
3052fb |
Instead of using NODENAME directly use the newly-introduced
|
|
|
3052fb |
ocf_attribute_target function. This allows the operator to decide if an RA
|
|
|
3052fb |
running inside a bundle should use per-host properties or per-bundle
|
|
|
3052fb |
properties in a resource. This can be done by setting the meta-attribute
|
|
|
3052fb |
'container-attribute-target' to 'host' in the former case and leave the
|
|
|
3052fb |
defaults as is in the latter case.
|
|
|
3052fb |
|
|
|
3052fb |
This change has been tested in the following scenarios (for rabbit/redis
|
|
|
3052fb |
and galera):
|
|
|
3052fb |
1) A deployment without bundles and without the container-attribute-target meta attr set.
|
|
|
3052fb |
2) A deployment with the resources running in bundles without the meta-attr set
|
|
|
3052fb |
3) A deployment with the resources running in bundles with the meta-attr set to 'host'
|
|
|
3052fb |
|
|
|
3052fb |
Additionally we successfully tested restarting of each resource, banning
|
|
|
3052fb |
of each resource from a node and rebooting a cluster node hosting the
|
|
|
3052fb |
resource.
|
|
|
3052fb |
|
|
|
3052fb |
Signed-off-by: Andrew Beekhof <abeekhof@redhat.com>
|
|
|
3052fb |
Signed-off-by: Michele Baldessari <michele@acksyn.org>
|
|
|
3052fb |
Signed-off-by: Damien Ciabrini <dciabrin@redhat.com>
|
|
|
3052fb |
---
|
|
|
3052fb |
heartbeat/galera | 16 +++++++++-------
|
|
|
3052fb |
heartbeat/rabbitmq-cluster | 4 ++--
|
|
|
3052fb |
heartbeat/redis | 5 +++--
|
|
|
3052fb |
3 files changed, 14 insertions(+), 11 deletions(-)
|
|
|
3052fb |
|
|
|
3052fb |
diff --git a/heartbeat/galera b/heartbeat/galera
|
|
|
3052fb |
index dc681a47079a..ab121a4be5a4 100755
|
|
|
3052fb |
--- a/heartbeat/galera
|
|
|
3052fb |
+++ b/heartbeat/galera
|
|
|
3052fb |
@@ -68,6 +68,8 @@
|
|
|
3052fb |
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
|
|
3052fb |
. ${OCF_FUNCTIONS_DIR}/mysql-common.sh
|
|
|
3052fb |
|
|
|
3052fb |
+NODENAME=$(ocf_attribute_target)
|
|
|
3052fb |
+
|
|
|
3052fb |
# It is common for some galera instances to store
|
|
|
3052fb |
# check user that can be used to query status
|
|
|
3052fb |
# in this file
|
|
|
3052fb |
@@ -279,7 +281,7 @@ get_status_variable()
|
|
|
3052fb |
|
|
|
3052fb |
set_bootstrap_node()
|
|
|
3052fb |
{
|
|
|
3052fb |
- local node=$1
|
|
|
3052fb |
+ local node=$(ocf_attribute_target $1)
|
|
|
3052fb |
|
|
|
3052fb |
${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-bootstrap" -v "true"
|
|
|
3052fb |
}
|
|
|
3052fb |
@@ -307,7 +309,7 @@ clear_no_grastate()
|
|
|
3052fb |
|
|
|
3052fb |
is_no_grastate()
|
|
|
3052fb |
{
|
|
|
3052fb |
- local node=$1
|
|
|
3052fb |
+ local node=$(ocf_attribute_target $1)
|
|
|
3052fb |
${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-no-grastate" -Q 2>/dev/null
|
|
|
3052fb |
}
|
|
|
3052fb |
|
|
|
3052fb |
@@ -323,7 +325,7 @@ set_last_commit()
|
|
|
3052fb |
|
|
|
3052fb |
get_last_commit()
|
|
|
3052fb |
{
|
|
|
3052fb |
- local node=$1
|
|
|
3052fb |
+ local node=$(ocf_attribute_target $1)
|
|
|
3052fb |
|
|
|
3052fb |
if [ -z "$node" ]; then
|
|
|
3052fb |
${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-last-committed" -Q 2>/dev/null
|
|
|
3052fb |
@@ -413,7 +415,7 @@ master_exists()
|
|
|
3052fb |
|
|
|
3052fb |
clear_master_score()
|
|
|
3052fb |
{
|
|
|
3052fb |
- local node=$1
|
|
|
3052fb |
+ local node=$(ocf_attribute_target $1)
|
|
|
3052fb |
if [ -z "$node" ]; then
|
|
|
3052fb |
$CRM_MASTER -D
|
|
|
3052fb |
else
|
|
|
3052fb |
@@ -423,7 +425,7 @@ clear_master_score()
|
|
|
3052fb |
|
|
|
3052fb |
set_master_score()
|
|
|
3052fb |
{
|
|
|
3052fb |
- local node=$1
|
|
|
3052fb |
+ local node=$(ocf_attribute_target $1)
|
|
|
3052fb |
|
|
|
3052fb |
if [ -z "$node" ]; then
|
|
|
3052fb |
$CRM_MASTER -v 100
|
|
|
3052fb |
@@ -542,7 +544,7 @@ detect_first_master()
|
|
|
3052fb |
|
|
|
3052fb |
greater_than_equal_long "$last_commit" "$best_commit"
|
|
|
3052fb |
if [ $? -eq 0 ]; then
|
|
|
3052fb |
- best_node=$node
|
|
|
3052fb |
+ best_node=$(ocf_attribute_target $node)
|
|
|
3052fb |
best_commit=$last_commit
|
|
|
3052fb |
fi
|
|
|
3052fb |
|
|
|
3052fb |
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
|
|
|
3052fb |
index 1e78d9ecab98..362556d3f644 100755
|
|
|
3052fb |
--- a/heartbeat/rabbitmq-cluster
|
|
|
3052fb |
+++ b/heartbeat/rabbitmq-cluster
|
|
|
3052fb |
@@ -37,7 +37,7 @@ RMQ_DATA_DIR="/var/lib/rabbitmq/mnesia"
|
|
|
3052fb |
RMQ_PID_DIR="/var/run/rabbitmq"
|
|
|
3052fb |
RMQ_PID_FILE="/var/run/rabbitmq/rmq.pid"
|
|
|
3052fb |
RMQ_LOG_DIR="/var/log/rabbitmq"
|
|
|
3052fb |
-NODENAME=$(ocf_local_nodename)
|
|
|
3052fb |
+NODENAME=$(ocf_attribute_target)
|
|
|
3052fb |
|
|
|
3052fb |
# this attr represents the current active local rmq node name.
|
|
|
3052fb |
# when rmq stops or the node is fenced, this attr disappears
|
|
|
3052fb |
@@ -340,7 +340,7 @@ rmq_notify() {
|
|
|
3052fb |
|
|
|
3052fb |
# forget each stopped rmq instance in the provided pcmk node in the list.
|
|
|
3052fb |
for node in $(echo "$node_list"); do
|
|
|
3052fb |
- local rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $node -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)"
|
|
|
3052fb |
+ local rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $(ocf_attribute_target $node) -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)"
|
|
|
3052fb |
if [ -z "$rmq_node" ]; then
|
|
|
3052fb |
ocf_log warn "Unable to map pcmk node $node to a known rmq node."
|
|
|
3052fb |
continue
|
|
|
3052fb |
diff --git a/heartbeat/redis b/heartbeat/redis
|
|
|
3052fb |
index 708ce84e6184..bc97f14096a6 100755
|
|
|
3052fb |
--- a/heartbeat/redis
|
|
|
3052fb |
+++ b/heartbeat/redis
|
|
|
3052fb |
@@ -188,7 +188,8 @@ function last_known_master()
|
|
|
3052fb |
}
|
|
|
3052fb |
|
|
|
3052fb |
function crm_master_reboot() {
|
|
|
3052fb |
- "${HA_SBIN_DIR}/crm_master" -l reboot "$@"
|
|
|
3052fb |
+ local node=$(ocf_attribute_target)
|
|
|
3052fb |
+ "${HA_SBIN_DIR}/crm_master" -N $node -l reboot "$@"
|
|
|
3052fb |
}
|
|
|
3052fb |
|
|
|
3052fb |
function calculate_score()
|
|
|
3052fb |
@@ -545,7 +546,7 @@ function validate() {
|
|
|
3052fb |
fi
|
|
|
3052fb |
}
|
|
|
3052fb |
|
|
|
3052fb |
-NODENAME=$(ocf_local_nodename)
|
|
|
3052fb |
+NODENAME=$(ocf_attribute_target)
|
|
|
3052fb |
if [ -f "$REDIS_CONFIG" ]; then
|
|
|
3052fb |
clientpasswd="$(cat $REDIS_CONFIG | sed -n -e 's/^\s*requirepass\s*\(.*\)\s*$/\1/p' | tail -n 1)"
|
|
|
3052fb |
fi
|
|
|
3052fb |
--
|
|
|
3052fb |
2.13.5
|
|
|
3052fb |
|