1
From 8b74c55e186a923506559e324224bc86885e0917 Mon Sep 17 00:00:00 2001
2
From: Ben Pfaff <blp@nicira.com>
3
Date: Mon, 6 Aug 2012 13:23:04 -0700
4
Subject: [PATCH] ovs-ctl: Add support for newer name for Open vSwitch kernel module.
6
Open vSwitch 1.4 and later is compatible with the upstream Linux kernel
7
module but the init scripts hadn't been adapted to work with the upstream
11
Signed-off-by: Ben Pfaff <blp@nicira.com>
13
utilities/ovs-ctl.in | 41 +++++++++++++++++++++++++++++++----------
14
1 files changed, 31 insertions(+), 10 deletions(-)
16
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
17
index 527bd60..41edb93 100755
18
--- a/utilities/ovs-ctl.in
19
+++ b/utilities/ovs-ctl.in
20
@@ -30,12 +30,32 @@ done
25
+ # First try the name suffixed with _mod, because this is the
26
+ # original name used for the out-of-tree kernel module. If the
27
+ # user has a module by that name, then it means that he went to
28
+ # some trouble to build it, so presumably he wants to use it.
30
+ # Then try the name without the _mod suffix, the upstream Linux
31
+ # kernel module name and the name used by later versions of Open
33
+ modprobe ${1}_mod || modprobe $1
36
insert_openvswitch_mod_if_required () {
37
# If openvswitch_mod is already loaded then we're done.
38
- test -e /sys/module/openvswitch_mod && return 0
39
+ if test -e /sys/module/openvswitch_mod || test -e /sys/module/openvswitch
44
+ if (modprobe --dry-run openvswitch_mod && \
45
+ modprobe --dry-run openvswitch) 2>/dev/null; then
46
+ log_warning_msg "openvswitch_mod.ko and openvswitch.ko modules are both available. openvswitch_mod.ko will be preferred."
49
# Load openvswitch_mod. If that's successful then we're done.
50
- action "Inserting openvswitch module" modprobe openvswitch_mod && return 0
51
+ action "Inserting openvswitch module" do_modprobe openvswitch && return 0
53
# If the bridge module is loaded, then that might be blocking
54
# openvswitch_mod. Try to unload it, if there are no bridges.
55
@@ -48,12 +68,12 @@ insert_openvswitch_mod_if_required () {
56
action "removing bridge module" rmmod bridge || return 1
58
# Try loading openvswitch_mod again.
59
- action "Inserting openvswitch module" modprobe openvswitch_mod
60
+ action "Inserting openvswitch module" do_modprobe openvswitch
63
insert_brcompat_mod_if_required () {
64
test -e /sys/module/brcompat_mod && return 0
65
- action "Inserting brcompat module" modprobe brcompat_mod
66
+ action "Inserting brcompat module" do_modprobe brcompat
69
insert_mod_if_required () {
70
@@ -287,12 +307,13 @@ force_reload_kmod () {
71
action "Removing datapath: $dp" ovs-dpctl del-dp "$dp"
74
- if test -e /sys/module/brcompat_mod; then
75
- action "Removing brcompat module" rmmod brcompat_mod
77
- if test -e /sys/module/openvswitch_mod; then
78
- action "Removing openvswitch module" rmmod openvswitch_mod
80
+ for module in brcompat openvswitch; do
81
+ for fullname in ${module}_mod $module; do
82
+ if test -e /sys/module/$fullname; then
83
+ action "Removing $module module" rmmod $fullname