Install OVS from source when it was configured like that

Function _neutron_ovs_base_install_agent_packages always tried to
install openvswitch from packages and start it using systemd units.
That was failing when ovs was expected to be installed from source.
This patch fixes that.

Change-Id: Iae8625dd800d30061ea3dbed9eb0dfbe16f21572
This commit is contained in:
Slawek Kaplonski 2021-07-06 12:05:31 +02:00
parent b4e683e6b9
commit 4185358837
3 changed files with 35 additions and 28 deletions

View File

@ -24,11 +24,6 @@ source ${TOP_DIR}/lib/neutron_plugins/openvswitch_agent
# Load devstack ovs compliation and loading functions # Load devstack ovs compliation and loading functions
source ${TOP_DIR}/lib/neutron_plugins/ovs_source source ${TOP_DIR}/lib/neutron_plugins/ovs_source
# Defaults
# --------
Q_BUILD_OVS_FROM_GIT=$(trueorfalse True Q_BUILD_OVS_FROM_GIT)
# Set variables for building OVN from source # Set variables for building OVN from source
OVN_REPO=${OVN_REPO:-https://github.com/ovn-org/ovn.git} OVN_REPO=${OVN_REPO:-https://github.com/ovn-org/ovn.git}
OVN_REPO_NAME=$(basename ${OVN_REPO} | cut -f1 -d'.') OVN_REPO_NAME=$(basename ${OVN_REPO} | cut -f1 -d'.')
@ -74,6 +69,9 @@ OVN_UUID=${OVN_UUID:-}
# unless the distro kernel includes ovs+conntrack support. # unless the distro kernel includes ovs+conntrack support.
OVN_BUILD_MODULES=$(trueorfalse False OVN_BUILD_MODULES) OVN_BUILD_MODULES=$(trueorfalse False OVN_BUILD_MODULES)
OVN_BUILD_FROM_SOURCE=$(trueorfalse False OVN_BUILD_FROM_SOURCE) OVN_BUILD_FROM_SOURCE=$(trueorfalse False OVN_BUILD_FROM_SOURCE)
if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then
Q_BUILD_OVS_FROM_GIT=True
fi
# Whether or not to install the ovs python module from ovs source. This can be # Whether or not to install the ovs python module from ovs source. This can be
# used to test and validate new ovs python features. This should only be used # used to test and validate new ovs python features. This should only be used
@ -341,11 +339,6 @@ function ovn_sanity_check {
# install_ovn() - Collect source and prepare # install_ovn() - Collect source and prepare
function install_ovn { function install_ovn {
if [[ "$Q_BUILD_OVS_FROM_GIT" == "False" ]]; then
echo "Installation of OVS from source disabled."
return 0
fi
echo "Installing OVN and dependent packages" echo "Installing OVN and dependent packages"
# Check the OVN configuration # Check the OVN configuration

View File

@ -7,6 +7,12 @@
_XTRACE_NEUTRON_OVS_BASE=$(set +o | grep xtrace) _XTRACE_NEUTRON_OVS_BASE=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
# Load devstack ovs compliation and loading functions
source ${TOP_DIR}/lib/neutron_plugins/ovs_source
# Defaults
# --------
OVS_BRIDGE=${OVS_BRIDGE:-br-int} OVS_BRIDGE=${OVS_BRIDGE:-br-int}
# OVS recognize default 'system' datapath or 'netdev' for userspace datapath # OVS recognize default 'system' datapath or 'netdev' for userspace datapath
OVS_DATAPATH_TYPE=${OVS_DATAPATH_TYPE:-system} OVS_DATAPATH_TYPE=${OVS_DATAPATH_TYPE:-system}
@ -60,6 +66,12 @@ function _neutron_ovs_base_install_ubuntu_dkms {
} }
function _neutron_ovs_base_install_agent_packages { function _neutron_ovs_base_install_agent_packages {
if [ "$Q_BUILD_OVS_FROM_GIT" == "True" ]; then
remove_ovs_packages
compile_ovs False /usr /var
load_conntrack_gre_module
start_new_ovs
else
# Install deps # Install deps
install_package $(get_packages "openvswitch") install_package $(get_packages "openvswitch")
if is_ubuntu; then if is_ubuntu; then
@ -82,6 +94,7 @@ function _neutron_ovs_base_install_agent_packages {
} }
fi fi
fi fi
fi
} }
function _neutron_ovs_base_configure_firewall_driver { function _neutron_ovs_base_configure_firewall_driver {

View File

@ -14,6 +14,7 @@
# Defaults # Defaults
# -------- # --------
Q_BUILD_OVS_FROM_GIT=$(trueorfalse False Q_BUILD_OVS_FROM_GIT)
# Set variables for building OVS from source # Set variables for building OVS from source
OVS_REPO=${OVS_REPO:-https://github.com/openvswitch/ovs.git} OVS_REPO=${OVS_REPO:-https://github.com/openvswitch/ovs.git}