1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

Monitor a randomized host every time

This commit is contained in:
Jaime Melis 2013-09-19 17:20:23 +02:00
parent 66a25715b0
commit 598535c03c
5 changed files with 19 additions and 7 deletions

View File

@ -51,7 +51,7 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
POOL_NAME="${XPATH_ELEMENTS[j++]:-$POOL_NAME}"
HOST=`get_destination_host $IMAGE_ID`
HOST=`get_destination_host`
if [ -z "$HOST" ]; then
error_message "Datastore template missing 'BRIDGE_LIST' attribute."

View File

@ -51,7 +51,7 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
HOST=`get_destination_host $IMAGE_ID`
HOST=`get_destination_host`
if [ -z "$HOST" ]; then
error_message "Datastore template missing 'BRIDGE_LIST' attribute."

View File

@ -211,7 +211,14 @@ function check_restricted {
# @return host to be used as bridge
#-------------------------------------------------------------------------------
function get_destination_host {
HOSTS_ARRAY=($BRIDGE_LIST)
ARRAY_INDEX=`expr $1 % ${#HOSTS_ARRAY[@]}`
echo ${HOSTS_ARRAY[$ARRAY_INDEX]}
HOSTS_ARRAY=($BRIDGE_LIST)
N_HOSTS=${#HOSTS_ARRAY[@]}
if [ -n "$1" ]; then
ARRAY_INDEX=$(($1 % ${N_HOSTS}))
else
ARRAY_INDEX=$((RANDOM % ${N_HOSTS}))
fi
echo ${HOSTS_ARRAY[$ARRAY_INDEX]}
}

View File

@ -51,7 +51,7 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
HOST=`get_destination_host $IMAGE_ID`
HOST=`get_destination_host`
if [ -z "$HOST" ]; then
error_message "Datastore template missing 'BRIDGE_LIST' attribute."

View File

@ -50,7 +50,12 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
BASE_PATH="${XPATH_ELEMENTS[0]}"
BRIDGE_LIST="${XPATH_ELEMENTS[1]}"
HOST=`get_destination_host $ID`
HOST=`get_destination_host`
if [ -z "$HOST" ]; then
error_message "Datastore template missing 'BRIDGE_LIST' attribute."
exit -1
fi
# ------------ Compute datastore usage -------------