Skip to content
Snippets Groups Projects
Commit 02327b1c authored by Mark Goddard's avatar Mark Goddard
Browse files

CI: Test SSH connectivity to deployed instances

Add testing of the dataplane to the overcloud jobs. To support both
baremetal provisioning and VMs with VXLAN tenant networks, we use the
provision-net as our external network to which floating IPs are
attached.

We depend on a backport of parts of this patch to allow testing of SSH
connectivity after upgrades.

Depends-On: https://review.opendev.org/708915/
Depends-On: https://review.opendev.org/709145/

Change-Id: I6316e8959cff987e4e97280889e1038a9537ed32
parent 3de40b57
No related branches found
No related tags found
No related merge requests found
...@@ -377,6 +377,11 @@ function overcloud_test_init { ...@@ -377,6 +377,11 @@ function overcloud_test_init {
export ENABLE_EXT_NET=0 export ENABLE_EXT_NET=0
${KOLLA_VENV_PATH:-$HOME/kolla-venv}/share/kolla-ansible/init-runonce ${KOLLA_VENV_PATH:-$HOME/kolla-venv}/share/kolla-ansible/init-runonce
unset ENABLE_EXT_NET unset ENABLE_EXT_NET
# Allow provision-net to be used as an external network for floating IPs.
# Note: a provisioning network would not normally be external.
openstack network set provision-net --external
openstack router set demo-router --external-gateway provision-net
else else
echo "Not running kolla-ansible init-runonce - resources exist" echo "Not running kolla-ansible init-runonce - resources exist"
fi fi
...@@ -406,7 +411,35 @@ function overcloud_test { ...@@ -406,7 +411,35 @@ function overcloud_test {
echo "$name: Node creation failed" echo "$name: Node creation failed"
return 1 return 1
fi fi
# TODO(mgoddard): Test SSH connectivity to the VM.
# Test SSH connectivity. For servers attached directly to the external
# network, use the fixed IP. Otherwise add a floating IP.
if [[ $network = provision-net ]]; then
ip=$(openstack server show "$name" -f value -c addresses | sed -e "s/${network}=//")
else
echo "$name: Attaching floating IP"
ip=$(openstack floating ip create provision-net -f value -c floating_ip_address)
openstack server add floating ip ${name} ${ip}
fi
echo "$name: Waiting for ping and SSH access via ${ip}"
attempts=6
for i in $(seq 1 $attempts); do
if ping -c1 -W1 $ip && ssh -v -o StrictHostKeyChecking=no -o BatchMode=yes cirros@$ip hostname; then
break
elif [[ $i -eq $attempts ]]; then
echo "Failed to access server $name via SSH after $attempts attempts"
return 1
else
echo "Cannot access server $name - retrying"
fi
sleep 10
done
echo "$name: Ping and SSH successful"
if [[ $network != provision-net ]]; then
echo "$name: Removing floating IP"
openstack server remove floating ip ${name} ${ip}
openstack floating ip delete ${ip}
fi
echo "$name: Deleting the Node" echo "$name: Deleting the Node"
openstack server delete --wait "$name" openstack server delete --wait "$name"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment