diff options
author | Christopher Walker <kris240376@gmail.com> | 2011-08-22 08:23:47 -0300 |
---|---|---|
committer | Niels Horn <niels.horn@slackbuilds.org> | 2011-08-22 08:23:47 -0300 |
commit | 444996d10d6be685428e1cc744d87c9d0868d990 (patch) | |
tree | 7b14df9df12f80e943df939f1bdc4f21461cce34 /network/openvswitch/rc.openvswitch | |
parent | 27f6419c387b460c83791b38d4374a5cecce5a8d (diff) | |
download | slackbuilds-444996d10d6be685428e1cc744d87c9d0868d990.tar.gz |
network/openvswitch: Added (multilayer virtual switch)
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
Diffstat (limited to 'network/openvswitch/rc.openvswitch')
-rw-r--r-- | network/openvswitch/rc.openvswitch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/network/openvswitch/rc.openvswitch b/network/openvswitch/rc.openvswitch new file mode 100644 index 0000000000..5e0f3d561a --- /dev/null +++ b/network/openvswitch/rc.openvswitch @@ -0,0 +1,68 @@ +#!/bin/sh +# Start/stop/restart openvswitch. + +# To start Open vSwitch automatically at boot, be sure this script is +# executable: +# +# % chmod 755 /etc/rc.d/rc.openvswitch + +# Before you can run Open vSwitch daemon, you must have a database. To +# install an initial database, perform the following as root: +# +# % modprobe openvswitch_mod +# % ovsdb-tool create /etc/openvswitch/ovs-vswitchd.conf.db @DOCDIR@/schema/vswitch.ovsschema +# + +# Module to make Open vSwitch compatible with Linux bridge utils: +BRCOMPAT=0 + +SOCKET=/var/run/openvswitch/db.sock +VSPID=/var/run/openvswitch/ovs-vswitchd.pid +DBPID=/var/run/openvswitch/ovsdb-server.pid + +# Insert kernel driver for Open vSwitch: +/sbin/modprobe openvswitch_mod + +# Insert kernel driver for VLANs: +/sbin/modprobe 8021q + +# Insert kernel driver for bridge util compatibility: +if [ $BRCOMPAT -ne 0 ] ; then + /sbin/modprobe brcompat_mod +fi + +# Start openvswitch: +openvswitch_start() { + echo "Starting openvswitch: /etc/rc.d/rc.openvswitch" + /usr/sbin/ovsdb-server /etc/openvswitch/ovs-vswitchd.conf.db --remote=punix:$SOCKET --detach --pidfile=$DBPID + /usr/bin/ovs-vsctl --no-wait init + /usr/sbin/ovs-vswitchd unix:$SOCKET --detach --pidfile=$VSPID +} + +# Stop openvswitch: +openvswitch_stop() { + echo "Stopping openvswitch: /etc/rc.d/rc.openvswitch" + if [ -e $VSPID ]; then + pid=$(cat $VSPID) + /usr/bin/ovs-appctl -t /var/run/openvswitch/ovs-vswitchd.$pid.ctl exit + fi + if [ -e $DBPID ]; then + pid=$(cat $DBPID) + /usr/bin/ovs-appctl -t /var/run/openvswitch/ovsdb-server.$pid.ctl exit + fi +} + +case "$1" in +'start') + openvswitch_start + ;; +'stop') + openvswitch_stop + ;; +'restart') + openvswitch_stop + openvswitch_start + ;; +*) + echo "usage $0 start|stop|restart" +esac |