From e53af3f07c5706def49b0bdc6012c9a9061a34c7 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Sat, 22 Nov 2014 15:01:24 -0800 Subject: [PATCH] Set up ssh_known_host based on hostname Tempest live migration tests use hostnames and resize uses IP addresses, so set up ssh_known_hosts for both. Change-Id: Ia647275fa064335277942ef6ac95e2d4ada87a09 --- devstack-vm-gate.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/devstack-vm-gate.sh b/devstack-vm-gate.sh index 31c46b8e..57403a20 100755 --- a/devstack-vm-gate.sh +++ b/devstack-vm-gate.sh @@ -504,15 +504,20 @@ EOF if [[ "$DEVSTACK_GATE_TOPOLOGY" != "aio" ]]; then echo "Preparing cross node connectivity" - # set up ssh_known_host files and /etc/hosts + # set up ssh_known_hosts by IP and /etc/hosts for NODE in `cat /etc/nodepool/sub_nodes_private`; do ssh-keyscan $NODE | sudo tee --append tmp_ssh_known_hosts > /dev/null - echo $NODE `remote_command $NODE hostname -f` | sudo tee --append tmp_hosts > /dev/null + echo $NODE `remote_command $NODE hostname -f | tr -d '\r'` | sudo tee --append tmp_hosts > /dev/null done ssh-keyscan `cat /etc/nodepool/primary_node_private` | sudo tee --append tmp_ssh_known_hosts > /dev/null echo `cat /etc/nodepool/primary_node_private` `hostname -f` | sudo tee --append tmp_hosts > /dev/null + cat tmp_hosts | sudo tee --append /etc/hosts + + # set up ssh_known_host files based on hostname + for HOSTNAME in `cat tmp_hosts | cut -d' ' -f2`; do + ssh-keyscan $HOSTNAME | sudo tee --append tmp_ssh_known_hosts > /dev/null + done sudo cp tmp_ssh_known_hosts /etc/ssh/ssh_known_hosts - cat tmp_hosts | sudo tee --append /etc/hosts > /dev/null sudo chmod 444 /etc/ssh/ssh_known_hosts for NODE in `cat /etc/nodepool/sub_nodes_private`; do