From: Ben Pfaff Date: Tue, 21 Jun 2011 20:00:22 +0000 (-0700) Subject: Add RHEL 5/6 spec files and instructions. X-Git-Tag: v1.2.0~151 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=c434706a374bd44d1274e7bdbee40067a6620b61 Add RHEL 5/6 spec files and instructions. --- diff --git a/INSTALL.RHEL b/INSTALL.RHEL new file mode 100644 index 000000000..355894840 --- /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 bugs@openvswitch.org. diff --git a/Makefile.am b/Makefile.am index 2a1bb3536..e01459aa6 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 d23636d59..dddad3f68 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 hosts. Open vSwitch can also operate, at a cost in performance, entirely in userspace, without assistance from a kernel module. This userspace @@ -58,9 +59,10 @@ 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 - to be installed on a Citrix XenServer host as a drop-in - replacement for its switch, with additional functionality. + * Scripts and specs for building RPMs for Citrix XenServer and Red + Hat Enterprise Linux. 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. * ovs-vsctl, a utility for querying and updating the configuration of ovs-vswitchd. @@ -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 host, read INSTALL.RHEL. + 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 000000000..69e69b93a --- /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 000000000..d4d59613e --- /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 000000000..c7543cc55 --- /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|force-reload-kmod]\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 000000000..1a08fa928 --- /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 000000000..ce1d54a65 --- /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ä , +# Thorsten Leemhuis +# Jon Masters +# +# 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 <= %{?epoch:%{epoch}:}%{version} +# + + cat < /dev/null || : +fi +EOF + + if [ ! -z "$kmp" ]; then + cat < /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules +EOF + + fi + + cat < /dev/null || : +EOF + + if [ ! -z "$kmp" ]; then + cat <&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 <