Skip to content

Commit

Permalink
Merge pull request #54 from cloudscale-ch/denis/two-ping-probes
Browse files Browse the repository at this point in the history
Send two ICMPv6 probes, each time we start a server
  • Loading branch information
href authored Sep 30, 2024
2 parents 67ce41d + b333d52 commit 5f998c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,17 @@ def create_host(self, timeout):
# address. A DNS lookup is used for it, to not hard-code the
# address. The DNS lookup is usually done via IPv4 on the host.
ipv6_address = self.resolve('api.cloudscale.ch', version=6)[0]
self.ping(ipv6_address, tries=10, wait=2)

try:
self.ping(ipv6_address, tries=1, wait=1)
except AssertionError:

# In the vast majority of cases, the ping probe works on the
# first attempt. If it does not, we have to wait for up to 16s
# for the neighbor cache on the switches to expire.
time.sleep(16)

self.ping(ipv6_address, tries=1, wait=1)

@with_trigger('server.wait-for-cloud-init')
def wait_for_cloud_init(self, host, timeout):
Expand Down

0 comments on commit 5f998c7

Please sign in to comment.