From: Simon Horman Date: Wed, 7 Sep 2011 01:10:30 +0000 (+0900) Subject: ovs-ctl: Add load-kmod command X-Git-Tag: v1.3.0~353 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=da3db88f3a7993a8e2a118542704e0babbe93fac;p=sliver-openvswitch.git ovs-ctl: Add load-kmod command 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. --- diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8 index 8d8088adf..0e4116206 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 c10241903..8788e4a3e 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 ;;