Fix the OVS version check to work with upstream master versions of OVS.
This patch adds two functions to check version strings in the toplevel functions file. The openvswitch_agent then uses these to compare versions when checking for tunneling support. The tunneling version check now also takes into account upstream master versions of Open vSwitch, which the previous version check always failed on. Fixes bug #1190734 Change-Id: I0102fb57f8ce5529169025efa21a0996ad68bef1
This commit is contained in:
parent
ad31e1cb95
commit
51a3f1f636
54
functions
54
functions
@ -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
|
# Restore xtrace
|
||||||
$XTRACE
|
$XTRACE
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ function quantum_plugin_configure_plugin_agent() {
|
|||||||
if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then
|
if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then
|
||||||
# Verify tunnels are supported
|
# Verify tunnels are supported
|
||||||
# REVISIT - also check kernel module support for GRE and patch ports
|
# REVISIT - also check kernel module support for GRE and patch ports
|
||||||
OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
|
OVS_VERSION=`ovs-vsctl --version | head -n 1 | grep -E -o "[0-9]+\.[0-9]+"`
|
||||||
if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then
|
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."
|
die $LINENO "You are running OVS version $OVS_VERSION. OVS 1.4+ is required for tunneling between multiple hosts."
|
||||||
fi
|
fi
|
||||||
iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True
|
iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True
|
||||||
|
Loading…
Reference in New Issue
Block a user