On 04/13/2015 06:03 PM, 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.

Do you want to remove the 'ex run' part, too?

> 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;

You can use ':' here instead of sleep 0.

    while test ! -e "$sandbox"/db.sock; do : ; done

or it could be sleep 1 to avoid using too many CPU cycles if you're just
off in gdb setting up breakpoints before starting ovsdb-server.

> +    done
> +    echo "  Done"
> +fi
> +
>  # Initialize database.
>  run ovs-vsctl --no-wait -- init
>  
> 


-- 
Russell Bryant
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to