Merge branch 'feature/manage-default-cluster-name'

This commit is contained in:
Daniel Dehennin 2018-04-09 11:05:31 +02:00
commit f76d98d7c3
4 changed files with 38 additions and 49 deletions

View File

@ -27,6 +27,9 @@
</variable> </variable>
</family> </family>
<family name='Virtualisation' icon='cloud'> <family name='Virtualisation' icon='cloud'>
<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 utilisé pour le réseau virtuel' hidden='True' /> <variable name='vnet_pilote' type='string' description='Pilote utilisé pour le réseau virtuel' hidden='True' />
<variable name='vnets' type='string' description="Nom du réseau virtuel à plage d'adresse IP" multi='True'/> <variable name='vnets' type='string' description="Nom du réseau virtuel à plage d'adresse IP" multi='True'/>
<variable name='vnet_range_start' type='ip' description='Première IP de la plage' mandatory="True"/> <variable name='vnet_range_start' type='ip' description='Première IP de la plage' mandatory="True"/>

View File

@ -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}
# Wait 4 seconds for service (ref #16848) # Wait 4 seconds for service (ref #16848)
sleep 4 sleep 4
@ -457,12 +447,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

View File

@ -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')

View File

@ -34,9 +34,7 @@ EOF
# #
function register_node() function register_node()
{ {
# ref https://dev-eole.ac-dijon.fr/issues/16797 cmd="onehost create -i kvm -v kvm -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 -c \"default\" ${1}"
ret=$(su - ${ONEUSER} -c -- "${cmd}") ret=$(su - ${ONEUSER} -c -- "${cmd}")
return $? return $?
} }