"$@"
rc=$?
if [ $rc -eq 0 ] ; then
- log_success_msg $"$STRING "
+ log_success_msg $"$STRING "
else
- log_failure_msg $"$STRING "
+ log_failure_msg $"$STRING "
fi
return $rc
}
: ${FORCE_COREFILES:=y}
# Config variables specific to ovsdb-server
-: ${OVSDB_SERVER_REMOTES:=punix:/var/run/openvswitch/db.sock db:Open_vSwitch,managers}
+: ${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}
fi
}
-function dp_list {
- "$dpctl" show | grep '^dp[0-9]\+:' | cut -d':' -f 1
-}
-
function turn_on_corefiles {
ulimit -Sc 67108864
}
function remove_all_dp {
- for dp in $(dp_list); do
+ 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
+ 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
external-ids:system-id="$INSTALLATION_UUID" \
external-ids:xs-system-uuid="$INSTALLATION_UUID"
else
- if test -f /etc/openvswitch/install_uuid.conf; then
+ if test -f /etc/openvswitch/install_uuid.conf; then
. /etc/openvswitch/install_uuid.conf
- elif INSTALLATION_UUID=`uuidgen`; then
- echo "INSTALLATION_UUID=$INSTALLATION_UUID" > /etc/openvswitch/install_uuid.conf
- else
- log_failure_msg "missing uuidgen, could not generate system UUID"
- return
+ elif INSTALLATION_UUID=`uuidgen`; then
+ echo "INSTALLATION_UUID=$INSTALLATION_UUID" > /etc/openvswitch/install_uuid.conf
+ else
+ log_failure_msg "missing uuidgen, could not generate system UUID"
+ return
fi
$vsctl --no-wait --timeout=5 set Open_vSwitch . \
external-ids:system-id="$INSTALLATION_UUID"
fi
}
+function internal_interfaces {
+ # Outputs a list of internal interfaces:
+ #
+ # - There is an internal interface for every bridge, whether it has
+ # an Interface record or not and whether the Interface record's
+ # 'type' is properly set.
+ #
+ # - There is an internal interface for each Interface record whose
+ # 'type' is 'internal'.
+ #
+ # But ignore interfaces that don't really exist.
+ for d in `(ovs-vsctl --bare \
+ -- --columns=name find Interface type=internal \
+ -- list-br) | sort -u`
+ do
+ if test -e "/sys/class/net/$d"; then
+ printf "%s " "$d"
+ fi
+ done
+}
+
+function force_reload_kmod {
+ ifaces=$(internal_interfaces)
+ action "Configured internal interfaces: $ifaces" true
+
+ stop
+
+ script=$(mktemp)
+ action "Save interface configuration to $script" true
+ if ! /usr/share/openvswitch/scripts/ovs-save $ifaces > $script; then
+ warning "Failed to save configuration, not replacing kernel module"
+ start
+ exit 1
+ fi
+ chmod +x $script
+
+ action "Destroy datapaths" remove_all_dp
+
+ remove_modules
+
+ start
+
+ action "Restore interface configuration from $script" $script
+}
+
case "$1" in
start)
start
# configuration up-to-date all the time. HUP ovs-external-ids so it
# re-runs.
hup_monitor_external_ids
- ;;
+ ;;
strace-vswitchd)
shift
strace -p $(cat "$VSWITCHD_PIDFILE") "$@"
/usr/sbin/ovs-vswitchd -V
/usr/sbin/ovs-brcompatd -V
;;
+ force-reload-kmod)
+ force_reload_kmod
+ ;;
help)
printf "openvswitch [start|stop|restart|reload|force-reload|status|version]\n"
;;