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>
This commit is contained in:
Lucas Alvares Gomes 2018-11-07 13:17:43 +00:00
parent 3c64c5caa0
commit cdfeeaf2bc
1 changed files with 10 additions and 2 deletions

View File

@ -34,7 +34,9 @@ function load_module {
# prepare_for_compilation() - Fetch ovs git repository and install packages needed for
# compilation.
function prepare_for_compilation {
local build_modules=${1:-True}
OVS_DIR=$DEST/$OVS_REPO_NAME
if [ ! -d $OVS_DIR ] ; then
# We can't use git_clone here because we want to ignore ERROR_ON_CLONE
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?
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
# is_fedora covers Fedora, RHEL, CentOS, etc...
if [[ "$os_VENDOR" == "Fedora" ]]; then
@ -107,7 +115,7 @@ function compile_ovs {
localstatedir="--localstatedir=$localstatedir"
fi
prepare_for_compilation
prepare_for_compilation $build_modules
if [ ! -f configure ] ; then
./boot.sh