The default cluster can be renamed
* dicos/29_one-master.xml: “one_cluster_name” store the name of the default cluster. * postservice/30-one-mng: take care of the customizable cluster name. * postservice/31-one-netmng: ditoo. * scripts/onehost_create_all: ditoo. Ref: #23553
This commit is contained in:
parent
1a911bd9fc
commit
939f1b7591
|
@ -23,6 +23,9 @@
|
||||||
<variable name='activer_onesinglenode' type='oui/non' description="Activer le serveur de virtualisation" mode='expert'>
|
<variable name='activer_onesinglenode' type='oui/non' description="Activer le serveur de virtualisation" mode='expert'>
|
||||||
<value>oui</value>
|
<value>oui</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
<variable name='one_cluster_name' type='string' description="Nom de la grappe OpenNebula par défaut" mode='expert'>
|
||||||
|
<value>default</value>
|
||||||
|
</variable>
|
||||||
<variable name='vnet_pilote' type='string' description='Pilote réseau' hidden='True' />
|
<variable name='vnet_pilote' type='string' description='Pilote réseau' hidden='True' />
|
||||||
<variable name='vnets' type='string' description='Réseaux virtuels Niveau 3' multi='True'/>
|
<variable name='vnets' type='string' description='Réseaux virtuels Niveau 3' multi='True'/>
|
||||||
<variable name='vnet_network_addr' type='ip' description='Adresse du réseau'/>
|
<variable name='vnet_network_addr' type='ip' description='Adresse du réseau'/>
|
||||||
|
|
|
@ -21,44 +21,35 @@ function get_one_auth()
|
||||||
${CMD} ${FILE}
|
${CMD} ${FILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
function check_default_cluster()
|
||||||
#function check_cluster()
|
{
|
||||||
#{
|
name="${1}"
|
||||||
# name="${1}"
|
cmd="onecluster show 0"
|
||||||
# cmd="onecluster"
|
auth=$(get_one_auth)
|
||||||
# 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}
|
|
||||||
#}
|
|
||||||
|
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
DEFAULT_NAME=$(${cmd} --user ${auth%:*} --password ${auth#*:} | awk '/^NAME/ {print $3}')
|
||||||
#function manage_cluster()
|
[[ "${name}" = "${DEFAULT_NAME}" ]]
|
||||||
#{
|
}
|
||||||
# NAME="${1}"
|
|
||||||
# CMD="onecluster create"
|
function rename_default_cluster()
|
||||||
# AUTH=$(get_one_auth)
|
{
|
||||||
#
|
NAME="${1}"
|
||||||
# check_cluster ${clst_name}
|
CMD="onecluster rename 0 ${NAME}"
|
||||||
# if [[ ${?} -eq 0 ]]
|
AUTH=$(get_one_auth)
|
||||||
# then
|
|
||||||
# crt=$(${CMD} --user ${AUTH%:*} --password ${AUTH#*:} ${NAME})
|
if ! check_default_cluster "${NAME}"
|
||||||
# if [[ ${?} -ne 0 ]]
|
then
|
||||||
# then
|
|
||||||
# error "Cluster create failed"
|
if ${CMD} --user ${AUTH%:*} --password ${AUTH#*:}
|
||||||
# else
|
then
|
||||||
# echo "Cluster ${NAME} created"
|
echo "The default cluster name is now '${NAME}'"
|
||||||
# fi
|
else
|
||||||
# else
|
error "The default cluster can not be renamed"
|
||||||
# echo "Cluster \"${NAME}\" already exist"
|
fi
|
||||||
# fi
|
else
|
||||||
#}
|
echo "The default cluster name is already \"${NAME}\""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function check_host()
|
function check_host()
|
||||||
{
|
{
|
||||||
|
@ -437,10 +428,9 @@ function manage_datastores()
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
#
|
#
|
||||||
# Creating Cluster
|
# Rename default cluster
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
clst_name=$(CreoleGet one_cluster_name)
|
||||||
#clst_name=$(CreoleGet one_cluster_name)
|
rename_default_cluster "${clst_name}"
|
||||||
#manage_cluster ${clst_name}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Creating Host
|
# Creating Host
|
||||||
|
@ -454,12 +444,12 @@ function main()
|
||||||
#
|
#
|
||||||
# Attaching Host to the Cluster
|
# Attaching Host to the Cluster
|
||||||
#
|
#
|
||||||
attach_host ${host} "default"
|
attach_host ${host} "${clst_name}"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Création des Datastores
|
# Création des Datastores
|
||||||
#
|
#
|
||||||
manage_datastores ${clst_name}
|
manage_datastores "${clst_name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
|
@ -289,9 +289,7 @@ def main():
|
||||||
client = CreoleClient()
|
client = CreoleClient()
|
||||||
one_client = OneClient('oneadmin')
|
one_client = OneClient('oneadmin')
|
||||||
networks = []
|
networks = []
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
cluster = client.get_creole('one_cluster_name')
|
||||||
# cluster = client.get_creole('one_cluster_name')
|
|
||||||
cluster = "default"
|
|
||||||
swname = client.get_creole('ovs_sw_name')
|
swname = client.get_creole('ovs_sw_name')
|
||||||
zones = client.get_creole('vnets')
|
zones = client.get_creole('vnets')
|
||||||
vlans = client.get_creole('vnet_vlan_tag')
|
vlans = client.get_creole('vnet_vlan_tag')
|
||||||
|
|
|
@ -24,9 +24,7 @@ function copy_ssh_id()
|
||||||
#
|
#
|
||||||
function register_node()
|
function register_node()
|
||||||
{
|
{
|
||||||
# ref https://dev-eole.ac-dijon.fr/issues/16797
|
cmd="onehost create -i kvm -v kvm -n ovswitch -c 0 ${1}"
|
||||||
#cmd="onehost create -i kvm -v kvm -n ovswitch -c \"$(CreoleGet one_cluster_name)\" ${1}"
|
|
||||||
cmd="onehost create -i kvm -v kvm -n ovswitch -c \"default\" ${1}"
|
|
||||||
ret=$(su - ${ONEUSER} -c -- "${cmd}")
|
ret=$(su - ${ONEUSER} -c -- "${cmd}")
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue