From 1de440e97de9428941e653c786923fdd9f2e7915 Mon Sep 17 00:00:00 2001 From: Keith Amidon Date: Wed, 29 Apr 2009 12:05:28 -0700 Subject: [PATCH] Fix vswitch init script "restart" and "update-modules" options These options are not guaranteed to work reliably but are useful in some situations, especially during development. These changes fix problems introduced by the combination of the vswitch and brcompatd init files. To make it clear that behavior may not be sane after a restart, a big warning has been added and explicit user confirmation is requested before the action is implemented. --- vswitchd/etc/init.d/vswitch | 68 +++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/vswitchd/etc/init.d/vswitch b/vswitchd/etc/init.d/vswitch index 1a08166e..737ec8c4 100755 --- a/vswitchd/etc/init.d/vswitch +++ b/vswitchd/etc/init.d/vswitch @@ -124,6 +124,12 @@ function turn_on_corefiles { 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 @@ -134,12 +140,12 @@ function insert_modules_if_required { } 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 { @@ -246,6 +252,29 @@ function stop_brcompatd { fi } +function restart_approval { + cat <