]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler: Change method used to ping Cobbler host in rc.local 388/head
authorDavid Galloway <dgallowa@redhat.com>
Tue, 20 Mar 2018 15:22:53 +0000 (11:22 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 20 Mar 2018 15:22:53 +0000 (11:22 -0400)
I've observed a *very* occasional race condition where dhclient
completes but the host can't ping Cobbler.  Instead of timing out
waiting for one ping packet to return, we'll try pinging X number of
times (based on $attempts number) and then give up.

I'll paste an example of the race condition observed in the PR notes.

Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/cobbler/templates/snippets/cephlab_rc_local

index b87bcd213629bb80ad6a4296d513b782cdf2102a..71496622ef5444ad8f5f7dd4871da546132087cd 100644 (file)
@@ -37,9 +37,15 @@ if [ ! -f /.cephlab_net_configured ]; then
       # Don't bail if NIC fails to come up
       set +e
       ifup $nic
+      attempts=0
+      # Try for 5 seconds to ping our Cobbler host
 #end raw
-      if ! timeout 5s ping -I $nic -nq -c1 $http_server 2>&1 >/dev/null; then
+      while ! ping -I $nic -nq -c1 $http_server && [ $attempts -lt 5 ]; do
 #raw
+        sleep 1
+        attempts=$[$attempts+1]
+      done
+      if [ $attempts == 5 ]; then
         # If we can't ping our Cobbler host, remove the DHCP config for this NIC.
         # It must either be on a non-routable network or has no reachable DHCP server.
         ifdown $nic