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,26 +66,33 @@ function _neutron_ovs_base_install_ubuntu_dkms {
} }
function _neutron_ovs_base_install_agent_packages { function _neutron_ovs_base_install_agent_packages {
# Install deps if [ "$Q_BUILD_OVS_FROM_GIT" == "True" ]; then
install_package $(get_packages "openvswitch") remove_ovs_packages
if is_ubuntu; then compile_ovs False /usr /var
_neutron_ovs_base_install_ubuntu_dkms load_conntrack_gre_module
restart_service openvswitch-switch start_new_ovs
elif is_fedora; then else
restart_service openvswitch # Install deps
sudo systemctl enable openvswitch install_package $(get_packages "openvswitch")
elif is_suse; then if is_ubuntu; then
if [[ $DISTRO == "sle12" ]] && vercmp "$os_RELEASE" "<" "12.2" ; then _neutron_ovs_base_install_ubuntu_dkms
restart_service openvswitch-switch restart_service openvswitch-switch
else elif is_fedora; then
# workaround for https://bugzilla.suse.com/show_bug.cgi?id=1085971 restart_service openvswitch
if [[ $DISTRO =~ "tumbleweed" ]]; then sudo systemctl enable openvswitch
sudo sed -i -e "s,^OVS_USER_ID=.*,OVS_USER_ID='root:root'," /etc/sysconfig/openvswitch elif is_suse; then
if [[ $DISTRO == "sle12" ]] && vercmp "$os_RELEASE" "<" "12.2" ; then
restart_service openvswitch-switch
else
# workaround for https://bugzilla.suse.com/show_bug.cgi?id=1085971
if [[ $DISTRO =~ "tumbleweed" ]]; then
sudo sed -i -e "s,^OVS_USER_ID=.*,OVS_USER_ID='root:root'," /etc/sysconfig/openvswitch
fi
restart_service openvswitch || {
journalctl -xe || :
systemctl status openvswitch
}
fi fi
restart_service openvswitch || {
journalctl -xe || :
systemctl status openvswitch
}
fi fi
fi fi
} }

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}