Adding host sync with rsync

ONE 5.6.1 is affected by this bug :
https://github.com/OpenNebula/one/issues/2962

Fixed in 5.6.2 but we don't have packages for this version.
This commit is contained in:
Philippe Caseiro 2019-02-21 10:53:26 +01:00
parent 171328c890
commit 693532b324
1 changed files with 21 additions and 1 deletions

View File

@ -69,6 +69,21 @@ function check_host()
return ${res}
}
# Fix host creation error from 5.6.1 with sync methode rsync
function sync_host()
{
CMD="onehost"
OPT="sync -f --rsync"
AUTH=$(get_one_auth)
res=$(su - oneadmin -c "${CMD} ${OPT} --user ${AUTH%:*} --password ${AUTH#*:}")
if [[ ${?} -ne 0 ]]
then
error "Hosts sync failed"
else
echo "Hosts sync OK"
fi
}
function manage_host()
{
NAME=${1}
@ -441,7 +456,7 @@ function init_ha() {
function main()
{
wait_true_retcode "Wait for oned to be started" "onecluster show 0 > /dev/null"
if [ $(CreoleGet one_ha_role) = "leader" ]; then
if [ "$(CreoleGet one_ha_role none)" = "leader" ]; then
init_ha
fi
#
@ -466,6 +481,11 @@ function main()
#
attach_host ${host} "${clst_name}"
#
# Force host synchronisation
#
sync_host
#
# Création des Datastores
#