gate_hook: Compile ovs only with supported kernels

The intention of this patch is not to break current compilations on
Xenial boxes that run with 4.4 kernel which is not supported by OVS
openvswitch kernel module. After we are confident to switch master
branch to be running on Xenial only, we will get rid of the compilation
itself until it's needed by other features.

Change-Id: I1c890bf5a6564a69e36b8289a5d8dc0deee2a429
This commit is contained in:
Jakub Libosvar 2016-09-02 14:43:06 +02:00
parent 1d4a621718
commit fa5e23cbe6
2 changed files with 24 additions and 8 deletions

View File

@ -31,6 +31,20 @@ function load_module {
fi fi
} }
# is_kernel_supported_for_ovs25() - compilation of openvswitch 2.5 kernel module
# supports only kernels up to 4.3.x, function
# determines whether compilation from source
# will succeed on this machine
function is_kernel_supported_for_ovs25 {
major=$(uname -r | cut -d\. -f 1)
minor=$(uname -r | cut -d\. -f 2)
if [ $major -le 4 -a $minor -le 3 ]; then
return 0
fi
return 1
}
# compile_ovs() - Compile OVS from source and load needed modules. # compile_ovs() - Compile OVS from source and load needed modules.
# Accepts two parameters: # Accepts two parameters:
# - first one is True, modules are built and installed. # - first one is True, modules are built and installed.

View File

@ -44,6 +44,7 @@ case $VENV in
configure_host_for_func_testing configure_host_for_func_testing
if is_kernel_supported_for_ovs25; then
# The OVS_BRANCH variable is used by git checkout. In the case below, # The OVS_BRANCH variable is used by git checkout. In the case below,
# we use a current (2016-08-19) HEAD commit from branch-2.5 that contains # we use a current (2016-08-19) HEAD commit from branch-2.5 that contains
# a fix for usage of VXLAN tunnels on a single node: # a fix for usage of VXLAN tunnels on a single node:
@ -52,6 +53,7 @@ case $VENV in
remove_ovs_packages remove_ovs_packages
compile_ovs True /usr /var compile_ovs True /usr /var
start_new_ovs start_new_ovs
fi
load_conf_hook iptables_verify load_conf_hook iptables_verify
# Make the workspace owned by the stack user # Make the workspace owned by the stack user