Browse Source

Merge "[OVN] Unify OVN/OVS compilation" into stable/ussuri

changes/15/741915/1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
3c598a1a73
7 changed files with 43 additions and 144 deletions
  1. +4
    -95
      devstack/lib/ovn_agent
  2. +27
    -38
      devstack/lib/ovs
  3. +3
    -3
      neutron/tests/contrib/gate_hook.sh
  4. +4
    -4
      roles/configure_functional_tests/tasks/main.yaml
  5. +3
    -3
      tools/configure_for_func_testing.sh
  6. +0
    -1
      zuul.d/rally.yaml
  7. +2
    -0
      zuul.d/tempest-multinode.yaml

+ 4
- 95
devstack/lib/ovn_agent View File

@@ -22,6 +22,9 @@
source ${TOP_DIR}/lib/neutron_plugins/ovs_base
source ${TOP_DIR}/lib/neutron_plugins/openvswitch_agent

# Load devstack ovs base functions
source $NEUTRON_DIR/devstack/lib/ovs


# Defaults
# --------
@@ -30,13 +33,7 @@ source ${TOP_DIR}/lib/neutron_plugins/openvswitch_agent
OVN_REPO=${OVN_REPO:-https://github.com/ovn-org/ovn.git}
OVN_REPO_NAME=$(basename ${OVN_REPO} | cut -f1 -d'.')
OVN_REPO_NAME=${OVN_REPO_NAME:-ovn}
OVN_BRANCH=${OVN_BRANCH:-master}

# 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:-master}
OVN_BRANCH=${OVN_BRANCH:-v20.03.0}

if is_service_enabled tls-proxy; then
OVN_PROTO=ssl
@@ -289,93 +286,6 @@ function _disable_libvirt_apparmor {
# 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

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
# Accepts three parameters:
# - first optional is False by default and means that
@@ -446,7 +356,6 @@ function install_ovn {

# Install tox, used to generate the config (see devstack/override-defaults)
pip_install tox
source $NEUTRON_DIR/devstack/lib/ovs
remove_ovs_packages
sudo rm -f $OVS_RUNDIR/*



+ 27
- 38
devstack/lib/ovs View File

@@ -10,9 +10,14 @@
# License for the specific language governing permissions and limitations
# under the License.

# Defaults
# --------

# 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_BRANCH=${OVS_BRANCH:-master}
OVS_REPO_NAME=${OVS_REPO_NAME:-ovs}
OVS_BRANCH=${OVS_BRANCH:-51e9479da62edb04a5be47a7655de75c299b9fa1}

# Functions

@@ -33,7 +38,7 @@ function load_module {

# prepare_for_compilation() - Fetch ovs git repository and install packages needed for
# compilation.
function prepare_for_compilation {
function prepare_for_ovs_compilation {
local build_modules=${1:-False}
OVS_DIR=$DEST/$OVS_REPO_NAME

@@ -85,22 +90,24 @@ function prepare_for_compilation {
fi
}

# load_kernel_modules() - load openvswitch kernel module
function load_kernel_modules {
# load_ovs_kernel_modules() - load openvswitch kernel module
function load_ovs_kernel_modules {
load_module openvswitch
load_module vport-geneve False
dmesg | tail
}

# reload_kernel_modules() - reload openvswitch kernel module
function reload_kernel_modules {
local ovs_system=$(sudo ovs-dpctl dump-dps | grep ovs-system)
# reload_ovs_kernel_modules() - reload openvswitch kernel module
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
load_kernel_modules
load_ovs_kernel_modules
}

# compile_ovs() - Compile OVS from source and load needed modules.
@@ -123,7 +130,16 @@ function compile_ovs {
localstatedir="--localstatedir=$localstatedir"
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
./boot.sh
@@ -139,9 +155,9 @@ function compile_ovs {
sudo make install
if [[ "$build_modules" == "True" ]]; then
sudo make INSTALL_MOD_DIR=kernel/net/openvswitch modules_install
reload_kernel_modules
reload_ovs_kernel_modules
else
load_kernel_modules
load_ovs_kernel_modules
fi

cd $_pwd
@@ -166,33 +182,6 @@ function action_openvswitch {
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
function start_new_ovs () {
sudo rm -f /etc/openvswitch/conf.db /etc/openvswitch/.conf.db~lock~


+ 3
- 3
neutron/tests/contrib/gate_hook.sh View File

@@ -6,11 +6,11 @@ VENV=${1:-"api"}
FLAVOR=${2:-"all"}

GATE_DEST=$BASE/new
NEUTRON_PATH=$GATE_DEST/neutron
GATE_HOOKS=$NEUTRON_PATH/neutron/tests/contrib/hooks
NEUTRON_DIR=$GATE_DEST/neutron
GATE_HOOKS=$NEUTRON_DIR/neutron/tests/contrib/hooks
DEVSTACK_PATH=$GATE_DEST/devstack
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

# Install devstack-tools used to produce local.conf; we can't rely on


+ 4
- 4
roles/configure_functional_tests/tasks/main.yaml View File

@@ -8,7 +8,7 @@
BASE_DIR={{ base_dir }}
GATE_DEST={{ gate_dest_dir }}
PROJECT_NAME={{ project_name }}
NEUTRON_PATH={{ neutron_dir }}
NEUTRON_DIR={{ neutron_dir }}
DEVSTACK_PATH={{ devstack_dir }}
TOP_DIR={{ devstack_dir }}
VENV={{ tests_venv }}
@@ -17,9 +17,9 @@
OVN_BRANCH={{ OVN_BRANCH }}

source $DEVSTACK_PATH/functions
source $NEUTRON_PATH/devstack/lib/ovs
source $NEUTRON_PATH/devstack/lib/ovn_agent
source $NEUTRON_PATH/tools/configure_for_func_testing.sh
source $NEUTRON_DIR/devstack/lib/ovs
source $NEUTRON_DIR/devstack/lib/ovn_agent
source $NEUTRON_DIR/tools/configure_for_func_testing.sh

configure_host_for_func_testing
executable: /bin/bash

+ 3
- 3
tools/configure_for_func_testing.sh View File

@@ -58,7 +58,7 @@ VENV=${VENV:-dsvm-functional}
DEVSTACK_PATH=${DEVSTACK_PATH:-$1}
PROJECT_NAME=${PROJECT_NAME:-neutron}
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}
# The gate should automatically install dependencies.
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')
install_package $PACKAGES

source $NEUTRON_PATH/devstack/lib/ovs
source $NEUTRON_PATH/devstack/lib/ovn_agent
source $NEUTRON_DIR/devstack/lib/ovs
source $NEUTRON_DIR/devstack/lib/ovn_agent
echo_summary "OVN_BRANCH: ${OVN_BRANCH} OVS_BRANCH: ${OVS_BRANCH}"
compile_ovs False /usr /var
compile_ovn False /usr /var


+ 0
- 1
zuul.d/rally.yaml View File

@@ -76,7 +76,6 @@
Q_USE_PROVIDERNET_FOR_PUBLIC: true
ENABLE_CHASSIS_AS_GW: true
OVN_L3_CREATE_PUBLIC_NETWORK: true
OVN_BRANCH: master
devstack_local_conf:
post-config:
"${RALLY_CONF_DIR}/${RALLY_CONF_FILE}":


+ 2
- 0
zuul.d/tempest-multinode.yaml View File

@@ -240,7 +240,9 @@
(tempest.(api|scenario|thirdparty))).*$"
devstack_localrc:
OVN_BRANCH: master
OVS_BRANCH: master
group-vars:
subnode:
devstack_localrc:
OVN_BRANCH: master
OVS_BRANCH: master

Loading…
Cancel
Save