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
}
# 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.
# Accepts two parameters:
# - first one is True, modules are built and installed.

View File

@ -44,14 +44,16 @@ case $VENV in
configure_host_for_func_testing
# 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
# a fix for usage of VXLAN tunnels on a single node:
# https://github.com/openvswitch/ovs/commit/741f47cf35df2bfc7811b2cff75c9bb8d05fd26f
OVS_BRANCH=042326c3fcf61e8638fa15926f984ce5ae142f4b
remove_ovs_packages
compile_ovs True /usr /var
start_new_ovs
if is_kernel_supported_for_ovs25; then
# 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
# a fix for usage of VXLAN tunnels on a single node:
# https://github.com/openvswitch/ovs/commit/741f47cf35df2bfc7811b2cff75c9bb8d05fd26f
OVS_BRANCH=042326c3fcf61e8638fa15926f984ce5ae142f4b
remove_ovs_packages
compile_ovs True /usr /var
start_new_ovs
fi
load_conf_hook iptables_verify
# Make the workspace owned by the stack user