From fa5e23cbe62424896ce200882e2d255b66ec7abe Mon Sep 17 00:00:00 2001 From: Jakub Libosvar Date: Fri, 2 Sep 2016 14:43:06 +0200 Subject: [PATCH] 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 --- devstack/lib/ovs | 14 ++++++++++++++ neutron/tests/contrib/gate_hook.sh | 18 ++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/devstack/lib/ovs b/devstack/lib/ovs index 287e3e48dff..6112a71661d 100644 --- a/devstack/lib/ovs +++ b/devstack/lib/ovs @@ -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. diff --git a/neutron/tests/contrib/gate_hook.sh b/neutron/tests/contrib/gate_hook.sh index f993c63ce47..52e51ecb711 100644 --- a/neutron/tests/contrib/gate_hook.sh +++ b/neutron/tests/contrib/gate_hook.sh @@ -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