create/remove /var/lock/subsys/vswitch on initscript start/stop
authorIan Campbell <Ian.Campbell@citrix.com>
Wed, 16 Sep 2009 14:56:00 +0000 (15:56 +0100)
committerBen Pfaff <blp@nicira.com>
Wed, 16 Sep 2009 16:17:00 +0000 (09:17 -0700)
commit3f2c96d605ab2732ce2930bf6a747df5e8540613
treedde5c64d5646ccef51c0ce958df48b02752e4303
parent22d24ebf66d1069ad27accf66916fd77642c118a
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)
xenserver/etc_init.d_vswitch