From: Ian Campbell Date: Wed, 16 Sep 2009 14:56:00 +0000 (+0100) Subject: create/remove /var/lock/subsys/vswitch on initscript start/stop X-Git-Tag: v0.99.0~93 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3f2c96d605ab2732ce2930bf6a747df5e8540613;p=sliver-openvswitch.git create/remove /var/lock/subsys/vswitch on initscript start/stop A lock file in /var/lock/subsys must be created with the same name as the initscript in order for the stop action to be automatically called on runlevel change. This is true at least on Red Hat derived systems such as XenServer where /etc/rcS contains: # First, run the KILL scripts. for i in /etc/rc$runlevel.d/K* ; do check_runlevel "$i" || continue # Check if the subsystem is already up. subsys=${i#/etc/rc$runlevel.d/K??} [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \ || continue ... (This could potentially expose bugs e.g. in the stop priority for the script since I think it is likely that the stop action hasn't been running to now. I haven't closely considered this case yet but vswitch is currently scheduled at K91vswitch vs K90network which seems correct at first glance) --- diff --git a/xenserver/etc_init.d_vswitch b/xenserver/etc_init.d_vswitch index 8f0adf797..e63a001ab 100755 --- a/xenserver/etc_init.d_vswitch +++ b/xenserver/etc_init.d_vswitch @@ -269,11 +269,13 @@ function start { start_vswitchd start_brcompatd reload_vswitchd # ensures ovs-vswitchd has fully read config file. + touch /var/lock/subsys/vswitch } function stop { stop_brcompatd stop_vswitchd + rm -f /var/lock/subsys/vswitch } function restart {