I'm pondering adding a way to disable brcompat. This would keep from
building it and strip it from config templates, init scripts, ovs-ctl,
etc... Here's a quick hack to give an idea.
Any thoughts whether this is worth pursuing, and if so ideas on best way
to do it?
thanks,
-chris
diff --git a/Makefile.am b/Makefile.am
index dc4a609..6d05df6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -90,6 +90,12 @@ noinst_HEADERS += $(EXTRA_DIST)
ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
ro_shell = printf '\043 Generated automatically -- do not modify! -*-
buffer-read-only: t -*-\n'
+if BUILD_BRCOMPAT
+ brcompat_sed = -e 's,[@]BUILD_BRCOMPAT[@],,g'
+else
+ brcompat_sed = -e '/[@]BUILD_BRCOMPAT[@]/d'
+endif
+
SUFFIXES += .in
.in:
$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
@@ -102,6 +108,7 @@ SUFFIXES += .in
-e 's,[@]VERSION[@],$(VERSION),g' \
-e 's,[@]BUILDNR[@],$(BUILDNR),g' \
-e 's,[@]OVSKMOD[@],$(OVSKMOD),g' \
+ $(brcompat_sed) \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
diff --git a/configure.ac b/configure.ac
index 7e4fdb7..cd6e01d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,7 @@ OVS_CHECK_SOCKET_LIBS
OVS_CHECK_LINKER_SECTIONS
OVS_CHECK_XENSERVER_VERSION
OVS_CHECK_GROFF
+OVS_CHECK_BRCOMPAT
OVS_ENABLE_OPTION([-Wall])
OVS_ENABLE_OPTION([-Wno-sign-compare])
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 9b2a5ba..ee972fb 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -354,3 +354,18 @@ AC_DEFUN([OVS_CHECK_GROFF],
ovs_cv_groff=no
fi])
AM_CONDITIONAL([HAVE_GROFF], [test "$ovs_cv_groff" = yes])])
+
+dnl Checks for --disable-brcompat and undefines BUILD_BRCOMPAT if it is
specified.
+AC_DEFUN([OVS_CHECK_BRCOMPAT],
+ [AC_ARG_ENABLE(
+ [brcompat],
+ [AC_HELP_STRING([--disable-brcompat],
+ [Disable building brcompat])],
+ [case "${enableval}" in
+ (yes) brcompat=true ;;
+ (no) brcompat=false ;;
+ (*) AC_MSG_ERROR([bad value ${enableval} for --enable-brcompat]) ;;
+ esac],
+ [brcompat=true])
+ AM_CONDITIONAL([BUILD_BRCOMPAT], [test x$brcompat = xtrue])])
+
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 07b9f32..d14764c 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -37,34 +37,34 @@ insert_openvswitch_mod_if_required () {
# Load @OVSKMOD@. If that's successful then we're done.
action "Inserting openvswitch module" modprobe @OVSKMOD@ && return 0
- # If the bridge module is loaded, then that might be blocking
- # @OVSKMOD@. Try to unload it, if there are no bridges.
- test -e /sys/module/bridge || return 1
- bridges=`echo /sys/class/net/*/bridge | sed
's,/sys/class/net/,,g;s,/bridge,,g'`
- if test "$bridges" != "*"; then
- log_warning_msg "not removing bridge module because bridges exist
($bridges)"
- return 1
- fi
- action "removing bridge module" rmmod bridge || return 1
-
- # Try loading @OVSKMOD@ again.
- action "Inserting openvswitch module" modprobe @OVSKMOD@
+@BUILD_BRCOMPAT@ # If the bridge module is loaded, then that might be
blocking
+@BUILD_BRCOMPAT@ # @OVSKMOD@. Try to unload it, if there are no bridges.
+@BUILD_BRCOMPAT@ test -e /sys/module/bridge || return 1
+@BUILD_BRCOMPAT@ bridges=`echo /sys/class/net/*/bridge | sed
's,/sys/class/net/,,g;s,/bridge,,g'`
+@BUILD_BRCOMPAT@ if test "$bridges" != "*"; then
+@BUILD_BRCOMPAT@ log_warning_msg "not removing bridge module because
bridges exist ($bridges)"
+@BUILD_BRCOMPAT@ return 1
+@BUILD_BRCOMPAT@ fi
+@BUILD_BRCOMPAT@ action "removing bridge module" rmmod bridge || return 1
+@BUILD_BRCOMPAT@
+@BUILD_BRCOMPAT@ # Try loading @OVSKMOD@ again.
+@BUILD_BRCOMPAT@ action "Inserting openvswitch module" modprobe @OVSKMOD@
}
-insert_brcompat_mod_if_required () {
- if test -e /sys/module/bridge; then
- log_warning_msg "bridge module is loaded, not loading brcompat_mod"
- return 1
- fi
- test -e /sys/module/brcompat_mod && return 0
- action "Inserting brcompat module" modprobe brcompat_mod
-}
+@BUILD_BRCOMPAT@insert_brcompat_mod_if_required () {
+@BUILD_BRCOMPAT@ if test -e /sys/module/bridge; then
+@BUILD_BRCOMPAT@ log_warning_msg "bridge module is loaded, not loading
brcompat_mod"
+@BUILD_BRCOMPAT@ return 1
+@BUILD_BRCOMPAT@ fi
+@BUILD_BRCOMPAT@ test -e /sys/module/brcompat_mod && return 0
+@BUILD_BRCOMPAT@ action "Inserting brcompat module" modprobe brcompat_mod
+@BUILD_BRCOMPAT@}
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
+@BUILD_BRCOMPAT@ if test X"$BRCOMPAT" = Xyes; then
+@BUILD_BRCOMPAT@ insert_brcompat_mod_if_required || return 1
+@BUILD_BRCOMPAT@ fi
}
ovs_vsctl () {
@@ -217,13 +217,13 @@ start () {
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
+@BUILD_BRCOMPAT@ if daemon_is_running ovs-brcompatd; then
+@BUILD_BRCOMPAT@ log_success_msg "ovs-brcompatd is already running"
+@BUILD_BRCOMPAT@ elif test X"$BRCOMPAT" = Xyes; then
+@BUILD_BRCOMPAT@ set ovs-brcompatd
+@BUILD_BRCOMPAT@ set "$@" -vANY:CONSOLE:EMER -vANY:SYSLOG:ERR
-vANY:FILE:INFO
+@BUILD_BRCOMPAT@ start_daemon "$OVS_BRCOMPATD_PRIORITY" "$@"
+@BUILD_BRCOMPAT@ fi
}
## ---- ##
@@ -231,7 +231,7 @@ start () {
## ---- ##
stop () {
- stop_daemon ovs-brcompatd
+@BUILD_BRCOMPAT@ stop_daemon ovs-brcompatd
stop_daemon ovs-vswitchd
stop_daemon ovsdb-server
}
@@ -286,9 +286,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
+@BUILD_BRCOMPAT@ if test -e /sys/module/brcompat_mod; then
+@BUILD_BRCOMPAT@ action "Removing brcompat module" rmmod brcompat_mod
+@BUILD_BRCOMPAT@ fi
if test -e /sys/module/@OVSKMOD@; then
action "Removing openvswitch module" rmmod @OVSKMOD@
fi
@@ -361,14 +361,14 @@ set_defaults () {
SYSTEM_ID=
DELETE_BRIDGES=no
- BRCOMPAT=no
+@BUILD_BRCOMPAT@ BRCOMPAT=no
DAEMON_CWD=/
FORCE_COREFILES=yes
MLOCKALL=yes
OVSDB_SERVER_PRIORITY=-10
OVS_VSWITCHD_PRIORITY=-10
- OVS_BRCOMPATD_PRIORITY=-10
+@BUILD_BRCOMPAT@ OVS_BRCOMPATD_PRIORITY=-10
DB_FILE=$etcdir/conf.db
DB_SOCK=$rundir/db.sock
@@ -432,10 +432,10 @@ Less important options for "start" and
"force-reload-kmod":
--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)
+@BUILD_BRCOMPAT@ --ovs-brcompatd-priority=NICE set ovs-brcompatd's niceness
(default: $OVS_BRCOMPATD_PRIORITY)
Options for "start", "force-reload-kmod", "load-kmod", "status", and "version":
- --brcompat enable Linux bridge compatibility module and daemon
+@BUILD_BRCOMPAT@ --brcompat enable Linux bridge compatibility module
and daemon
File location options:
--db-file=FILE database file name (default: $DB_FILE)
@@ -480,9 +480,9 @@ set_option () {
daemons () {
echo ovsdb-server ovs-vswitchd
- if test X"$BRCOMPAT" = Xyes; then
- echo ovs-brcompatd
- fi
+@BUILD_BRCOMPAT@ if test X"$BRCOMPAT" = Xyes; then
+@BUILD_BRCOMPAT@ echo ovs-brcompatd
+@BUILD_BRCOMPAT@ fi
}
set_defaults
diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk
index 8319c93..a8aadd2 100644
--- a/vswitchd/automake.mk
+++ b/vswitchd/automake.mk
@@ -1,10 +1,13 @@
sbin_PROGRAMS += vswitchd/ovs-vswitchd
+if BUILD_BRCOMPAT
+ ovs_brcompatd_8 = vswitchd/ovs-brcompatd.8
+endif
man_MANS += \
vswitchd/ovs-vswitchd.8 \
- vswitchd/ovs-brcompatd.8
+ $(ovs_brcompatd_8)
DISTCLEANFILES += \
vswitchd/ovs-vswitchd.8 \
- vswitchd/ovs-brcompatd.8
+ $(ovs_brcompatd_8)
vswitchd_ovs_vswitchd_SOURCES = \
vswitchd/bridge.c \
@@ -24,6 +27,7 @@ vswitchd_ovs_vswitchd_LDADD = \
EXTRA_DIST += vswitchd/INTERNALS
MAN_ROOTS += vswitchd/ovs-vswitchd.8.in
+if BUILD_BRCOMPAT
if HAVE_NETLINK
sbin_PROGRAMS += vswitchd/ovs-brcompatd
vswitchd_ovs_brcompatd_SOURCES = \
@@ -33,6 +37,7 @@ vswitchd_ovs_brcompatd_SOURCES = \
vswitchd_ovs_brcompatd_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
endif
MAN_ROOTS += vswitchd/ovs-brcompatd.8.in
+endif
# vswitch schema and IDL
OVSIDL_BUILT += \
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev