[ovs-dev] [PATCH V2] ovs-ctl: Remove used-by modules of openvswitch during force-relaod-kmod.

Alex Wang alexw at nicira.com
Wed Apr 22 02:07:29 UTC 2015


With the latest change of separating vports into their own modules,
before removing the openvswitch kernel module, we must remove all
modules currently using it first.  Otherwise, the force-reload-kmod
will fail due to:

e.g., Module openvswitch is in use by vport_vxlan         [FAILED]

Signed-off-by: Alex Wang <alexw at nicira.com>
---
PATCH->V2:
- correct commit message and comments.
---
 utilities/ovs-ctl.in |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 6d2e938..51def86 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -392,6 +392,11 @@ force_reload_kmod () {
     if test -e /sys/module/openvswitch_mod; then
         action "Removing openvswitch module" rmmod openvswitch_mod
     elif test -e /sys/module/openvswitch; then
+        # extract all modules using openvswitch and remove them first.
+        depend_mods=$(lsmod | awk '$1 == "openvswitch" {print $4}' | tr ',' ' ')
+        for __mod in ${depend_mods}; do
+            action "Removing ${__mod} module" rmmod ${__mod}
+        done
         action "Removing openvswitch module" rmmod openvswitch
     fi
 
-- 
1.7.9.5




More information about the dev mailing list