"$dpctl" show | grep '^dp[0-9]\+:' | cut -d':' -f 1
}
-function dp_intf {
- local dp=$1
- # Currently port0 is hardcoded to be the local port.
- "$dpctl" show $dp | grep 'port 0:' | cut -d' ' -f 3
-}
-
-function ifdown_dp_intf {
- for dp in $(dp_list); do
- local intf=$(dp_intf $dp)
- if [ -e "/etc/sysconfig/network-scripts/ifcfg-$intf" ]; then
- action "Bringing down datapath interface: $intf" ifdown "$intf"
- fi
- done
-}
-
-function xen_mgmt_intf {
- ( test -e /etc/xensource-inventory \
- && source /etc/xensource-inventory \
- && echo "$MANAGEMENT_INTERFACE" )
-}
-
-function xen_mgmt_pifdev {
- ( test -e "/etc/sysconfig/network-scripts/ifcfg-$1" \
- && source "/etc/sysconfig/network-scripts/ifcfg-$1" \
- && echo "$PIFDEV" )
-}
-
-function xen_pifdev_hwaddr {
- ( test -e "/etc/sysconfig/network-scripts/ifcfg-$1" \
- && source "/etc/sysconfig/network-scripts/ifcfg-$1" \
- && echo "$HWADDR" )
-}
-
-function allow_xen_mgmt_traffic {
- local mgmt_intf=$(xen_mgmt_intf)
- test -n "$mgmt_intf" || return
- # TBD: This needs to be extended to deal with VLANs, etc.
- local mgmt_pifdev=$(xen_mgmt_pifdev "$mgmt_intf")
- test -n "$mgmt_pifdev" || return
- local mgmt_hwaddr=$(xen_pifdev_hwaddr "$mgmt_pifdev")
- test -n "$mgmt_hwaddr" || return
- action "Inserting dl_addr $mgmt_hwaddr flows for mgmt intf" true
- "$ofctl" add-flow "$mgmt_intf" dl_src="$mgmt_hwaddr",idle_timeout=0,priority=0,action=normal
- "$ofctl" add-flow "$mgmt_intf" dl_dst="$mgmt_hwaddr",idle_timeout=0,priority=0,action=normal
-}
-
-function ifup_dp_intf {
- for dp in $(dp_list); do
- local intf=$(dp_intf $dp)
- if [ -e "/etc/sysconfig/network-scripts/ifcfg-$intf" ]; then
- action "Bringing up datapath interface: $intf" ifup "$intf"
- fi
- done
-}
-
function turn_on_corefiles {
# This has global effect so should not normally be used...
ulimit -c unlimited
start_vswitchd
start_brcompatd
reload_vswitchd # ensures ovs-vswitchd has fully read config file.
- #allow_xen_mgmt_traffic # Seems to work okay without...
-}
-
-function stop_unload {
- stop_brcompatd
- ifdown_dp_intf
- remove_all_dp
- stop_vswitchd
- remove_modules
}
function stop {
stop_vswitchd
}
-function restart_unload {
- if restart_approval; then
- stop_unload
- insert_modules_if_required
- start_vswitchd
- reload_vswitchd
- ifup_dp_intf
- start_brcompatd
- fi
-}
-
function restart {
if restart_approval; then
stop
shift
strace -p $(cat "$BRCOMPATD_PIDFILE") "$@"
;;
- unload)
- stop_unload
- ;;
- update-modules)
- restart_unload
- ;;
status)
status -p ovs-vswitchd.pid ovs-vswitchd
status -p ovs-brcompatd.pid ovs-brcompatd