[ovs-dev] [PATCH 1/3] ovs-ctl: Add load-kmod sub-command

Simon Horman horms at verge.net.au
Tue Sep 6 00:35:47 UTC 2011


On Debian there is a need for the init scripts to die gracefully
if module insertion fails. In such a case it is desirable to print
some sort of informative message.

By adding the load-kmod sub-command to ovs-ctl init scripts
may try to load modules and take appropriate action on failure
or then try to start the daemons.
---
 utilities/ovs-ctl.in |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index c102419..5d0f995 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -56,6 +56,13 @@ insert_brcompat_mod_if_required () {
     action "Inserting brcompat module" modprobe brcompat_mod
 }
 
+insert_mod_if_required () {
+    insert_openvswitch_mod_if_required || return 1
+    if test X"$BRCOMPAT" = Xyes; then
+        insert_brcompat_mod_if_required || return 1
+    fi
+}
+
 ovs_vsctl () {
     ovs-vsctl --no-wait --timeout=5 "$@"
 }
@@ -160,10 +167,7 @@ start () {
         ulimit -Sc 67108864
     fi
 
-    insert_openvswitch_mod_if_required || return 1
-    if test X"$BRCOMPAT" = Xyes; then
-        insert_brcompat_mod_if_required || return 1
-    fi
+    insert_mod_if_required || return 1
 
     if daemon_is_running ovsdb-server; then
 	log_success_msg "ovsdb-server is already running"
@@ -394,6 +398,7 @@ Commands:
   stop               stop Open vSwitch daemons
   status             check whether Open vSwitch daemons are running
   version            print versions of Open vSwitch daemons
+  load-kmod          insert modules if not already present
   force-reload-kmod  save OVS network device state, stop OVS, unload kernel
                      module, reload kernel module, start OVS, restore state
   enable-protocol    enable protocol specified in options with iptables
@@ -418,7 +423,7 @@ Less important options for "start" and "force-reload-kmod":
   --ovs-vswitchd-priority=NICE   set ovs-vswitchd's niceness (default: $OVS_VSWITCHD_PRIORITY)
   --ovs-brcompatd-priority=NICE  set ovs-brcompatd's niceness (default: $OVS_BRCOMPATD_PRIORITY)
 
-Options for "start", "force-reload-kmod", "status", and "version":
+Options for "start", "force-reload-kmod", "load-kmod", "status", and "version":
   --brcompat         enable Linux bridge compatibility module and daemon
 
 File location options:
@@ -548,6 +553,9 @@ case $command in
     force-reload-kmod)
 	force_reload_kmod
         ;;
+    load-kmod)
+	insert_mod_if_required
+        ;;
     enable-protocol)
         enable_protocol
         ;;
-- 
1.7.5.4




More information about the dev mailing list