On Mon, Apr 13, 2015 at 03:03:53PM -0700, Andy Zhou wrote: > 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 <rbry...@redhat.com> > Signed-off-by: Andy Zhou <az...@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
Personally I'd put "sleep 0.1" above the loop and then sleep 1 inside it, like in tests/ovs-macros.at: ovs_wait () { # First try a quick sleep, so that the test completes very quickly # in the normal case. POSIX doesn't require fractional times to # work, so this might not work. sleep 0.1 ovs_wait_cond && exit 0 # Then wait up to 10 seconds. for d in 0 1 2 3 4 5 6 7 8 9; do sleep 1 ovs_wait_cond && exit 0 done exit 1 } _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev