From 2715620d176fd77ccbcbc13a8e88efc11301f507 Mon Sep 17 00:00:00 2001 From: Chris Wedgwood Date: Fri, 13 Oct 2017 22:28:12 +0000 Subject: [PATCH] openvswitch: wait for ovs socket readiness Add a check (with a timeout) to wait for the openvswitch socket to prevent erronious crashes on inital startup. Change-Id: I000425a439f320974904129b65b7840702693ab4 --- .../templates/bin/_openvswitch-vswitchd.sh.tpl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl b/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl index 467fd46ee6..ff88e7a233 100644 --- a/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl +++ b/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl @@ -24,6 +24,18 @@ modprobe openvswitch modprobe gre modprobe vxlan +sock="/var/run/openvswitch/db.sock" +t=0 +while [ ! -e "${sock}" ] ; do + echo "waiting for ovs socket $sock" + sleep 1 + t=$(($t+1)) + if [ $t -ge 10 ] ; then + echo "no ovs socket, giving up" + exit 1 + fi +done + ovs-vsctl --no-wait show external_bridge="{{- .Values.network.external_bridge -}}"