From cdfeeaf2bcd422c1b5cbb9d9ccc49ec639f5abea Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Wed, 7 Nov 2018 13:17:43 +0000 Subject: [PATCH] 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 --- devstack/lib/ovs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/devstack/lib/ovs b/devstack/lib/ovs index a82f1276986..05a9042c6e3 100644 --- a/devstack/lib/ovs +++ b/devstack/lib/ovs @@ -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