summaryrefslogtreecommitdiff
path: root/rhel
diff options
context:
space:
mode:
authorGreg Rose <gvrose8192@gmail.com>2022-07-14 14:23:27 -0700
committerIlya Maximets <i.maximets@ovn.org>2022-07-15 13:45:55 +0200
commitc94ae8a75408bf12dba4cac95a5ed93fdbee09f0 (patch)
tree1eb610cf460d06b1aa9c348fa2b53a7dafb14736 /rhel
parentb6941ca7b8c943d78f3d1f4016068e2041701904 (diff)
downloadopenvswitch-c94ae8a75408bf12dba4cac95a5ed93fdbee09f0.tar.gz
rhel: Stop packaging OVS kernel module.
Remove the kernel driver specification for RHEL 6.x, 7.x, 8.x and Fedora. Reviewed-by: David Marchand <david.marchand@redhat.com> Signed-off-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'rhel')
-rw-r--r--rhel/.gitignore4
-rw-r--r--rhel/automake.mk23
-rw-r--r--rhel/kmod-openvswitch-rhel6.spec.in123
-rw-r--r--rhel/openvswitch-dkms.spec.in103
-rw-r--r--rhel/openvswitch-fedora.spec.in5
-rw-r--r--rhel/openvswitch-kmod-fedora.spec.in152
-rw-r--r--rhel/openvswitch.spec.in4
-rw-r--r--rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh237
8 files changed, 2 insertions, 649 deletions
diff --git a/rhel/.gitignore b/rhel/.gitignore
index a9c047f83..577108130 100644
--- a/rhel/.gitignore
+++ b/rhel/.gitignore
@@ -1,7 +1,3 @@
-openvswitch-dkms.spec
-openvswitch-kmod-rhel5.spec
-kmod-openvswitch-rhel6.spec
-openvswitch-kmod-fedora.spec
openvswitch.spec
openvswitch-fedora.spec
usr_lib_systemd_system_ovs-vswitchd.service
diff --git a/rhel/automake.mk b/rhel/automake.mk
index c75406e05..246bfb51e 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -13,12 +13,6 @@ EXTRA_DIST += \
rhel/etc_openvswitch_default.conf \
rhel/etc_sysconfig_network-scripts_ifdown-ovs \
rhel/etc_sysconfig_network-scripts_ifup-ovs \
- rhel/openvswitch-dkms.spec \
- rhel/openvswitch-dkms.spec.in \
- rhel/kmod-openvswitch-rhel6.spec \
- rhel/kmod-openvswitch-rhel6.spec.in \
- rhel/openvswitch-kmod-fedora.spec \
- rhel/openvswitch-kmod-fedora.spec.in \
rhel/openvswitch.spec \
rhel/openvswitch.spec.in \
rhel/openvswitch-fedora.spec \
@@ -26,7 +20,6 @@ EXTRA_DIST += \
rhel/usr_share_openvswitch_scripts_ovs-systemd-reload \
rhel/usr_share_openvswitch_scripts_sysconfig.template \
rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
- rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh \
rhel/usr_lib_udev_rules.d_91-vfio.rules \
rhel/usr_lib_systemd_system_openvswitch.service \
rhel/usr_lib_systemd_system_ovsdb-server.service \
@@ -41,15 +34,6 @@ update_rhel_spec = \
< $(srcdir)/rhel/$(@F).in > $(@F).tmp || exit 1; \
if cmp -s $(@F).tmp $@; then touch $@; rm $(@F).tmp; else mv $(@F).tmp $@; fi
-$(srcdir)/rhel/openvswitch-dkms.spec: rhel/openvswitch-dkms.spec.in $(top_builddir)/config.status
- $(update_rhel_spec)
-
-$(srcdir)/rhel/kmod-openvswitch-rhel6.spec: rhel/kmod-openvswitch-rhel6.spec.in $(top_builddir)/config.status
- $(update_rhel_spec)
-
-$(srcdir)/rhel/openvswitch-kmod-fedora.spec: rhel/openvswitch-kmod-fedora.spec.in $(top_builddir)/config.status
- $(update_rhel_spec)
-
$(srcdir)/rhel/openvswitch.spec: rhel/openvswitch.spec.in $(top_builddir)/config.status
$(update_rhel_spec)
@@ -67,10 +51,3 @@ rpm-fedora: dist $(srcdir)/rhel/openvswitch-fedora.spec
-D "_topdir ${RPMBUILD_TOP}" \
-ba $(srcdir)/rhel/openvswitch-fedora.spec
-# Build kernel datapath RPM
-rpm-fedora-kmod: dist $(srcdir)/rhel/openvswitch-kmod-fedora.spec
- ${MKDIR_P} ${RPMBUILD_TOP}/SOURCES
- cp ${DIST_ARCHIVES} ${RPMBUILD_TOP}/SOURCES
- rpmbuild -D "kversion $(shell uname -r)" ${RPMBUILD_OPT} \
- -D "_topdir ${RPMBUILD_TOP}" \
- -ba $(srcdir)/rhel/openvswitch-kmod-fedora.spec
diff --git a/rhel/kmod-openvswitch-rhel6.spec.in b/rhel/kmod-openvswitch-rhel6.spec.in
deleted file mode 100644
index de69863d7..000000000
--- a/rhel/kmod-openvswitch-rhel6.spec.in
+++ /dev/null
@@ -1,123 +0,0 @@
-# Spec file for Open vSwitch kernel modules on Red Hat Enterprise
-# Linux 6.
-
-# Copyright (C) 2011, 2012, 2018 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.
-
-%define oname openvswitch
-%{!?release_number:%define release_number 1}
-
-Name: kmod-%{oname}
-Version: @VERSION@
-Release: %{release_number}%{?dist}
-Summary: Open vSwitch kernel module
-
-Group: System/Kernel
-License: GPLv2
-URL: http://openvswitch.org/
-Source0: %{oname}-%{version}.tar.gz
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-
-# Without this we get an empty openvswitch-debuginfo package (whose name
-# conflicts with the openvswitch-debuginfo package for OVS userspace).
-%undefine _enable_debug_packages
-
-%define kernel_source_extended() /usr/src/kernels/%{2}$([ %{1} = default ] || echo ".%{1}")
-
-# Use -D 'kversion 2.6.32-131.6.1.el6.x86_64' to build package
-# for specified kernel version.
-# Use -D 'kversion 3.10.0-693.1.1.el7.x86_64 3.10.0-693.17.1.el7.x86_64'
-# to build package for mulitple kernel versions in the same package
-# This only works for kernel 3.10.0 major revision 693 (RHEL 7.4)
-# and major revision 327 (RHEL 7.2)
-# By default, build against the latest installed kernel-devel
-%{!?kversion:%global kversion %(rpm -qa | egrep "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1| sed "s/^kernel.*-devel-//")}
-
-# Use -D 'kflavors default debug kdump' to build packages for
-# specified kernel variants.
-%{!?kflavors:%global kflavors default}
-
-%description
-Open vSwitch Linux kernel module.
-
-%prep
-
-%setup -n %{oname}-%{version}
-
-%build
-for kv in %{kversion}; do
- for flavor in %{kflavors}; do
- mkdir -p _$flavor/_$kv
- (cd _$flavor/_$kv && ../../configure --with-linux="%{kernel_source_extended $flavor $kv}")
- %{__make} -C _$flavor/_$kv/datapath/linux %{?_smp_mflags}
- done
-done
-
-%install
-export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
-export INSTALL_MOD_DIR=extra/%{oname}
-for kv in %{kversion}; do
- for flavor in %{kflavors} ; do
- make -C %{kernel_source_extended $flavor $kv} modules_install \
- M="`pwd`"/_$flavor/_$kv/datapath/linux
- # Cleanup unnecessary kernel-generated module dependency files.
- find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
- done
-done
-install -d %{buildroot}%{_sysconfdir}/depmod.d/
-for kv in %{kversion}; do
- for module in %{buildroot}/lib/modules/$kv/$INSTALL_MOD_DIR/*.ko;
- do
- modname="$(basename ${module})"
- grep -qsPo "^\s*override ${modname%.ko} \* extra\/%{oname}" %{oname}.conf || \
- echo "override ${modname%.ko} * extra/%{oname}" >> %{oname}.conf
- grep -qsPo "^\s*override ${modname%.ko} \* weak-updates\/%{oname}" %{oname}.conf || \
- echo "override ${modname%.ko} * weak-updates/%{oname}" >> %{oname}.conf
- done
-done
-install -m 644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/
-install -d -m 0755 $RPM_BUILD_ROOT/usr/share/%{oname}/scripts
-install -p -m 0755 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh \
- $RPM_BUILD_ROOT/usr/share/%{oname}/scripts/ovs-kmod-manage.sh
-
-%post
-current_kernel=$(uname -r)
-IFS=. read installed_major installed_minor installed_micro installed_arch \
- installed_build <<<"${current_kernel##*-}"
-if [ "$installed_major" = "327" ] || [ "$installed_major" = "693" ]; then
- # Workaround for RHEL 7.2 and 7.4
- if [ -x "/usr/share/%{oname}/scripts/ovs-kmod-manage.sh" ]; then
- /usr/share/%{oname}/scripts/ovs-kmod-manage.sh
- fi
-else
- # Ensure that modprobe will find our modules.
- for k in $(cd /lib/modules && /bin/ls); do
- [ -d "/lib/modules/$k/kernel/" ] && /sbin/depmod -a "$k"
- done
- if [ -x "/sbin/weak-modules" ]; then
- rpm -ql kmod-%{oname} | grep '\.ko$' | \
- /sbin/weak-modules --add-modules
- fi
-fi
-
-%postun
-if [ "$1" = 0 ]; then # Erase, not upgrade
- for kname in `ls -d /lib/modules/*`
- do
- rm -rf $kname/weak-updates/openvswitch
- done
-fi
-/sbin/depmod -a
-
-%files
-%defattr(644,root,root,755)
-/etc/depmod.d/%{oname}.conf
-/lib/modules/
-%attr(755,root,root) /usr/share/%{oname}/scripts/ovs-kmod-manage.sh
-
-%clean
-rm -rf $RPM_BUILD_ROOT
diff --git a/rhel/openvswitch-dkms.spec.in b/rhel/openvswitch-dkms.spec.in
deleted file mode 100644
index e3d77e3c7..000000000
--- a/rhel/openvswitch-dkms.spec.in
+++ /dev/null
@@ -1,103 +0,0 @@
-# Spec file for Open vSwitch kernel modules using DKMS.
-#
-# Copyright (C) 2015 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.
-
-%define oname openvswitch
-%{!?release_number:%define release_number 1}
-
-Name: %{oname}-dkms
-Version: @VERSION@
-Release: %{release_number}%{?dist}
-Summary: Open vSwitch kernel module
-
-Group: System/Kernel
-License: GPLv2
-URL: http://openvswitch.org/
-Source: %{oname}-%{version}.tar.gz
-Requires: autoconf, gcc, make
-Requires(post): dkms
-Requires(preun): dkms
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-
-# Without this we get an empty openvswitch-debuginfo package (whose name
-# conflicts with the openvswitch-debuginfo package for OVS userspace).
-%undefine _enable_debug_packages
-
-# Disable shebangs mangling
-%undefine __brp_mangle_shebangs
-
-%description
-Open vSwitch Linux kernel module.
-
-
-%prep
-%setup -n %{oname}-%{version}
-
-cat > %{oname}.conf << EOF
-override %{oname} * extra/%{oname}
-override %{oname} * weak-updates/%{oname}
-EOF
-
-
-%build
-# for running the '%{__make} -C datapath print-build-modules' below.
-./configure
-
-
-%install
-%{__rm} -rf %{buildroot}
-
-# Kernel module sources install for dkms
-%{__mkdir_p} %{buildroot}%{_usrsrc}/%{oname}-%{version}/
-%{__cp} -r * %{buildroot}%{_usrsrc}/%{oname}-%{version}/
-
-# check we can get kernel module names
-%{__make} -C datapath print-build-modules
-
-# Prepare dkms.conf
-cat > %{buildroot}%{_usrsrc}/%{oname}-%{version}/dkms.conf << EOF
-MODULES=( `%{__make} -C datapath print-build-modules | grep -v make` )
-
-PACKAGE_NAME="openvswitch"
-PACKAGE_VERSION="%{version}-%{release}"
-MAKE="./configure --with-linux='\${kernel_source_dir}' && make -C datapath/linux"
-for __idx in \${!MODULES[@]}; do
- BUILT_MODULE_NAME[__idx]=\${MODULES[__idx]}
- BUILT_MODULE_LOCATION[__idx]=datapath/linux/
- DEST_MODULE_LOCATION[__idx]=/kernel/drivers/net/openvswitch/
-done
-AUTOINSTALL=yes
-EOF
-
-install -d %{buildroot}%{_sysconfdir}/depmod.d/
-install -m 644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/
-
-
-%post
-# Add to DKMS registry
-isadded=`dkms status -m "%{oname}" -v "%{version}"`
-if [ "x${isadded}" = "x" ] ; then
- dkms add -m "%{oname}" -v "%{version}" || :
-fi
-dkms build -m "%{oname}" -v "%{version}" || :
-dkms install -m "%{oname}" -v "%{version}" --force || :
-
-
-%preun
-# Remove all versions from DKMS registry
-dkms remove -m "%{oname}" -v "%{version}" --all || :
-
-
-%clean
-%{__rm} -rf %{buildroot}
-
-
-%files
-%defattr(-,root,root)
-%{_usrsrc}/%{oname}-%{version}/
-/etc/depmod.d/openvswitch.conf
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index d0ae78e4e..cb7a02cab 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -17,9 +17,7 @@
# These tests can be executed, for example, via:
# rpmbuild -rb --with check_datapath_kernel openvswitch-fedora.src.rpm
#
-# These tests will use the currently installed OVS kernel modules, when
-# testing out of tree kernel modules the appropriate openvswitch-kmod
-# package should be installed first.
+# These tests will use the currently installed OVS kernel modules.
#%define kernel 2.6.40.4-5.fc15.x86_64
@@ -54,7 +52,6 @@ Version: @VERSION@
# Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
# lib/sflow*.[ch] files are SISSL
-# datapath/ is GPLv2 (although not built into any of the binary packages)
License: ASL 2.0 and LGPLv2+ and SISSL
Release: %{release_number}%{?dist}
Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in
deleted file mode 100644
index e5f78701f..000000000
--- a/rhel/openvswitch-kmod-fedora.spec.in
+++ /dev/null
@@ -1,152 +0,0 @@
-# Spec file for Open vSwitch.
-
-# Copyright (C) 2009, 2010, 2015, 2018 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.
-
-%global debug_package %{nil}
-
-# Use the kversion macro such as
-# RPMBUILD_OPT='-D "kversion 3.10.0-693.1.1.el7.x86_64 3.10.0-693.17.1.el7.x86_64"'
-# to build package for mulitple kernel versions in the same package
-# This only works for the following kernels.
-# - 3.10.0 major revision 327 (RHEL 7.2)
-# - 3.10.0 major revision 693 (RHEL 7.4)
-# - 3.10.0 major revision 957 (RHEL 7.6)
-# - 3.10.0 major revision 1062 (RHEL 7.7)
-# - 3.10.0 major revision 1101 (RHEL 7.8 Beta)
-# - 3.10.0 major revision 1127 (RHEL 7.8 GA)
-# - 3.10.0 major revision 1160 (RHEL 7.9 GA)
-# By default, build against the current running kernel version
-#%define kernel 3.1.5-1.fc16.x86_64
-#define kernel %{kernel_source}
-%{?kversion:%define kernel %kversion}
-
-%{!?release_number:%define release_number 1}
-
-Name: openvswitch-kmod
-Summary: Open vSwitch Kernel Modules
-Group: System Environment/Daemons
-URL: http://www.openvswitch.org/
-Vendor: OpenSource Security Ralf Spenneberg <ralf@os-s.net>
-Version: @VERSION@
-
-# The entire source code is ASL 2.0 except datapath/ which is GPLv2
-License: GPLv2
-Release: %{release_number}%{?dist}
-Source: openvswitch-%{version}.tar.gz
-#Source1: openvswitch-init
-Buildroot: /tmp/openvswitch-xen-rpm
-Provides: kmod-openvswitch
-Obsoletes: kmod-openvswitch < %{version}-%{release}
-
-%description
-Open vSwitch provides standard network bridging functions augmented with
-support for the OpenFlow protocol for remote per-flow control of
-traffic. This package contains the kernel modules.
-
-%prep
-%setup -q -n openvswitch-%{version}
-
-%build
-for kv in %{kversion}; do
- mkdir -p _$kv
- (cd _$kv && /bin/cp -f ../configure . && %configure --srcdir=.. \
- --with-linux=/lib/modules/${kv}/build --enable-ssl %{_ovs_config_extra_flags})
- make %{_smp_mflags} -C _$kv/datapath/linux
-done
-
-%install
-export INSTALL_MOD_DIR=extra/openvswitch
-rm -rf $RPM_BUILD_ROOT
-for kv in %{kversion}; do
- make INSTALL_MOD_PATH=$RPM_BUILD_ROOT -C _$kv/datapath/linux modules_install
-done
-mkdir -p $RPM_BUILD_ROOT/etc/depmod.d
-for kv in %{kversion}; do
- for module in $RPM_BUILD_ROOT/lib/modules/${kv}/extra/openvswitch/*.ko
- do
- modname="$(basename ${module})"
- grep -qsPo "^\s*override ${modname%.ko} \* extra\/openvwitch" \
- $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf || \
- echo "override ${modname%.ko} * extra/openvswitch" >> \
- $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf
- grep -qsPo "^\s*override ${modname%.ko} \* weak-updates\/openvwitch" \
- $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf || \
- echo "override ${modname%.ko} * weak-updates/openvswitch" >> \
- $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf
- done
-done
-install -d -m 0755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
-install -p -m 0755 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh \
- $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%post
-current_kernel=$(uname -r)
-IFS='.\|-' read mainline_major mainline_minor mainline_patch major_rev \
- minor_rev _extra <<<"${current_kernel}"
-# echo mainline_major=$mainline_major mainline_minor=$mainline_minor \
-# mainline_patch=$mainline_patch major_rev=$major_rev minor_rev=$minor_rev
-if grep -qs "suse" /etc/os-release; then
- # For SLES or OpenSUSE
- if [ -x "%{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh" ]; then
- %{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
- fi
-elif [ "$mainline_major" = "3" ] && [ "$mainline_minor" = "10" ] &&
- { [ "$major_rev" = "327" ] || [ "$major_rev" = "693" ] || \
- [ "$major_rev" = "957" ] || [ "$major_rev" == "1062" ] || \
- [ "$major_rev" = "1101" ] || [ "$major_rev" = "1127" ] || \
- [ "$major_rev" = "1160" ] ; }; then
- # For RHEL 7.2, 7.4, 7.6, 7.7, 7.8 and 7.9
- if [ -x "%{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh" ]; then
- %{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
- fi
-else
- # Ensure that modprobe will find our modules.
- for k in $(cd /lib/modules && /bin/ls); do
- [ -d "/lib/modules/$k/kernel/" ] && /sbin/depmod -a "$k"
- done
- if [ -x "/sbin/weak-modules" ]; then
- for m in openvswitch vport-gre vport-stt vport-geneve \
- vport-lisp vport-vxlan; do
- echo "/lib/modules/%{kernel}/extra/openvswitch/$m.ko"
- done | /sbin/weak-modules --add-modules
- fi
-fi
-
-%postun
-if [ "$1" = 0 ]; then # Erase, not upgrade
- for kname in `ls -d /lib/modules/*`
-do
- rm -rf $kname/weak-updates/openvswitch
-done
-fi
-/sbin/depmod -a
-
-%posttrans
-# The upgrade path from the older kmod-openvswitch SysV package to
-# the newer openvswitch-kmod systemd package will end up removing
-# the symlinks to the weak-updates/openvswitch drivers because of
-# it's %postun section. We add this section to handle that case.
-if [ -x "%{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh" ]; then
- %{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
-fi
-
-%files
-%defattr(0644,root,root)
-/lib/modules/*/extra/openvswitch/*.ko
-/etc/depmod.d/kmod-openvswitch.conf
-%exclude /lib/modules/*/modules.*
-%attr(755,root,root) %{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
-
-%changelog
-* Wed Sep 21 2011 Kyle Mestery <kmestery@cisco.com>
-- Updated for F15
-* Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
-- First build on F14
diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
index 2d8ff18bb..dbfff333c 100644
--- a/rhel/openvswitch.spec.in
+++ b/rhel/openvswitch.spec.in
@@ -17,9 +17,7 @@
# These tests can be executed, for example, via:
# rpmbuild -rb --with check_datapath_kernel openvswitch.src.rpm
#
-# These tests will use the currently installed OVS kernel modules, when
-# testing out of tree kernel modules the appropriate openvswitch-kmod
-# package should be installed first.
+# These tests will use the currently installed OVS kernel modules.
%{!?release_number:%define release_number 1}
diff --git a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
deleted file mode 100644
index 2dda3865a..000000000
--- a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
+++ /dev/null
@@ -1,237 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 2018 Nicira/VMware, 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.
-
-# This script is intended to be used on the following kernels.
-# - 3.10.0 major revision 327 (RHEL 7.2)
-# - 3.10.0 major revision 693 (RHEL 7.4)
-# - 3.10.0 major revision 957 (RHEL 7.6)
-# - 3.10.0 major revision 1062 (RHEL 7.7)
-# - 3.10.0 major revision 1101 (RHEL 7.8 Beta)
-# - 3.10.0 major revision 1127 (RHEL 7.8 GA)
-# - 3.10.0 major revision 1160 (RHEL 7.9)
-# - 4.4.x, x >= 73 (SLES 12 SP3)
-# - 4.12.x, x >= 14 (SLES 12 SP4).
-# - 4.18.x major revision 305 (RHEL 8.4)
-# It is packaged in the openvswitch kmod RPM and run in the post-install
-# scripts.
-#
-# For kernel 3.10.0-957,
-# due to some backward incompatible changes introduced in minor revision 12.1,
-# kernel modules built against kernels newer than 12.1 cannot be loaded on
-# system running kernels older than 12.1, vice versa.
-#
-# For kernel 3.10.0-693,
-# due to some backward incompatible changes introduced in minor revision 17.1,
-# kernel modules built against kernels newer than 17.1 cannot be loaded on
-# system running kernels older than 17.1, vice versa.
-#
-# For kernel 3.10.0-327,
-# due to some backward incompatible changes introduced in minor revision 41.3,
-# kernel modules built against kernels newer than 41.3 cannot be loaded on
-# system running kernels older than 41.3, vice versa.
-#
-# For kernel >= 4.4.73,
-# kernel modules built with 4.4.73 can run on systems with kernel versions from
-# 4.4.73 to 4.4.114; modules built against 4.4.120 can run on systems from
-# 4.4.120 onwards.
-#
-# For kernel 4.12.x, x>=14,
-# kernel modules built with the oldest compatible kernel 4.12.14-94.41.1 can
-# run on all versions onwards.
-#
-# This script checks the current running kernel version, and update symlinks
-# for the openvswitch kernel modules in the appropriate kernel directory,
-# provided the kmod RPM has installed kernel modules files built from both
-# minor revisions.
-#
-# In case of a kernel minor revision change after the openvswitch kmod package
-# is installed, this script shall be run manually after system reboots and
-# switches to a different kernel
-if [ -n "$(rpm -qa kmod-openvswitch)" ]; then
- rpmname="kmod-openvswitch"
-elif [ -n "$(rpm -qa openvswitch-kmod)" ]; then
- rpmname="openvswitch-kmod"
-else
- echo "openvswitch kmod package not installed, existing"
- exit 1
-fi
-#echo $rpmname
-script_name=$(basename -- "$0")
-current_kernel=$(uname -r)
-echo current kernel is $current_kernel
-
-IFS='.\|-' read mainline_major mainline_minor mainline_patch major_rev \
- minor_rev _extra <<<"${current_kernel}"
-# echo mainline_major=$mainline_major mainline_minor=$mainline_minor \
-# mainline_patch=$mainline_patch major_rev=$major_rev minor_rev=$minor_rev
-
-expected_rhel_base_minor="el7"
-if [ "$mainline_major" = "3" ] && [ "$mainline_minor" = "10" ]; then
- if [ "$major_rev" = "327" ]; then
-# echo "rhel72"
- comp_ver=36
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "514" ]; then
-# echo "rhel73"
- comp_ver=26
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "693" ]; then
-# echo "rhel74"
- comp_ver=11
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "862" ]; then
-# echo "rhel75"
- comp_ver=20
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "957" ]; then
-# echo "rhel76"
- comp_ver=10
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "1062" ]; then
-# echo "rhel77"
- comp_ver=10
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "1101" ]; then
-# echo "rhel78"
- comp_ver=10
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "1127" ]; then
-# echo "rhel78"
- comp_ver=10
- ver_offset=4
- installed_ver="$minor_rev"
- elif [ "$major_rev" = "1160" ]; then
-# echo "rhel79"
- comp_ver=10
- ver_offset=4
- installed_ver="$minor_rev"
- fi
-elif [ "$mainline_major" = "4" ] && [ "$mainline_minor" = "4" ]; then
- if [ "$mainline_patch" -ge "73" ]; then
-# echo "sles12sp3"
- comp_ver=114
- ver_offset=2
- installed_ver="$mainline_patch"
- fi
-elif [ "$mainline_major" = "4" ] && [ "$mainline_minor" = "12" ]; then
- if [ "$mainline_patch" -ge "14" ]; then
-# echo "sles12sp4"
- comp_ver=1
- ver_offset=2
- installed_ver="$mainline_patch"
- fi
-elif [ "$mainline_major" = "4" ] && [ "$mainline_minor" = "18" ]; then
- if [ "$major_rev" = "305" ]; then
- echo "rhel84"
- comp_ver=9
- ver_offset=4
- installed_ver="$minor_rev"
- fi
-fi
-
-if [ X"$ver_offset" = X ]; then
-# echo "This script is not intended to run on kernel $(uname -r)"
- exit 0
-fi
-
-#IFS='.\|-' read -r -a version_nums <<<"${current_kernel}"
-#echo ver_offset=$ver_offset
-#echo installed_ver="$installed_ver"
-#echo installed_ver="${version_nums[$ver_offset]}"
-
-kmod_versions=()
-kversion=$(rpm -ql ${rpmname} | grep '\.ko$' | \
- sed -n -e 's/^\/lib\/modules\/\(.*\)\/extra\/.*$/\1/p' | \
- sort | uniq)
-
-IFS='.\|-' read installed_major installed_minor installed_patch \
- installed_major_rev installed_minor_rev installed_extra <<<"${kversion}"
-
-if [ "$installed_major_rev" -lt "$major_rev" ]; then
- echo "Not installing RPM with major revision $installed_major_rev" \
- "to kernel with greater major revision $major_rev. Exiting"
- exit 1
-fi
-
-for kv in $kversion; do
- IFS='.\|-' read -r -a kv_nums <<<"${kv}"
- kmod_versions+=(${kv_nums[$ver_offset]})
-done
-sorted_kmod_vers=$(printf "%s\n" "${kmod_versions[@]}" | \
- sort -n)
-#echo "$sorted_kmod_vers"
-
-if [ ! -n "$sorted_kmod_vers" ]; then
- echo "No kernel modules found from package $rpmname, exiting"
- exit 1
-else
- # first line for kmod_low_ver, last for kmod_high_ver
- kmod_low_ver=$(echo "$sorted_kmod_vers" | head -1)
- kmod_high_ver=$(echo "$sorted_kmod_vers" | tail -1)
-fi
-#echo "Installing KMOD with minor revisions $kmod_low_ver and \
-#$kmod_high_ver"
-
-found_match=false
-for kname in $kversion;
-do
- IFS='.\|-' read -r -a pkg_ver_nums <<<"${kname}"
- pkg_ver=${pkg_ver_nums[$ver_offset]}
- if [ "$installed_ver" = "$expected_rhel_base_minor" ] ||
- [ "$installed_ver" -le "$comp_ver" ]; then
- if [ "$pkg_ver" = "$kmod_low_ver" ]; then
- requested_kernel=$kname
- found_match="true"
- echo "Installing Openvswitch KMOD from kernel $kname"
- break
- fi
- else
- if [ "$pkg_ver" = "$kmod_high_ver" ]; then
- requested_kernel=$kname
- found_match="true"
- echo "Installing Openvswitch KMOD from kernel $kname"
- break
- fi
- fi
-done
-
-if [ "$found_match" = "false" ]; then
- echo $script_name: Failed
- exit 1
-fi
-
-if [ "$requested_kernel" != "$current_kernel" ]; then
- if [ ! -d /lib/modules/$current_kernel/weak-updates/openvswitch ]; then
- mkdir -p /lib/modules/$current_kernel/weak-updates
- mkdir -p /lib/modules/$current_kernel/weak-updates/openvswitch
- fi
- for m in openvswitch vport-gre vport-stt vport-geneve \
- vport-lisp vport-vxlan; do
- ln -f -s /lib/modules/$requested_kernel/extra/openvswitch/$m.ko \
- /lib/modules/$current_kernel/weak-updates/openvswitch/$m.ko
- done
-else
- echo Proper OVS kernel modules already configured
-fi
-# Always run depmod
-/sbin/depmod -a