DevStack: OVS: Only install kernel-* packages when needed

If the host OS is using an older kernel and invoke the compile_ovs
function from the DevStack OVS library (devstack/lib/ovs), that function
will try to install the kernel-dev and kernel-headers package even if
the "build_modules" parameter is set to False.

That could fail because the specific kernel-* packages for the version
of the kernel running may not be present in the distro's repository
anymore. Plus, if the kernel modules will not be compiled, there's no
reason to install such packages.

This patch is fixing this problem by using the "build_modules" parameter
as a flag to whether install or not those kernel-* packages.

Change-Id: I11af0e22d25973e6334e867ab2659fbdf9f10d86
Closes-Bug: #1802101
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
(cherry picked from commit cdfeeaf2bc)
This commit is contained in:
Lucas Alvares Gomes 2018-11-07 13:17:43 +00:00
parent 02c1db78ee
commit bbb60c0d69

View File

@ -34,7 +34,9 @@ function load_module {
# prepare_for_compilation() - Fetch ovs git repository and install packages needed for # prepare_for_compilation() - Fetch ovs git repository and install packages needed for
# compilation. # compilation.
function prepare_for_compilation { function prepare_for_compilation {
local build_modules=${1:-True}
OVS_DIR=$DEST/$OVS_REPO_NAME OVS_DIR=$DEST/$OVS_REPO_NAME
if [ ! -d $OVS_DIR ] ; then if [ ! -d $OVS_DIR ] ; then
# We can't use git_clone here because we want to ignore ERROR_ON_CLONE # We can't use git_clone here because we want to ignore ERROR_ON_CLONE
git_timed clone $OVS_REPO $OVS_DIR git_timed clone $OVS_REPO $OVS_DIR
@ -49,8 +51,14 @@ function prepare_for_compilation {
# TODO: Can you create package list files like you can inside devstack? # TODO: Can you create package list files like you can inside devstack?
install_package autoconf automake libtool gcc patch make install_package autoconf automake libtool gcc patch make
KERNEL_VERSION=`uname -r`
# If build_modules is False, we don't need to install the kernel-*
# packages. Just return.
if [[ "$build_modules" == "False" ]]; then
return
fi
KERNEL_VERSION=`uname -r`
if is_fedora ; then if is_fedora ; then
# is_fedora covers Fedora, RHEL, CentOS, etc... # is_fedora covers Fedora, RHEL, CentOS, etc...
if [[ ${KERNEL_VERSION:0:2} != "3." ]]; then if [[ ${KERNEL_VERSION:0:2} != "3." ]]; then
@ -104,7 +112,7 @@ function compile_ovs {
localstatedir="--localstatedir=$localstatedir" localstatedir="--localstatedir=$localstatedir"
fi fi
prepare_for_compilation prepare_for_compilation $build_modules
if [ ! -f configure ] ; then if [ ! -f configure ] ; then
./boot.sh ./boot.sh