[ovs-dev] [PATCH] ovs-sandbox: add delay before running ovs-vsctl

Andy Zhou azhou at nicira.com
Mon Apr 13 22:03:53 UTC 2015


When running ovsdb-server under gdb, there is a race that ovs-vsctl
command can be called before ovsdb-server is fully launched. This will
cause ovs-vsctl to fail.  This patch fixes this by delay issuing
the ovs-vsctl command until ovsdb-server is fully launched.

CC: Russell Bryant <rbryant at redhat.com>
Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 tutorial/ovs-sandbox | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
index 251f021..4a0b014 100755
--- a/tutorial/ovs-sandbox
+++ b/tutorial/ovs-sandbox
@@ -235,6 +235,14 @@ run ovsdb-tool create conf.db "$schema"
 rungdb $gdb_ovsdb ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file \
     --remote=punix:"$sandbox"/db.sock
 
+if test ! -e "$sandbox"/db.sock; then
+    echo -n "Waiting for ovsdb-server to start..."
+    while test ! -e "$sandbox"/db.sock; do
+        sleep 0;
+    done
+    echo "  Done"
+fi
+
 # Initialize database.
 run ovs-vsctl --no-wait -- init
 
-- 
1.9.1




More information about the dev mailing list