# Spec file for Open vSwitch.
-# Copyright (C) 2009, 2010, 2011, 2012 Nicira Networks, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, 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.
-# When building, the rpmbuild command line should define
-# openvswitch_version, kernel_name, kernel_version, kernel_flavor,
-# and build_number using -D arguments.
+# For XenServer version < 6.5, when building, the rpmbuild command line
+# should define openvswitch_version, kernel_name, kernel_version and
+# kernel_flavor using -D arguments.
# for example:
#
# rpmbuild -D "openvswitch_version 1.1.0+build123"
# -D "kernel_name NAME-xen"
# -D "kernel_version 2.6.32.12-0.7.1.xs5.6.100.323.170596"
# -D "kernel_flavor xen"
-# -D "build_number --with-build-number=123"
# -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
+#
+# For XenServer version >= 6.5, use kernel_uname which should be
+# the `uname -r` output.
+# for example:
+#
+# rpmbuild -D "openvswitch_version 2.3.0+build123"
+# -D "kernel_uname 3.10.0+2"
+# -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
+#
+# If tests have to be skipped while building, specify the '--without check'
+# option. For example:
+# rpmbuild -bb --without check xenserver/openvswitch-xen.spec
%if %{?openvswitch_version:0}%{!?openvswitch_version:1}
%define openvswitch_version @VERSION@
%endif
+%if %{?kernel_uname:1}%{!?kernel_uname:0}
+%define kernel_name kernel
+%define kernel_version %{kernel_uname}
+%endif
+
%if %{?kernel_name:0}%{!?kernel_name:1}
%define kernel %(rpm -qa 'kernel*xen-devel' | head -1)
%define kernel_name %(rpm -q --queryformat "%%{Name}" %{kernel} | sed 's/-devel//' | sed 's/kernel-//')
%define kernel_flavor xen
%endif
-%define xen_version %{kernel_version}%{kernel_flavor}
+%if %{?xen_version:0}%{!?xen_version:1}
+%define xen_version %{kernel_version}%{?kernel_flavor:%{kernel_flavor}}
+%endif
# bump this when breaking compatibility with userspace
%define module_abi_version 0
# build-supplemental-pack.sh requires this naming for kernel module packages
-%define module_package modules-%{kernel_flavor}-%{kernel_version}
+%define module_package modules%{?kernel_flavor:-%{kernel_flavor}}-%{kernel_version}
+
+%bcond_without check
Name: openvswitch
Summary: Open vSwitch daemon/database/utilities
Group: System Environment/Daemons
URL: http://www.openvswitch.org/
-Vendor: Nicira Networks, Inc.
+Vendor: Nicira, Inc.
Version: %{openvswitch_version}
License: ASL 2.0
Summary: Open vSwitch kernel module
Group: System Environment/Kernel
License: GPLv2
-Provides: %{name}-modules-%{kernel_flavor} = %{kernel_version}, openvswitch.ko.%{module_abi_version}
-Requires: kernel-%{kernel_name} = %{kernel_version}
+Provides: %{name}-modules%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}, openvswitch.ko.%{module_abi_version}
+%if %{?kernel_uname:0}%{!?kernel_uname:1}
+Requires: kernel%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}
+%endif
+%if %{?kernel_uname:1}%{!?kernel_uname:0}
+Requires: kernel-uname-r = %{kernel_version}
+%endif
%description %{module_package}
Open vSwitch Linux kernel module compiled against kernel version
-%{xen_version}.
+%{kernel_version}%{?kernel_flavor:%{kernel_flavor}}.
%prep
%setup -q -n openvswitch-%{openvswitch_version}
%build
-./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --with-linux=/lib/modules/%{xen_version}/build --enable-ssl %{?build_number}
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --with-linux=/lib/modules/%{xen_version}/build --enable-ssl CFLAGS='-g -O2 -msse -msse2'
make %{_smp_mflags}
%install
install -d -m 755 $RPM_BUILD_ROOT/lib/modules/%{xen_version}/extra/openvswitch
find datapath/linux -name *.ko -exec install -m 755 \{\} $RPM_BUILD_ROOT/lib/modules/%{xen_version}/extra/openvswitch \;
-install python/compat/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
-install python/compat/argparse.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
install -d -m 755 $RPM_BUILD_ROOT/etc/xensource/bugtool
-mv $RPM_BUILD_ROOT/usr/share/openvswitch/bugtool-plugins/* $RPM_BUILD_ROOT/etc/xensource/bugtool
+cp -rf $RPM_BUILD_ROOT/usr/share/openvswitch/bugtool-plugins/* $RPM_BUILD_ROOT/etc/xensource/bugtool
# Get rid of stuff we don't want to make RPM happy.
rm \
- $RPM_BUILD_ROOT/usr/bin/ovs-benchmark \
- $RPM_BUILD_ROOT/usr/sbin/ovs-bugtool \
- $RPM_BUILD_ROOT/usr/bin/ovs-controller \
+ $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \
+ $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
$RPM_BUILD_ROOT/usr/bin/ovs-pki \
$RPM_BUILD_ROOT/usr/bin/ovs-test \
- $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
- $RPM_BUILD_ROOT/usr/share/man/man1/ovs-benchmark.1 \
- $RPM_BUILD_ROOT/usr/share/man/man8/ovs-bugtool.8 \
- $RPM_BUILD_ROOT/usr/share/man/man8/ovs-controller.8 \
- $RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8
+ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \
+ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
+ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8 \
+ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8
+(cd "$RPM_BUILD_ROOT" && rm -f usr/lib/lib*)
+(cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
+(cd "$RPM_BUILD_ROOT" && rm -rf usr/lib/pkgconfig)
install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
+%check
+%if %{with check}
+ if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
+ else
+ cat tests/testsuite.log
+ exit 1
+ fi
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
replace_files=$scripts
printf "\nVerified host scripts from XenServer 6.0.0.\n"
;;
+
+ c5f48246577a17cf1b971fb5ce4e920b,2e2c912f86f9c536c89adc34ff3c2b2b,28d3ff72d72bdec4f37d70699f5edb76,67e1d0af16fc1ddf10009c5c063ad2ba,f3feff30aa3b3f8b514664a96a8dc0ab)
+ keep_files=
+ replace_files=$scripts
+ printf "\nVerified host scripts from XenServer 5.6-SP2.\n"
+ ;;
c5f48246577a17cf1b971fb5ce4e920b,2e2c912f86f9c536c89adc34ff3c2b2b,28d3ff72d72bdec4f37d70699f5edb76,67e1d0af16fc1ddf10009c5c063ad2ba,24bae6906d182ba47668174f8e480cc6)
keep_files=
install -d -m 755 -o root -g root /etc/openvswitch
# Create ovs-vswitchd config database
- ovsdb-tool -vANY:console:off create /etc/openvswitch/conf.db \
+ ovsdb-tool -vconsole:off create /etc/openvswitch/conf.db \
/usr/share/openvswitch/vswitch.ovsschema
# Create initial table in config database
- ovsdb-tool -vANY:console:off transact /etc/openvswitch/conf.db \
+ ovsdb-tool -vconsole:off transact /etc/openvswitch/conf.db \
'[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
> /dev/null
fi
# provided by OVS. Any time a replacement script is removed from OVS,
# it should be added here to ensure correct reversion from old versions of
# OVS that don't clean up dangling symlinks during the uninstall phase.
-for orig in /usr/sbin/brctl /usr/sbin/xen-bugtool $keep_files; do
+for orig in /usr/sbin/xen-bugtool $keep_files; do
saved=/usr/lib/openvswitch/xs-saved/$(basename "$orig")
[ -e "$saved" ] && mv -f "$saved" "$orig"
done
# Ensure all required services are set to run
for s in openvswitch openvswitch-xapi-update; do
if chkconfig --list $s >/dev/null 2>&1; then
- chkconfig --del $s || printf "Could not remove $s init script."
+ chkconfig --del $s || printf "Could not remove $s init script.\n"
fi
- chkconfig --add $s || printf "Could not add $s init script."
- chkconfig $s on || printf "Could not enable $s init script."
+ chkconfig --add $s || printf "Could not add $s init script.\n"
+ chkconfig $s on || printf "Could not enable $s init script.\n"
done
if [ "$1" = "1" ]; then # $1 = 1 for install
printf "\nThe server is not configured to run Open vSwitch. To run in\n"
printf "vswitch mode, you must run the following command:\n\n"
printf "\txe-switch-network-backend vswitch"
- else
- printf "\nTo use the new Open vSwitch install, you should reboot the\n"
- printf "server now. Failure to do so may result in incorrect operation."
+ printf "\n\n"
fi
-
- printf "\n\n"
fi
%posttrans %{module_package}
# be removed.
depmod %{xen_version}
+mode=$(cat /etc/xensource/network.conf)
+if [ "$mode" = "vswitch" ] || [ "$mode" = "openvswitch" ]; then
+ printf "\nTo use the newly installed Open vSwitch kernel module, you\n"
+ printf "will either have to reboot the hypervisor or follow any\n"
+ printf "workarounds provided by your administration guide. Failure to do\n"
+ printf "so may result in incorrect operation."
+ printf "\n\n"
+fi
+
%preun
if [ "$1" = "0" ]; then # $1 = 0 for uninstall
# Configure system to use bridge
# this restore-on-upgrade logic.
for f in \
/etc/xensource/scripts/vif \
- /usr/sbin/brctl \
/usr/sbin/xen-bugtool \
/opt/xensource/libexec/interface-reconfigure \
/opt/xensource/libexec/InterfaceReconfigure.py \
%files
%defattr(-,root,root)
+/etc/bash_completion.d/ovs-appctl-bashcomp.bash
+/etc/bash_completion.d/ovs-vsctl-bashcomp.bash
/etc/init.d/openvswitch
/etc/init.d/openvswitch-xapi-update
/etc/xapi.d/plugins/openvswitch-cfg-update
/etc/logrotate.d/openvswitch
/etc/profile.d/openvswitch.sh
/usr/share/openvswitch/python/
+/usr/share/openvswitch/bugtool-plugins/*
+/usr/share/openvswitch/scripts/ovs-check-dead-ifs
/usr/share/openvswitch/scripts/ovs-xapi-sync
/usr/share/openvswitch/scripts/interface-reconfigure
/usr/share/openvswitch/scripts/InterfaceReconfigure.py
/usr/share/openvswitch/scripts/ovs-save
/usr/share/openvswitch/scripts/ovs-ctl
/usr/share/openvswitch/scripts/ovs-lib
+/usr/share/openvswitch/scripts/ovs-vtep
/usr/share/openvswitch/vswitch.ovsschema
+/usr/share/openvswitch/vtep.ovsschema
+/usr/sbin/ovs-bugtool
/usr/sbin/ovs-vlan-bug-workaround
/usr/sbin/ovs-vswitchd
/usr/sbin/ovsdb-server
/usr/bin/ovs-appctl
/usr/bin/ovs-dpctl
+/usr/bin/ovs-dpctl-top
+/usr/bin/ovs-docker
/usr/bin/ovs-ofctl
-/usr/bin/ovs-parse-leaks
+/usr/bin/ovs-parse-backtrace
/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/bin/vtep-ctl
/usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.py
/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/man5/vtep.5.gz
/usr/share/man/man8/ovs-appctl.8.gz
+/usr/share/man/man8/ovs-bugtool.8.gz
/usr/share/man/man8/ovs-ctl.8.gz
/usr/share/man/man8/ovs-dpctl.8.gz
+/usr/share/man/man8/ovs-dpctl-top.8.gz
/usr/share/man/man8/ovs-ofctl.8.gz
-/usr/share/man/man8/ovs-parse-leaks.8.gz
+/usr/share/man/man8/ovs-parse-backtrace.8.gz
/usr/share/man/man1/ovs-pcap.1.gz
/usr/share/man/man1/ovs-tcpundump.1.gz
/usr/share/man/man8/ovs-vlan-bug-workaround.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/man/man8/vtep-ctl.8.gz
/var/lib/openvswitch
+/var/log/openvswitch
%exclude /usr/lib/xsconsole/plugins-base/*.py[co]
-%exclude /usr/sbin/ovs-brcompatd
-%exclude /usr/share/man/man8/ovs-brcompatd.8.gz
%exclude /usr/share/openvswitch/scripts/*.py[co]
%exclude /usr/share/openvswitch/python/*.py[co]
%exclude /usr/share/openvswitch/python/ovs/*.py[co]
%exclude /usr/share/openvswitch/python/ovs/db/*.py[co]
+%exclude /usr/bin/ovn-*
+%exclude /usr/share/man/man5/ovn-*
+%exclude /usr/share/man/man7/ovn-*
+%exclude /usr/share/man/man8/ovn-*
+%exclude /usr/share/openvswitch/ovn-*
+%exclude /usr/share/openvswitch/scripts/ovn-*
%files %{module_package}
/lib/modules/%{xen_version}/extra/openvswitch/openvswitch.ko
-%exclude /lib/modules/%{xen_version}/extra/openvswitch/brcompat.ko
+/lib/modules/%{xen_version}/extra/openvswitch/vport-*.ko