110336
# Copyright (C) 2009, 2010, 2013, 2014 Nicira Networks, Inc.
110336
#
110336
# Copying and distribution of this file, with or without modification,
110336
# are permitted in any medium without royalty provided the copyright
110336
# notice and this notice are preserved.  This file is offered as-is,
110336
# without warranty of any kind.
110336
#
110336
# If tests have to be skipped while building, specify the '--without check'
110336
# option. For example:
110336
# rpmbuild -bb --without check rhel/openvswitch-fedora.spec
110336
110336
# This defines the base package name's version.
110336
110336
%define pkgname openvswitch2.16
110336
110336
110336
%if 0%{?commit:1}
110336
%global shortcommit %(c=%{commit}; echo ${c:0:7})
110336
%endif
110336
110336
# Enable PIE, bz#955181
110336
%global _hardened_build 1
110336
110336
# RHEL-7 doesn't define _rundir macro yet
110336
# Fedora 15 onwards uses /run as _rundir
110336
%if 0%{!?_rundir:1}
110336
%define _rundir /run
110336
%endif
110336
110336
# FIXME Test "STP - flush the fdb and mdb when topology changed" fails on s390x
110336
# FIXME 2 tests fails on ppc64le. They will be hopefully fixed before official 2.11
110336
%ifarch %{ix86} x86_64 aarch64
110336
%bcond_without check
110336
%else
110336
%bcond_with check
110336
%endif
110336
# option to run kernel datapath tests, requires building as root!
110336
%bcond_with check_datapath_kernel
110336
# option to build with libcap-ng, needed for running OVS as regular user
110336
%bcond_without libcapng
110336
# option to build with ipsec support
110336
%bcond_without ipsec
110336
110336
# Build python2 (that provides python) and python3 subpackages on Fedora
110336
# Build only python3 (that provides python) subpackage on RHEL8
110336
# Build only python subpackage on RHEL7
110336
%if 0%{?rhel} > 7 || 0%{?fedora}
110336
# On RHEL8 Sphinx is included in buildroot
110336
%global external_sphinx 1
110336
%else
110336
# Don't use external sphinx (RHV doesn't have optional repositories enabled)
110336
%global external_sphinx 0
110336
%endif
110336
110336
Name: %{pkgname}
110336
Summary: Open vSwitch
110336
Group: System Environment/Daemons daemon/database/utilities
110336
URL: http://www.openvswitch.org/
110336
Version: 2.16.0
110336
Release: 8%{?dist}
110336
110336
# Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
110336
# lib/sflow*.[ch] files are SISSL
110336
# datapath/ is GPLv2 (although not built into any of the binary packages)
110336
License: ASL 2.0 and LGPLv2+ and SISSL
110336
110336
%define dpdkver 20.11.1
110336
%define dpdkdir dpdk
110336
%define dpdksver %(echo %{dpdkver} | cut -d. -f-2)
110336
# NOTE: DPDK does not currently build for s390x
110336
# DPDK on aarch64 is not stable enough to be enabled in FDP
110336
%if 0%{?rhel} > 7 || 0%{?fedora}
110336
%define dpdkarches x86_64 ppc64le
110336
%else
110336
%define dpdkarches
110336
%endif
110336
110336
%if 0%{?commit:1}
110336
Source: https://github.com/openvswitch/ovs/archive/%{commit}.tar.gz#/openvswitch-%{commit}.tar.gz
110336
%else
110336
Source: https://github.com/openvswitch/ovs/archive/v%{version}.tar.gz#/openvswitch-%{version}.tar.gz
110336
%endif
110336
Source10: https://fast.dpdk.org/rel/dpdk-%{dpdkver}.tar.xz
110336
110336
%define docutilsver 0.12
110336
%define pygmentsver 1.4
110336
%define sphinxver   1.2.3
110336
Source100: https://pypi.io/packages/source/d/docutils/docutils-%{docutilsver}.tar.gz
110336
Source101: https://pypi.io/packages/source/P/Pygments/Pygments-%{pygmentsver}.tar.gz
110336
Source102: https://pypi.io/packages/source/S/Sphinx/Sphinx-%{sphinxver}.tar.gz
110336
110336
Patch:     openvswitch-%{version}.patch
110336
110336
# The DPDK is designed to optimize througput of network traffic using, among
110336
# other techniques, carefully crafted assembly instructions.  As such it
110336
# needs extensive work to port it to other architectures.
110336
ExclusiveArch: x86_64 aarch64 ppc64le s390x
110336
110336
# Do not enable this otherwise YUM will break on any upgrade.
110336
# Provides: openvswitch
110336
Conflicts: openvswitch < 2.16
110336
Conflicts: openvswitch-dpdk < 2.16
110336
Conflicts: openvswitch2.10
110336
Conflicts: openvswitch2.11
110336
Conflicts: openvswitch2.12
110336
Conflicts: openvswitch2.13
110336
Conflicts: openvswitch2.14
110336
Conflicts: openvswitch2.15
110336
110336
# FIXME Sphinx is used to generate some manpages, unfortunately, on RHEL, it's
110336
# in the -optional repository and so we can't require it directly since RHV
110336
# doesn't have the -optional repository enabled and so TPS fails
110336
%if %{external_sphinx}
110336
BuildRequires: python3-sphinx
110336
%else
110336
# Sphinx dependencies
110336
BuildRequires: python-devel
110336
BuildRequires: python-setuptools
110336
#BuildRequires: python2-docutils
110336
BuildRequires: python-jinja2
110336
BuildRequires: python-nose
110336
#BuildRequires: python2-pygments
110336
# docutils dependencies
110336
BuildRequires: python-imaging
110336
# pygments dependencies
110336
BuildRequires: python-nose
110336
%endif
110336
110336
BuildRequires: gcc gcc-c++ make
110336
BuildRequires: autoconf automake libtool
110336
BuildRequires: systemd-units openssl openssl-devel
110336
BuildRequires: python3-devel python3-setuptools
110336
BuildRequires: desktop-file-utils
110336
BuildRequires: groff-base graphviz
110336
BuildRequires: unbound-devel
110336
# make check dependencies
110336
BuildRequires: procps-ng
110336
%if 0%{?rhel} > 7 || 0%{?fedora}
110336
BuildRequires: python3-pyOpenSSL
110336
%endif
110336
%if %{with check_datapath_kernel}
110336
BuildRequires: nmap-ncat
110336
# would be useful but not available in RHEL or EPEL
110336
#BuildRequires: pyftpdlib
110336
%endif
110336
110336
%if %{with libcapng}
110336
BuildRequires: libcap-ng libcap-ng-devel
110336
%endif
110336
110336
%ifarch %{dpdkarches}
110336
BuildRequires: meson
110336
# DPDK driver dependencies
110336
BuildRequires: zlib-devel numactl-devel
110336
%ifarch x86_64
110336
BuildRequires: rdma-core-devel >= 15 libmnl-devel
110336
%endif
110336
110336
# Required by packaging policy for the bundled DPDK
110336
Provides: bundled(dpdk) = %{dpdkver}
110336
%endif
110336
110336
Requires: openssl iproute module-init-tools
110336
#Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
110336
#Requires: kernel >= 3.15.0-0
110336
Requires: openvswitch-selinux-extra-policy
110336
110336
Requires(pre): shadow-utils
110336
Requires(post): /bin/sed
110336
Requires(post): /usr/sbin/usermod
110336
Requires(post): /usr/sbin/groupadd
110336
Requires(post): systemd-units
110336
Requires(preun): systemd-units
110336
Requires(postun): systemd-units
110336
Obsoletes: openvswitch-controller <= 0:2.1.0-1
110336
110336
%description
110336
Open vSwitch provides standard network bridging functions and
110336
support for the OpenFlow protocol for remote per-flow control of
110336
traffic.
110336
110336
%package -n python3-%{pkgname}
110336
Summary: Open vSwitch python3 bindings
110336
License: ASL 2.0
110336
Requires: %{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
110336
Provides: python-%{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
110336
110336
%description -n python3-%{pkgname}
110336
Python bindings for the Open vSwitch database
110336
110336
%package test
110336
Summary: Open vSwitch testing utilities
110336
License: ASL 2.0
110336
BuildArch: noarch
110336
Requires: python3-%{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
110336
Requires: tcpdump
110336
110336
%description test
110336
Utilities that are useful to diagnose performance and connectivity
110336
issues in Open vSwitch setup.
110336
110336
%package devel
110336
Summary: Open vSwitch OpenFlow development package (library, headers)
110336
License: ASL 2.0
110336
Requires: %{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
110336
110336
%description devel
110336
This provides shared library, libopenswitch.so and the openvswitch header
110336
files needed to build an external application.
110336
110336
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
110336
%package -n network-scripts-%{name}
110336
Summary: Open vSwitch legacy network service support
110336
License: ASL 2.0
110336
Requires: network-scripts
110336
Supplements: (%{name} and network-scripts)
110336
110336
%description -n network-scripts-%{name}
110336
This provides the ifup and ifdown scripts for use with the legacy network
110336
service.
110336
%endif
110336
110336
%if %{with ipsec}
110336
%package ipsec
110336
Summary: Open vSwitch IPsec tunneling support
110336
License: ASL 2.0
110336
Requires: python3-%{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
110336
Requires: libreswan
110336
110336
%description ipsec
110336
This package provides IPsec tunneling support for OVS tunnels.
110336
%endif
110336
110336
%prep
110336
%if 0%{?commit:1}
110336
%setup -q -n ovs-%{commit} -a 10
110336
%else
110336
%setup -q -n ovs-%{version} -a 10
110336
%endif
110336
%if ! %{external_sphinx}
110336
%if 0%{?commit:1}
110336
%setup -n ovs-%{commit} -q -D -T -a 100 -a 101 -a 102
110336
%else
110336
%setup -n ovs-%{version} -q -D -T -a 100 -a 101 -a 102
110336
%endif
110336
%endif
110336
110336
mv dpdk-*/ %{dpdkdir}/
110336
110336
# FIXME should we propose a way to do that upstream?
110336
sed -ri "/^subdir\('(usertools|app)'\)/d" %{dpdkdir}/meson.build
110336
110336
%patch -p1
110336
110336
%build
110336
# Build Sphinx on RHEL
110336
%if ! %{external_sphinx}
110336
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}%{_builddir}/pytmp/lib/python"
110336
for x in docutils-%{docutilsver} Pygments-%{pygmentsver} Sphinx-%{sphinxver}; do
110336
    pushd "$x"
110336
    python2 setup.py install --home %{_builddir}/pytmp
110336
    popd
110336
done
110336
110336
export PATH="$PATH:%{_builddir}/pytmp/bin"
110336
%endif
110336
110336
./boot.sh
110336
110336
%ifarch %{dpdkarches}    # build dpdk
110336
# Lets build DPDK first
110336
cd %{dpdkdir}
110336
110336
ENABLED_DRIVERS=(
110336
    bus/pci
110336
    bus/vdev
110336
    mempool/ring
110336
    net/failsafe
110336
    net/i40e
110336
    net/ring
110336
    net/vhost
110336
    net/virtio
110336
    net/tap
110336
)
110336
110336
%ifarch x86_64
110336
ENABLED_DRIVERS+=(
110336
    bus/vmbus
110336
    common/iavf
110336
    common/mlx5
110336
    net/bnxt
110336
    net/enic
110336
    net/iavf
110336
    net/ice
110336
    net/mlx4
110336
    net/mlx5
110336
    net/netvsc
110336
    net/nfp
110336
    net/qede
110336
    net/vdev_netvsc
110336
)
110336
%endif
110336
110336
%ifarch aarch64 x86_64
110336
ENABLED_DRIVERS+=(
110336
    net/e1000
110336
    net/ixgbe
110336
)
110336
%endif
110336
110336
# Since upstream doesn't have a way
110336
for driver in drivers/*/*/; do
110336
    driver=${driver#drivers/}
110336
    driver=${driver%/}
110336
    [[ " ${ENABLED_DRIVERS[@]} " == *" $driver "* ]] || \
110336
        disable_drivers="${disable_drivers:+$disable_drivers,}"$driver
110336
done
110336
110336
#CFLAGS="$(echo %{optflags} | sed -e 's:-Wall::g' -e 's:-march=[[:alnum:]]* ::g') -Wformat -fPIC %{_hardening_ldflags}" \
110336
%set_build_flags
110336
%__meson --prefix=%{_builddir}/dpdk-build \
110336
         --buildtype=plain \
110336
         -Ddisable_drivers="$disable_drivers" \
110336
         -Dmachine=default \
110336
         -Dmax_ethports=128 \
110336
         -Dmax_numa_nodes=8 \
110336
         -Dtests=false \
110336
         %{_vpath_builddir}
110336
%meson_build
110336
%__meson install -C %{_vpath_builddir} --no-rebuild
110336
110336
# FIXME currently with LTO enabled OVS tries to link with both static and shared libraries
110336
rm -v %{_builddir}/dpdk-build/%{_lib}/*.so*
110336
110336
# Generate a list of supported drivers, its hard to tell otherwise.
110336
cat << EOF > README.DPDK-PMDS
110336
DPDK drivers included in this package:
110336
110336
EOF
110336
110336
for f in %{_builddir}/dpdk-build/%{_lib}/librte_net_*.a; do
110336
    basename ${f} | cut -c12- | cut -d. -f1 | tr [:lower:] [:upper:]
110336
done >> README.DPDK-PMDS
110336
110336
cat << EOF >> README.DPDK-PMDS
110336
110336
For further information about the drivers, see
110336
http://dpdk.org/doc/guides-%{dpdksver}/nics/index.html
110336
EOF
110336
110336
cd -
110336
%endif    # build dpdk
110336
110336
# And now for OVS...
110336
mkdir build-shared build-static
110336
pushd build-shared
110336
ln -s ../configure
110336
%configure \
110336
%if %{with libcapng}
110336
        --enable-libcapng \
110336
%else
110336
        --disable-libcapng \
110336
%endif
110336
        --disable-static \
110336
        --enable-shared \
110336
        --enable-ssl \
110336
        --with-pkidir=%{_sharedstatedir}/openvswitch/pki
110336
make %{?_smp_mflags}
110336
popd
110336
pushd build-static
110336
ln -s ../configure
110336
%ifarch %{dpdkarches}
110336
PKG_CONFIG_PATH=%{_builddir}/dpdk-build/%{_lib}/pkgconfig \
110336
%endif
110336
%configure \
110336
%if %{with libcapng}
110336
        --enable-libcapng \
110336
%else
110336
        --disable-libcapng \
110336
%endif
110336
        --enable-ssl \
110336
%ifarch %{dpdkarches}
110336
        --with-dpdk=static \
110336
%endif
110336
        --with-pkidir=%{_sharedstatedir}/openvswitch/pki
110336
make %{?_smp_mflags}
110336
popd
110336
110336
/usr/bin/python3 build-aux/dpdkstrip.py \
110336
        --dpdk \
110336
        < rhel/usr_lib_systemd_system_ovs-vswitchd.service.in \
110336
        > rhel/usr_lib_systemd_system_ovs-vswitchd.service
110336
110336
%install
110336
rm -rf $RPM_BUILD_ROOT
110336
make -C build-shared install-libLTLIBRARIES DESTDIR=$RPM_BUILD_ROOT
110336
make -C build-static install DESTDIR=$RPM_BUILD_ROOT
110336
110336
install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
110336
install -d -m 0750 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
110336
install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
110336
110336
install -p -D -m 0644 rhel/usr_lib_udev_rules.d_91-vfio.rules \
110336
        $RPM_BUILD_ROOT%{_udevrulesdir}/91-vfio.rules
110336
110336
install -p -D -m 0644 \
110336
        rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
110336
        $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
110336
110336
for service in openvswitch ovsdb-server ovs-vswitchd \
110336
               ovs-delete-transient-ports; do
110336
        install -p -D -m 0644 \
110336
                        rhel/usr_lib_systemd_system_${service}.service \
110336
                        $RPM_BUILD_ROOT%{_unitdir}/${service}.service
110336
done
110336
110336
%if %{with ipsec}
110336
install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch-ipsec.service \
110336
                      $RPM_BUILD_ROOT%{_unitdir}/openvswitch-ipsec.service
110336
%endif
110336
110336
install -m 0755 rhel/etc_init.d_openvswitch \
110336
        $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
110336
110336
install -p -D -m 0644 rhel/etc_openvswitch_default.conf \
110336
        $RPM_BUILD_ROOT/%{_sysconfdir}/openvswitch/default.conf
110336
110336
install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
110336
        $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
110336
110336
install -m 0644 vswitchd/vswitch.ovsschema \
110336
        $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
110336
110336
install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
110336
install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
110336
        $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
110336
install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
110336
        $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
110336
110336
install -d -m 0755 $RPM_BUILD_ROOT%{python3_sitelib}
110336
cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/ovstest \
110336
        $RPM_BUILD_ROOT%{python3_sitelib}
110336
110336
# Build the JSON C extension for the Python lib (#1417738)
110336
pushd python
110336
(
110336
export CPPFLAGS="-I ../include -I ../build-shared/include"
110336
export LDFLAGS="%{__global_ldflags} -L $RPM_BUILD_ROOT%{_libdir}"
110336
%py3_build
110336
%py3_install
110336
[ -f "$RPM_BUILD_ROOT/%{python3_sitearch}/ovs/_json$(python3-config --extension-suffix)" ]
110336
)
110336
popd
110336
110336
rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
110336
110336
install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
110336
110336
install -d -m 0755 $RPM_BUILD_ROOT%{_prefix}/lib/firewalld/services/
110336
110336
install -p -D -m 0755 \
110336
        rhel/usr_share_openvswitch_scripts_ovs-systemd-reload \
110336
        $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovs-systemd-reload
110336
110336
touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
110336
# The db needs special permission as IPsec Pre-shared keys are stored in it.
110336
chmod 0640 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
110336
110336
touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
110336
110336
# remove unpackaged files
110336
rm -f $RPM_BUILD_ROOT/%{_bindir}/ovs-benchmark \
110336
        $RPM_BUILD_ROOT/%{_bindir}/ovs-docker \
110336
        $RPM_BUILD_ROOT/%{_bindir}/ovs-parse-backtrace \
110336
        $RPM_BUILD_ROOT/%{_bindir}/ovs-testcontroller \
110336
        $RPM_BUILD_ROOT/%{_sbindir}/ovs-vlan-bug-workaround \
110336
        $RPM_BUILD_ROOT/%{_mandir}/man1/ovs-benchmark.1* \
110336
        $RPM_BUILD_ROOT/%{_mandir}/man8/ovs-testcontroller.* \
110336
        $RPM_BUILD_ROOT/%{_mandir}/man8/ovs-vlan-bug-workaround.8*
110336
110336
%if ! %{with ipsec}
110336
rm -f $RPM_BUILD_ROOT/%{_datadir}/openvswitch/scripts/ovs-monitor-ipsec
110336
%endif
110336
110336
# remove ovn unpackages files
110336
rm -f $RPM_BUILD_ROOT%{_bindir}/ovn*
110336
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ovn*
110336
rm -f $RPM_BUILD_ROOT%{_mandir}/man5/ovn*
110336
rm -f $RPM_BUILD_ROOT%{_mandir}/man7/ovn*
110336
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/ovn*
110336
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/ovn*
110336
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovn*
110336
rm -f $RPM_BUILD_ROOT%{_includedir}/ovn/*
110336
110336
%check
110336
%if %{with check}
110336
    pushd build-static
110336
    touch resolv.conf
110336
    export OVS_RESOLV_CONF=$(pwd)/resolv.conf
110336
    if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
110336
       make check TESTSUITEFLAGS='--recheck'; then :;
110336
    else
110336
        cat tests/testsuite.log
110336
        exit 1
110336
    fi
110336
    popd
110336
%endif
110336
%if %{with check_datapath_kernel}
110336
    pushd build-static
110336
    if make check-kernel RECHECK=yes; then :;
110336
    else
110336
        cat tests/system-kmod-testsuite.log
110336
        exit 1
110336
    fi
110336
    popd
110336
%endif
110336
110336
%clean
110336
rm -rf $RPM_BUILD_ROOT
110336
110336
%preun
110336
%if 0%{?systemd_preun:1}
110336
    %systemd_preun openvswitch.service
110336
%else
110336
    if [ $1 -eq 0 ] ; then
110336
    # Package removal, not upgrade
110336
        /bin/systemctl --no-reload disable openvswitch.service >/dev/null 2>&1 || :
110336
        /bin/systemctl stop openvswitch.service >/dev/null 2>&1 || :
110336
    fi
110336
%endif
110336
110336
%pre
110336
getent group openvswitch >/dev/null || groupadd -r openvswitch
110336
getent passwd openvswitch >/dev/null || \
110336
    useradd -r -g openvswitch -d / -s /sbin/nologin \
110336
    -c "Open vSwitch Daemons" openvswitch
110336
110336
%ifarch %{dpdkarches}
110336
    getent group hugetlbfs >/dev/null || groupadd hugetlbfs
110336
    usermod -a -G hugetlbfs openvswitch
110336
%endif
110336
exit 0
110336
110336
%post
110336
if [ $1 -eq 1 ]; then
110336
    sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
110336
110336
%ifarch %{dpdkarches}
110336
    sed -i \
110336
        's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
110336
        /etc/sysconfig/openvswitch
110336
%endif
110336
fi
110336
chown -R openvswitch:openvswitch /etc/openvswitch
110336
110336
%if 0%{?systemd_post:1}
110336
    %systemd_post openvswitch.service
110336
%else
110336
    # Package install, not upgrade
110336
    if [ $1 -eq 1 ]; then
110336
        /bin/systemctl daemon-reload >dev/null || :
110336
    fi
110336
%endif
110336
110336
%postun
110336
%if 0%{?systemd_postun:1}
110336
    %systemd_postun openvswitch.service
110336
%else
110336
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
110336
%endif
110336
110336
%triggerun -- openvswitch < 2.5.0-22.git20160727%{?dist}
110336
# old rpm versions restart the service in postun, but
110336
# due to systemd some preparation is needed.
110336
if systemctl is-active openvswitch >/dev/null 2>&1 ; then
110336
    /usr/share/openvswitch/scripts/ovs-ctl stop >/dev/null 2>&1 || :
110336
    systemctl daemon-reload >/dev/null 2>&1 || :
110336
    systemctl stop openvswitch ovsdb-server ovs-vswitchd >/dev/null 2>&1 || :
110336
    systemctl start openvswitch >/dev/null 2>&1 || :
110336
fi
110336
exit 0
110336
110336
%files -n python3-%{pkgname}
110336
%{python3_sitearch}/ovs
110336
%{python3_sitearch}/ovs-*.egg-info
110336
%doc LICENSE
110336
110336
%files test
110336
%{_bindir}/ovs-pcap
110336
%{_bindir}/ovs-tcpdump
110336
%{_bindir}/ovs-tcpundump
110336
%{_mandir}/man1/ovs-pcap.1*
110336
%{_mandir}/man8/ovs-tcpdump.8*
110336
%{_mandir}/man1/ovs-tcpundump.1*
110336
%{_bindir}/ovs-test
110336
%{_bindir}/ovs-vlan-test
110336
%{_bindir}/ovs-l3ping
110336
%{_mandir}/man8/ovs-test.8*
110336
%{_mandir}/man8/ovs-vlan-test.8*
110336
%{_mandir}/man8/ovs-l3ping.8*
110336
%{python3_sitelib}/ovstest
110336
110336
%files devel
110336
%{_libdir}/*.so
110336
%{_libdir}/pkgconfig/*.pc
110336
%{_includedir}/openvswitch/*
110336
%{_includedir}/openflow/*
110336
%exclude %{_libdir}/*.a
110336
%exclude %{_libdir}/*.la
110336
110336
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
110336
%files -n network-scripts-%{name}
110336
%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
110336
%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
110336
%endif
110336
110336
%files
110336
%defattr(-,openvswitch,openvswitch)
110336
%dir %{_sysconfdir}/openvswitch
110336
%{_sysconfdir}/openvswitch/default.conf
110336
%config %ghost %verify(not owner group md5 size mtime) %{_sysconfdir}/openvswitch/conf.db
110336
%ghost %attr(0600,-,-) %verify(not owner group md5 size mtime) %{_sysconfdir}/openvswitch/.conf.db.~lock~
110336
%config %ghost %{_sysconfdir}/openvswitch/system-id.conf
110336
%defattr(-,root,root)
110336
%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/sysconfig/openvswitch
110336
%{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
110336
%{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
110336
%config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
110336
%{_unitdir}/openvswitch.service
110336
%{_unitdir}/ovsdb-server.service
110336
%{_unitdir}/ovs-vswitchd.service
110336
%{_unitdir}/ovs-delete-transient-ports.service
110336
%{_datadir}/openvswitch/scripts/openvswitch.init
110336
%{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
110336
%{_datadir}/openvswitch/scripts/ovs-lib
110336
%{_datadir}/openvswitch/scripts/ovs-save
110336
%{_datadir}/openvswitch/scripts/ovs-vtep
110336
%{_datadir}/openvswitch/scripts/ovs-ctl
110336
%{_datadir}/openvswitch/scripts/ovs-kmod-ctl
110336
%{_datadir}/openvswitch/scripts/ovs-systemd-reload
110336
%config %{_datadir}/openvswitch/vswitch.ovsschema
110336
%config %{_datadir}/openvswitch/vtep.ovsschema
110336
%{_bindir}/ovs-appctl
110336
%{_bindir}/ovs-dpctl
110336
%{_bindir}/ovs-ofctl
110336
%{_bindir}/ovs-vsctl
110336
%{_bindir}/ovsdb-client
110336
%{_bindir}/ovsdb-tool
110336
%{_bindir}/ovs-pki
110336
%{_bindir}/vtep-ctl
110336
%{_libdir}/*.so.*
110336
%{_sbindir}/ovs-vswitchd
110336
%{_sbindir}/ovsdb-server
110336
%{_mandir}/man1/ovsdb-client.1*
110336
%{_mandir}/man1/ovsdb-server.1*
110336
%{_mandir}/man1/ovsdb-tool.1*
110336
%{_mandir}/man5/ovsdb.5*
110336
%{_mandir}/man5/ovsdb-server.5.*
110336
%{_mandir}/man5/ovs-vswitchd.conf.db.5*
110336
%{_mandir}/man5/vtep.5*
110336
%{_mandir}/man7/ovsdb-server.7*
110336
%{_mandir}/man7/ovsdb.7*
110336
%{_mandir}/man7/ovs-actions.7*
110336
%{_mandir}/man7/ovs-fields.7*
110336
%{_mandir}/man8/vtep-ctl.8*
110336
%{_mandir}/man8/ovs-appctl.8*
110336
%{_mandir}/man8/ovs-ctl.8*
110336
%{_mandir}/man8/ovs-dpctl.8*
110336
%{_mandir}/man8/ovs-kmod-ctl.8.*
110336
%{_mandir}/man8/ovs-ofctl.8*
110336
%{_mandir}/man8/ovs-pki.8*
110336
%{_mandir}/man8/ovs-vsctl.8*
110336
%{_mandir}/man8/ovs-vswitchd.8*
110336
%{_mandir}/man8/ovs-parse-backtrace.8*
110336
%{_udevrulesdir}/91-vfio.rules
110336
%doc LICENSE NOTICE README.rst NEWS rhel/README.RHEL.rst
110336
%ifarch %{dpdkarches}
110336
%doc %{dpdkdir}/README.DPDK-PMDS
110336
%endif
110336
/var/lib/openvswitch
110336
%attr(750,openvswitch,openvswitch) %verify(not owner group) /var/log/openvswitch
110336
%ghost %attr(755,root,root) %verify(not owner group) %{_rundir}/openvswitch
110336
%{_datadir}/openvswitch/bugtool-plugins/
110336
%{_datadir}/openvswitch/scripts/ovs-bugtool-*
110336
%{_bindir}/ovs-dpctl-top
110336
%{_sbindir}/ovs-bugtool
110336
%{_mandir}/man8/ovs-dpctl-top.8*
110336
%{_mandir}/man8/ovs-bugtool.8*
110336
%if (0%{?rhel} && 0%{?rhel} <= 7) || (0%{?fedora} && 0%{?fedora} < 29)
110336
%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
110336
%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
110336
%endif
110336
110336
%if %{with ipsec}
110336
%files ipsec
110336
%{_datadir}/openvswitch/scripts/ovs-monitor-ipsec
110336
%{_unitdir}/openvswitch-ipsec.service
110336
%endif
110336
110336
%changelog
110336
* Thu Sep 16 2021 Open vSwitch CI <ovs-ci@redhat.com> - 2.16.0-8
110336
- Merging upstream branch-2.16 [RH git: 7332b410fc]
110336
    Commit list:
110336
    facaf5bc71 netdev-linux: Fix a null pointer dereference in netdev_linux_notify_sock().
110336
    6e203d4873 pcap-file: Fix memory leak in ovs_pcap_open().
110336
    f50da0b267 odp-util: Fix a null pointer dereference in odp_flow_format().
110336
    7da752e43f odp-util: Fix a null pointer dereference in odp_nsh_key_from_attr__().
110336
    bc22b01459 netdev-dpdk: Fix RSS configuration for virtio.
110336
    81706c5d43 ipf: Fix only nat the first fragment in the reass process.
110336
110336
110336
* Wed Sep 08 2021 Open vSwitch CI <ovs-ci@redhat.com> - 2.16.0-7
110336
- Merging upstream branch-2.16 [RH git: e71f31dfd6]
110336
    Commit list:
110336
    242c280f0e dpif-netdev: Fix crash when PACKET_OUT is metered.
110336
110336
110336
* Tue Aug 31 2021 Ilya Maximets <i.maximets@redhat.com> - 2.16.0-6
110336
- ovsdb: monitor: Store serialized json in a json cache. [RH git: bc20330c85] (#1996152)
110336
    commit 43e66fc27659af2a5c976bdd27fe747b442b5554
110336
    Author: Ilya Maximets <i.maximets@ovn.org>
110336
    Date:   Tue Aug 24 21:00:39 2021 +0200
110336
    
110336
        Same json from a json cache is typically sent to all the clients,
110336
        e.g., in case of OVN deployment with ovn-monitor-all=true.
110336
    
110336
        There could be hundreds or thousands connected clients and ovsdb
110336
        will serialize the same json object for each of them before sending.
110336
    
110336
        Serializing it once before storing into json cache to speed up
110336
        processing.
110336
    
110336
        This change allows to save a lot of CPU cycles and a bit of memory
110336
        since we need to store in memory only a string and not the full json
110336
        object.
110336
    
110336
        Testing with ovn-heater on 120 nodes using density-heavy scenario
110336
        shows reduction of the total CPU time used by Southbound DB processes
110336
        from 256 minutes to 147.  Duration of unreasonably long poll intervals
110336
        also reduced dramatically from 7 to 2 seconds:
110336
    
110336
                   Count   Min    Max   Median    Mean   95 percentile
110336
         -------------------------------------------------------------
110336
          Before   1934   1012   7480   4302.5   4875.3     7034.3
110336
          After    1909   1004   2730   1453.0   1532.5     2053.6
110336
    
110336
        Acked-by: Dumitru Ceara <dceara@redhat.com>
110336
        Acked-by: Han Zhou <hzhou@ovn.org>
110336
        Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
110336
    
110336
    Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1996152
110336
    Signed-off-by: Ilya Maximets <i.maximets@redhat.com>
110336
110336
110336
* Tue Aug 31 2021 Ilya Maximets <i.maximets@redhat.com> - 2.16.0-5
110336
- raft: Don't keep full json objects in memory if no longer needed. [RH git: 4606423e8b] (#1990058)
110336
    commit 0de882954032aa37dc943bafd72c33324aa0c95a
110336
    Author: Ilya Maximets <i.maximets@ovn.org>
110336
    Date:   Tue Aug 24 21:00:38 2021 +0200
110336
    
110336
        raft: Don't keep full json objects in memory if no longer needed.
110336
    
110336
        Raft log entries (and raft database snapshot) contains json objects
110336
        of the data.  Follower receives append requests with data that gets
110336
        parsed and added to the raft log.  Leader receives execution requests,
110336
        parses data out of them and adds to the log.  In both cases, later
110336
        ovsdb-server reads the log with ovsdb_storage_read(), constructs
110336
        transaction and updates the database.  On followers these json objects
110336
        in common case are never used again.  Leader may use them to send
110336
        append requests or snapshot installation requests to followers.
110336
        However, all these operations (except for ovsdb_storage_read()) are
110336
        just serializing the json in order to send it over the network.
110336
    
110336
        Json objects are significantly larger than their serialized string
110336
        representation.  For example, the snapshot of the database from one of
110336
        the ovn-heater scale tests takes 270 MB as a string, but 1.6 GB as
110336
        a json object from the total 3.8 GB consumed by ovsdb-server process.
110336
    
110336
        ovsdb_storage_read() for a given raft entry happens only once in a
110336
        lifetime, so after this call, we can serialize the json object, store
110336
        the string representation and free the actual json object that ovsdb
110336
        will never need again.  This can save a lot of memory and can also
110336
        save serialization time, because each raft entry for append requests
110336
        and snapshot installation requests serialized only once instead of
110336
        doing that every time such request needs to be sent.
110336
    
110336
        JSON_SERIALIZED_OBJECT can be used in order to seamlessly integrate
110336
        pre-serialized data into raft_header and similar json objects.
110336
    
110336
        One major special case is creation of a database snapshot.
110336
        Snapshot installation request received over the network will be parsed
110336
        and read by ovsdb-server just like any other raft log entry.  However,
110336
        snapshots created locally with raft_store_snapshot() will never be
110336
        read back, because they reflect the current state of the database,
110336
        hence already applied.  For this case we can free the json object
110336
        right after writing snapshot on disk.
110336
    
110336
        Tests performed with ovn-heater on 60 node density-light scenario,
110336
        where on-disk database goes up to 97 MB, shows average memory
110336
        consumption of ovsdb-server Southbound DB processes decreased by 58%
110336
        (from 602 MB to 256 MB per process) and peak memory consumption
110336
        decreased by 40% (from 1288 MB to 771 MB).
110336
    
110336
        Test with 120 nodes on density-heavy scenario with 270 MB on-disk
110336
        database shows 1.5 GB memory consumption decrease as expected.
110336
        Also, total CPU time consumed by the Southbound DB process reduced
110336
        from 296 to 256 minutes.  Number of unreasonably long poll intervals
110336
        reduced from 2896 down to 1934.
110336
    
110336
        Deserialization is also implemented just in case.  I didn't see this
110336
        function being invoked in practice.
110336
    
110336
        Acked-by: Dumitru Ceara <dceara@redhat.com>
110336
        Acked-by: Han Zhou <hzhou@ovn.org>
110336
        Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
110336
    
110336
    Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1990058
110336
    Signed-off-by: Ilya Maximets <i.maximets@redhat.com>
110336
110336
110336
* Tue Aug 31 2021 Ilya Maximets <i.maximets@redhat.com> - 2.16.0-4
110336
- json: Add support for partially serialized json objects. [RH git: 885e5ce1b5] (#1990058)
110336
    commit b0bca6f27aae845c3ca8b48d66a7dbd3d978162a
110336
    Author: Ilya Maximets <i.maximets@ovn.org>
110336
    Date:   Tue Aug 24 21:00:37 2021 +0200
110336
    
110336
        json: Add support for partially serialized json objects.
110336
    
110336
        Introducing a new json type JSON_SERIALIZED_OBJECT.  It's not an
110336
        actual type that can be seen in a json message on a wire, but
110336
        internal type that is intended to hold a serialized version of
110336
        some other json object.  For this reason it's defined after the
110336
        JSON_N_TYPES to not confuse parsers and other parts of the code
110336
        that relies on compliance with RFC 4627.
110336
    
110336
        With this JSON type internal users may construct large JSON objects,
110336
        parts of which are already serialized.  This way, while serializing
110336
        the larger object, data from JSON_SERIALIZED_OBJECT can be added
110336
        directly to the result, without additional processing.
110336
    
110336
        This will be used by next commits to add pre-serialized JSON data
110336
        to the raft_header structure, that can be converted to a JSON
110336
        before writing the file transaction on disk or sending to other
110336
        servers.  Same technique can also be used to pre-serialize json_cache
110336
        for ovsdb monitors, this should allow to not perform serialization
110336
        for every client and will save some more memory.
110336
    
110336
        Since serialized JSON is just a string, reusing the 'json->string'
110336
        pointer for it.
110336
    
110336
        Acked-by: Dumitru Ceara <dceara@redhat.com>
110336
        Acked-by: Han Zhou <hzhou@ovn.org>
110336
        Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
110336
    
110336
    Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1990058
110336
    Signed-off-by: Ilya Maximets <i.maximets@redhat.com>
110336
110336
110336
* Tue Aug 31 2021 Ilya Maximets <i.maximets@redhat.com> - 2.16.0-3
110336
- json: Optimize string serialization. [RH git: bb1654da63] (#1990069)
110336
    commit 748010ff304b7cd2c43f4eb98a554433f0df07f9
110336
    Author: Ilya Maximets <i.maximets@ovn.org>
110336
    Date:   Tue Aug 24 23:07:22 2021 +0200
110336
    
110336
        json: Optimize string serialization.
110336
    
110336
        Current string serialization code puts all characters one by one.
110336
        This is slow because dynamic string needs to perform length checks
110336
        on every ds_put_char() and it's also doesn't allow compiler to use
110336
        better memory copy operations, i.e. doesn't allow copying few bytes
110336
        at once.
110336
    
110336
        Special symbols are rare in a typical database.  Quotes are frequent,
110336
        but not too frequent.  In databases created by ovn-kubernetes, for
110336
        example, usually there are at least 10 to 50 chars between quotes.
110336
        So, it's better to count characters that doesn't require escaping
110336
        and use fast data copy for the whole sequential block.
110336
    
110336
        Testing with a synthetic benchmark (included) on my laptop shows
110336
        following performance improvement:
110336
    
110336
           Size      Q  S       Before       After       Diff
110336
         -----------------------------------------------------
110336
         100000      0  0 :    0.227 ms     0.142 ms   -37.4 %
110336
         100000      2  1 :    0.277 ms     0.186 ms   -32.8 %
110336
         100000      10 1 :    0.361 ms     0.309 ms   -14.4 %
110336
         10000000    0  0 :   22.720 ms    12.160 ms   -46.4 %
110336
         10000000    2  1 :   27.470 ms    19.300 ms   -29.7 %
110336
         10000000    10 1 :   37.950 ms    31.250 ms   -17.6 %
110336
         100000000   0  0 :  239.600 ms   126.700 ms   -47.1 %
110336
         100000000   2  1 :  292.400 ms   188.600 ms   -35.4 %
110336
         100000000   10 1 :  387.700 ms   321.200 ms   -17.1 %
110336
    
110336
        Here Q - probability (%) for a character to be a '\"' and
110336
        S - probability (%) to be a special character ( < 32).
110336
    
110336
        Testing with a closer to real world scenario shows overall decrease
110336
        of the time needed for database compaction by ~5-10 %.  And this
110336
        change also decreases CPU consumption in general, because string
110336
        serialization is used in many different places including ovsdb
110336
        monitors and raft.
110336
    
110336
        Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
110336
        Acked-by: Numan Siddique <numans@ovn.org>
110336
        Acked-by: Dumitru Ceara <dceara@redhat.com>
110336
    
110336
    Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1990069
110336
    Signed-off-by: Ilya Maximets <i.maximets@redhat.com>
110336
110336
110336
* Fri Aug 20 2021 Open vSwitch CI <ovs-ci@redhat.com> - 2.16.0-2
110336
- Merging upstream branch-2.16 [RH git: 7d7567e339]
110336
    Commit list:
110336
    0991ea8d19 Prepare for 2.16.1.
110336
110336
110336
* Wed Aug 18 2021 Flavio Leitner <fbl@redhat.com> - 2.16.0-1
110336
- redhat: First 2.16.0 release. [RH git: 0a1c4276cc]
110336
110336