X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fintegration-get-slave-addresses.sh;h=98cd3db7b34038a182f2222752aad9157730587d;hb=a6a5ff9147b21654d54e33685ac05ae9e53556b0;hp=d9c571b0f9d570e5c4a2c4628971262de0832618;hpb=ef213d033567d885f6a7f44bc223df511bedf03f;p=releng%2Fbuilder.git diff --git a/jjb/integration/integration-get-slave-addresses.sh b/jjb/integration/integration-get-slave-addresses.sh index d9c571b0f..98cd3db7b 100644 --- a/jjb/integration/integration-get-slave-addresses.sh +++ b/jjb/integration/integration-get-slave-addresses.sh @@ -1,4 +1,13 @@ -#!/bin/bash +#!/bin/bash -l + +# shellcheck disable=SC1090 +. ~/lf-env.sh + +lf-activate-venv --python python3 \ + python-heatclient \ + python-openstackclient \ + yq + # Get the Controller and Tools VM slave addresses set -x @@ -7,14 +16,8 @@ ODL_SYSTEM=() TOOLS_SYSTEM=() OPENSTACK_SYSTEM=() OPENSTACK_CONTROLLERS=() -[ "$NUM_OPENSTACK_SITES" ] || NUM_OPENSTACK_SITES=1 - -OPENSTACK_VENV="/tmp/v/openstack" -# shellcheck source=/tmp/v/openstack/bin/activate disable=SC1091 -source $OPENSTACK_VENV/bin/activate -ADDR=($(openstack stack show -f json -c outputs "$STACK_NAME" | \ - jq -r '.outputs[] | select(.output_key | match("^vm_[0-9]+_ips$")) | .output_value | .[]')) +mapfile -t ADDR <<< "$(openstack stack show -f json -c outputs "$STACK_NAME" | jq -r '.outputs[] | select(.output_key | match("^vm_[0-9]+_ips$")) | .output_value | .[]')" # The next two blocks of code will parse the list of vm IP's hostnames to determine which type of node # the vm is: odl, devstack controller or compute, ha_proxy or tools. For the odl node's the hsotname will contain @@ -32,9 +35,9 @@ ADDR=($(openstack stack show -f json -c outputs "$STACK_NAME" | \ for i in "${ADDR[@]}" do - REMHOST=$(ssh "${i}" hostname) + REMHOST=$(ssh "${i}" hostname -s) case ${REMHOST} in - *java*) + *builder*) ODL_SYSTEM=( "${ODL_SYSTEM[@]}" "${i}" ) ;; *devstack*) @@ -56,7 +59,7 @@ echo "NUM_TOOLS_SYSTEM=${#TOOLS_SYSTEM[@]}" >> slave_addresses.txt #if HA Proxy is requested the last devstack node will be configured as haproxy if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then # HA Proxy is installed on one OPENSTACK_SYSTEM VM on each site - NUM_OPENSTACK_SYSTEM=$(( ${#OPENSTACK_SYSTEM[@]} - NUM_OPENSTACK_SITES )) + NUM_OPENSTACK_SYSTEM=$(( ${#OPENSTACK_SYSTEM[@]} - 1 )) else NUM_OPENSTACK_SYSTEM=${#OPENSTACK_SYSTEM[@]} fi @@ -93,7 +96,7 @@ done openstack_index=0 # Assuming number of openstack control nodes equals number of openstack sites -NUM_OPENSTACK_CONTROL_NODES=$(( NUM_OPENSTACK_SITES )) +NUM_OPENSTACK_CONTROL_NODES=1 echo "NUM_OPENSTACK_CONTROL_NODES=${NUM_OPENSTACK_CONTROL_NODES}" >> slave_addresses.txt for i in $(seq 0 $((NUM_OPENSTACK_CONTROL_NODES - 1))) do @@ -103,6 +106,15 @@ done # The rest of the openstack nodes until NUM_OPENSTACK_SYSTEM are computes NUM_OPENSTACK_COMPUTE_NODES=$(( NUM_OPENSTACK_SYSTEM - NUM_OPENSTACK_CONTROL_NODES )) echo "NUM_OPENSTACK_COMPUTE_NODES=${NUM_OPENSTACK_COMPUTE_NODES}" >> slave_addresses.txt + +# Order the computes in the list so that the devstack-0 is index 1 and devstack-1 is index 2. Currently they are +# backwards because of the controller swap earlier. +if [ ${NUM_OPENSTACK_COMPUTE_NODES} -ge 2 ]; then + tmp_addr=${OPENSTACK_SYSTEM[1]} + OPENSTACK_SYSTEM[1]=${OPENSTACK_SYSTEM[2]} + OPENSTACK_SYSTEM[2]=${tmp_addr} +fi + for i in $(seq 0 $((NUM_OPENSTACK_COMPUTE_NODES - 1))) do echo "OPENSTACK_COMPUTE_NODE_$((i+1))_IP=${OPENSTACK_SYSTEM[$((openstack_index++))]}" >> slave_addresses.txt