init ha
This commit is contained in:
parent
09389489f2
commit
5eeb4d6832
|
@ -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="one_vip">
|
||||||
|
<param type='eole'>adresse_ip_eth0</param>
|
||||||
|
</check>
|
||||||
|
<check name="valid_differ" target="one_vip">
|
||||||
|
<param type='eole'>adresse_ip_gw</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>
|
||||||
|
|
|
@ -427,9 +427,40 @@ 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)
|
||||||
|
|
|
@ -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