fix login to controller nodes
[doctor.git] / tests / run.sh
index 42600da..477d9c2 100755 (executable)
@@ -215,8 +215,10 @@ start_consumer() {
     # 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=$(nova list | grep ' overcloud-controller-[0-9] ' \
-                         | sed -e 's/^.*ctlplane=//' -e 's/ *|$//')
+        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."
@@ -225,7 +227,7 @@ start_consumer() {
     for ip in $CONTROLLER_IPS
     do
         forward_rule="-R $CONSUMER_PORT:localhost:$CONSUMER_PORT"
-        tunnel_command="sudo ssh $ssh_opts $ip $forward_rule sleep 600"
+        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
 }
@@ -239,7 +241,7 @@ stop_consumer() {
     for ip in $CONTROLLER_IPS
     do
         forward_rule="-R $CONSUMER_PORT:localhost:$CONSUMER_PORT"
-        tunnel_command="sudo ssh $ssh_opts $ip $forward_rule sleep 600"
+        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