From: Greg Rose <[email protected]>

A bug in RHEL 7.2 has been found in which a customer who installed
a RHEL 7.2 openvswitch kernel module rpm with a slightly different
minor build number than the rnning kernel found that the kernel
modules were installed to the wrong directory.

After the installation the new openvswitch kernel modules were
installed to:
/lib/modules/3.10.0-327.22.2.el7.x86_64/extra/openvswitch

But the running kernel was 3.10.0-327.el7.x86_64 and after the
installation was complete the kernel modules in the installed
directory were not linked to the "weak-updates" directory in
the running kernel.  So the customer was not able to load the
correct kernel modules and a critical bug was encountered.

This patch does a post installation sanity check to make sure
that the ../extra/openvswitch directory or the
../weak-updates/openvswitch directory at least exist.

Signed-off-by: Greg Rose <[email protected]>
---
 rhel/openvswitch.spec.in | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
index e510d35..fbcd868 100644
--- a/rhel/openvswitch.spec.in
+++ b/rhel/openvswitch.spec.in
@@ -169,6 +169,25 @@ fi
 /sbin/chkconfig --add openvswitch
 /sbin/chkconfig openvswitch on
 
+# In some cases a kernel module rpm will have a different minor build
+# version than the current running kernel.  Check and copy modules if
+# necessary.
+if [[ ! -d /lib/modules/$(uname -r)/extra/openvswitch && \
+      ! -d /lib/modules/$(uname -r)/weak-updates/openvswitch ]]; then
+    found="false"
+    for i in `ls -t /lib/modules`
+    do
+         if [ -d /lib/modules/$i/extra/openvswitch ]; then
+             cp -r --preserve /lib/modules/$i/extra /lib/modules/$(uname -r)
+             /usr/sbin/depmod -a
+             found="true"
+         fi
+    done
+    if [ "$found" != "true" ]; then
+        echo "Error in openvswitch kernel modules installation"
+    fi
+fi
+
 %post selinux-policy
 /usr/sbin/semodule -i 
%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || :
 
-- 
1.8.3.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to