Install OVS from git if current version < 2.5.1

In OVS version 2.5.1 there are several bug fixes to issues that Neutron
encounters. This fix allows devstack to install a newer version of OVS,
by default version 2.5.1.

Specifically, for bug 1640283, we need the following commit from OVS:
8c0b419a0b9ac0141d6973dcc80306dfc6a83d31 ofproto/trace: Fix "unchanged"
output for Final flow

The version is overridable by NEUTRON_OVERRIDE_OVS_BRANCH variable.

Change-Id: Icc9d9811e6fc1935966241ed499c5e597a675877
Related-Bug: 1602567
Closes-Bug: 1640283
This commit is contained in:
Omer Anson 2016-11-08 18:08:50 +02:00
parent 475241834d
commit 7403bccbc3
2 changed files with 62 additions and 10 deletions

View File

@ -49,6 +49,67 @@ function is_kernel_supported_for_ovs25 {
return 1
}
# is_version_le() - Helper function to test if the first version string is less
# than or equal to the second version string
function is_version_le {
version1=$1
version2=$2
echo -e "$version1\\n$version2" | sort -VC
return $?
}
# is_kernel_supported_for_ovs261() - compilation of openvswitch 2.6.1 kernel
# module supports only kernels versions
# between 3.10 and 4.8 (inclusive)
# Taken from the OVS tree (acinclude.m4)
function is_kernel_supported_for_ovs261 {
major=$(uname -r | cut -d\. -f 1)
minor=$(uname -r | cut -d\. -f 2)
kversion="$major.$minor"
minimum_version="3.10"
maximum_version="4.8"
if ! is_version_le $minimum_version $kversion; then
return 1
fi
if ! is_version_le $kversion $maximum_version ; then
return 1
fi
return 0
}
# is_ovs_version_ok() - Verify the OVS version is new enough. Specifically,
# verify the OVS version >= 2.5.1
function is_ovs_version_ok {
minimum_version="2.5.1"
version_string=$(ovs-vswitchd -V | awk '/^ovs-vswitchd/ { print $NF}')
is_version_le $minimum_version $version_string
return $?
}
# upgrade_ovs_if_necessary() - Check if OVS version is high enough ( >= 2.5.1)
# and upgrade if necessary.
function upgrade_ovs_if_necessary {
if ! is_ovs_version_ok; then
if [ "$NEUTRON_OVERRIDE_OVS_BRANCH" ]; then
OVS_BRANCH=$NEUTRON_OVERRIDE_OVS_BRANCH
elif is_kernel_supported_for_ovs25; then
# The order of conditions here is such that on Trusty we install
# version 2.5.1, and on Xenial we upgrade to 2.6.1 (Since Xenial
# kernel is not compatible with 2.5.1)
OVS_BRANCH="v2.5.1"
elif is_kernel_supported_for_ovs261; then
OVS_BRANCH="v2.6.1"
else
echo "WARNING: Unsupported kernel for OVS compilation. Trying default branch."
fi
echo "Compiling OVS branch: $OVS_BRANCH"
remove_ovs_packages
compile_ovs True /usr /var
start_new_ovs
fi
}
# 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,16 +44,7 @@ case $VENV in
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,
# 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
upgrade_ovs_if_necessary
load_conf_hook iptables_verify
# Make the workspace owned by the stack user