diff mbox series

[ovs-dev,v2] rhel: support kmod build against multiple 7.2 kernels, rhel6

Message ID 1533106792-104124-1-git-send-email-martinxu9.ovs@gmail.com
State Superseded
Headers show
Series [ovs-dev,v2] rhel: support kmod build against multiple 7.2 kernels, rhel6 | expand

Commit Message

Martin Xu Aug. 1, 2018, 6:59 a.m. UTC
This patch extends commit 89dd5819cf18 (rhel: support kmod-openvswitch
build against multiple kernels, rhel6) to support building kmod RPMs
with multiple minor revisions within 3.10.0-327 kernels. It was
discovered for RHEL 7.2 that 41.3 minor revision introduced backward
incompatible changes.

VMware-BZ: #2170334

Signed-off-by: Martin Xu <martinxu9.ovs@gmail.com>
CC: Greg Rose <gvrose8192@gmail.com>
CC: Ben Pfaff <blp@ovn.org>
CC: Flavio Leitner <fbl@redhat.com>
CC: Yi-Hung Wei <yihung.wei@gmail.com>
---
v1->v2: added author sign-off signature

 rhel/kmod-openvswitch-rhel6.spec.in                |  7 +++--
 ...sr_share_openvswitch_scripts_ovs-kmod-manage.sh | 35 ++++++++++++++++------
 2 files changed, 30 insertions(+), 12 deletions(-)

Comments

Yi-Hung Wei Aug. 1, 2018, 4:08 p.m. UTC | #1
On Tue, Jul 31, 2018 at 11:59 PM, Martin Xu <martinxu9.ovs@gmail.com> wrote:
> This patch extends commit 89dd5819cf18 (rhel: support kmod-openvswitch
> build against multiple kernels, rhel6) to support building kmod RPMs
> with multiple minor revisions within 3.10.0-327 kernels. It was
> discovered for RHEL 7.2 that 41.3 minor revision introduced backward
> incompatible changes.
>
> VMware-BZ: #2170334
>
> Signed-off-by: Martin Xu <martinxu9.ovs@gmail.com>
> CC: Greg Rose <gvrose8192@gmail.com>
> CC: Ben Pfaff <blp@ovn.org>
> CC: Flavio Leitner <fbl@redhat.com>
> CC: Yi-Hung Wei <yihung.wei@gmail.com>
> ---
Thanks for the patch.

>  expected_base_minor="el7"
> -expected_minor=11
> +if [ "$installed_major" = "327" ]; then
> +    expected_minor=36
> +    kmod_minor_low_ver=22
> +    kmod_minor_high_ver=62
> +elif [ "$installed_major" = "693" ]; then
> +    expected_minor=11
> +    kmod_minor_low_ver=1
> +    kmod_minor_high_ver=17

I am wondering if we shall have fixed kmod_minor_low_ver and
kmod_minor_high_ver?

Is it possible to derive these two numbers from kversion for
kmod-openvswitch-rhel6.spec file?

For example, we can assume the following format of kversion

-D 'kversion 3.10.0-327.{kmod_minor_low}.x.el7.x86_64
3.10.0-327.{kmod_minor_high_ver}.x.el7.x86_64"

and we expect kmod_minor_low_ver <= expected_minor and
kmod_minor_high_ver > expected_minor.

Thanks,

-Yi-Hung
diff mbox series

Patch

diff --git a/rhel/kmod-openvswitch-rhel6.spec.in b/rhel/kmod-openvswitch-rhel6.spec.in
index f18802d..7ca4853 100644
--- a/rhel/kmod-openvswitch-rhel6.spec.in
+++ b/rhel/kmod-openvswitch-rhel6.spec.in
@@ -31,7 +31,8 @@  BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 # 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
+# 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-//")}
 
@@ -86,8 +87,8 @@  install -p -m 0755 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh \
 current_kernel=$(uname -r)
 IFS=. read installed_major installed_minor installed_micro installed_arch \
     installed_build <<<"${current_kernel##*-}"
-if [ "$installed_major" = "693" ]; then
-    # Workaround for RHEL 7.4
+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
diff --git a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
index a6c738f..fbf8887 100644
--- a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
+++ b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
@@ -14,19 +14,25 @@ 
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# This version of the script is intended to be used on kernel version
-# 3.10.0 major revision 693 only. It is packaged in the openvswitch kmod RPM
-# built using the rhel6 spec file, and run in the post-install for minor 
-# revision 693 kernels.
+# This version of the script is intended to be used on kernel version 3.10.0
+# major revision 327 and 693 only. It is packaged in the openvswitch kmod RPM
+# built using the rhel6 spec file, and run in the post-install for major
+# revision 327/693 kernels.
 #
-# Due to some backward incompatible changes introduced in minor revision 17.1,
+# 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.
+#
 # 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
-# 1.1 and 17.1 minor revisions.
+# 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
@@ -42,7 +48,18 @@  IFS=. read installed_major installed_minor installed_micro \
 # installed_build=$installed_build
 
 expected_base_minor="el7"
-expected_minor=11
+if [ "$installed_major" = "327" ]; then
+    expected_minor=36
+    kmod_minor_low_ver=22
+    kmod_minor_high_ver=62
+elif [ "$installed_major" = "693" ]; then
+    expected_minor=11
+    kmod_minor_low_ver=1
+    kmod_minor_high_ver=17
+else
+    echo "This script is not intended to run on kernel $(uname -r)"
+    exit 1
+fi
 
 found_match=false
 for kname in `ls -d /lib/modules/*`
@@ -51,14 +68,14 @@  do
 #   echo major=$major minor=$minor micro=$micro arch=$arch build=$build
     if [ "$installed_minor" = "$expected_base_minor" ] ||
        [ "$installed_minor" -le "$expected_minor" ]; then
-        if [ "$minor" = "1" ]; then
+        if [ "$minor" = "$kmod_minor_low_ver" ]; then
             requested_kernel=$kname
             found_match="true"
             echo "Installing Openvswitch KMOD from kernel $kname"
             break
         fi
     else
-        if [ "$minor" = "17" ]; then
+        if [ "$minor" = "$kmod_minor_high_ver" ]; then
             requested_kernel=$kname
             found_match="true"
             echo "Installing Openvswitch KMOD from kernel $kname"