Merge "CI: display VM console log on ping or SSH failure"

This commit is contained in:
Zuul 2021-03-10 14:08:25 +00:00 committed by Gerrit Code Review
commit 3d7f15faa9

View File

@ -517,12 +517,14 @@ function overcloud_test {
openstack server add floating ip ${name} ${ip} openstack server add floating ip ${name} ${ip}
fi fi
echo "$name: Waiting for ping and SSH access via ${ip}" echo "$name: Waiting for ping and SSH access via ${ip}"
attempts=6 attempts=12
for i in $(seq 1 $attempts); do for i in $(seq 1 $attempts); do
if ping -c1 -W1 $ip && ssh -v -o StrictHostKeyChecking=no -o BatchMode=yes cirros@$ip hostname; then if ping -c1 -W1 $ip && ssh -v -o StrictHostKeyChecking=no -o BatchMode=yes cirros@$ip hostname; then
break break
elif [[ $i -eq $attempts ]]; then elif [[ $i -eq $attempts ]]; then
echo "Failed to access server $name via SSH after $attempts attempts" echo "Failed to access server $name via SSH after $attempts attempts"
echo "Console log:"
openstack console log show ${name}
return 1 return 1
else else
echo "Cannot access server $name - retrying" echo "Cannot access server $name - retrying"