-# General config variables in /etc/sysconfig/openvswitch
-if [ -f /etc/xensource-inventory ]; then
- if test "$PRODUCT_VERSION" = "5.5.0"; then
- # XenServer 5.5.0 needs ovs-brcompatd and /proc/net simulation.
- : ${ENABLE_BRCOMPAT:=y}
- : ${ENABLE_FAKE_PROC_NET:=y}
- else
- # Later versions don't need them.
- : ${ENABLE_BRCOMPAT:=n}
- : ${ENABLE_FAKE_PROC_NET:=n}
- fi
-else
- : ${ENABLE_BRCOMPAT:=y}
- : ${ENABLE_FAKE_PROC_NET:=y}
-fi
-: ${ENABLE_MONITOR:=y}
-: ${FORCE_COREFILES:=y}
-
-# Config variables specific to ovsdb-server
-: ${OVSDB_SERVER_REMOTES:=punix:/var/run/openvswitch/db.sock db:Open_vSwitch,managers db:Open_vSwitch,manager_options}
-: ${OVSDB_SERVER_DB:=/etc/openvswitch/conf.db}
-: ${OVSDB_SERVER_PIDFILE:=/var/run/openvswitch/ovsdb-server.pid}
-: ${OVSDB_SERVER_RUN_DIR:=/var/xen/openvswitch}
-: ${OVSDB_SERVER_PRIORITY:=-10}
-: ${OVSDB_SERVER_LOGFILE:=/var/log/openvswitch/ovsdb-server.log}
-: ${OVSDB_SERVER_FILE_LOGLEVEL:=INFO}
-: ${OVSDB_SERVER_SYSLOG_LOGLEVEL:=ERR}
-: ${OVSDB_SERVER_MEMLEAK_LOGFILE:=}
-: ${OVSDB_SERVER_STRACE_LOG:=}
-: ${OVSDB_SERVER_STRACE_OPT:=}
-: ${OVSDB_SERVER_VALGRIND_LOG:=}
-: ${OVSDB_SERVER_VALGRIND_OPT:=}
-
-# Config variables specific to ovs-vswitchd
-: ${VSWITCHD_OVSDB_SERVER:=unix:/var/run/openvswitch/db.sock}
-: ${VSWITCHD_OVSDB_SCHEMA:=/usr/share/openvswitch/vswitch.ovsschema}
-: ${VSWITCHD_PIDFILE:=/var/run/openvswitch/ovs-vswitchd.pid}
-: ${VSWITCHD_RUN_DIR:=/var/xen/openvswitch}
-: ${VSWITCHD_PRIORITY:=-10}
-: ${VSWITCHD_MLOCKALL:=yes}
-: ${VSWITCHD_LOGFILE:=/var/log/openvswitch/ovs-vswitchd.log}
-: ${VSWITCHD_FILE_LOGLEVEL:=INFO}
-: ${VSWITCHD_SYSLOG_LOGLEVEL:=ERR}
-: ${VSWITCHD_MEMLEAK_LOGFILE:=}
-: ${VSWITCHD_STRACE_LOG:=}
-: ${VSWITCHD_STRACE_OPT:=}
-: ${VSWITCHD_VALGRIND_LOG:=}
-: ${VSWITCHD_VALGRIND_OPT:=}
-
-# Config variables specific to ovs-brcompatd
-: ${BRCOMPATD_PIDFILE:=/var/run/openvswitch/ovs-brcompatd.pid}
-: ${BRCOMPATD_RUN_DIR:=/var/xen/openvswitch}
-: ${BRCOMPATD_PRIORITY:=-10}
-: ${BRCOMPATD_LOGFILE:=/var/log/openvswitch/ovs-brcompatd.log}
-: ${BRCOMPATD_FILE_LOGLEVEL:=INFO}
-: ${BRCOMPATD_SYSLOG_LOGLEVEL:=ERR}
-: ${BRCOMPATD_MEMLEAK_LOGFILE:=}
-: ${BRCOMPATD_STRACE_LOG:=}
-: ${BRCOMPATD_STRACE_OPT:=}
-: ${BRCOMPATD_VALGRIND_LOG:=}
-: ${BRCOMPATD_VALGRIND_OPT:=}
-
-# Full paths to executables & modules
-ovsdb_server="/usr/sbin/ovsdb-server"
-ovsdb_tool="/usr/bin/ovsdb-tool"
-vswitchd="/usr/sbin/ovs-vswitchd"
-brcompatd="/usr/sbin/ovs-brcompatd"
-dpctl="/usr/bin/ovs-dpctl"
-appctl="/usr/bin/ovs-appctl"
-ofctl="/usr/bin/ovs-ofctl"
-vsctl="/usr/bin/ovs-vsctl"
-
-if [ "$ENABLE_FAKE_PROC_NET" = "y" ]; then
- if [ "$ENABLE_BRCOMPAT" != "y" ]; then
- warning "FAKE_PROC_NET required BRCOMPAT which was disabled. Force enabling."
- ENABLE_BRCOMPAT="y"
- fi
-fi
-
-if test "$ENABLE_MONITOR" = "y"; then
- monitor_opt="--monitor"
-else
- monitor_opt=
-fi
-
-function hup_monitor_external_ids {
- if [ -e /var/run/openvswitch/ovs-external-ids.pid ]; then
- action "Configuring Open vSwitch external IDs" kill -HUP `cat /var/run/openvswitch/ovs-external-ids.pid`
- fi
-}
-
-function turn_on_corefiles {
- ulimit -Sc 67108864
-}
-
-function remove_all_dp {
- for dp in $($dpctl dump-dps); do
- action "Removing datapath: $dp" "$dpctl" del-dp "$dp"
- done
-}
-
-function insert_modules_if_required {
- if test -e /sys/module/bridge; then
- bridges=`echo /sys/class/net/*/bridge | sed 's,/sys/class/net/,,g;s,/bridge,,g'`
- if test "$bridges" != "*"; then
- log_warning_msg "not removing bridge module because bridges exist ($bridges)"
- else
- action "removing bridge module" rmmod bridge
- fi
- fi
- if ! lsmod | grep -q "openvswitch_mod"; then
- action "Inserting llc module" modprobe llc
- action "Inserting openvswitch module" modprobe openvswitch_mod
- fi
- if [ "$ENABLE_BRCOMPAT" = "y" ] && [ -n "$BRCOMPATD_PIDFILE" ] && ! lsmod | grep -q "brcompat_mod"; then
- action "Inserting brcompat module" modprobe brcompat_mod
- fi
-}
-
-function remove_modules {
- if lsmod | grep -q "brcompat_mod"; then
- action "Removing brcompat module" rmmod brcompat_mod.ko