--- INSTALL.RHEL | 61 +++++ Makefile.am | 2 + README | 9 +- rhel/.gitignore | 3 + rhel/automake.mk | 30 +++ rhel/etc_init.d_openvswitch | 96 +++++++ rhel/etc_logrotate.d_openvswitch | 20 ++ rhel/kmodtool-openvswitch-el5.sh | 273 ++++++++++++++++++++ rhel/openvswitch-kmod-rhel5.spec.in | 85 ++++++ rhel/openvswitch-kmod-rhel6.spec.in | 56 ++++ rhel/openvswitch.spec.in | 137 ++++++++++ ...sr_share_openvswitch_scripts_sysconfig.template | 20 ++ 12 files changed, 790 insertions(+), 2 deletions(-) create mode 100644 INSTALL.RHEL create mode 100644 rhel/.gitignore create mode 100644 rhel/automake.mk create mode 100755 rhel/etc_init.d_openvswitch create mode 100644 rhel/etc_logrotate.d_openvswitch create mode 100755 rhel/kmodtool-openvswitch-el5.sh create mode 100644 rhel/openvswitch-kmod-rhel5.spec.in create mode 100644 rhel/openvswitch-kmod-rhel6.spec.in create mode 100644 rhel/openvswitch.spec.in create mode 100644 rhel/usr_share_openvswitch_scripts_sysconfig.template
diff --git a/INSTALL.RHEL b/INSTALL.RHEL new file mode 100644 index 0000000..3558948 --- /dev/null +++ b/INSTALL.RHEL @@ -0,0 +1,61 @@ + How to Install Open vSwitch on Red Hat Enterprise Linux + ======================================================= + +This document describes how to build and install Open vSwitch on a Red +Hat Enterprise Linux (RHEL) host. If you want to install Open vSwitch +on a generic Linux host, see INSTALL.Linux instead. + +We have tested these instructions with RHEL 5.6 and RHEL 6.0. + +Building Open vSwitch for RHEL +------------------------------ + +You may build from an Open vSwitch distribution tarball or from an +Open vSwitch Git tree. + +Before you begin, note the RPM source directory on your version of +RHEL. On RHEL 5, the default RPM source directory is +/usr/src/redhat/SOURCES. On RHEL 6, it is $HOME/rpmbuild/SOURCES. + +1. If you are building from an Open vSwitch Git tree, then you will + need to first create a distribution tarball by running "./boot.sh; + ./configure; make dist" in the Git tree. + +2. Copy the distribution tarball into the RPM source directory. + +3. Unpack the distribution tarball into a temporary directory and "cd" + into the root of the distribution tarball. + +4. To build Open vSwitch userspace, run: + + rpmbuild -bb rhel/openvswitch.spec + + This produces two RPMs: "openvswitch" and "openvswitch-debuginfo". + +5a. On RHEL 5, to build the Open vSwitch kernel module, copy + rhel/kmodtool-openvswitch-el5.sh into the RPM source directory and + run: + + rpmbuild -bb --target=i686-unknown-linux \ + rhel/openvswitch-kmod-rhel5.spec + + You might have to specify a kernel version, e.g.: + + rpmbuild -bb -D "kversion 2.6.18-238.12.1.el5" \ + --target=i686-unknown-linux \ + rhel/openvswitch-kmod-rhel5.spec + + This produces a "kmod-openvswitch" RPM for each kernel variant, + which is usually: "kmod-openvswitch", "kmod-openvswitch-xen", and + "kmod-openvswitch-PAE". + +5b. On RHEL 6, to build the Open vSwitch kernel module, run: + + rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec + + This produces an "kmod-openvswitch" RPM. + +Reporting Bugs +-------------- + +Please report problems to b...@openvswitch.org. diff --git a/Makefile.am b/Makefile.am index 2a1bb35..e01459a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,7 @@ EXTRA_DIST = \ DESIGN \ INSTALL.KVM \ INSTALL.Linux \ + INSTALL.RHEL \ INSTALL.SSL \ INSTALL.XenServer \ INSTALL.bridge \ @@ -157,5 +158,6 @@ include third-party/automake.mk include debian/automake.mk include vswitchd/automake.mk include ovsdb/automake.mk +include rhel/automake.mk include xenserver/automake.mk include python/ovs/automake.mk diff --git a/README b/README index d23636d..352c58c 100644 --- a/README +++ b/README @@ -33,7 +33,8 @@ vSwitch supports the following features: The included Linux kernel module supports Linux 2.6.18 and up, with testing focused on 2.6.32 with Centos and Xen patches. Open vSwitch -also has special support for Citrix XenServer hosts. +also has special support for Citrix XenServer and Red Hat Enterprise +Linux 5.6 hosts. Open vSwitch can also operate, at a cost in performance, entirely in userspace, without assistance from a kernel module. This userspace @@ -58,7 +59,8 @@ The main components of this distribution are: * ovs-dpctl, a tool for configuring the switch kernel module. - * Scripts and specs for building RPMs that allow Open vSwitch + * Scripts and specs for building RPMs for Citrix XenServer and Red + Hat Enterprise Linux 5.6. The XenServer RPMs allow Open vSwitch to be installed on a Citrix XenServer host as a drop-in replacement for its switch, with additional functionality. @@ -94,6 +96,9 @@ read INSTALL.bridge. To build RPMs for installing Open vSwitch on a Citrix XenServer host or resource pool, read INSTALL.XenServer. +To build RPMs for installing Open vSwitch on a Red Hat Enterprise +Linux 5.6 host, read INSTALL.RHEL-5.6. + To use Open vSwitch with KVM on Linux, read INSTALL.Linux, then INSTALL.KVM. diff --git a/rhel/.gitignore b/rhel/.gitignore new file mode 100644 index 0000000..69e69b9 --- /dev/null +++ b/rhel/.gitignore @@ -0,0 +1,3 @@ +openvswitch-kmod-rhel5.spec +openvswitch-kmod-rhel6.spec +openvswitch.spec diff --git a/rhel/automake.mk b/rhel/automake.mk new file mode 100644 index 0000000..d4d5961 --- /dev/null +++ b/rhel/automake.mk @@ -0,0 +1,30 @@ +# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. + +EXTRA_DIST += \ + rhel/automake.mk \ + rhel/etc_init.d_openvswitch \ + rhel/etc_logrotate.d_openvswitch \ + rhel/kmodtool-openvswitch-el5.sh \ + rhel/openvswitch-kmod-rhel5.spec \ + rhel/openvswitch-kmod-rhel5.spec.in \ + rhel/openvswitch-kmod-rhel6.spec \ + rhel/openvswitch-kmod-rhel6.spec.in \ + rhel/openvswitch.spec \ + rhel/openvswitch.spec.in \ + rhel/usr_share_openvswitch_scripts_sysconfig.template + + +$(srcdir)/rhel/openvswitch-kmod-rhel5.spec: rhel/openvswitch-kmod-rhel5.spec.in $(top_builddir)/config.status + sed -e 's,[@]VERSION[@],$(VERSION),g' < $< > $@ + +$(srcdir)/rhel/openvswitch-kmod-rhel6.spec: rhel/openvswitch-kmod-rhel6.spec.in $(top_builddir)/config.status + + sed -e 's,[@]VERSION[@],$(VERSION),g' < $< > $@ + +$(srcdir)/rhel/openvswitch.spec: rhel/openvswitch.spec.in $(top_builddir)/config.status + sed -e 's,[@]VERSION[@],$(VERSION),g' < $< > $@ diff --git a/rhel/etc_init.d_openvswitch b/rhel/etc_init.d_openvswitch new file mode 100755 index 0000000..104be47 --- /dev/null +++ b/rhel/etc_init.d_openvswitch @@ -0,0 +1,96 @@ +#!/bin/sh +# +# openvswitch +# +# chkconfig: 2345 09 91 +# description: Manage Open vSwitch kernel modules and user-space daemons + +# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +### BEGIN INIT INFO +# Provides: openvswitch-switch +# Required-Start: +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Open vSwitch switch +### END INIT INFO + +. /usr/share/openvswitch/scripts/ovs-lib.sh || exit 1 +test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch + +start () { + # Allow GRE traffic. + /sbin/iptables -I INPUT -p gre -j ACCEPT + + set $ovs_ctl ${1-start} + set "$@" --system-id=random + if test X"$FORCE_COREFILES" != X; then + set "$@" --force-corefiles="$FORCE_COREFILES" + fi + if test X"$OVSDB_SERVER_PRIORITY" != X; then + set "$@" --ovsdb-server-priority="$OVSDB_SERVER_PRIORITY" + fi + if test X"$VSWITCHD_PRIORITY" != X; then + set "$@" --ovs-vswitchd-priority="$VSWITCHD_PRIORITY" + fi + if test X"$VSWITCHD_MLOCKALL" != X; then + set "$@" --mlockall="$VSWITCHD_MLOCKALL" + fi + if test ! -e /var/run/openvswitch.booted; then + touch /var/run/openvswitch.booted + set "$@" --delete-bridges + fi + "$@" + + touch /var/lock/subsys/openvswitch +} + +stop () { + $ovs_ctl stop + rm -f /var/lock/subsys/openvswitch +} + +ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl +case $1 in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + reload|force-reload) + # Nothing to do. + ;; + status) + $ovs_ctl status + ;; + version) + $ovs_ctl version + ;; + force-reload-kmod) + start force-reload-kmod + ;; + help) + printf "$0 [start|stop|restart|reload|force-reload|status|version]\n" + ;; + *) + printf "Unknown command: $1\n" + exit 1 + ;; +esac diff --git a/rhel/etc_logrotate.d_openvswitch b/rhel/etc_logrotate.d_openvswitch new file mode 100644 index 0000000..1a08fa9 --- /dev/null +++ b/rhel/etc_logrotate.d_openvswitch @@ -0,0 +1,20 @@ +# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. + +/var/log/openvswitch/*.log { + sharedscripts + missingok + postrotate + # Tell Open vSwitch daemons to reopen their log files + if [ -e /var/run/openvswitch/ovs-vswitchd.pid ]; then + /usr/bin/ovs-appctl -t ovs-vswitchd vlog/reopen + fi + if [ -e /var/run/openvswitch/ovsdb-server.pid ]; then + /usr/bin/ovs-appctl -t ovsdb-server vlog/reopen + fi + endscript +} diff --git a/rhel/kmodtool-openvswitch-el5.sh b/rhel/kmodtool-openvswitch-el5.sh new file mode 100755 index 0000000..ce1d54a --- /dev/null +++ b/rhel/kmodtool-openvswitch-el5.sh @@ -0,0 +1,273 @@ +#!/bin/bash + +# kmodtool - Helper script for building kernel module RPMs +# Copyright (c) 2003-2008 Ville Skyttä <ville.sky...@iki.fi>, +# Thorsten Leemhuis <fed...@leemhuis.info> +# Jon Masters <j...@redhat.com> +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +shopt -s extglob + +myprog="kmodtool" +myver="0.10.10_kmp3" +knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen) +kmod_name= +kver= +verrel= +variant= +kmp= + +get_verrel () +{ + verrel=${1:-$(uname -r)} + verrel=${verrel%%$knownvariants} +} + +print_verrel () +{ + get_verrel $@ + echo "${verrel}" +} + +get_variant () +{ + get_verrel $@ + variant=${1:-$(uname -r)} + variant=${variant##$verrel} + variant=${variant:-'""'} +} + +print_variant () +{ + get_variant $@ + echo "${variant}" +} + +get_rpmtemplate () +{ + local variant="${1}" + local dashvariant="${variant:+-${variant}}" + case "$verrel" in + *.el*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;; + *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;; + *) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;; + esac + + echo "%package -n kmod-${kmod_name}${dashvariant}" + + if [ -z "$kmp_provides_summary" ]; then + echo "Summary: ${kmod_name} kernel module(s)" + fi + + if [ -z "$kmp_provides_group" ]; then + echo "Group: System Environment/Kernel" + fi + + if [ ! -z "$kmp_version" ]; then + echo "Version: %{kmp_version}" + fi + + if [ ! -z "$kmp_release" ]; then + echo "Release: %{kmp_release}" + fi + + if [ ! -z "$kmp" ]; then + echo "%global _use_internal_dependency_generator 0" + fi + + cat <<EOF +Provides: kernel-modules = ${verrel}${variant} +Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} +EOF + + if [ -z "$kmp" ]; then + echo "Requires: ${kdep}" + fi + +# +# RHEL5 - Remove common package requirement on general kmod packages. +# Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version} +# + + cat <<EOF +Requires(post): /sbin/depmod +Requires(postun): /sbin/depmod +EOF + +if [ "no" != "$kmp_nobuildreqs" ] +then + echo "BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel}" +fi + +if [ "" != "$kmp_override_preamble" ] +then + cat "$kmp_override_preamble" +fi + +cat <<EOF +%description -n kmod-${kmod_name}${dashvariant} +This package provides the ${kmod_name} kernel modules built for the Linux +kernel ${verrel}${variant} for the %{_target_cpu} family of processors. +%post -n kmod-${kmod_name}${dashvariant} +if [ -e "/boot/System.map-${verrel}${variant}" ]; then + /sbin/depmod -aeF "/boot/System.map-${verrel}${variant}" "${verrel}${variant}" > /dev/null || : +fi +EOF + + if [ ! -z "$kmp" ]; then + cat <<EOF + +#modules=( \$(rpm -ql kmod-${kmod_name}${dashvariant} | grep '\.ko$') ) +modules=( \$(find /lib/modules/${verrel}${variant}/extra/${kmod_name} \ + | grep '\.ko$') ) +if [ -x "/sbin/weak-modules" ]; then + printf '%s\n' "\${modules[@]}" \ + | /sbin/weak-modules --add-modules +fi +%preun -n kmod-${kmod_name}${dashvariant} +rpm -ql kmod-${kmod_name}${dashvariant} | grep '\.ko$' \ + > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules +EOF + + fi + + cat <<EOF +%postun -n kmod-${kmod_name}${dashvariant} +/sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || : +EOF + + if [ ! -z "$kmp" ]; then + cat <<EOF +modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) ) +#rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules +if [ -x "/sbin/weak-modules" ]; then + printf '%s\n' "\${modules[@]}" \ + | /sbin/weak-modules --remove-modules +fi +EOF + fi + +echo "%files -n kmod-${kmod_name}${dashvariant}" + +if [ "" == "$kmp_override_filelist" ]; +then + echo "%defattr(644,root,root,755)" + echo "/lib/modules/${verrel}${variant}/" + echo "%config /etc/depmod.d/kmod-${kmod_name}.conf" + #BZ252188 - I've commented this out for the moment since RHEL5 doesn't + # really support external firmware e.g. at install time. If + # you really want it, use an override filelist solution. + #echo "/lib/firmware/" +else + cat "$kmp_override_filelist" +fi +} + +print_rpmtemplate () +{ + kmod_name="${1}" + shift + kver="${1}" + get_verrel "${1}" + shift + if [ -z "${kmod_name}" ] ; then + echo "Please provide the kmodule-name as first parameter." >&2 + exit 2 + elif [ -z "${kver}" ] ; then + echo "Please provide the kver as second parameter." >&2 + exit 2 + elif [ -z "${verrel}" ] ; then + echo "Couldn't find out the verrel." >&2 + exit 2 + fi + + for variant in "$@" ; do + if [ "default" == "$variant" ]; + then + get_rpmtemplate "" + else + get_rpmtemplate "${variant}" + fi + done +} + +usage () +{ + cat <<EOF +You called: ${invocation} + +Usage: ${myprog} <command> <option>+ + Commands: + verrel <uname> + - Get "base" version-release. + variant <uname> + - Get variant from uname. + rpmtemplate <mainpgkname> <uname> <variants> + - Return a template for use in a source RPM + rpmtemplate_kmp <mainpgkname> <uname> <variants> + - Return a template for use in a source RPM with KMP dependencies + version + - Output version number and exit. +EOF +} + +invocation="$(basename ${0}) $@" +while [ "${1}" ] ; do + case "${1}" in + verrel) + shift + print_verrel $@ + exit $? + ;; + variant) + shift + print_variant $@ + exit $? + ;; + rpmtemplate) + shift + print_rpmtemplate "$@" + exit $? + ;; + rpmtemplate_kmp) + shift + kmp=1 + print_rpmtemplate "$@" + exit $? + ;; + version) + echo "${myprog} ${myver}" + exit 0 + ;; + *) + echo "Error: Unknown option '${1}'." >&2 + usage >&2 + exit 2 + ;; + esac +done + +# Local variables: +# mode: sh +# sh-indentation: 2 +# indent-tabs-mode: nil +# End: +# ex: ts=2 sw=2 et diff --git a/rhel/openvswitch-kmod-rhel5.spec.in b/rhel/openvswitch-kmod-rhel5.spec.in new file mode 100644 index 0000000..f1bc02e --- /dev/null +++ b/rhel/openvswitch-kmod-rhel5.spec.in @@ -0,0 +1,85 @@ +# Spec file for Open vSwitch kernel modules on Red Hat Enterprise +# Linux 5. + +# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. + +%define kmod_name openvswitch +%{!?kversion: %define kversion 2.6.18-238.12.1.el5} + +Name: %{kmod_name}-kmod +Version: @VERSION@ +Release: 1%{?dist} +Group: System Environment/Kernel +License: GPLv2 +Summary: Open vSwitch kernel modules +URL: http://openvswitch.org/ + +BuildRequires: redhat-rpm-config +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build-%(%{__id_u} -n) +ExclusiveArch: i686 x86_64 + +# Sources. +Source0: %{kmod_name}-%{version}.tar.gz +Source10: kmodtool-%{kmod_name}-el5.sh + +# Define the variants for each architecture. +%define basevar "" +%ifarch i686 +%define paevar PAE +%endif +%ifarch i686 x86_64 +%define xenvar xen +%endif + +# If kvariants isn't defined on the rpmbuild line, build all variants for this architecture. +%{!?kvariants: %define kvariants %{?basevar} %{?xenvar} %{?paevar}} + +# Magic hidden here. +%{expand:%(sh %{SOURCE10} rpmtemplate_kmp %{kmod_name} %{kversion} %{kvariants})} + +# Disable the building of the debug package(s). +%define debug_package %{nil} + +# Define the filter. +%define __find_requires sh %{_builddir}/%{buildsubdir}/filter-requires.sh + +%description +Open vSwitch Linux kernel module. + +%prep +%setup -q -c -T -a 0 +for kvariant in %{kvariants} ; do + %{__cp} -a %{kmod_name}-%{version} _kmod_build_$kvariant +done +echo "/usr/lib/rpm/redhat/find-requires | %{__sed} -e '/^ksym.*/d'" > filter-requires.sh +echo "override %{kmod_name} * weak-updates/%{kmod_name}" > kmod-%{kmod_name}.conf + +%build +for kvariant in %{kvariants} ; do + KSRC=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu} + cd _kmod_build_$kvariant + ../openvswitch-%{version}/configure --with-l26="$KSRC" + %{__make} -C datapath/linux-2.6 %{?_smp_mflags} + cd .. +done + +%install +%{__rm} -rf %{buildroot} +export INSTALL_MOD_PATH=%{buildroot} +export INSTALL_MOD_DIR=extra/%{kmod_name} +for kvariant in %{kvariants} ; do + KSRC=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu} + %{__make} -C "${KSRC}" modules_install M=$PWD/_kmod_build_$kvariant/datapath/linux-2.6 +done +%{__install} -d %{buildroot}%{_sysconfdir}/depmod.d/ +%{__install} kmod-%{kmod_name}.conf %{buildroot}%{_sysconfdir}/depmod.d/ +# Set the module(s) to be executable, so that they will be stripped when packaged. +find %{buildroot} -type f -name \*.ko -exec %{__chmod} u+x \{\} \; + +%clean +%{__rm} -rf %{buildroot} diff --git a/rhel/openvswitch-kmod-rhel6.spec.in b/rhel/openvswitch-kmod-rhel6.spec.in new file mode 100644 index 0000000..5aa92bd --- /dev/null +++ b/rhel/openvswitch-kmod-rhel6.spec.in @@ -0,0 +1,56 @@ +# Spec file for Open vSwitch kernel modules on Red Hat Enterprise +# Linux 6. + +# Copyright (C) 2011 Nicira Networks, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. + +Name: openvswitch +Version: @VERSION@ +Release: 1%{?dist} +Summary: Open vSwitch kernel module + +Group: System/Kernel +License: GPLv2 +URL: http://openvswitch.org/ +Source0: %{name}-%{version}.tar.gz +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildRequires: %kernel_module_package_buildreqs + +# Without this we get an empty openvswitch-debuginfo package (whose name +# conflicts with the openvswitch-debuginfo package for OVS userspace). +%undefine _enable_debug_packages + +# Uncomment to build "debug" packages +#kernel_module_package default debug + +# Build only for standard kernel variant(s) +%kernel_module_package default + +%description +Open vSwitch Linux kernel module. + +%prep + +%setup + +%build +for flavor in %flavors_to_build; do + mkdir _$flavor + (cd _$flavor && ../configure --with-l26="%{kernel_source $flavor}") + %{__make} -C _$flavor/datapath/linux-2.6 %{?_smp_mflags} +done + +%install +export INSTALL_MOD_PATH=$RPM_BUILD_ROOT +export INSTALL_MOD_DIR=extra/%{name} +for flavor in %flavors_to_build ; do + make -C %{kernel_source $flavor} modules_install \ + M=$PWD/_$flavor/datapath/linux-2.6 +done + +%clean +rm -rf $RPM_BUILD_ROOT diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in new file mode 100644 index 0000000..d643745 --- /dev/null +++ b/rhel/openvswitch.spec.in @@ -0,0 +1,137 @@ +# Spec file for Open vSwitch on Red Hat Enterprise Linux. + +# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. + +Name: openvswitch +Summary: Open vSwitch daemon/database/utilities +Group: System Environment/Daemons +URL: http://www.openvswitch.org/ +Vendor: Nicira Networks, Inc. +Version: @VERSION@ + +License: ASL 2.0 +Release: 1 +Source: openvswitch-%{version}.tar.gz +Buildroot: /tmp/openvswitch-rpm +Requires: openvswitch-kmod, logrotate, python + +%description +Open vSwitch provides standard network bridging functions and +support for the OpenFlow protocol for remote per-flow control of +traffic. + +%prep +%setup -q + +%build +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --enable-ssl %{?build_number} +make %{_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT +install -d -m 755 $RPM_BUILD_ROOT/etc +install -d -m 755 $RPM_BUILD_ROOT/etc/init.d +install -m 755 rhel/etc_init.d_openvswitch \ + $RPM_BUILD_ROOT/etc/init.d/openvswitch +install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig +install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d +install -m 755 rhel/etc_logrotate.d_openvswitch \ + $RPM_BUILD_ROOT/etc/logrotate.d/openvswitch +install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts +install -m 755 rhel/usr_share_openvswitch_scripts_sysconfig.template \ + $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/sysconfig.template +install xenserver/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python + +# Get rid of stuff we don't want to make RPM happy. +rm \ + $RPM_BUILD_ROOT/usr/bin/ovs-controller \ + $RPM_BUILD_ROOT/usr/bin/ovs-pki \ + $RPM_BUILD_ROOT/usr/share/man/man8/ovs-controller.8 \ + $RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8 \ + $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \ + $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 + +install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +# Create default or update existing /etc/sysconfig/openvswitch. +SYSCONFIG=/etc/sysconfig/openvswitch +TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template +if [ ! -e $SYSCONFIG ]; then + cp $TEMPLATE $SYSCONFIG +else + for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE) + do + if ! grep $var $SYSCONFIG >/dev/null 2>&1; then + echo >> $SYSCONFIG + sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG + fi + done +fi + +# Ensure all required services are set to run +/sbin/chkconfig --add openvswitch +/sbin/chkconfig openvswitch on + +%preun +if [ "$1" = "0" ]; then # $1 = 0 for uninstall + /sbin/service openvswitch stop + /sbin/chkconfig --del openvswitch +fi + +%postun +if [ "$1" = "0" ]; then # $1 = 0 for uninstall + rm -f /etc/openvswitch/conf.db + rm -f /etc/sysconfig/openvswitch + rm -f /etc/openvswitch/vswitchd.cacert +fi + +exit 0 + +%files +%defattr(-,root,root) +/etc/init.d/openvswitch +/etc/logrotate.d/openvswitch +/usr/bin/ovs-appctl +/usr/bin/ovs-dpctl +/usr/bin/ovs-ofctl +/usr/bin/ovs-pcap +/usr/bin/ovs-tcpundump +/usr/bin/ovs-vlan-test +/usr/bin/ovs-vsctl +/usr/bin/ovsdb-client +/usr/bin/ovsdb-tool +/usr/sbin/ovs-brcompatd +/usr/sbin/ovs-vswitchd +/usr/sbin/ovsdb-server +/usr/share/man/man1/ovs-pcap.1.gz +/usr/share/man/man1/ovs-tcpundump.1.gz +/usr/share/man/man1/ovsdb-client.1.gz +/usr/share/man/man1/ovsdb-server.1.gz +/usr/share/man/man1/ovsdb-tool.1.gz +/usr/share/man/man5/ovs-vswitchd.conf.db.5.gz +/usr/share/man/man8/ovs-appctl.8.gz +/usr/share/man/man8/ovs-brcompatd.8.gz +/usr/share/man/man8/ovs-ctl.8.gz +/usr/share/man/man8/ovs-dpctl.8.gz +/usr/share/man/man8/ovs-ofctl.8.gz +/usr/share/man/man8/ovs-parse-leaks.8.gz +/usr/share/man/man8/ovs-vlan-test.8.gz +/usr/share/man/man8/ovs-vsctl.8.gz +/usr/share/man/man8/ovs-vswitchd.8.gz +/usr/share/openvswitch/python/ +/usr/share/openvswitch/scripts/ovs-ctl +/usr/share/openvswitch/scripts/ovs-lib.sh +/usr/share/openvswitch/scripts/ovs-save +/usr/share/openvswitch/scripts/sysconfig.template +/usr/share/openvswitch/vswitch.ovsschema +/var/lib/openvswitch diff --git a/rhel/usr_share_openvswitch_scripts_sysconfig.template b/rhel/usr_share_openvswitch_scripts_sysconfig.template new file mode 100644 index 0000000..26543af --- /dev/null +++ b/rhel/usr_share_openvswitch_scripts_sysconfig.template @@ -0,0 +1,20 @@ +### Configuration options for openvswitch + +# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc. + +# FORCE_COREFILES: If 'yes' then core files will be enabled. +# FORCE_COREFILES=yes + +# OVSDB_SERVER_PRIORITY: "nice" priority at which to run ovsdb-server. +# +# OVSDB_SERVER_PRIORITY=-10 + +# VSWITCHD_PRIORITY: "nice" priority at which to run ovs-vswitchd. +# VSWITCHD_PRIORITY=-10 + +# VSWITCHD_MLOCKALL: Whether to pass ovs-vswitchd the --mlockall option. +# This option should be set to "yes" or "no". The default is "yes". +# Enabling this option can avoid networking interruptions due to +# system memory pressure in extraordinary situations, such as multiple +# concurrent VM import operations. +# VSWITCHD_MLOCKALL=yes -- 1.7.4.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev