[ovs-dev] [restart v2 3/3] xenserver: Wait for ovs-xapi-sync to exit in "stop" command.

Ben Pfaff blp at nicira.com
Tue Mar 29 09:36:29 PDT 2011


It seems possible that "restart" or a quick application of "stop" then
"start" could kill ovs-xapi-sync without starting it again, if
ovs-xapi-sync takes a little while to die, long enough for the next
instance of it to see that its pidfile is still open and locked.

I hope that this fixes some odd races that we've noticed in the "restart"
command.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 xenserver/etc_init.d_openvswitch |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch
index 7300981..dfd8c39 100755
--- a/xenserver/etc_init.d_openvswitch
+++ b/xenserver/etc_init.d_openvswitch
@@ -109,6 +109,8 @@ esac
 : ${VSWITCHD_VALGRIND_LOG:=}
 : ${VSWITCHD_VALGRIND_OPT:=}
 
+: ${OVS_XAPI_SYNC_PIDFILE:=/var/run/openvswitch/ovs-xapi-sync.pid}
+
 # Full paths to executables & modules
 ovsdb_server="/usr/sbin/ovsdb-server"
 ovsdb_tool="/usr/bin/ovsdb-tool"
@@ -382,9 +384,7 @@ function start {
 function stop {
     stop_daemon VSWITCHD "$vswitchd"
     stop_daemon OVSDB_SERVER "$ovsdb_server"
-    if [ -e /var/run/openvswitch/ovs-xapi-sync.pid ]; then
-        kill `cat /var/run/openvswitch/ovs-xapi-sync.pid`
-    fi
+    stop_daemon OVS_XAPI_SYNC ovs-xapi-sync
     rm -f /var/lock/subsys/openvswitch
 }
 
-- 
1.7.1




More information about the dev mailing list