[ovs-dev] [PATCH 1/3] ovs-ctl: Add load-kmod command
Simon Horman
horms at verge.net.au
Wed Sep 7 01:10:30 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.
---
v2
* Document load-kmod in ovs-ctl.8
---
utilities/ovs-ctl.8 | 18 ++++++++++++++++++
utilities/ovs-ctl.in | 18 +++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8
index 8d8088a..0e41162 100644
--- a/utilities/ovs-ctl.8
+++ b/utilities/ovs-ctl.8
@@ -27,6 +27,10 @@ ovs\-ctl \- OVS startup helper script
\fBovs\-ctl version
.br
\fBovs\-ctl
+[\fIoptions\fR]
+\fBload\-kmod\fR
+.br
+\fBovs\-ctl
\fB\-\-system\-id=random\fR|\fIuuid\fR
[\fIoptions\fR]
\fBforce\-reload\-kmod\fR
@@ -263,6 +267,20 @@ have to be restarted after completing the above procedure.
\fBforce\-kmod\-reload\fR internally stops and starts OVS, so it
accepts all of the options accepted by the \fBstart\fR command.
.
+.SH "The ``load\-kmod'' command"
+.
+.PP
+The \fBload\-kmod\fR command loads the openvswitch kernel modules if
+they are not already loaded. This operation also occurs as part of
+the \fBstart\fR command. The motivation for providing the \fBload\-kmod\fR
+command is to allow errors when loading modules to be handled separatetly
+from other errors that may occur when running the \fBstart\fR command.
+.
+.PP
+By default the \fBload\-kmod\fR command attempts to load the
+openvswitch_mod kernel module. If the \fB\-\-brcompat\fR option is
+specified then the brcompat_mod kernel module is also loaded.
+.
.SH "The ``enable\-protocol'' command"
.
.PP
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index c102419..8788e4a 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