|
|
cb8e9e |
From c21040a0d9a81b6337ec7849bcee6bec525fdd4c Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Kaleb S. KEITHLEY <kkeithle@redhat.com>
|
|
|
cb8e9e |
Date: Wed, 17 Jun 2015 11:03:12 -0400
|
|
|
cb8e9e |
Subject: [PATCH 102/129] common-ha: cluster HA setup sometimes fails
|
|
|
cb8e9e |
|
|
|
cb8e9e |
the "s in the VIP_foo="x.x.x.x" lines are problematic now that the
|
|
|
cb8e9e |
config file isn't sourced.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Revised to also handle names containing '-', e.g. host-11, and FQNs,
|
|
|
cb8e9e |
e.g. host-11.lab.gluster.org
|
|
|
cb8e9e |
|
|
|
cb8e9e |
backport of
|
|
|
cb8e9e |
>> Change-Id: I1a52afbf398a024cdff851d0c415d8363f699c90
|
|
|
cb8e9e |
>> BUG: 1232001
|
|
|
cb8e9e |
>> Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
|
|
|
cb8e9e |
>> http://review.gluster.org/#/c/11281/
|
|
|
cb8e9e |
>
|
|
|
cb8e9e |
> Change-Id: I108eb5f1922a0b6ee41817d901a2ae0e027e5370
|
|
|
cb8e9e |
> BUG: 1232002
|
|
|
cb8e9e |
> Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
|
|
|
cb8e9e |
> http://review.gluster.org/#/c/11282/
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Change-Id: I40b45d79d25f8b047081c86bf6b75c07216d5165
|
|
|
cb8e9e |
BUG: 1227311
|
|
|
cb8e9e |
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50952
|
|
|
cb8e9e |
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
extras/ganesha/scripts/ganesha-ha.sh | 27 ++++++++++++++++++++++-----
|
|
|
cb8e9e |
1 files changed, 22 insertions(+), 5 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
|
|
|
cb8e9e |
index 7c7e9c5..fc2a009 100755
|
|
|
cb8e9e |
--- a/extras/ganesha/scripts/ganesha-ha.sh
|
|
|
cb8e9e |
+++ b/extras/ganesha/scripts/ganesha-ha.sh
|
|
|
cb8e9e |
@@ -343,10 +343,23 @@ setup_create_resources()
|
|
|
cb8e9e |
|
|
|
cb8e9e |
while [[ ${1} ]]; do
|
|
|
cb8e9e |
|
|
|
cb8e9e |
+ # this is variable indirection
|
|
|
cb8e9e |
+ # from a nvs like 'VIP_host1=10.7.6.5' or 'VIP_host1="10.7.6.5"'
|
|
|
cb8e9e |
+ # (or VIP_host-1=..., or VIP_host-1.my.domain.name=...)
|
|
|
cb8e9e |
+ # a variable 'clean_name' is created (e.g. w/ value 'VIP_host_1')
|
|
|
cb8e9e |
+ # and a clean nvs (e.g. w/ value 'VIP_host_1="10_7_6_5"')
|
|
|
cb8e9e |
+ # after the `eval ${clean_nvs}` there is a variable VIP_host_1
|
|
|
cb8e9e |
+ # with the value '10_7_6_5', and the following \$$ magic to
|
|
|
cb8e9e |
+ # reference it, i.e. `eval tmp_ipaddr=\$${clean_name}` gives us
|
|
|
cb8e9e |
+ # ${tmp_ipaddr} with 10_7_6_5 and then convert the _s back to .s
|
|
|
cb8e9e |
+ # to give us ipaddr="10.7.6.5". whew!
|
|
|
cb8e9e |
name="VIP_${1}"
|
|
|
cb8e9e |
+ clean_name=${name//[-.]/_}
|
|
|
cb8e9e |
nvs=$(grep "^${name}=" ${HA_CONFDIR}/ganesha-ha.conf)
|
|
|
cb8e9e |
- eval ${nvs}
|
|
|
cb8e9e |
- eval ipaddr=\$$name
|
|
|
cb8e9e |
+ clean_nvs=${nvs//[-.]/_}
|
|
|
cb8e9e |
+ eval ${clean_nvs}
|
|
|
cb8e9e |
+ eval tmp_ipaddr=\$${clean_name}
|
|
|
cb8e9e |
+ ipaddr=${tmp_ipaddr//_/.}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
pcs -f ${cibfile} resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} cidr_netmask=32 op monitor interval=15s
|
|
|
cb8e9e |
if [ $? -ne 0 ]; then
|
|
|
cb8e9e |
@@ -440,10 +453,15 @@ recreate_resources()
|
|
|
cb8e9e |
local cibfile=${1}; shift
|
|
|
cb8e9e |
|
|
|
cb8e9e |
while [[ ${1} ]]; do
|
|
|
cb8e9e |
+ # this is variable indirection
|
|
|
cb8e9e |
+ # see the comment on the same a few lines up
|
|
|
cb8e9e |
name="VIP_${1}"
|
|
|
cb8e9e |
+ clean_name=${name//[-.]/_}
|
|
|
cb8e9e |
nvs=$(grep "^${name}=" ${HA_CONFDIR}/ganesha-ha.conf)
|
|
|
cb8e9e |
- eval ${nvs}
|
|
|
cb8e9e |
- eval ipaddr=\$$name
|
|
|
cb8e9e |
+ clean_nvs=${nvs//[-.]/_}
|
|
|
cb8e9e |
+ eval ${clean_nvs}
|
|
|
cb8e9e |
+ eval tmp_ipaddr=\$${clean_name}
|
|
|
cb8e9e |
+ ipaddr=${tmp_ipaddr//_/.}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
pcs -f ${cibfile} resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} cidr_netmask=32 op monitor interval=15s
|
|
|
cb8e9e |
if [ $? -ne 0 ]; then
|
|
|
cb8e9e |
@@ -767,7 +785,6 @@ main()
|
|
|
cb8e9e |
teardown_resources ${HA_SERVERS}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
teardown_cluster ${HA_NAME}
|
|
|
cb8e9e |
-
|
|
|
cb8e9e |
;;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
cleanup | --cleanup)
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|