Merge "Fix the OVS version check to work with upstream master versions of OVS."

This commit is contained in:
Jenkins 2013-06-18 20:07:48 +00:00 committed by Gerrit Code Review
commit c3e5cfcffa
2 changed files with 56 additions and 2 deletions

View File

@ -1466,6 +1466,60 @@ function check_path_perm_sanity() {
}
# This function recursively compares versions, and is not meant to be
# called by anything other than vercmp_numbers below. This function does
# not work with alphabetic versions.
#
# _vercmp_r sep ver1 ver2
function _vercmp_r {
typeset sep
typeset -a ver1=() ver2=()
sep=$1; shift
ver1=("${@:1:sep}")
ver2=("${@:sep+1}")
if ((ver1 > ver2)); then
echo 1; return 0
elif ((ver2 > ver1)); then
echo -1; return 0
fi
if ((sep <= 1)); then
echo 0; return 0
fi
_vercmp_r $((sep-1)) "${ver1[@]:1}" "${ver2[@]:1}"
}
# This function compares two versions and is meant to be called by
# external callers. Please note the function assumes non-alphabetic
# versions. For example, this will work:
#
# vercmp_numbers 1.10 1.4
#
# The above will return "1", as 1.10 is greater than 1.4.
#
# vercmp_numbers 5.2 6.4
#
# The above will return "-1", as 5.2 is less than 6.4.
#
# vercmp_numbers 4.0 4.0
#
# The above will return "0", as the versions are equal.
#
# vercmp_numbers ver1 ver2
vercmp_numbers() {
typeset v1=$1 v2=$2 sep
typeset -a ver1 ver2
IFS=. read -ra ver1 <<< "$v1"
IFS=. read -ra ver2 <<< "$v2"
_vercmp_r "${#ver1[@]}" "${ver1[@]}" "${ver2[@]}"
}
# Restore xtrace
$XTRACE

View File

@ -43,8 +43,8 @@ function quantum_plugin_configure_plugin_agent() {
if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then
# Verify tunnels are supported
# REVISIT - also check kernel module support for GRE and patch ports
OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then
OVS_VERSION=`ovs-vsctl --version | head -n 1 | grep -E -o "[0-9]+\.[0-9]+"`
if [ `vercmp_numbers "$OVS_VERSION" "1.4"` -lt "0" ] && ! is_service_enabled q-svc ; then
die $LINENO "You are running OVS version $OVS_VERSION. OVS 1.4+ is required for tunneling between multiple hosts."
fi
iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True