initialiser la HA en dernier

This commit is contained in:
Emmanuel Garette 2019-02-22 14:47:20 +01:00
parent 5661832da8
commit a640384c5b
2 changed files with 22 additions and 19 deletions

View File

@ -442,22 +442,10 @@ function manage_datastores()
return 0 return 0
} }
function init_ha() {
# server with index 1 exists if already instanciate
onezone show 0 | grep -A 3 ^"HA & FEDERATION SYNC STATUS" | tail -n 1 | grep -q ^" 1 "
if [ ! $? = 0 ]; then
FOLLOWER=$(CreoleGet one_nodes)
for follower in $FOLLOWER; do
onezone server-add 0 --name $follower --rpc http://$follower:2633/RPC2
done
fi
}
function main() function main()
{ {
wait_true_retcode "Wait for oned to be started" "onecluster show 0 > /dev/null" wait_true_retcode "Wait for oned to be started" "onecluster show 0 > /dev/null"
if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then
if [ "$(CreoleGet one_ha_server_index)" != "0" ]; then if [ "$(CreoleGet one_ha_server_index)" != "0" ]; then
return return
fi fi
@ -493,13 +481,8 @@ function main()
# Création des Datastores # Création des Datastores
# #
manage_datastores "${clst_name}" manage_datastores "${clst_name}"
#
# Dans le cas du mode HA, seul le leader fait l'init
#
if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then
init_ha
fi
} }
main main
exit 0

20
postservice/99-z-ha Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
function init_ha() {
# server with index 1 exists if already instanciate
onezone show 0 | grep -A 3 ^"HA & FEDERATION SYNC STATUS" | tail -n 1 | grep -q ^" 1 "
if [ ! $? = 0 ]; then
FOLLOWER=$(CreoleGet one_nodes)
for follower in $FOLLOWER; do
onezone server-add 0 --name $follower --rpc http://$follower:2633/RPC2
done
fi
}
if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then
if [ "$(CreoleGet one_ha_server_index)" = "0" ]; then
init_ha
fi
fi
exit 0