~james-page/ubuntu/raring/openvswitch/lts-raring-backport-dkms

« back to all changes in this revision

Viewing changes to debian/patches/bug-684057-ovs-ctl-Add-support-for-newer-module-name.patch

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-08-07 16:00:53 UTC
  • mfrom: (5.1.25 sid)
  • Revision ID: package-import@ubuntu.com-20120807160053-nj4pgmkn6bp8t4md
Tags: 1.4.2+git20120612-9ubuntu1
* Merge from Debian unstable; remaining changes:
  - d/control: Disable openvswitch-datapath-dkms package.
* Dropped changes:
  - d/patches/kernel_3.5_support.patch: Superceded by 
    bug-684057-ovs-ctl-Add-support-for-newer-module-name.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
5
 
 
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
 
8
module name.
 
9
 
 
10
Debian bug #684057.
 
11
Signed-off-by: Ben Pfaff <blp@nicira.com>
 
12
---
 
13
 utilities/ovs-ctl.in |   41 +++++++++++++++++++++++++++++++----------
 
14
 1 files changed, 31 insertions(+), 10 deletions(-)
 
15
 
 
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
 
21
 ## start ##
 
22
 ## ----- ##
 
23
 
 
24
+do_modprobe () {
 
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.
 
29
+    #
 
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
 
32
+    # vSwitch.
 
33
+    modprobe ${1}_mod || modprobe $1
 
34
+} 2>/dev/null
 
35
+
 
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
 
40
+    then
 
41
+        return 0
 
42
+    fi
 
43
+
 
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."
 
47
+    fi
 
48
 
 
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
 
52
 
 
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
 
57
 
 
58
     # Try loading openvswitch_mod again.
 
59
-    action "Inserting openvswitch module" modprobe openvswitch_mod
 
60
+    action "Inserting openvswitch module" do_modprobe openvswitch
 
61
 }
 
62
 
 
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
 
67
 }
 
68
 
 
69
 insert_mod_if_required () {
 
70
@@ -287,12 +307,13 @@ force_reload_kmod () {
 
71
         action "Removing datapath: $dp" ovs-dpctl del-dp "$dp"
 
72
     done
 
73
 
 
74
-    if test -e /sys/module/brcompat_mod; then
 
75
-        action "Removing brcompat module" rmmod brcompat_mod
 
76
-    fi
 
77
-    if test -e /sys/module/openvswitch_mod; then
 
78
-        action "Removing openvswitch module" rmmod openvswitch_mod
 
79
-    fi
 
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
 
84
+            fi
 
85
+        done
 
86
+    done
 
87
 
 
88
     start
 
89
 
 
90
-- 
 
91
1.7.2.5
 
92