diff options
author | Tomi Juvonen <tomi.juvonen@nokia.com> | 2016-08-22 14:12:08 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-08-22 14:12:08 +0000 |
commit | 5b6123f6782aa979e452cfe82a8c238f7475d391 (patch) | |
tree | e0b5d7192d2f2f04a9bd078a724f59a785f7a6ac /tests | |
parent | 2a8991b88b5f168b48b97e630f6ba158c9d747f0 (diff) | |
parent | 4cb2a317cfc3c189b733c6b8dd22ea388823a76f (diff) |
Merge "resolve controller cannot talk to consumer in fuel"
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/run.sh | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/tests/run.sh b/tests/run.sh index a972c35d..f425879a 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -205,8 +205,16 @@ get_compute_host_info() { } get_consumer_ip() { - CONSUMER_IP=$(sudo ssh $ssh_opts root@$INSTALLER_IP \ - "ip route get $COMPUTE_IP | awk '/ src /{print \$NF}'") + local get_consumer_command="ip route get $COMPUTE_IP | awk '/ src /{print \$NF}'" + if [[ "$INSTALLER_TYPE" == "apex" ]] ; then + CONSUMER_IP=$(sudo ssh $ssh_opts root@$INSTALLER_IP \ + "$get_consumer_command") + elif [[ "$INSTALLER_TYPE" == "fuel" ]] ; then + CONSUMER_IP=$(sudo sshpass -p r00tme ssh $ssh_opts root@${INSTALLER_IP} \ + "$get_consumer_command") + elif [[ "$INSTALLER_TYPE" == "local" ]] ; then + CONSUMER_IP=`$get_consumer_command` + fi echo "CONSUMER_IP=$CONSUMER_IP" if [[ -z "$CONSUMER_IP" ]]; then @@ -366,22 +374,28 @@ start_consumer() { # NOTE(r-mibu): create tunnel to the controller nodes, so that we can # avoid some network problems dpends on infra and installers. # This tunnel will be terminated by stop_consumer() or after 10 mins passed. - if [[ "$INSTALLER_TYPE" == "apex" ]] ; then - CONTROLLER_IPS=$(sudo ssh $ssh_opts $INSTALLER_IP \ - "source stackrc; \ - nova list | grep ' overcloud-controller-[0-9] ' \ - | sed -e 's/^.*ctlplane=//' -e 's/ *|\$//'") - fi - if [[ -z "$CONTROLLER_IPS" ]]; then - echo "ERROR: Could not get CONTROLLER_IPS." - exit 1 + if [[ "$INSTALLER_TYPE" != "local" ]] ; then + if [[ "$INSTALLER_TYPE" == "apex" ]] ; then + CONTROLLER_IPS=$(sudo ssh $ssh_opts $INSTALLER_IP \ + "source stackrc; \ + nova list | grep ' overcloud-controller-[0-9] ' \ + | sed -e 's/^.*ctlplane=//' -e 's/ *|\$//'") + elif [[ "$INSTALLER_TYPE" == "fuel" ]] ; then + CONTROLLER_IPS=$(sshpass -p r00tme ssh 2>/dev/null $ssh_opts root@${INSTALLER_IP} \ + "fuel node | grep controller | cut -d '|' -f 5|xargs") + fi + + if [[ -z "$CONTROLLER_IPS" ]]; then + echo "ERROR: Could not get CONTROLLER_IPS." + exit 1 + fi + for ip in $CONTROLLER_IPS + do + forward_rule="-R $CONSUMER_PORT:localhost:$CONSUMER_PORT" + tunnel_command="sudo ssh $ssh_opts_cpu $COMPUTE_USER@$ip $forward_rule sleep 600" + $tunnel_command > "ssh_tunnel.${ip}.log" 2>&1 < /dev/null & + done fi - for ip in $CONTROLLER_IPS - do - forward_rule="-R $CONSUMER_PORT:localhost:$CONSUMER_PORT" - tunnel_command="sudo ssh $ssh_opts_cpu $COMPUTE_USER@$ip $forward_rule sleep 600" - $tunnel_command > "ssh_tunnel.${ip}.log" 2>&1 < /dev/null & - done } stop_consumer() { @@ -390,13 +404,15 @@ stop_consumer() { print_log consumer.log # NOTE(r-mibu): terminate tunnels to the controller nodes - for ip in $CONTROLLER_IPS - do - forward_rule="-R $CONSUMER_PORT:localhost:$CONSUMER_PORT" - tunnel_command="sudo ssh $ssh_opts_cpu $COMPUTE_USER@$ip $forward_rule sleep 600" - kill $(pgrep -f "$tunnel_command") - print_log "ssh_tunnel.${ip}.log" - done + if [[ "$INSTALLER_TYPE" != "local" ]] ; then + for ip in $CONTROLLER_IPS + do + forward_rule="-R $CONSUMER_PORT:localhost:$CONSUMER_PORT" + tunnel_command="sudo ssh $ssh_opts_cpu $COMPUTE_USER@$ip $forward_rule sleep 600" + kill $(pgrep -f "$tunnel_command") + print_log "ssh_tunnel.${ip}.log" + done + fi } wait_for_vm_launch() { @@ -518,7 +534,8 @@ echo "get computer host info..." get_compute_host_info echo "creating alarm..." -get_consumer_ip +#TODO: change back to use, network problems depends on infra and installers +#get_consumer_ip create_alarm echo "starting doctor sample components..." |