summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-07-18 13:51:12 -0700
committerBen Pfaff <blp@nicira.com>2011-07-26 10:37:28 -0700
commit9fc47ed759a82391070dfbda0e06592eb0a18391 (patch)
tree6450ed953d2779ebde9a4dbfdc08873b4b315e87 /utilities
parent48a695011b3dda6b68e9a07824d649aa6b8eb2ef (diff)
downloadopenvswitch-9fc47ed759a82391070dfbda0e06592eb0a18391.tar.gz
debian: Add support for bridge compatibility.
This adds support for bridge compatibility to the generic Open vSwitch init scripts and to the Debian packaging. See https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/808224.
Diffstat (limited to 'utilities')
-rw-r--r--utilities/ovs-ctl.863
-rwxr-xr-xutilities/ovs-ctl.in68
2 files changed, 101 insertions, 30 deletions
diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8
index 885771c98..8d8088adf 100644
--- a/utilities/ovs-ctl.8
+++ b/utilities/ovs-ctl.8
@@ -65,30 +65,41 @@ bridge module and tries loading the Open vSwitch kernel module again.
(This is because the Open vSwitch kernel module cannot coexist with
the Linux bridge module before 2.6.37.)
.
+.IP 2.
+If \fB\-\-brcompat\fR was specified, loads the Open vSwitch bridge
+compatibility module.
+.
.PP
The \fBstart\fR command skips the following steps if
\fBovsdb\-server\fR is already running:
-.IP 2.
+.IP 3.
If the Open vSwitch database file does not exist, it creates it.
If the database does exist, but it has an obsolete version, it
upgrades it to the latest schema.
.
-.IP 3.
+.IP 4.
Starts \fBovsdb-server\fR.
.
-.IP 4.
+.IP 5.
Initializes a few values inside the database.
.
-.IP 5.
+.IP 6.
If the \fB\-\-delete\-bridges\fR option was used, deletes all of the
bridges from the database.
.
.PP
The \fBstart\fR command skips the following step if
\fBovs\-vswitchd\fR is already running:
-.IP 6.
+.IP 7.
Starts \fBovs\-vswitchd\fR.
.
+.PP
+The \fBstart\fR command skips the following step if
+\fBovs\-brcompatd\fR is already running or if \fB\-\-brcompat\fR is
+not specified:
+.IP 8.
+Starts \fBovs\-brcompatd\fR.
+.
.SS "Options"
.PP
Several command-line options influence the \fBstart\fR command's
@@ -181,9 +192,13 @@ Overrides the file name for the OVS database schema.
.SH "The ``stop'' command"
.
.PP
-The \fBstart\fR command shuts down Open vSwitch. If
-\fBovs\-vswitchd\fR is running, kills it and waits for it to
-terminate, then it does the same for \fBovsdb\-server\fR.
+The \fBstop\fR command shuts down Open vSwitch. It kills any running
+\fBovs\-brcompatd\fR, \fBovs\-vswitchd\fR, or \fBovsdb\-server\fR
+daemons and waits for them to terminate.
+.
+.PP
+The \fBstop\fR command does not unload the Open vSwitch kernel
+modules.
.
.PP
This command does nothing and finishes successfully if the OVS daemons
@@ -192,15 +207,18 @@ aren't running.
.SH "The ``status'' command"
.
.PP
-The \fBstatus\fR command checks whether the OVS daemons are running
-and prints messages with that information. It exits with status 0 if
+The \fBstatus\fR command checks whether the OVS daemons
+\fBovs-vswitchd\fR and \fBovsdb\-server\fR are running and prints
+messages with that information. If \fB\-\-brcompat\fR is specified,
+it also checks for \fBovs\-brcompatd\fR. It exits with status 0 if
the daemons are running, 1 otherwise.
.
.SH "The ``version'' command"
.
.PP
The \fBversion\fR command runs \fBovsdb\-server \-\-version\fR and
-\fBovs\-vswitchd \-\-version\fR.
+\fBovs\-vswitchd \-\-version\fR. If \fB\-\-brcompat\fR is specified,
+it also runs \fBovs\-brcompatd \-\-version\fR.
.
.SH "The ``force\-reload\-kmod'' command"
.
@@ -224,11 +242,13 @@ listed in step 1, including IP and IPv6 addresses and routing table
entries.
.
.IP 4.
-Unloads the Open vSwitch kernel module.
+Unloads the Open vSwitch kernel module (including the bridge
+compatibility module if it is loaded).
.
.IP 5.
Starts OVS back up, as if by a call to \fBovs\-ctl start\fR. This
-reloads the kernel module and restarts the OVS daemons.
+reloads the kernel module and restarts the OVS daemons (including
+\fBovs\-brcompatd\fR, if \fB\-\-brcompat\fR is specified).
.
.IP 6.
Restores the kernel configuration state that was saved in step 3.
@@ -289,6 +309,21 @@ and allowed only with \fB\-\-protocol=tcp\fR or
.
Prints a usage message and exits successfully.
.
+.SH "OPTIONS"
+.PP
+In addition to the options listed for each command above, this option
+controls the behavior of several of \fBovs\-ctl\fR's commands.
+.
+.IP "\fB\-\-brcompat\fR"
+By default, \fBovs\-ctl\fR does not load the Open vSwitch bridge
+compatibility module and does not start or check the status or report
+the version of the \fBovs\-brcompatd\fR daemon. This option enables
+all of those behaviors.
+.
+.IP
+The \fBstop\fR command always stops \fBovs\-brcompatd\fR, if it is
+running, regardless of this option.
+.
.SH "EXIT STATUS"
.
\fBovs\-ctl\fR exits with status 0 on success and nonzero on failure.
@@ -356,5 +391,5 @@ distribution are good examples of how to use \fBovs\-ctl\fR.
.
.SH "SEE ALSO"
.
-\fBREADME\fR, \fBINSTALL.LINUX\fR, \fBovsdb\-server\fR(8),
+\fBREADME\fR, \fBINSTALL.Linux\fR, \fBovsdb\-server\fR(8),
\fBovs\-vswitchd\fR(8).
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index da6ea814d..01741e755 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -30,7 +30,7 @@ done
## start ##
## ----- ##
-insert_modules_if_required () {
+insert_openvswitch_mod_if_required () {
# If openvswitch_mod is already loaded then we're done.
test -e /sys/module/openvswitch_mod && return 0
@@ -51,6 +51,11 @@ insert_modules_if_required () {
action "Inserting openvswitch module" modprobe openvswitch_mod
}
+insert_brcompat_mod_if_required () {
+ test -e /sys/module/brcompat_mod && return 0
+ action "Inserting brcompat module" modprobe brcompat_mod
+}
+
ovs_vsctl () {
ovs-vsctl --no-wait --timeout=5 "$@"
}
@@ -155,7 +160,10 @@ start () {
ulimit -Sc 67108864
fi
- insert_modules_if_required || return 1
+ insert_openvswitch_mod_if_required || return 1
+ if test X"$BRCOMPAT" = Xyes; then
+ insert_brcompat_mod_if_required || return 1
+ fi
if daemon_is_running ovsdb-server; then
log_success_msg "ovsdb-server is already running"
@@ -199,6 +207,14 @@ start () {
fi
start_daemon "$OVS_VSWITCHD_PRIORITY" "$@"
fi
+
+ if daemon_is_running ovs-brcompatd; then
+ log_success_msg "ovs-brcompatd is already running"
+ elif test X"$BRCOMPAT" = Xyes; then
+ set ovs-brcompatd
+ set "$@" -vANY:CONSOLE:EMER -vANY:SYSLOG:ERR -vANY:FILE:INFO
+ start_daemon "$OVS_BRCOMPATD_PRIORITY" "$@"
+ fi
}
## ---- ##
@@ -206,6 +222,7 @@ start () {
## ---- ##
stop () {
+ stop_daemon ovs-brcompatd
stop_daemon ovs-vswitchd
stop_daemon ovsdb-server
}
@@ -260,6 +277,9 @@ force_reload_kmod () {
action "Removing datapath: $dp" ovs-dpctl del-dp "$dp"
done
+ if test -e /sys/module/brcompat_mod; then
+ action "Removing brcompat module" rmmod brcompat_mod
+ fi
if test -e /sys/module/openvswitch_mod; then
action "Removing openvswitch module" rmmod openvswitch_mod
fi
@@ -332,12 +352,14 @@ set_defaults () {
SYSTEM_ID=
DELETE_BRIDGES=no
+ BRCOMPAT=no
DAEMON_CWD=/
FORCE_COREFILES=yes
MLOCKALL=yes
OVSDB_SERVER_PRIORITY=-10
OVS_VSWITCHD_PRIORITY=-10
+ OVS_BRCOMPATD_PRIORITY=-10
DB_FILE=$etcdir/conf.db
DB_SOCK=$rundir/db.sock
@@ -377,33 +399,34 @@ Commands:
enable-protocol enable protocol specified in options with iptables
help display this help message
-One of the following options should be specified when starting Open vSwitch:
+One of the following options is required for "start" and "force-reload-kmod":
--system-id=UUID set specific ID to uniquely identify this system
--system-id=random use a random but persistent UUID to identify this system
-Other important options for starting Open vSwitch:
+Other important options for "start" and "force-reload-kmod":
--system-type=TYPE set system type (e.g. "XenServer")
--system-version=VERSION set system version (e.g. "5.6.100-39265p")
--external-id="key=value"
add given key-value pair to Open_vSwitch external-ids
--delete-bridges delete all bridges just before starting ovs-vswitchd
-Less important options for starting Open vSwitch:
- --daemon-cwd=DIR current working directory for OVS daemons (default: $DAEMON_CWD)
- --no-force-corefiles
- do not forcibly enable core dumps for OVS daemons
- --no-mlockall do not lock all of ovs-vswitchd into memory
- --ovsdb-server-priority=NICE
- set ovsdb-server's niceness (default: $OVSDB_SERVER_PRIORITY)
- --ovs-vswitchd-priority=NICE
- set ovs-vswitchd's niceness (default: $OVS_VSWITCHD_PRIORITY)
+Less important options for "start" and "force-reload-kmod":
+ --daemon-cwd=DIR set working dir for OVS daemons (default: $DAEMON_CWD)
+ --no-force-corefiles do not force on core dumps for OVS daemons
+ --no-mlockall do not lock all of ovs-vswitchd into memory
+ --ovsdb-server-priority=NICE set ovsdb-server's niceness (default: $OVSDB_SERVER_PRIORITY)
+ --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":
+ --brcompat enable Linux bridge compatibility module and daemon
File location options:
--db-file=FILE database file name (default: $DB_FILE)
--db-sock=SOCKET JSON-RPC socket name (default: $DB_SOCK)
--db-schema=FILE database schema file name (default: $DB_SCHEMA)
-Options for enable-protocol:
+Options for "enable-protocol":
--protocol=PROTOCOL protocol to enable with iptables (default: gre)
--sport=PORT source port to match (for tcp or udp protocol)
--dport=PORT ddestination port to match (for tcp or udp protocol)
@@ -439,6 +462,13 @@ set_option () {
eval $var=\$value
}
+daemons () {
+ echo ovsdb-server ovs-vswitchd
+ if test X"$BRCOMPAT" = Xyes; then
+ echo ovs-brcompatd
+ fi
+}
+
set_defaults
extra_ids=
command=
@@ -504,10 +534,16 @@ case $command in
stop
;;
status)
- daemon_status ovsdb-server && daemon_status ovs-vswitchd
+ rc=0
+ for daemon in `daemons`; do
+ daemon_status $daemon || rc=$?
+ done
+ exit $rc
;;
version)
- ovsdb-server --version && ovs-vswitchd --version
+ for daemon in `daemons`; do
+ $daemon --version
+ done
;;
force-reload-kmod)
force_reload_kmod