mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-20 19:41:34 +01:00
network/openvswitch: Updated for version 2.3.2.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
567773f5d1
commit
ebb74a4195
5 changed files with 5 additions and 254 deletions
|
@ -23,8 +23,8 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=openvswitch
|
||||
VERSION=${VERSION:-2.3.1}
|
||||
BUILD=${BUILD:-2}
|
||||
VERSION=${VERSION:-2.3.2}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
|
||||
KERNEL=${KERNEL:-$(uname -r)}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
PRGNAM="openvswitch"
|
||||
VERSION="2.3.1"
|
||||
VERSION="2.3.2"
|
||||
HOMEPAGE="http://openvswitch.org"
|
||||
DOWNLOAD="http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz"
|
||||
MD5SUM="c008c1de0a8b6363b37afa599105d6d6"
|
||||
DOWNLOAD="http://openvswitch.org/releases/openvswitch-2.3.2.tar.gz"
|
||||
MD5SUM="5a5739ed82f1accac1c2d8d7553dc88f"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
Here are some scripts that I've written for use with Xen at my site.
|
||||
In order to use these scripts with your Xen installation you'll need to copy
|
||||
both the network-openvswitch and vif-openvswitch files to your
|
||||
/etc/xen/scripts directory. You can instruct Xen to use these scripts by
|
||||
editing your /etc/xen/xend-config.sxp file and specifying these scripts as
|
||||
the default network-script and vif-script.
|
||||
|
||||
For example, here are the entries in my xend-config.sxp file:
|
||||
|
||||
(network-script 'network-openvswitch netdev=eth2 bridge=ovs0')
|
||||
|
||||
(vif-script 'vif-openvswitch bridge=ovs0')
|
||||
|
||||
If your network interface card and attached network switch support VLAN
|
||||
tagged traffic, you can place virtual machines within a seperate VLAN by
|
||||
appending a '.' and the VLAN tag number you wish the domain to use. For
|
||||
example, to have all domains default to VLAN 2 you can do the following:
|
||||
|
||||
(vif-script 'vif-openvswitch bridge=ovs0.2')
|
||||
|
||||
You can also specify tagged traffic in the domain configuration file.
|
||||
|
||||
If you are hosting a hardware virtualized domain understand that the
|
||||
/etc/xen/scripts/qemu-ifup script is run instead of the vif-script specified
|
||||
in the xend-config.sxp file. You'll need to edit this file to add the port
|
||||
to the vswitch instead of using the brctl (unless of course you are using
|
||||
the appropriate kernel module to control the vswitch using brctl.) Here is
|
||||
a snippet from my qemu-ifup to handle hardware virtualized ports:
|
||||
|
||||
if lsmod | grep -c openvswitch_mod 1> /dev/null && ! lsmod | grep -c brcompat_mod 1> /dev/null
|
||||
then
|
||||
ovs-vsctl -- --may-exist add-port $bridge $1
|
||||
else
|
||||
brctl addif $bridge $1 || true
|
||||
fi
|
||||
|
||||
This doesn't handle tagged traffic. I'll leave that as an exercise for you.
|
||||
|
||||
Enjoy.
|
|
@ -1,124 +0,0 @@
|
|||
#!/bin/bash
|
||||
#============================================================================
|
||||
# Default Xen network start/stop script.
|
||||
# Xend calls a network script when it starts.
|
||||
# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp
|
||||
# in the network-script field.
|
||||
#
|
||||
# This script creates a virtual switch (default ${netdev}) and adds a
|
||||
# device (defaults to eth0) to it. The interface that this Open vSwitch
|
||||
# is created on should not have a working IP address and will be used as
|
||||
# a switch for Xen domU's.
|
||||
#
|
||||
# Usage:
|
||||
# network-openvswitch (start|stop|status) {VAR=VAL}*
|
||||
#
|
||||
# Vars:
|
||||
# bridge The bridge to use (default xenvs0).
|
||||
# netdev The interface to add to the bridge (default eth0). This
|
||||
# device should not be configured with an IP address. If so
|
||||
# this script will tear down the interface and bring it back up
|
||||
# without an IP address.
|
||||
#
|
||||
# start:
|
||||
# Creates the bridge as bridge
|
||||
# Enslaves netdev to bridge
|
||||
#
|
||||
# stop:
|
||||
# Removes netdev from the bridge
|
||||
# Deletes bridge
|
||||
#
|
||||
# status:
|
||||
# Print addresses, interfaces
|
||||
#
|
||||
#============================================================================
|
||||
|
||||
dir=$(dirname "$0")
|
||||
. "$dir/logging.sh"
|
||||
. "$dir/xen-script-common.sh"
|
||||
. "$dir/xen-network-common.sh"
|
||||
. "$dir/locking.sh"
|
||||
|
||||
findCommand "$@"
|
||||
evalVariables "$@"
|
||||
|
||||
netdev=${netdev:-eth0}
|
||||
bridge=${bridge:-ovs0}
|
||||
|
||||
addr=`ip addr show dev ${netdev} | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'`
|
||||
if [ -n "$addr" ]; then
|
||||
echo "Invalid device: ${netdev} is up and has a valid IP address!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
show_status () {
|
||||
local dev=$1
|
||||
local bridge=$2
|
||||
|
||||
echo '============================================================'
|
||||
echo 'vSwitch interfaces'
|
||||
ovs-vsctl list-ifaces ${bridge}
|
||||
echo ' '
|
||||
echo 'vSwitch ports'
|
||||
ovs-vsctl list-ports ${bridge}
|
||||
echo '============================================================'
|
||||
}
|
||||
|
||||
op_start () {
|
||||
if [ "${bridge}" = "null" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
ifconfig "${netdev}" down
|
||||
ifconfig "${netdev}" 0.0.0.0 up
|
||||
ovs-vsctl -- --may-exist add-br ${bridge}
|
||||
ifconfig "${bridge}" 0.0.0.0 up
|
||||
ovs-vsctl -- --may-exist add-port ${bridge} ${netdev}
|
||||
|
||||
# Remove any stale ports from last time virtual switch was running.
|
||||
# Open vSwitch has the habit of remembering port settings between
|
||||
# runs.
|
||||
for port in $(ovs-vsctl list-ports ${bridge})
|
||||
do
|
||||
if [ "${port}" != "${netdev}" ]
|
||||
then
|
||||
ifconfig "${port}" down
|
||||
ovs-vsctl del-port ${port}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
op_stop () {
|
||||
if [ "${bridge}" = "null" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Remove all ports from virtual switch.
|
||||
for port in $(ovs-vsctl list-ports ${bridge})
|
||||
do
|
||||
ifconfig "${port}" down
|
||||
ovs-vsctl del-port ${port}
|
||||
done
|
||||
|
||||
ifconfig "${bridge}" down
|
||||
ovs-vsctl -- --if-exists del-br ${bridge}
|
||||
}
|
||||
|
||||
case "$command" in
|
||||
start)
|
||||
op_start
|
||||
;;
|
||||
|
||||
stop)
|
||||
op_stop
|
||||
;;
|
||||
|
||||
status)
|
||||
show_status ${netdev} ${bridge}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown command: $command" >&2
|
||||
echo 'Valid commands are: start, stop, status' >&2
|
||||
exit 1
|
||||
esac
|
|
@ -1,86 +0,0 @@
|
|||
#!/bin/bash
|
||||
#============================================================================
|
||||
# ${XEN_SCRIPT_DIR}/vif-openvswitch
|
||||
#
|
||||
# Script for configuring a vif using Open vSwitch.
|
||||
#
|
||||
# Usage:
|
||||
# vif-openvswitch (add|remove|online|offline)
|
||||
#
|
||||
# Environment vars:
|
||||
# vif vif interface name (required).
|
||||
# XENBUS_PATH path to this device's details in the XenStore (required).
|
||||
#
|
||||
# Read from the store:
|
||||
# bridge bridge to add the vif to (optional). Defaults to searching for the
|
||||
# bridge itself.
|
||||
#
|
||||
# up:
|
||||
# Enslaves the vif interface to the bridge.
|
||||
#
|
||||
# down:
|
||||
# Removes the vif interface from the bridge.
|
||||
#============================================================================
|
||||
|
||||
dir=$(dirname "$0")
|
||||
. "$dir/vif-common.sh"
|
||||
|
||||
bridge=${bridge:-}
|
||||
bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge")
|
||||
|
||||
if [ -z "${bridge}" ]
|
||||
then
|
||||
bridge=$(ovs-vsctl list-br | cut -d "
|
||||
" -f 1)
|
||||
|
||||
if [ -z "${bridge}" ]
|
||||
then
|
||||
fatal "Could not find bridge and none was specified"
|
||||
fi
|
||||
fi
|
||||
|
||||
tag=${tag:-}
|
||||
|
||||
# Domain on VLAN tagged bridge?
|
||||
RET=0
|
||||
ovs-vsctl list-br | grep -c ${bridge} 1>/dev/null 2>&1 || RET=1
|
||||
if [ $RET -eq 1 ]
|
||||
then
|
||||
if [[ $bridge =~ \.[[:digit:]]{1,4}$ ]]
|
||||
then
|
||||
tag=$(echo ${bridge} | cut -d "." -f 2)
|
||||
bridge=$(echo ${bridge} | cut -d "." -f 1)
|
||||
else
|
||||
fatal "Could not find bridge device ${bridge}"
|
||||
fi
|
||||
fi
|
||||
|
||||
RET=0
|
||||
ovs-vsctl list-br | grep -c ${bridge} 1>/dev/null 2>&1 || RET=1
|
||||
if [ $RET -eq 1 ]
|
||||
then
|
||||
fatal "Could not find bridge device ${bridge}"
|
||||
fi
|
||||
|
||||
log debug "Successful vif-bridge $command for ${vif}, bridge ${bridge}."
|
||||
case "$command" in
|
||||
online)
|
||||
ifconfig "${vif}" 0.0.0.0 up
|
||||
if [ -z $tag ]
|
||||
then
|
||||
ovs-vsctl -- --may-exist add-port ${bridge} ${vif}
|
||||
else
|
||||
ovs-vsctl -- --may-exist add-port ${bridge} ${vif} tag=${tag}
|
||||
fi
|
||||
;;
|
||||
|
||||
offline)
|
||||
ovs-vsctl -- --if-exists del-port ${bridge} ${vif}
|
||||
ifconfig "$vif" 0.0.0.0 down
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$command" == "online" ]
|
||||
then
|
||||
success
|
||||
fi
|
Loading…
Reference in a new issue