Skip to content

Commit

Permalink
debian: Add support for bridge compatibility.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blp committed Jul 26, 2011
1 parent 48a6950 commit 9fc47ed
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 35 deletions.
1 change: 1 addition & 0 deletions debian/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/files
/nicira-switch
/openvswitch
/openvswitch-brcompat
/openvswitch-common
/openvswitch-common.copyright
/openvswitch-controller
Expand Down
3 changes: 3 additions & 0 deletions debian/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ EXTRA_DIST += \
debian/copyright \
debian/copyright.in \
debian/dirs \
debian/openvswitch-brcompat.install \
debian/openvswitch-brcompat.manpages \
debian/openvswitch-brcompat.postinst \
debian/openvswitch-common.dirs \
debian/openvswitch-common.install \
debian/openvswitch-common.manpages \
Expand Down
15 changes: 15 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ Description: Open vSwitch controller implementation
.
Open vSwitch is a full-featured software-based Ethernet switch.

Package: openvswitch-brcompat
Architecture: linux-any
Depends: ${shlibs:Depends}, openvswitch-switch (= ${binary:Version})
Recommends: bridge-utils
Description: Open vSwitch bridge compatibility support
openvswitch-brcompat provides a way for applications that use the
Linux bridge to gradually migrate to Open vSwitch. Programs that
ordinarily control the Linux bridge module, such as "brctl", instead
control the Open vSwitch kernel-based switch.
.
Once this package is installed, adding BRCOMPAT=yes in
/etc/default/openvswitch-switch enables bridge compatibility.
.
Open vSwitch is a full-featured software-based Ethernet switch.

Package: openvswitch-dbg
Section: debug
Architecture: linux-any
Expand Down
1 change: 1 addition & 0 deletions debian/openvswitch-brcompat.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_debian/vswitchd/ovs-brcompatd usr/sbin
1 change: 1 addition & 0 deletions debian/openvswitch-brcompat.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_debian/vswitchd/ovs-brcompatd.8
15 changes: 15 additions & 0 deletions debian/openvswitch-brcompat.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# If openvswitch-switch is installed, and then later openvswitch-brcompat is
# installed, make sure that ovs-brcompatd starts.
if test X"$1" = Xconfigure && \
test -x /etc/init.d/openvswitch-switch && \
test -e /var/run/openvswitch/ovs-vswitchd.pid; then
invoke-rc.d openvswitch-switch start || exit $?
fi

#DEBHELPER#

exit 0


22 changes: 17 additions & 5 deletions debian/openvswitch-switch.init
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,34 @@

(test -x /usr/sbin/ovs-vswitchd && test -x /usr/bin/ovsdb-server) || exit 0

. /usr/share/openvswitch/scripts/ovs-lib.sh
test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch

ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl
if test X"$BRCOMPAT" = Xyes && test ! -x /usr/sbin/ovs-brcompatd; then
BRCOMPAT=no
log_warning_msg "ovs-brcompatd missing, disabling bridge compatibility"
fi

ovs_ctl () {
set /usr/share/openvswitch/scripts/ovs-ctl "$@"
if test X"$BRCOMPAT" = Xyes; then
set "$@" --brcompat
fi
"$@"
}

start () {
set $ovs_ctl ${1-start} --system-id=random
set ovs_ctl ${1-start} --system-id=random
if test X"$FORCE_COREFILES" != X; then
set "$@" --force-corefiles="$FORCE_COREFILES"
fi
"$@" || exit $?

$ovs_ctl --protocol=gre enable-protocol
ovs_ctl --protocol=gre enable-protocol
}

stop () {
$ovs_ctl stop
ovs_ctl stop
}

case $1 in
Expand All @@ -58,7 +70,7 @@ case $1 in
start
;;
status)
$ovs_ctl status
ovs_ctl status
;;
force-reload-kmod)
start force-reload-kmod
Expand Down
4 changes: 4 additions & 0 deletions debian/openvswitch-switch.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

# FORCE_COREFILES: If 'yes' then core files will be enabled.
# FORCE_COREFILES=yes

# BRCOMPAT: If 'yes' and the openvswitch-brcompat package is installed, then
# Linux bridge compatibility will be enabled.
# BRCOMPAT=no
63 changes: 49 additions & 14 deletions utilities/ovs-ctl.8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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).
Loading

0 comments on commit 9fc47ed

Please sign in to comment.