+get_installer_ip() {
+ if [[ "$INSTALLER_TYPE" == "apex" ]] ; then
+ if [[ "$INSTALLER_IP" == "none" ]] ; then
+ instack_mac=$(sudo virsh domiflist instack | awk '/default/{print $5}')
+ INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk '{print $1}')
+ fi
+ elif [[ "$INSTALLER_TYPE" == "fuel" ]] ; then
+ if [[ "$INSTALLER_IP" == "none" ]] ; then
+ instack_mac=$(sudo virsh domiflist fuel-opnfv | awk '/pxebr/{print $5}')
+ INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk '{print $1}')
+ fi
+ fi
+
+ if [[ "$INSTALLER_TYPE" -ne "local" ]] ; then
+ if [[ -z "$INSTALLER_IP" ]] ; then
+ echo "ERROR: no installer ip"
+ exit 1
+ fi
+ fi
+}
+
+prepare_ssh_to_cloud() {
+ ssh_opts_cpu="$ssh_opts"
+
+ # get ssh key from installer node
+ if [[ "$INSTALLER_TYPE" == "apex" ]] ; then
+ sudo scp $ssh_opts root@"$INSTALLER_IP":/home/stack/.ssh/id_rsa instack_key
+ sudo chown $(whoami):$(whoami) instack_key
+ chmod 400 instack_key
+ ssh_opts_cpu+=" -i instack_key"
+ elif [[ "$INSTALLER_TYPE" == "fuel" ]] ; then
+ sshpass -p r00tme scp $ssh_opts root@${INSTALLER_IP}:.ssh/id_rsa instack_key
+ sudo chown $(whoami):$(whoami) instack_key
+ chmod 400 instack_key
+ ssh_opts_cpu+=" -i instack_key"
+ elif [[ "$INSTALLER_TYPE" == "local" ]] ; then
+ echo "INSTALLER_TYPE set to 'local'. Assuming SSH keys already exchanged with $COMPUTE_HOST"
+ fi
+}
+