[ovs-dev] [PATCH RFC] ovs-lib: try to call exit before killing
Ben Pfaff
blp at ovn.org
Wed Dec 16 04:21:36 UTC 2015
On Tue, Dec 15, 2015 at 04:37:34PM +0300, Ilya Maximets wrote:
> While killing OVS may not free all allocated resources.
>
> Eample:
> Socket for vhost-user port will stay in a system
> after 'systemctl stop openvswitch' and opening
> that port after restart will fail.
>
> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
> ---
> utilities/ovs-lib.in | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> index dd8a1e9..8b371dd 100644
> --- a/utilities/ovs-lib.in
> +++ b/utilities/ovs-lib.in
> @@ -202,11 +202,14 @@ start_daemon () {
> stop_daemon () {
> if test -e "$rundir/$1.pid"; then
> if pid=`cat "$rundir/$1.pid"`; then
> - for action in TERM .1 .25 .65 1 1 1 1 KILL 1 1 1 2 10 15 30 FAIL; do
> + for action in EXIT 2 TERM .1 .25 .65 1 1 1 1 KILL 1 1 1 2 10 15 30 FAIL; do
> if pid_exists "$pid" >/dev/null 2>&1; then :; else
> return 0
> fi
> case $action in
> + EXIT)
> + action "Exiting $1 ($pid)" ${bindir}/ovs-appctl -t $1 exit
Probably should specify "-T 1" to make sure that ovs-appctl doesn't hang
forever if the daemon is buggy.
Might want to specify "-t $rundir/$1.pid" instead of "-t $1" so that the
process we kill is certain to be the one in the right pidfile (in case
of some weird configuration mismatch).
More information about the dev
mailing list