[OVN] Unify OVN/OVS compilation
There were duplicated methods doing almost the same in terms of OVS/OVN compilation. This change: * move of OVS related compilation code to devstack/lib/ovs * delete of OVS related compilation code from devstack/lib/ovn_agent * source unified functions in devstack/lib/ovn_agent from devstack/lib/ovs * Unify NEUTRON_PATH variable to NEUTRON_DIR Closes-Bug: #1877377 Change-Id: Ia012a8e116a276a6674f86366c803e0e2d8ff704
This commit is contained in:
parent
a3c7aad790
commit
fb2806f808
@ -22,6 +22,9 @@
|
|||||||
source ${TOP_DIR}/lib/neutron_plugins/ovs_base
|
source ${TOP_DIR}/lib/neutron_plugins/ovs_base
|
||||||
source ${TOP_DIR}/lib/neutron_plugins/openvswitch_agent
|
source ${TOP_DIR}/lib/neutron_plugins/openvswitch_agent
|
||||||
|
|
||||||
|
# Load devstack ovs base functions
|
||||||
|
source $NEUTRON_DIR/devstack/lib/ovs
|
||||||
|
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
# --------
|
# --------
|
||||||
@ -36,12 +39,6 @@ OVN_BRANCH=${OVN_BRANCH:-v20.03.0}
|
|||||||
# https://github.com/openvswitch/ovs/commit/05bf1dbb98b0635a51f75e268ef8aed27601401d
|
# https://github.com/openvswitch/ovs/commit/05bf1dbb98b0635a51f75e268ef8aed27601401d
|
||||||
OVN_SPLIT_HASH=05bf1dbb98b0635a51f75e268ef8aed27601401d
|
OVN_SPLIT_HASH=05bf1dbb98b0635a51f75e268ef8aed27601401d
|
||||||
|
|
||||||
# Set variables for building OVS from source
|
|
||||||
OVS_REPO=${OVS_REPO:-https://github.com/openvswitch/ovs.git}
|
|
||||||
OVS_REPO_NAME=$(basename ${OVS_REPO} | cut -f1 -d'.')
|
|
||||||
OVS_REPO_NAME=${OVS_REPO_NAME:-ovs}
|
|
||||||
OVS_BRANCH=${OVS_BRANCH:-v2.13.0}
|
|
||||||
|
|
||||||
if is_service_enabled tls-proxy; then
|
if is_service_enabled tls-proxy; then
|
||||||
OVN_PROTO=ssl
|
OVN_PROTO=ssl
|
||||||
else
|
else
|
||||||
@ -303,101 +300,6 @@ function _disable_libvirt_apparmor {
|
|||||||
# OVN compilation functions
|
# OVN compilation functions
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
# Fetch the ovs git repository and install packages needed for
|
|
||||||
# the compilation.
|
|
||||||
function _prepare_for_ovs_compilation {
|
|
||||||
local build_modules=$1
|
|
||||||
clone_repository $OVS_REPO $DEST/$OVS_REPO_NAME $OVS_BRANCH
|
|
||||||
|
|
||||||
if [[ "$build_modules" == "False" ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
KERNEL_VERSION=`uname -r`
|
|
||||||
if is_fedora ; then
|
|
||||||
# is_fedora covers Fedora, RHEL, CentOS, etc...
|
|
||||||
if [[ "$os_VENDOR" == "Fedora" ]]; then
|
|
||||||
install_package elfutils-libelf-devel
|
|
||||||
KERNEL_VERSION=`echo $KERNEL_VERSION | cut --delimiter='-' --field 1`
|
|
||||||
elif [[ ${KERNEL_VERSION:0:2} != "3." ]]; then
|
|
||||||
# dash is illegal character in rpm version so replace
|
|
||||||
# them with underscore like it is done in the kernel
|
|
||||||
# https://github.com/torvalds/linux/blob/master/scripts/package/mkspec#L25
|
|
||||||
# but only for latest series of the kernel, not 3.x
|
|
||||||
|
|
||||||
KERNEL_VERSION=`echo $KERNEL_VERSION | tr - _`
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo NOTE: if kernel-devel-$KERNEL_VERSION or kernel-headers-$KERNEL_VERSION installation
|
|
||||||
echo failed, please, provide a repository with the package, or yum update / reboot
|
|
||||||
echo your machine to get the latest kernel.
|
|
||||||
|
|
||||||
install_package kernel-devel-$KERNEL_VERSION
|
|
||||||
install_package kernel-headers-$KERNEL_VERSION
|
|
||||||
|
|
||||||
elif is_ubuntu ; then
|
|
||||||
install_package linux-headers-$KERNEL_VERSION
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Reload the ovs kernel modules
|
|
||||||
function _reload_ovs_kernel_modules {
|
|
||||||
set +e
|
|
||||||
ovs_system=$(sudo ovs-dpctl dump-dps | grep ovs-system)
|
|
||||||
if [ -n "$ovs_system" ]; then
|
|
||||||
sudo ovs-dpctl del-dp ovs-system
|
|
||||||
fi
|
|
||||||
set -e
|
|
||||||
sudo modprobe -r vport_geneve
|
|
||||||
sudo modprobe -r openvswitch
|
|
||||||
sudo modprobe openvswitch || (dmesg && die $LINENO "FAILED TO LOAD openvswitch")
|
|
||||||
sudo modprobe vport-geneve || (dmesg && echo "FAILED TO LOAD vport-geneve")
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compile openvswitch and its kernel module
|
|
||||||
function _compile_ovs {
|
|
||||||
local build_modules=$1
|
|
||||||
|
|
||||||
# Install the dependencies
|
|
||||||
install_package autoconf automake libtool gcc patch make
|
|
||||||
# TODO(flaviof): Would prefer to use pip_install wrapper, but that is not
|
|
||||||
# useable right now because REQUIREMENTS_DIR variable is hard coded in
|
|
||||||
# starckrc
|
|
||||||
sudo pip3 install six
|
|
||||||
|
|
||||||
_prepare_for_ovs_compilation $build_modules
|
|
||||||
|
|
||||||
KERNEL_VERSION=$(uname -r)
|
|
||||||
major_version=$(echo "${KERNEL_VERSION}" | cut -d '.' -f1)
|
|
||||||
patch_level=$(echo "${KERNEL_VERSION}" | cut -d '.' -f2)
|
|
||||||
if [ "${major_version}" -gt 5 ] || [ "${major_version}" == 5 ] && [ "${patch_level}" -gt 5 ]; then
|
|
||||||
echo "NOTE: KERNEL VERSION is ${KERNEL_VERSION} and OVS doesn't support compiling "
|
|
||||||
echo "Kernel module for version higher than 5.5. Skipping module compilation..."
|
|
||||||
build_modules="False"
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd $DEST/$OVS_REPO_NAME
|
|
||||||
[ -f configure ] || ./boot.sh
|
|
||||||
if [ ! -f config.status ] || [ configure -nt config.status ] ; then
|
|
||||||
if [[ "$build_modules" == "True" ]]; then
|
|
||||||
./configure --with-linux=/lib/modules/$(uname -r)/build
|
|
||||||
else
|
|
||||||
./configure
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
make -j$(($(nproc) + 1))
|
|
||||||
sudo make install
|
|
||||||
if [[ "$build_modules" == "True" ]]; then
|
|
||||||
sudo make INSTALL_MOD_DIR=kernel/net/openvswitch modules_install
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
_reload_ovs_kernel_modules
|
|
||||||
else
|
|
||||||
echo "Compiling OVS kernel modules failed"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
popd
|
|
||||||
}
|
|
||||||
|
|
||||||
# compile_ovn() - Compile OVN from source and load needed modules
|
# compile_ovn() - Compile OVN from source and load needed modules
|
||||||
# Accepts three parameters:
|
# Accepts three parameters:
|
||||||
@ -469,7 +371,6 @@ function install_ovn {
|
|||||||
|
|
||||||
# Install tox, used to generate the config (see devstack/override-defaults)
|
# Install tox, used to generate the config (see devstack/override-defaults)
|
||||||
pip_install tox
|
pip_install tox
|
||||||
source $NEUTRON_DIR/devstack/lib/ovs
|
|
||||||
remove_ovs_packages
|
remove_ovs_packages
|
||||||
sudo rm -f $OVS_RUNDIR/*
|
sudo rm -f $OVS_RUNDIR/*
|
||||||
|
|
||||||
|
@ -10,9 +10,14 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
# --------
|
||||||
|
|
||||||
|
# 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}
|
||||||
OVS_REPO_NAME=$(basename ${OVS_REPO} | cut -f1 -d'.')
|
OVS_REPO_NAME=$(basename ${OVS_REPO} | cut -f1 -d'.')
|
||||||
OVS_BRANCH=${OVS_BRANCH:-master}
|
OVS_REPO_NAME=${OVS_REPO_NAME:-ovs}
|
||||||
|
OVS_BRANCH=${OVS_BRANCH:-51e9479da62edb04a5be47a7655de75c299b9fa1}
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
@ -33,7 +38,7 @@ function load_module {
|
|||||||
|
|
||||||
# prepare_for_compilation() - Fetch ovs git repository and install packages needed for
|
# prepare_for_compilation() - Fetch ovs git repository and install packages needed for
|
||||||
# compilation.
|
# compilation.
|
||||||
function prepare_for_compilation {
|
function prepare_for_ovs_compilation {
|
||||||
local build_modules=${1:-False}
|
local build_modules=${1:-False}
|
||||||
OVS_DIR=$DEST/$OVS_REPO_NAME
|
OVS_DIR=$DEST/$OVS_REPO_NAME
|
||||||
|
|
||||||
@ -85,22 +90,24 @@ function prepare_for_compilation {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# load_kernel_modules() - load openvswitch kernel module
|
# load_ovs_kernel_modules() - load openvswitch kernel module
|
||||||
function load_kernel_modules {
|
function load_ovs_kernel_modules {
|
||||||
load_module openvswitch
|
load_module openvswitch
|
||||||
load_module vport-geneve False
|
load_module vport-geneve False
|
||||||
dmesg | tail
|
dmesg | tail
|
||||||
}
|
}
|
||||||
|
|
||||||
# reload_kernel_modules() - reload openvswitch kernel module
|
# reload_ovs_kernel_modules() - reload openvswitch kernel module
|
||||||
function reload_kernel_modules {
|
function reload_ovs_kernel_modules {
|
||||||
local ovs_system=$(sudo ovs-dpctl dump-dps | grep ovs-system)
|
set +e
|
||||||
|
ovs_system=$(sudo ovs-dpctl dump-dps | grep ovs-system)
|
||||||
if [ -n "$ovs_system" ]; then
|
if [ -n "$ovs_system" ]; then
|
||||||
sudo ovs-dpctl del-dp ovs-system
|
sudo ovs-dpctl del-dp ovs-system
|
||||||
fi
|
fi
|
||||||
|
set -e
|
||||||
sudo modprobe -r vport_geneve
|
sudo modprobe -r vport_geneve
|
||||||
sudo modprobe -r openvswitch
|
sudo modprobe -r openvswitch
|
||||||
load_kernel_modules
|
load_ovs_kernel_modules
|
||||||
}
|
}
|
||||||
|
|
||||||
# compile_ovs() - Compile OVS from source and load needed modules.
|
# compile_ovs() - Compile OVS from source and load needed modules.
|
||||||
@ -123,7 +130,16 @@ function compile_ovs {
|
|||||||
localstatedir="--localstatedir=$localstatedir"
|
localstatedir="--localstatedir=$localstatedir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prepare_for_compilation $build_modules
|
prepare_for_ovs_compilation $build_modules
|
||||||
|
|
||||||
|
KERNEL_VERSION=$(uname -r)
|
||||||
|
major_version=$(echo "${KERNEL_VERSION}" | cut -d '.' -f1)
|
||||||
|
patch_level=$(echo "${KERNEL_VERSION}" | cut -d '.' -f2)
|
||||||
|
if [ "${major_version}" -gt 5 ] || [ "${major_version}" == 5 ] && [ "${patch_level}" -gt 5 ]; then
|
||||||
|
echo "NOTE: KERNEL VERSION is ${KERNEL_VERSION} and OVS doesn't support compiling "
|
||||||
|
echo "Kernel module for version higher than 5.5. Skipping module compilation..."
|
||||||
|
build_modules="False"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f configure ] ; then
|
if [ ! -f configure ] ; then
|
||||||
./boot.sh
|
./boot.sh
|
||||||
@ -139,9 +155,9 @@ function compile_ovs {
|
|||||||
sudo make install
|
sudo make install
|
||||||
if [[ "$build_modules" == "True" ]]; then
|
if [[ "$build_modules" == "True" ]]; then
|
||||||
sudo make INSTALL_MOD_DIR=kernel/net/openvswitch modules_install
|
sudo make INSTALL_MOD_DIR=kernel/net/openvswitch modules_install
|
||||||
reload_kernel_modules
|
reload_ovs_kernel_modules
|
||||||
else
|
else
|
||||||
load_kernel_modules
|
load_ovs_kernel_modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $_pwd
|
cd $_pwd
|
||||||
@ -166,33 +182,6 @@ function action_openvswitch {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# compile_ovs_kernel_module() - Compile openvswitch kernel module and load it
|
|
||||||
function compile_ovs_kernel_module {
|
|
||||||
local _pwd=$PWD
|
|
||||||
|
|
||||||
prepare_for_compilation
|
|
||||||
|
|
||||||
[ -f configure ] || ./boot.sh
|
|
||||||
if [ ! -f config.status ] || [ configure -nt config.status ] ; then
|
|
||||||
./configure --with-linux=/lib/modules/$(uname -r)/build
|
|
||||||
fi
|
|
||||||
|
|
||||||
action_openvswitch stop
|
|
||||||
|
|
||||||
make -j$[$(nproc) + 1]
|
|
||||||
sudo make INSTALL_MOD_DIR=kernel/net/openvswitch modules_install
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
reload_kernel_modules
|
|
||||||
else
|
|
||||||
echo "Compiling OVS kernel module failed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
action_openvswitch start
|
|
||||||
|
|
||||||
cd $_pwd
|
|
||||||
}
|
|
||||||
|
|
||||||
# start_new_ovs() - removes old ovs database, creates a new one and starts ovs
|
# start_new_ovs() - removes old ovs database, creates a new one and starts ovs
|
||||||
function start_new_ovs () {
|
function start_new_ovs () {
|
||||||
sudo rm -f /etc/openvswitch/conf.db /etc/openvswitch/.conf.db~lock~
|
sudo rm -f /etc/openvswitch/conf.db /etc/openvswitch/.conf.db~lock~
|
||||||
|
@ -6,11 +6,11 @@ VENV=${1:-"api"}
|
|||||||
FLAVOR=${2:-"all"}
|
FLAVOR=${2:-"all"}
|
||||||
|
|
||||||
GATE_DEST=$BASE/new
|
GATE_DEST=$BASE/new
|
||||||
NEUTRON_PATH=$GATE_DEST/neutron
|
NEUTRON_DIR=$GATE_DEST/neutron
|
||||||
GATE_HOOKS=$NEUTRON_PATH/neutron/tests/contrib/hooks
|
GATE_HOOKS=$NEUTRON_DIR/neutron/tests/contrib/hooks
|
||||||
DEVSTACK_PATH=$GATE_DEST/devstack
|
DEVSTACK_PATH=$GATE_DEST/devstack
|
||||||
LOCAL_CONF=$DEVSTACK_PATH/late-local.conf
|
LOCAL_CONF=$DEVSTACK_PATH/late-local.conf
|
||||||
RALLY_EXTRA_DIR=$NEUTRON_PATH/rally-jobs/extra
|
RALLY_EXTRA_DIR=$NEUTRON_DIR/rally-jobs/extra
|
||||||
DSCONF=/tmp/devstack-tools/bin/dsconf
|
DSCONF=/tmp/devstack-tools/bin/dsconf
|
||||||
|
|
||||||
# Install devstack-tools used to produce local.conf; we can't rely on
|
# Install devstack-tools used to produce local.conf; we can't rely on
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
BASE_DIR={{ base_dir }}
|
BASE_DIR={{ base_dir }}
|
||||||
GATE_DEST={{ gate_dest_dir }}
|
GATE_DEST={{ gate_dest_dir }}
|
||||||
PROJECT_NAME={{ project_name }}
|
PROJECT_NAME={{ project_name }}
|
||||||
NEUTRON_PATH={{ neutron_dir }}
|
NEUTRON_DIR={{ neutron_dir }}
|
||||||
DEVSTACK_PATH={{ devstack_dir }}
|
DEVSTACK_PATH={{ devstack_dir }}
|
||||||
TOP_DIR={{ devstack_dir }}
|
TOP_DIR={{ devstack_dir }}
|
||||||
VENV={{ tests_venv }}
|
VENV={{ tests_venv }}
|
||||||
@ -17,9 +17,9 @@
|
|||||||
OVN_BRANCH={{ OVN_BRANCH }}
|
OVN_BRANCH={{ OVN_BRANCH }}
|
||||||
|
|
||||||
source $DEVSTACK_PATH/functions
|
source $DEVSTACK_PATH/functions
|
||||||
source $NEUTRON_PATH/devstack/lib/ovs
|
source $NEUTRON_DIR/devstack/lib/ovs
|
||||||
source $NEUTRON_PATH/devstack/lib/ovn_agent
|
source $NEUTRON_DIR/devstack/lib/ovn_agent
|
||||||
source $NEUTRON_PATH/tools/configure_for_func_testing.sh
|
source $NEUTRON_DIR/tools/configure_for_func_testing.sh
|
||||||
|
|
||||||
configure_host_for_func_testing
|
configure_host_for_func_testing
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
@ -58,7 +58,7 @@ VENV=${VENV:-dsvm-functional}
|
|||||||
DEVSTACK_PATH=${DEVSTACK_PATH:-$1}
|
DEVSTACK_PATH=${DEVSTACK_PATH:-$1}
|
||||||
PROJECT_NAME=${PROJECT_NAME:-neutron}
|
PROJECT_NAME=${PROJECT_NAME:-neutron}
|
||||||
REPO_BASE=${GATE_DEST:-$(cd $(dirname "$0")/../.. && pwd)}
|
REPO_BASE=${GATE_DEST:-$(cd $(dirname "$0")/../.. && pwd)}
|
||||||
NEUTRON_PATH=${NEUTRON_PATH:=$REPO_BASE/$PROJECT_NAME}
|
NEUTRON_DIR=${NEUTRON_DIR:=$REPO_BASE/$PROJECT_NAME}
|
||||||
INSTALL_MYSQL_ONLY=${INSTALL_MYSQL_ONLY:-False}
|
INSTALL_MYSQL_ONLY=${INSTALL_MYSQL_ONLY:-False}
|
||||||
# The gate should automatically install dependencies.
|
# The gate should automatically install dependencies.
|
||||||
INSTALL_BASE_DEPENDENCIES=${INSTALL_BASE_DEPENDENCIES:-$IS_GATE}
|
INSTALL_BASE_DEPENDENCIES=${INSTALL_BASE_DEPENDENCIES:-$IS_GATE}
|
||||||
@ -110,8 +110,8 @@ function _install_base_deps {
|
|||||||
PACKAGES=$(echo $PACKAGES | perl -pe 's|python-(?!dev)[^ ]*||g')
|
PACKAGES=$(echo $PACKAGES | perl -pe 's|python-(?!dev)[^ ]*||g')
|
||||||
install_package $PACKAGES
|
install_package $PACKAGES
|
||||||
|
|
||||||
source $NEUTRON_PATH/devstack/lib/ovs
|
source $NEUTRON_DIR/devstack/lib/ovs
|
||||||
source $NEUTRON_PATH/devstack/lib/ovn_agent
|
source $NEUTRON_DIR/devstack/lib/ovn_agent
|
||||||
echo_summary "OVN_BRANCH: ${OVN_BRANCH} OVS_BRANCH: ${OVS_BRANCH}"
|
echo_summary "OVN_BRANCH: ${OVN_BRANCH} OVS_BRANCH: ${OVS_BRANCH}"
|
||||||
compile_ovs False /usr /var
|
compile_ovs False /usr /var
|
||||||
compile_ovn False /usr /var
|
compile_ovn False /usr /var
|
||||||
|
@ -76,7 +76,6 @@
|
|||||||
Q_USE_PROVIDERNET_FOR_PUBLIC: true
|
Q_USE_PROVIDERNET_FOR_PUBLIC: true
|
||||||
ENABLE_CHASSIS_AS_GW: true
|
ENABLE_CHASSIS_AS_GW: true
|
||||||
OVN_L3_CREATE_PUBLIC_NETWORK: true
|
OVN_L3_CREATE_PUBLIC_NETWORK: true
|
||||||
OVN_BRANCH: master
|
|
||||||
devstack_local_conf:
|
devstack_local_conf:
|
||||||
post-config:
|
post-config:
|
||||||
"${RALLY_CONF_DIR}/${RALLY_CONF_FILE}":
|
"${RALLY_CONF_DIR}/${RALLY_CONF_FILE}":
|
||||||
|
@ -262,7 +262,9 @@
|
|||||||
(tempest.(api|scenario|thirdparty))).*$"
|
(tempest.(api|scenario|thirdparty))).*$"
|
||||||
devstack_localrc:
|
devstack_localrc:
|
||||||
OVN_BRANCH: master
|
OVN_BRANCH: master
|
||||||
|
OVS_BRANCH: master
|
||||||
group-vars:
|
group-vars:
|
||||||
subnode:
|
subnode:
|
||||||
devstack_localrc:
|
devstack_localrc:
|
||||||
OVN_BRANCH: master
|
OVN_BRANCH: master
|
||||||
|
OVS_BRANCH: master
|
||||||
|
Loading…
Reference in New Issue
Block a user