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
fi
}
-function reload_vswitchd {
- if [ -f "$VSWITCHD_PIDFILE" ]; then
- "$appctl" --target=/var/run/ovs-vswitchd.`cat $VSWITCHD_PIDFILE`.ctl vswitchd/reload
- fi
-}
-
-function reload_brcompatd {
- if [ -f "$BRCOMPATD_PIDFILE" ]; then
- "$appctl" --target=/var/run/ovs-brcompatd.`cat $BRCOMPATD_PIDFILE`.ctl vlog/reopen
- fi
-}
-
function start_ovsdb_server {
local syslog_opt="-vANY:SYSLOG:${OVSDB_SERVER_SYSLOG_LOGLEVEL}"
local logfile_file_opt=""
Restarting vswitch on a live server is not guaranteed to work. It is
provided as a convenience for those situations in which it does work.
-If you just want to reload the configuration file, use "reload"
-instead of restart.
EOF
read -s -r -n 1 -p "Countinue with restart (y/N): " response
if [ ! -e "$OVSDB_SERVER_DB" ]; then
warning "$OVSDB_SERVER_DB does not exist"
- action "Creating empty $OVSDB_SERVER_DB" $ovsdb_tool create "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA"
- action "Creating initial table in $OVSDB_SERVER_DB" $ovsdb_tool transact "$OVSDB_SERVER_DB" '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]'
- #elif [ ! -e /var/run/vswitch.booted ]; then
- #touch /var/run/vswitch.booted
- #/usr/bin/ovs-cfg-mod '-vANY:console:emer' -F "$VSWITCHD_CONF" \
- #'--del-match=bridge.*' \
- #'--del-match=port.*' \
- #'--del-match=bonding.*' \
- #'--del-match=iface.*' \
- #'--del-match=vlan.*.trunks=*' \
- #'--del-match=vlan.*.tag=*'
+
+ action "Creating empty database $OVSDB_SERVER_DB" true
+ $ovsdb_tool -vANY:console:emer create "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA"
fi
start_ovsdb_server
+ $vsctl --no-wait init
+ if [ ! -e /var/run/vswitch.booted ]; then
+ touch /var/run/vswitch.booted
+ for bridge in $($vsctl list-br); do
+ $vsctl --no-wait del-br $bridge
+ done
+ fi
+
start_vswitchd
start_brcompatd
- reload_vswitchd # ensures ovs-vswitchd has fully read config.
touch /var/lock/subsys/vswitch
}
restart)
restart
;;
- reload)
- reload_vswitchd
- reload_brcompatd
- ;;
strace-vswitchd)
shift
strace -p $(cat "$VSWITCHD_PIDFILE") "$@"
strace -p $(cat "$BRCOMPATD_PIDFILE") "$@"
;;
status)
+ status -p ovsdb-server.pid ovsdb-server
status -p ovs-vswitchd.pid ovs-vswitchd
status -p ovs-brcompatd.pid ovs-brcompatd
;;
version)
+ /usr/sbin/ovsdb-server -V
/usr/sbin/ovs-vswitchd -V
/usr/sbin/ovs-brcompatd -V
;;
help)
- printf "vswitch [start|stop|restart|reload|unload|status|version]\n"
+ printf "vswitch [start|stop|restart|unload|status|version]\n"
;;
*)
printf "Unknown command: $1\n"