ovs-lib: Try to call exit before killing.
authorIlya Maximets <i.maximets@samsung.com>
Wed, 16 Dec 2015 12:32:21 +0000 (15:32 +0300)
committerBen Pfaff <blp@ovn.org>
Wed, 16 Dec 2015 12:38:11 +0000 (04:38 -0800)
While killing OVS may not free all allocated resources.

Example:
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@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
utilities/ovs-lib.in

index dd8a1e9..773efb3 100644 (file)
@@ -202,11 +202,18 @@ 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 .1 .25 .65 1 \
+                          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 -t $rundir/$1.$pid.ctl exit
+                        ;;
                     TERM)
                         action "Killing $1 ($pid)" kill $pid
                         ;;