Merge branch 'develop' into dist/eole/2.7.0/develop
This commit is contained in:
commit
fc7b2409b8
|
@ -59,7 +59,7 @@
|
||||||
<variable name="one_database_user" description="Utilisateur pour se connecter à la base de données" type="string" mandatory="True">
|
<variable name="one_database_user" description="Utilisateur pour se connecter à la base de données" type="string" mandatory="True">
|
||||||
<value>one</value>
|
<value>one</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="one_database_pass" description="Mot de passe pour se connecter à la base de données" type="string" mandatory="True"/>
|
<variable name="one_database_pass" description="Mot de passe pour se connecter à la base de données" type="password" mandatory="True"/>
|
||||||
|
|
||||||
<!-- VNETS -->
|
<!-- VNETS -->
|
||||||
<variable name='vnet_pilote' type='string' description='Pilote utilisé pour le réseau virtuel' hidden='True' />
|
<variable name='vnet_pilote' type='string' description='Pilote utilisé pour le réseau virtuel' hidden='True' />
|
||||||
|
|
|
@ -10,9 +10,10 @@
|
||||||
</family>
|
</family>
|
||||||
<family name='Haute disponibilité' icon='cloud'>
|
<family name='Haute disponibilité' icon='cloud'>
|
||||||
<variable name="one_ha_role" description="Rôle initial dans la grappe OpenNebula" type="string" mandatory="True"/>
|
<variable name="one_ha_role" description="Rôle initial dans la grappe OpenNebula" type="string" mandatory="True"/>
|
||||||
<variable name="one_host_id" description="Identififiant unique de l'hôte dans la grappe" type="number" mandatory="True"/>
|
<variable name="one_server_index" description="Index du serveur dans la liste des orchestrateurs follower" type="number" mandatory="True"/>
|
||||||
|
<variable name='one_followers_domain' description='Nom de domaine des orchestrateurs follower' multi="True" type="domain_strict" mandatory="True" auto_freeze="True"/>
|
||||||
<variable name="one_vip" description="Adresse IP de la VIP OpenNebula" type="ip" mandatory="True"/>
|
<variable name="one_vip" description="Adresse IP de la VIP OpenNebula" type="ip" mandatory="True"/>
|
||||||
<variable name="one_vip_mask" description="Masque de sous-réseau de la VIP OpenNebula (format CIDR)" type="number" mandatory="True"/>
|
<variable name="one_vip_mask" description="Masque de sous-réseau de la VIP OpenNebula" type="netmask" mandatory="True"/>
|
||||||
</family>
|
</family>
|
||||||
<separators>
|
<separators>
|
||||||
<separator name='one_ha_role'>Rôle du nœud de virtualisation</separator>
|
<separator name='one_ha_role'>Rôle du nœud de virtualisation</separator>
|
||||||
|
@ -29,14 +30,41 @@
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<target type='family'>Haute disponibilité</target>
|
<target type='family'>Haute disponibilité</target>
|
||||||
</condition>
|
</condition>
|
||||||
|
<condition name='disabled_if_in' source='one_ha_role'>
|
||||||
|
<param>follower</param>
|
||||||
|
<target type='variable'>one_followers_domain</target>
|
||||||
|
<target type='variable'>one_vip</target>
|
||||||
|
<target type='variable'>one_vip_mask</target>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition name='frozen_if_in' source='one_ha_role'>
|
||||||
|
<param>leader</param>
|
||||||
|
<target type='variable'>one_server_index</target>
|
||||||
|
</condition>
|
||||||
|
<auto name='calc_multi_condition' target='one_server_index'>
|
||||||
|
<param>leader</param>
|
||||||
|
<param type='eole' name='condition_1'>one_ha_role</param>
|
||||||
|
<param name='match' type='number'>0</param>
|
||||||
|
<param name='default_mismatch'>None</param>
|
||||||
|
</auto>
|
||||||
|
<fill name='calc_val' target='one_vip_mask'>
|
||||||
|
<param type='eole' name='valeur'>adresse_netmask_eth0</param>
|
||||||
|
</fill>
|
||||||
|
<check name="valid_differ" target="adresse_ip_eth0">
|
||||||
|
<param type='eole' hidden='False'>one_vip</param>
|
||||||
|
</check>
|
||||||
|
<check name="valid_differ" target="adresse_ip_gw">
|
||||||
|
<param type='eole' hidden='False'>one_vip</param>
|
||||||
|
</check>
|
||||||
|
<check name="valid_ipnetmask" target="one_vip_mask" level="warning">
|
||||||
|
<param type='eole'>one_vip</param>
|
||||||
|
</check>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help>
|
<help>
|
||||||
<variable name='enable_one_ha'>Active la possibilité d'intégrer Hâpy dans une grappe de haute disponibilité OpenNebula</variable>
|
<variable name='enable_one_ha'>Active la possibilité d'intégrer Hâpy dans une grappe de haute disponibilité OpenNebula</variable>
|
||||||
<family name='Haute disponibilité'>Configuration du comportement du noeud dans la grappe</family>
|
<family name='Haute disponibilité'>Configuration du comportement du noeud dans la grappe</family>
|
||||||
<variable name="one_ha_role">Rôle initial du noeud dans la grappe, permet de déterminer comment le serveur commence sa vie dans la grappe</variable>
|
<variable name="one_ha_role">Rôle initial du noeud dans la grappe, permet de déterminer comment le serveur commence sa vie dans la grappe</variable>
|
||||||
<variable name="one_host_id">Identifiant unique du serveur dans la grappe, cet identifiant est un entier (0,1,2,3...)</variable>
|
|
||||||
<variable name="one_vip">Adresse IP virtuelle (VIP) utilisée pour joindre le "Leader" de la grappe, les clients utiliseront cette IP pour contacter la grappe</variable>
|
<variable name="one_vip">Adresse IP virtuelle (VIP) utilisée pour joindre le "Leader" de la grappe, les clients utiliseront cette IP pour contacter la grappe</variable>
|
||||||
<variable name="one_vip_mask">Masque de sous réseau du réseau de la VIP au format CIDR (ex: 24 pour 255.255.255.0)</variable>
|
<variable name="one_vip_mask">Masque de sous réseau du réseau de la VIP au format CIDR (ex: 24 pour 255.255.255.0)</variable>
|
||||||
</help>
|
</help>
|
||||||
|
|
|
@ -185,9 +185,9 @@ function attach_host()
|
||||||
{
|
{
|
||||||
HOST=${1}
|
HOST=${1}
|
||||||
CLST=${2}
|
CLST=${2}
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#CLST_ID=$(get_cluster_id_by_name ${CLST})
|
#CLST_ID=$(get_cluster_id_by_name ${CLST})
|
||||||
CLST_ID=0
|
CLST_ID=0
|
||||||
HST_ID=$(get_host_id_by_name ${HOST})
|
HST_ID=$(get_host_id_by_name ${HOST})
|
||||||
AUTH=$(get_one_auth)
|
AUTH=$(get_one_auth)
|
||||||
CMD="onecluster"
|
CMD="onecluster"
|
||||||
|
@ -249,7 +249,7 @@ function create_datastore()
|
||||||
{
|
{
|
||||||
ds_type="${1}"
|
ds_type="${1}"
|
||||||
ds_name="${2}"
|
ds_name="${2}"
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#ds_cluster="${3}"
|
#ds_cluster="${3}"
|
||||||
|
|
||||||
if [[ $(CreoleGet activer_multinode 2>&1) == 'oui' ]]
|
if [[ $(CreoleGet activer_multinode 2>&1) == 'oui' ]]
|
||||||
|
@ -300,7 +300,7 @@ __EOF__
|
||||||
RUN=$(${cmd} ${opt})
|
RUN=$(${cmd} ${opt})
|
||||||
if [[ ${?} -eq 0 ]]
|
if [[ ${?} -eq 0 ]]
|
||||||
then
|
then
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#attach_ds_to_cluster ${ds_name} ${ds_cluster}
|
#attach_ds_to_cluster ${ds_name} ${ds_cluster}
|
||||||
rm ${TMPL_FILE}
|
rm ${TMPL_FILE}
|
||||||
return 0
|
return 0
|
||||||
|
@ -384,11 +384,11 @@ __EOF__
|
||||||
|
|
||||||
function manage_datastores()
|
function manage_datastores()
|
||||||
{
|
{
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#cluster=${1}
|
#cluster=${1}
|
||||||
AUTH=$(get_one_auth)
|
AUTH=$(get_one_auth)
|
||||||
|
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#SYSTEM_DS="$(CreoleGet 'one_ds_system_prefix')${cluster}"
|
#SYSTEM_DS="$(CreoleGet 'one_ds_system_prefix')${cluster}"
|
||||||
SYSTEM_DS="$(CreoleGet 'one_ds_system_prefix')default"
|
SYSTEM_DS="$(CreoleGet 'one_ds_system_prefix')default"
|
||||||
ISO_DS=$(CreoleGet 'one_ds_iso_name')
|
ISO_DS=$(CreoleGet 'one_ds_iso_name')
|
||||||
|
@ -398,7 +398,7 @@ function manage_datastores()
|
||||||
sid=$(get_ds_id_by_name ${SYSTEM_DS})
|
sid=$(get_ds_id_by_name ${SYSTEM_DS})
|
||||||
if [[ ${sid} = "ERR" ]]
|
if [[ ${sid} = "ERR" ]]
|
||||||
then
|
then
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#create_datastore "SYSTEM" "${SYSTEM_DS}" "${cluster}"
|
#create_datastore "SYSTEM" "${SYSTEM_DS}" "${cluster}"
|
||||||
create_datastore "SYSTEM" "${SYSTEM_DS}"
|
create_datastore "SYSTEM" "${SYSTEM_DS}"
|
||||||
else
|
else
|
||||||
|
@ -408,7 +408,7 @@ function manage_datastores()
|
||||||
imgid=$(get_ds_id_by_name ${IMAGE_DS})
|
imgid=$(get_ds_id_by_name ${IMAGE_DS})
|
||||||
if [[ ${imgid} = "ERR" ]]
|
if [[ ${imgid} = "ERR" ]]
|
||||||
then
|
then
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#create_datastore "IMAGE" "${IMAGE_DS}" "${cluster}"
|
#create_datastore "IMAGE" "${IMAGE_DS}" "${cluster}"
|
||||||
create_datastore "IMAGE" "${IMAGE_DS}"
|
create_datastore "IMAGE" "${IMAGE_DS}"
|
||||||
else
|
else
|
||||||
|
@ -418,7 +418,7 @@ function manage_datastores()
|
||||||
isoid=$(get_ds_id_by_name ${ISO_DS})
|
isoid=$(get_ds_id_by_name ${ISO_DS})
|
||||||
if [[ ${isoid} = "ERR" ]]
|
if [[ ${isoid} = "ERR" ]]
|
||||||
then
|
then
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
||||||
#create_datastore "ISO" "${ISO_DS}" "${cluster}"
|
#create_datastore "ISO" "${ISO_DS}" "${cluster}"
|
||||||
create_datastore "ISO" "${ISO_DS}"
|
create_datastore "ISO" "${ISO_DS}"
|
||||||
else
|
else
|
||||||
|
@ -427,25 +427,56 @@ function manage_datastores()
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function init_ha() {
|
||||||
|
onezone show 0 | grep -A 2 ^"HA & FEDERATION SYNC STATUS" | tail -n 1 | grep -q ^" 0 "
|
||||||
|
if [ ! $? = 0 ]; then
|
||||||
|
# server 0 not displayed with onezone
|
||||||
|
SERVER=$(CreoleGet one_master)
|
||||||
|
DOMAIN=$(CreoleGet nom_domaine_machine)
|
||||||
|
FOLLOWER=$(CreoleGet one_follower_servername)
|
||||||
|
onezone server-add 0 --name $SERVER --rpc http://$DOMAIN:2633/RPC2
|
||||||
|
for $follower in $FOLLOWER; do
|
||||||
|
onezone server-add 0 --name $follower --rpc http://$follower:2633/RPC2
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function to_mysql() {
|
||||||
|
if [ $(CreoleGet one_database_type) = "mysql" && $(CreoleGet one_ha_role leader) = "leader" ]; then
|
||||||
|
# do not recover db on follower
|
||||||
|
HOST=$(CreoleGet one_database_host)
|
||||||
|
DB=$(CreoleGet one_database_name)
|
||||||
|
USER=$(CreoleGet one_database_user)
|
||||||
|
PASS=$(CreoleGet one_database_pass)
|
||||||
|
onedb sqlite2mysql -s /var/lib/one/one.db -u $USER -p $PASS -d $DB -S $HOST
|
||||||
|
systemctl stop opennebula.service
|
||||||
|
systemctl start opennebula.service
|
||||||
|
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 one_ha_role) = "leader" ]; then
|
||||||
|
init_ha
|
||||||
|
fi
|
||||||
|
to_mysql
|
||||||
#
|
#
|
||||||
# Rename default cluster
|
# Rename default cluster
|
||||||
clst_name=$(CreoleGet one_cluster_name)
|
clst_name=$(CreoleGet one_cluster_name)
|
||||||
rename_default_cluster "${clst_name}"
|
rename_default_cluster "${clst_name}"
|
||||||
|
|
||||||
# Wait 4 seconds for service (ref #16848)
|
# Wait 4 seconds for service (ref #16848)
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
#
|
#
|
||||||
# Creating Host
|
# Creating Host
|
||||||
#
|
#
|
||||||
if [[ $(CreoleGet eole_module non) != 'hapy-master' ]]
|
if [[ $(CreoleGet eole_module non) != 'hapy-master' ]]
|
||||||
then
|
then
|
||||||
host=$(CreoleGet nom_machine)
|
host=$(CreoleGet nom_machine)
|
||||||
manage_host ${host}
|
manage_host ${host}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Attaching Host to the Cluster
|
# Attaching Host to the Cluster
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
SERVER=$(CreoleGet one_master)
|
|
||||||
IP=$(CreoleGet adresse_ip_eth0)
|
|
||||||
if [ $(CreoleGet one_database_type) = "mysql" && $(CreoleGet one_ha_role) = "leader" ]; then
|
|
||||||
HOST=$(CreoleGet one_database_host)
|
|
||||||
DB=$(CreoleGet one_database_name)
|
|
||||||
USER=$(CreoleGet one_database_user)
|
|
||||||
PASS=$(CreoleGet one_database_pass)
|
|
||||||
onedb sqlite2mysql -s /var/lib/one/one.db -u $USER -p $PASS -d $DB -S $HOST
|
|
||||||
systemctl stop opennebula
|
|
||||||
systemctl start opennebula
|
|
||||||
fi
|
|
||||||
onezone server-add 0 --name $SERVER --rpc http://$IP:2633/RPC2
|
|
|
@ -153,7 +153,11 @@ VNC_PORTS = [
|
||||||
FEDERATION = [
|
FEDERATION = [
|
||||||
MODE = "STANDALONE",
|
MODE = "STANDALONE",
|
||||||
ZONE_ID = 0,
|
ZONE_ID = 0,
|
||||||
|
%if %%enable_one_ha == 'oui'
|
||||||
|
SERVER_ID = %%one_server_index,
|
||||||
|
%else
|
||||||
SERVER_ID = -1,
|
SERVER_ID = -1,
|
||||||
|
%end if
|
||||||
MASTER_ONED = ""
|
MASTER_ONED = ""
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -166,17 +170,19 @@ RAFT = [
|
||||||
XMLRPC_TIMEOUT_MS = 450
|
XMLRPC_TIMEOUT_MS = 450
|
||||||
]
|
]
|
||||||
|
|
||||||
|
%if %%enable_one_ha == 'oui' and one_ha_role == 'leader'
|
||||||
# Executed when a server transits from follower->leader
|
# Executed when a server transits from follower->leader
|
||||||
# RAFT_LEADER_HOOK = [
|
RAFT_LEADER_HOOK = [
|
||||||
# COMMAND = "raft/vip.sh",
|
COMMAND = "raft/vip.sh",
|
||||||
# ARGUMENTS = "leader <interface> <ip_cidr>"
|
ARGUMENTS = "leader %%nom_zone_eth0 %%one_vip/%%calc_classe(%%one_vip_mask)"
|
||||||
# ]
|
]
|
||||||
|
|
||||||
# Executed when a server transits from leader->follower
|
# Executed when a server transits from leader->follower
|
||||||
# RAFT_FOLLOWER_HOOK = [
|
RAFT_FOLLOWER_HOOK = [
|
||||||
# COMMAND = "raft/vip.sh",
|
COMMAND = "raft/vip.sh",
|
||||||
# ARGUMENTS = "follower <interface> <ip_cidr>"
|
ARGUMENTS = "follower %%nom_zone_eth0 %%one_vip/%%calc_classe(%%one_vip_mask)"
|
||||||
# ]
|
]
|
||||||
|
%end if
|
||||||
|
|
||||||
#*******************************************************************************
|
#*******************************************************************************
|
||||||
# Default showback cost
|
# Default showback cost
|
||||||
|
|
Loading…
Reference in New Issue