echo "$COREFILE_PATTERN" > /proc/sys/kernel/core_pattern
}
+function remove_all_dp {
+ for dp in $(dp_list); do
+ action "Removing datapath: $dp" "$dpctl" deldp "$dp"
+ done
+}
+
function insert_modules_if_required {
if ! lsmod | grep -q "openflow_mod"; then
action "Inserting openflow module" insmod $VSWITCH_BASE/kernel_modules/openflow_mod.ko
}
function remove_modules {
- if ! lsmod | grep -q "openflow_mod"; then
- action "Removing openflow module" rmmod openflow_mod.ko
- fi
- if ! lsmod | grep -q "brcompat_mod"; then
+ if lsmod | grep -q "brcompat_mod"; then
action "Removing brcompat module" rmmod brcompat_mod.ko
fi
+ if lsmod | grep -q "openflow_mod"; then
+ action "Removing openflow module" rmmod openflow_mod.ko
+ fi
}
function reload_vswitchd {
fi
}
+function restart_approval {
+ cat <<EOF
+
+WARNING!!!
+
+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
+ printf "\n"
+ case "$response" in
+ y|Y)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
function start {
insert_modules_if_required
start_vswitchd
#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_brcompatd
stop_vswitchd
- if [ "$1" == "unload_modules" ]; then
- ifdown_dp_intf
- remove_modules
+}
+
+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 [ "$1" == "unload_modules" ]; then
- stop unload_modules
- start
- ifup_dp_intf
- else
+ if restart_approval; then
stop
start
fi
strace -p $(cat "$BRCOMPATD_PIDFILE") "$@"
;;
unload)
- stop unload_modules
+ stop_unload
;;
update-modules)
- restart unload_modules
+ restart_unload
;;
status)
status -p vswitchd.pid vswitchd