Chris Wright 2564f3b
#!/bin/sh
Chris Wright 2564f3b
#
Chris Wright 2564f3b
# openvswitch
Chris Wright 2564f3b
#
Chris Wright 2564f3b
# chkconfig: 2345 09 91
Chris Wright 2564f3b
# description: Manage Open vSwitch kernel modules and user-space daemons
Chris Wright 2564f3b
Chris Wright 2564f3b
# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
Chris Wright 2564f3b
#
Chris Wright 2564f3b
# Licensed under the Apache License, Version 2.0 (the "License");
Chris Wright 2564f3b
# you may not use this file except in compliance with the License.
Chris Wright 2564f3b
# You may obtain a copy of the License at:
Chris Wright 2564f3b
#
Chris Wright 2564f3b
#     http://www.apache.org/licenses/LICENSE-2.0
Chris Wright 2564f3b
#
Chris Wright 2564f3b
# Unless required by applicable law or agreed to in writing, software
Chris Wright 2564f3b
# distributed under the License is distributed on an "AS IS" BASIS,
Chris Wright 2564f3b
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Chris Wright 2564f3b
# See the License for the specific language governing permissions and
Chris Wright 2564f3b
# limitations under the License.
Chris Wright 2564f3b
### BEGIN INIT INFO
Chris Wright 2564f3b
# Provides:          openvswitch-switch
Chris Wright 2564f3b
# Required-Start:
Chris Wright 2564f3b
# Required-Stop:
Chris Wright 2564f3b
# Default-Start:     2 3 4 5
Chris Wright 2564f3b
# Default-Stop:      0 1 6
Chris Wright 2564f3b
# Short-Description: Open vSwitch switch
Chris Wright 2564f3b
### END INIT INFO
Chris Wright 2564f3b
Chris Wright 2564f3b
. /usr/share/openvswitch/scripts/ovs-lib || exit 1
Chris Wright 2564f3b
test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
Chris Wright 2564f3b
Chris Wright 2564f3b
start () {
Chris Wright 2564f3b
    set $ovs_ctl ${1-start}
Chris Wright 2564f3b
    set "$@" --system-id=random
Chris Wright 2564f3b
    if test X"$FORCE_COREFILES" != X; then
Chris Wright 2564f3b
	set "$@" --force-corefiles="$FORCE_COREFILES"
Chris Wright 2564f3b
    fi
Chris Wright 2564f3b
    if test X"$OVSDB_SERVER_PRIORITY" != X; then
Chris Wright 2564f3b
	set "$@" --ovsdb-server-priority="$OVSDB_SERVER_PRIORITY"
Chris Wright 2564f3b
    fi
Chris Wright 2564f3b
    if test X"$VSWITCHD_PRIORITY" != X; then
Chris Wright 2564f3b
	set "$@" --ovs-vswitchd-priority="$VSWITCHD_PRIORITY"
Chris Wright 2564f3b
    fi
Chris Wright 2564f3b
    if test X"$VSWITCHD_MLOCKALL" != X; then
Chris Wright 2564f3b
	set "$@" --mlockall="$VSWITCHD_MLOCKALL"
Chris Wright 2564f3b
    fi
Chris Wright 2564f3b
    if test X"$BRCOMPAT" = Xyes; then
Chris Wright 2564f3b
	set "$@" --brcompat
Chris Wright 2564f3b
    fi
Chris Wright 2564f3b
    "$@"
Chris Wright 2564f3b
1046df0
# Fedora kernel does not support OVS GRE tunneling yet
1046df0
#   $ovs_ctl --protocol=gre enable-protocol
Chris Wright 2564f3b
Chris Wright 2564f3b
    touch /var/lock/subsys/openvswitch
Chris Wright 2564f3b
}
Chris Wright 2564f3b
Chris Wright 2564f3b
stop () {
Chris Wright 2564f3b
    $ovs_ctl stop
Chris Wright 2564f3b
    rm -f /var/lock/subsys/openvswitch
Chris Wright 2564f3b
}
Chris Wright 2564f3b
Chris Wright 2564f3b
ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl
Chris Wright 2564f3b
case $1 in
Chris Wright 2564f3b
    start)
Chris Wright 2564f3b
        start
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    stop)
Chris Wright 2564f3b
        stop
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    restart)
Chris Wright 2564f3b
        stop
Chris Wright 2564f3b
        start
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    reload|force-reload)
Chris Wright 2564f3b
        # Nothing to do.
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    status)
Chris Wright 2564f3b
        $ovs_ctl status
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    version)
Chris Wright 2564f3b
        $ovs_ctl version
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    force-reload-kmod)
Chris Wright 2564f3b
        start force-reload-kmod
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    help)
Chris Wright 2564f3b
        printf "$0 [start|stop|restart|reload|force-reload|status|version|force-reload-kmod]\n"
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
    *)
Chris Wright 2564f3b
        printf "Unknown command: $1\n"
Chris Wright 2564f3b
        exit 1
Chris Wright 2564f3b
        ;;
Chris Wright 2564f3b
esac