Always make sure openvswitch kernel module is loaded

In change https://review.opendev.org/#/c/661065/ we stopped
compiling openvswitch from source, which was always doing
a reload of the kernel module.  We've seen in some cases
the module isn't loaded, so change to always load the
module unconditionally to avoid this.

Change-Id: I2ac2aa4cc84d6f5ac62bc8c7aec67ac17d89c614
Closes-bug: #1845324
This commit is contained in:
Brian Haley 2019-09-25 08:54:45 -04:00
parent 9fdac1e887
commit 6b241bb13c

View File

@ -27,7 +27,7 @@ function load_module {
if [ "$(trueorfalse True fatal)" == "True" ]; then if [ "$(trueorfalse True fatal)" == "True" ]; then
sudo modprobe $module || (dmesg && die $LINENO "FAILED TO LOAD $module") sudo modprobe $module || (dmesg && die $LINENO "FAILED TO LOAD $module")
else else
sudo modprobe $module || (echo "FAILED TO LOAD vport_geneve" && dmesg) sudo modprobe $module || (echo "FAILED TO LOAD $module" && dmesg)
fi fi
} }
@ -85,6 +85,12 @@ function prepare_for_compilation {
fi fi
} }
# load_kernel_modules() - load openvswitch kernel module
function load_kernel_modules {
load_module openvswitch
load_module vport-geneve False
dmesg | tail
}
# reload_kernel_modules() - reload openvswitch kernel module # reload_kernel_modules() - reload openvswitch kernel module
function reload_kernel_modules { function reload_kernel_modules {
@ -94,9 +100,7 @@ function reload_kernel_modules {
fi fi
sudo modprobe -r vport_geneve sudo modprobe -r vport_geneve
sudo modprobe -r openvswitch sudo modprobe -r openvswitch
load_module openvswitch load_kernel_modules
load_module vport-geneve False
dmesg | tail
} }
# compile_ovs() - Compile OVS from source and load needed modules. # compile_ovs() - Compile OVS from source and load needed modules.
@ -136,6 +140,8 @@ function compile_ovs {
if [[ "$build_modules" == "True" ]]; then if [[ "$build_modules" == "True" ]]; then
sudo make INSTALL_MOD_DIR=kernel/net/openvswitch modules_install sudo make INSTALL_MOD_DIR=kernel/net/openvswitch modules_install
reload_kernel_modules reload_kernel_modules
else
load_kernel_modules
fi fi
cd $_pwd cd $_pwd