[ovs-dev] [PATCH 2/3] Debian: fail gracefully if modules can't be loaded

Simon Horman horms at verge.net.au
Wed Sep 7 01:10:31 UTC 2011


When starting openvswtich-vswitch fail gracefully if
modules can't be loaded. Otherwise package install will
fail if the openvswitch_mod modules is not available.

This resolves a regression between 1.1.1 and 1.2.1.

This makes use of the load-kmod subcommand which was
added to ovs-ctl for this purpose.

---

v2
* Avoid using if !, as it may have portability problems
* Avoid duplicated 'echo "/usr/share/doc..."'
---
 debian/openvswitch-switch.init |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init
index 3487afb..c1cff31 100755
--- a/debian/openvswitch-switch.init
+++ b/debian/openvswitch-switch.init
@@ -42,6 +42,18 @@ ovs_ctl () {
 }
 
 start () {
+    if ovs_ctl load-kmod; then
+        :
+    else
+        echo "Module has probably not been built for this kernel."
+        if test -d /usr/share/doc/openvswitch-datapath-source; then
+            echo "For instructions, read"
+        else
+            echo "Install the openvswitch-datapath-source package, then read"
+        fi
+        echo "/usr/share/doc/openvswitch-datapath-source/README.Debian"
+        exit 0
+    fi
     set ovs_ctl ${1-start} --system-id=random
     if test X"$FORCE_COREFILES" != X; then
 	set "$@" --force-corefiles="$FORCE_COREFILES"
-- 
1.7.5.4




More information about the dev mailing list