Wait for ipv6 addrs when launching nodes

When launching new nodes with launch-node.py we need to wait for ipv6
addresses to configure prior to running ping6 sanity checks. The reason
for this is some clouds rely on router advertisements to configure ipv6
addrs on VMs. These happen periodically and the VM may not have its ipv6
address configured yet when we try to ping6 otherwise.

Change-Id: I77515fec481e4146765630cd230dd3c2c296958f
This commit is contained in:
Clark Boylan 2020-09-04 14:25:59 -07:00
parent cd4d940f64
commit 2f9b31a93f
1 changed files with 8 additions and 0 deletions

View File

@ -126,6 +126,14 @@ def bootstrap_server(server, key, name, volume_device, keep,
ssh_client.ssh('(ifdown eth0 && ifup eth0) || true')
if server.public_v6:
# The server may be waiting on Router Advertisements to configure
# this address. Wait for that to complete before pinging.
ssh_client.ssh("bash -c 'count=0 ; "
"while ! ip addr | grep -q %s && [\"$count\" -le 60 ] ; do "
" count=$((count + 1)) ; "
" echo \"Waiting for IPv6 address to configure\" ; "
" sleep 1 ; "
"done'" % server.public_v6)
ssh_client.ssh('ping6 -c5 -Q 0x10 review.openstack.org '
'|| ping6 -c5 -Q 0x10 wiki.openstack.org')