On 1/12/2018 11:39 AM, Flavio Leitner wrote:
On Fri, Jan 12, 2018 at 08:37:44AM -0800, Greg Rose wrote:
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 running kernel found that the kernel
modules were installed to the wrong directory.
I think this needs to be reworded because I thought something
has changed in 7.2 to introduce this problem when it seems
a bug in the way kmod is being handled in kmod package reproduces
in RHEL 7.2.
OK, I'll fix that up.
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 a critical bug was encountered in
which the in-tree openvswitch kernel module was loaded instead
of the one the customer explicitly installed with the rpm.
This patch replicates ./extra/openvswitch directory with kernel
modules, if for the currently running kernel there is neither
a ./extra/openvswitch nor ./weak-update/openvswitch directory.
I think the same comment I did for RHEL-6 works for RHEL-7,
all you need is to run /sbin/weak-modules --add-module
in the %post section.
Don't forget to run again in %postun to remove the symlinks
as the module will not exist.
Yes, now that I *know* about /sbin/weak-updates many of the problems that
we've been talking about with this patch are resolved in a much more elegant
and system friendly manner.
Thank you so much for the pointer!
- Greg
fbl
Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
V2 - Incorporate feedback from V1
---
rhel/openvswitch.spec.in | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
index e510d35..b5b5122 100644
--- a/rhel/openvswitch.spec.in
+++ b/rhel/openvswitch.spec.in
@@ -169,6 +169,32 @@ 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 currently running kernel. In this case the kernel
+# modules will be installed but not to the kernel modules directory
+# of the currently running kernel. Check and copy modules if
+# necessary.
+# This is a bug that has only been found to occur on RHEL 7.2.
+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
+ mkdir -p /lib/modules/$(uname -r)/extra
+ cp -r --preserve "/lib/modules/$i/extra/openvswitch" \
+ /lib/modules/$(uname -r)/extra
+ found="true"
+ break
+ fi
+ done
+ if [ "$found" != "true" ]; then
+ echo "Error in openvswitch kernel modules installation"
+ else
+ /usr/sbin/depmod -a
+ 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
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev