[ovs-dev] [PATCH] Wait for daemons to die in init.d script "stop" commands.

Justin Pettit jpettit at nicira.com
Thu Aug 12 17:38:10 UTC 2010


Looks good.

--Justin


On Aug 12, 2010, at 10:18 AM, Ben Pfaff wrote:

> Sometimes it takes a moment for the OVS daemons to die.  When that happens,
> the "start" half of "openvswitch restart" can fail when ovsdb-tool
> runs, because ovsdb-server will still have the lock on the database if it
> has not exited yet.  So this commit just makes the "stop" half wait for
> the daemons to really die.
> 
> Bug #3369.
> ---
> debian/openvswitch-switch.init   |    4 ++--
> xenserver/etc_init.d_openvswitch |    7 +++++++
> 2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init
> index a5b6857..a933a21 100755
> --- a/debian/openvswitch-switch.init
> +++ b/debian/openvswitch-switch.init
> @@ -273,13 +273,13 @@ case "$1" in
>         ;;
>     stop)
>         echo -n "Stopping ovs-vswitchd: "
> -        start-stop-daemon --stop --quiet --oknodo \
> +        start-stop-daemon --stop --quiet --oknodo --retry 5 \
>             --pidfile /var/run/openvswitch/ovs-vswitchd.pid \
>             --exec $ovs_vswitchd
>         echo "ovs-vswitchd."
> 
>         echo -n "Stopping ovsdb-server: "
> -        start-stop-daemon --stop --quiet --oknodo \
> +        start-stop-daemon --stop --quiet --oknodo --retry 5 \
>             --pidfile /var/run/openvswitch/ovsdb-server.pid \
>             --exec $ovsdb_server
>         echo "ovsdb-server."
> diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch
> index 0988fcc..c52864e 100755
> --- a/xenserver/etc_init.d_openvswitch
> +++ b/xenserver/etc_init.d_openvswitch
> @@ -254,6 +254,13 @@ function stop_daemon {
>     if test -f "$pidfile"; then
>         local pid=$(cat "$pidfile")
>         action "Killing `basename $BINARY` ($pid)" kill $pid
> +        for delay in .1 .25 .65 1 1 1 1; do
> +            if kill -0 $pid >/dev/null 2>&1; then
> +                sleep $delay
> +            else
> +                break
> +            fi
> +        done
>         rm -f "$pidfile"
>     fi
> }
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list