2014-11-13 10:06:16 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-04-18 10:25:08 +02:00
|
|
|
. /usr/lib/eole/utils.sh
|
|
|
|
|
2014-11-13 10:06:16 +01:00
|
|
|
function error()
|
|
|
|
{
|
|
|
|
MSG=${1}
|
|
|
|
echo "[ERROR][${MSG}]"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_user_home()
|
|
|
|
{
|
|
|
|
HOMEDIR=$(getent passwd ${1} | cut -d ':' -f 6)
|
|
|
|
echo ${HOMEDIR}
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_one_auth()
|
|
|
|
{
|
|
|
|
CMD="cat"
|
|
|
|
HOME=$(get_user_home oneadmin)
|
|
|
|
FILE="${HOME}/.one/one_auth"
|
|
|
|
${CMD} ${FILE}
|
|
|
|
}
|
|
|
|
|
2018-04-09 10:23:41 +02:00
|
|
|
function check_default_cluster()
|
|
|
|
{
|
|
|
|
name="${1}"
|
|
|
|
cmd="onecluster show 0"
|
|
|
|
auth=$(get_one_auth)
|
2016-07-21 14:32:53 +02:00
|
|
|
|
2018-04-09 10:23:41 +02:00
|
|
|
DEFAULT_NAME=$(${cmd} --user ${auth%:*} --password ${auth#*:} | awk '/^NAME/ {print $3}')
|
|
|
|
[[ "${name}" = "${DEFAULT_NAME}" ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
function rename_default_cluster()
|
|
|
|
{
|
|
|
|
NAME="${1}"
|
|
|
|
CMD="onecluster rename 0 ${NAME}"
|
|
|
|
AUTH=$(get_one_auth)
|
|
|
|
|
|
|
|
if ! check_default_cluster "${NAME}"
|
|
|
|
then
|
|
|
|
|
|
|
|
if ${CMD} --user ${AUTH%:*} --password ${AUTH#*:}
|
|
|
|
then
|
|
|
|
echo "The default cluster name is now '${NAME}'"
|
|
|
|
else
|
|
|
|
error "The default cluster can not be renamed"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "The default cluster name is already \"${NAME}\""
|
|
|
|
fi
|
|
|
|
}
|
2014-11-13 10:06:16 +01:00
|
|
|
|
|
|
|
function check_host()
|
|
|
|
{
|
|
|
|
name="${1}"
|
|
|
|
cmd="onehost"
|
|
|
|
opt="list"
|
|
|
|
auth=$(get_one_auth)
|
|
|
|
|
|
|
|
res=0
|
|
|
|
clst_list=$(${cmd} ${opt} --user ${auth%:*} --password ${auth#*:} | tail -n +2 | awk -F ' ' '{print $2}')
|
|
|
|
for hst in ${clst_list}
|
|
|
|
do
|
|
|
|
[[ "${NAME}" = "${hst}" ]] && res=$((res+1))
|
|
|
|
done
|
|
|
|
return ${res}
|
|
|
|
}
|
|
|
|
|
2019-02-21 10:53:26 +01:00
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2014-11-13 10:06:16 +01:00
|
|
|
function manage_host()
|
|
|
|
{
|
|
|
|
NAME=${1}
|
|
|
|
CMD="onehost"
|
|
|
|
IM_MAD='kvm'
|
|
|
|
VM_MAD='kvm'
|
2016-07-20 10:27:51 +02:00
|
|
|
OPT="create ${NAME} -i ${IM_MAD} -v ${VM_MAD}"
|
2014-11-13 10:06:16 +01:00
|
|
|
AUTH=$(get_one_auth)
|
|
|
|
|
|
|
|
check_host ${NAME}
|
|
|
|
if [[ ${?} -eq 0 ]]
|
|
|
|
then
|
|
|
|
res=$(${CMD} ${OPT} --user ${AUTH%:*} --password ${AUTH#*:})
|
|
|
|
if [[ ${?} -ne 0 ]]
|
|
|
|
then
|
|
|
|
error "Host creation failed"
|
|
|
|
else
|
|
|
|
echo "Host ${NAME} created"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Host ${NAME} already exist"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_cluster_id_by_name()
|
|
|
|
{
|
|
|
|
name=${1}
|
|
|
|
cmd="onecluster"
|
|
|
|
opt="show ${name}"
|
2015-08-14 10:36:46 +02:00
|
|
|
opt="list -l ID,NAME -f NAME=${name} --csv"
|
2016-05-11 11:31:53 +02:00
|
|
|
|
2014-11-13 10:06:16 +01:00
|
|
|
|
2015-08-14 10:36:46 +02:00
|
|
|
res=$(${cmd} ${opt} --user ${AUTH%:*} --password ${AUTH#*:} | awk -F ',' '/^[0-9]/ { print $1 }')
|
2014-11-13 10:06:16 +01:00
|
|
|
if [[ ${?} -eq 0 ]]
|
|
|
|
then
|
|
|
|
echo ${res#*:}
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Get Host ID by a name
|
|
|
|
#
|
|
|
|
function get_host_id_by_name()
|
|
|
|
{
|
|
|
|
name=${1}
|
|
|
|
cmd="onehost"
|
|
|
|
opt="show ${name}"
|
|
|
|
|
|
|
|
res=$(${cmd} ${opt} --user ${AUTH%:*} --password ${AUTH#*:} | grep "ID.*:")
|
|
|
|
if [[ ${?} -eq 0 ]]
|
|
|
|
then
|
|
|
|
echo ${res#*:}
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Get Datastore ID by a name
|
|
|
|
#
|
|
|
|
function get_ds_id_by_name()
|
|
|
|
{
|
|
|
|
name=${1}
|
|
|
|
cmd="onedatastore"
|
|
|
|
opt="show ${name}"
|
|
|
|
|
|
|
|
res=$(${cmd} ${opt} --user ${AUTH%:*} --password ${AUTH#*:} | grep "ID.*:")
|
|
|
|
if [[ ${?} -eq 0 ]]
|
|
|
|
then
|
|
|
|
echo ${res#*:}
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo "ERR"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# check_host_in_cluster
|
|
|
|
# if host is attached to cluster : return 0
|
|
|
|
# if host not attached to cluster : return 1
|
|
|
|
#
|
|
|
|
function check_host_in_cluster()
|
|
|
|
{
|
|
|
|
hst=${1}
|
|
|
|
clst=${2}
|
|
|
|
auth=$(get_one_auth)
|
|
|
|
cmd="onehost"
|
|
|
|
opt="show ${hst} --user ${AUTH%:*} --password ${AUTH#*:}"
|
|
|
|
|
|
|
|
RES=$(${cmd} ${opt} | grep CLUSTER)
|
|
|
|
cluster=${RES#*:}
|
|
|
|
# clean Outpu
|
|
|
|
cluster="${cluster#"${cluster%%[![:space:]]*}"}" # remove leading whitespace characters
|
|
|
|
cluster="${cluster%"${cluster##*[![:space:]]}"}" # remove trailing whitespace characters
|
|
|
|
if [[ "${cluster}" = "${clst}" ]]
|
|
|
|
then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Attach a host to a cluster
|
|
|
|
#
|
|
|
|
function attach_host()
|
|
|
|
{
|
|
|
|
HOST=${1}
|
|
|
|
CLST=${2}
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#CLST_ID=$(get_cluster_id_by_name ${CLST})
|
2019-02-15 16:51:53 +01:00
|
|
|
CLST_ID=0
|
2014-11-13 10:06:16 +01:00
|
|
|
HST_ID=$(get_host_id_by_name ${HOST})
|
|
|
|
AUTH=$(get_one_auth)
|
|
|
|
CMD="onecluster"
|
|
|
|
OPT="addhost ${CLST_ID} ${HST_ID}"
|
|
|
|
|
|
|
|
check_host_in_cluster ${HOST} ${CLST}
|
|
|
|
if [[ ${?} -eq 1 ]]
|
|
|
|
then
|
|
|
|
if [[ -n ${CLST_ID} ]]
|
|
|
|
then
|
|
|
|
if [[ -n ${HST_ID} ]]
|
|
|
|
then
|
|
|
|
RES=$(${CMD} ${OPT} --user ${AUTH%:*} --password ${AUTH#*:})
|
|
|
|
if [[ ${?} -ne 0 ]]
|
|
|
|
then
|
|
|
|
error "Attaching ${HOST} to ${CLST} failed"
|
|
|
|
else
|
|
|
|
echo "${HOST} attached to ${CLST}"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
error "No host id for ${HOST}"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
error "No Cluster id for ${CLST}"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Host ${HOST} already present in cluster ${CLST}"
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Attach a datastore to a cluster
|
|
|
|
#
|
2016-07-21 14:32:53 +02:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
|
|
|
#function attach_ds_to_cluster()
|
|
|
|
#{
|
|
|
|
# DS=${1}
|
|
|
|
# CLST=${2}
|
|
|
|
# CLST_ID=$(get_cluster_id_by_name ${CLST})
|
|
|
|
# DS_ID=$(get_ds_id_by_name ${ds_name})
|
|
|
|
# AUTH=$(get_one_auth)
|
|
|
|
# CMD="onecluster"
|
|
|
|
# OPT="adddatastore ${CLST_ID} ${DS_ID}"
|
|
|
|
#
|
|
|
|
# RES=$(${CMD} ${OPT} --user ${AUTH%:*} --password ${AUTH#*:})
|
|
|
|
# if [[ ${?} -ne 0 ]]
|
|
|
|
# then
|
|
|
|
# error "Attaching ${DS} to ${CLST} failed."
|
|
|
|
# else
|
|
|
|
# echo "Datastore ${DS} attached to ${CLST}."
|
|
|
|
# return 0
|
|
|
|
# fi
|
|
|
|
# return 0
|
|
|
|
#}
|
2014-11-13 10:06:16 +01:00
|
|
|
|
|
|
|
function create_datastore()
|
|
|
|
{
|
|
|
|
ds_type="${1}"
|
|
|
|
ds_name="${2}"
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#ds_cluster="${3}"
|
2014-11-13 10:06:16 +01:00
|
|
|
|
|
|
|
if [[ $(CreoleGet activer_multinode 2>&1) == 'oui' ]]
|
|
|
|
then
|
|
|
|
SYS_TM_MAD='ssh'
|
|
|
|
ISO_TM_MAD='ssh'
|
|
|
|
IMG_TM_MAD='ssh'
|
|
|
|
else
|
|
|
|
SYS_TM_MAD='shared'
|
|
|
|
ISO_TM_MAD='shared'
|
|
|
|
IMG_TM_MAD='qcow2'
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Creating datastore ${ds_name}"
|
|
|
|
TMPL_FILE=$(mktemp)
|
|
|
|
case ${ds_type} in
|
|
|
|
"SYSTEM")
|
|
|
|
cat <<__EOF__ > ${TMPL_FILE}
|
|
|
|
NAME = ${ds_name}
|
|
|
|
TM_MAD = ${SYS_TM_MAD}
|
|
|
|
TYPE = SYSTEM_DS
|
|
|
|
__EOF__
|
|
|
|
;;
|
|
|
|
"ISO")
|
|
|
|
cat <<__EOF__ > ${TMPL_FILE}
|
|
|
|
NAME = ${ds_name}
|
|
|
|
DS_MAD = fs
|
|
|
|
TM_MAD = ${ISO_TM_MAD}
|
|
|
|
TYPE = IMAGE_DS
|
|
|
|
__EOF__
|
|
|
|
;;
|
|
|
|
"IMAGE")
|
|
|
|
cat <<__EOF__ > ${TMPL_FILE}
|
|
|
|
NAME = ${ds_name}
|
|
|
|
DS_MAD = fs
|
|
|
|
TM_MAD = ${ISO_TM_MAD}
|
|
|
|
TYPE = IMAGE_DS
|
|
|
|
__EOF__
|
|
|
|
;;
|
|
|
|
|
|
|
|
*) echo "Nothing to do with ${ds_type}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
auth=$(get_one_auth)
|
|
|
|
cmd="onedatastore"
|
|
|
|
opt="create --user ${AUTH%:*} --password ${AUTH#*:} ${TMPL_FILE}"
|
|
|
|
RUN=$(${cmd} ${opt})
|
|
|
|
if [[ ${?} -eq 0 ]]
|
|
|
|
then
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#attach_ds_to_cluster ${ds_name} ${ds_cluster}
|
2014-11-13 10:06:16 +01:00
|
|
|
rm ${TMPL_FILE}
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function update_datastore()
|
|
|
|
{
|
|
|
|
local auth=${1}
|
|
|
|
local ds_id=${2}
|
|
|
|
local cmd="onedatastore"
|
|
|
|
local opt="show"
|
|
|
|
local multinode=$(CreoleGet activer_multinode 2>&1)
|
|
|
|
ds_type=""
|
|
|
|
ds_mad=""
|
|
|
|
ds_name=""
|
|
|
|
|
|
|
|
TMPL_FILE=$(mktemp)
|
|
|
|
|
|
|
|
if [[ ${multinode} == 'oui' ]]
|
|
|
|
then
|
|
|
|
SYS_TM_MAD='ssh'
|
|
|
|
ISO_TM_MAD='ssh'
|
|
|
|
IMG_TM_MAD='ssh'
|
|
|
|
else
|
|
|
|
SYS_TM_MAD='shared'
|
|
|
|
ISO_TM_MAD='shared'
|
|
|
|
IMG_TM_MAD='qcow2'
|
|
|
|
fi
|
|
|
|
|
|
|
|
out=$(${cmd} ${opt} ${ds_id} --user ${auth%:*} --password ${auth#*:} | \
|
|
|
|
awk -F ':' '/^DATASTORE.*INFORMATION/,/DATASTORE CAPACITY/ {gsub(" |\t",""); print $1 ":" $2 " " }')
|
|
|
|
for line in ${out}
|
|
|
|
do
|
|
|
|
[[ ${line} =~ ^TM_MAD ]] && ds_mad=${line#*:}
|
|
|
|
[[ ${line} =~ ^NAME ]] && ds_name=${line#*:}
|
|
|
|
[[ ${line} =~ ^TYPE ]] && ds_type=${line#*:}
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ${ds_name} == "$(CreoleGet one_ds_system_prefix 2>&1)$(CreoleGet one_cluster_name 2>&1)" ]]
|
|
|
|
then
|
|
|
|
cat <<__EOF__ > ${TMPL_FILE}
|
|
|
|
NAME = ${ds_name}
|
|
|
|
TM_MAD = ${SYS_TM_MAD}
|
|
|
|
TYPE = SYSTEM_DS
|
|
|
|
__EOF__
|
|
|
|
elif [[ ${ds_name} == "$(CreoleGet one_ds_iso_name 2>&1)" ]]
|
|
|
|
then
|
|
|
|
cat <<__EOF__ > ${TMPL_FILE}
|
|
|
|
NAME = ${ds_name}
|
|
|
|
DS_MAD = fs
|
|
|
|
TM_MAD = ${ISO_TM_MAD}
|
|
|
|
TYPE = IMAGE_DS
|
|
|
|
__EOF__
|
|
|
|
elif [[ ${ds_name} == "$(CreoleGet one_ds_image_name 2>&1)" ]]
|
|
|
|
then
|
|
|
|
cat <<__EOF__ > ${TMPL_FILE}
|
|
|
|
NAME = ${ds_name}
|
|
|
|
DS_MAD = fs
|
|
|
|
TM_MAD = ${ISO_TM_MAD}
|
|
|
|
TYPE = IMAGE_DS
|
|
|
|
__EOF__
|
|
|
|
else
|
|
|
|
echo "Nothing to do with ${ds_name}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -s ${TMPL_FILE} ]]
|
|
|
|
then
|
|
|
|
echo "Updating ${ds_name} datastore"
|
|
|
|
opt="update ${ds_id} --user ${AUTH%:*} --password ${AUTH#*:} ${TMPL_FILE}"
|
|
|
|
RUN=$(${cmd} ${opt})
|
|
|
|
rm ${TMPL_FILE}
|
|
|
|
return ${?}
|
|
|
|
else
|
|
|
|
rm ${TMPL_FILE}
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function manage_datastores()
|
|
|
|
{
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#cluster=${1}
|
2014-11-13 10:06:16 +01:00
|
|
|
AUTH=$(get_one_auth)
|
|
|
|
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#SYSTEM_DS="$(CreoleGet 'one_ds_system_prefix')${cluster}"
|
|
|
|
SYSTEM_DS="$(CreoleGet 'one_ds_system_prefix')default"
|
2014-11-13 10:06:16 +01:00
|
|
|
ISO_DS=$(CreoleGet 'one_ds_iso_name')
|
|
|
|
IMAGE_DS=$(CreoleGet 'one_ds_image_name')
|
|
|
|
|
|
|
|
echo "Configuring datastores for Cluster"
|
|
|
|
sid=$(get_ds_id_by_name ${SYSTEM_DS})
|
|
|
|
if [[ ${sid} = "ERR" ]]
|
|
|
|
then
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#create_datastore "SYSTEM" "${SYSTEM_DS}" "${cluster}"
|
|
|
|
create_datastore "SYSTEM" "${SYSTEM_DS}"
|
2014-11-13 10:06:16 +01:00
|
|
|
else
|
|
|
|
update_datastore ${AUTH} ${sid}
|
|
|
|
fi
|
|
|
|
|
|
|
|
imgid=$(get_ds_id_by_name ${IMAGE_DS})
|
|
|
|
if [[ ${imgid} = "ERR" ]]
|
|
|
|
then
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#create_datastore "IMAGE" "${IMAGE_DS}" "${cluster}"
|
|
|
|
create_datastore "IMAGE" "${IMAGE_DS}"
|
2014-11-13 10:06:16 +01:00
|
|
|
else
|
|
|
|
update_datastore ${AUTH} ${imgid}
|
|
|
|
fi
|
|
|
|
|
|
|
|
isoid=$(get_ds_id_by_name ${ISO_DS})
|
|
|
|
if [[ ${isoid} = "ERR" ]]
|
|
|
|
then
|
2019-02-15 16:51:53 +01:00
|
|
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
2016-07-21 14:32:53 +02:00
|
|
|
#create_datastore "ISO" "${ISO_DS}" "${cluster}"
|
|
|
|
create_datastore "ISO" "${ISO_DS}"
|
2014-11-13 10:06:16 +01:00
|
|
|
else
|
|
|
|
update_datastore ${AUTH} ${isoid}
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2019-02-15 16:51:53 +01:00
|
|
|
function init_ha() {
|
2019-02-20 14:17:48 +01:00
|
|
|
# server with index 1 exists if already instanciate
|
|
|
|
onezone show 0 | grep -A 3 ^"HA & FEDERATION SYNC STATUS" | tail -n 1 | grep -q ^" 1 "
|
2019-02-15 16:51:53 +01:00
|
|
|
if [ ! $? = 0 ]; then
|
2019-02-21 13:59:39 +01:00
|
|
|
FOLLOWER=$(CreoleGet one_nodes)
|
2019-02-19 15:07:17 +01:00
|
|
|
for follower in $FOLLOWER; do
|
2019-02-15 16:51:53 +01:00
|
|
|
onezone server-add 0 --name $follower --rpc http://$follower:2633/RPC2
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-11-13 10:06:16 +01:00
|
|
|
function main()
|
|
|
|
{
|
2018-04-18 10:25:08 +02:00
|
|
|
wait_true_retcode "Wait for oned to be started" "onecluster show 0 > /dev/null"
|
2019-02-22 14:02:50 +01:00
|
|
|
if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then
|
|
|
|
|
|
|
|
if [ "$(CreoleGet one_ha_server_index)" != "0" ]; then
|
|
|
|
return
|
|
|
|
fi
|
2019-02-15 16:51:53 +01:00
|
|
|
fi
|
2014-11-13 10:06:16 +01:00
|
|
|
#
|
2018-04-09 10:23:41 +02:00
|
|
|
# Rename default cluster
|
|
|
|
clst_name=$(CreoleGet one_cluster_name)
|
|
|
|
rename_default_cluster "${clst_name}"
|
2014-11-13 10:06:16 +01:00
|
|
|
|
2019-02-15 16:51:53 +01:00
|
|
|
# Wait 4 seconds for service (ref #16848)
|
|
|
|
sleep 4
|
2016-08-01 17:17:30 +02:00
|
|
|
|
2014-11-13 10:06:16 +01:00
|
|
|
#
|
|
|
|
# Creating Host
|
|
|
|
#
|
2019-02-15 16:51:53 +01:00
|
|
|
if [[ $(CreoleGet eole_module non) != 'hapy-master' ]]
|
|
|
|
then
|
|
|
|
host=$(CreoleGet nom_machine)
|
|
|
|
manage_host ${host}
|
|
|
|
fi
|
2014-11-13 10:06:16 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Attaching Host to the Cluster
|
|
|
|
#
|
2018-04-09 10:23:41 +02:00
|
|
|
attach_host ${host} "${clst_name}"
|
2014-11-13 10:06:16 +01:00
|
|
|
|
2019-02-21 10:53:26 +01:00
|
|
|
#
|
|
|
|
# Force host synchronisation
|
|
|
|
#
|
|
|
|
sync_host
|
|
|
|
|
2014-11-13 10:06:16 +01:00
|
|
|
#
|
|
|
|
# Création des Datastores
|
|
|
|
#
|
2018-04-09 10:23:41 +02:00
|
|
|
manage_datastores "${clst_name}"
|
2019-02-22 14:02:50 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Dans le cas du mode HA, seul le leader fait l'init
|
|
|
|
#
|
|
|
|
if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then
|
|
|
|
init_ha
|
|
|
|
fi
|
2014-11-13 10:06:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|