Browse Source

[OVN] Change DevStack to use the local OVN driver

This patch is changing DevStack to deploy with the local OVN driver
(instead of the networking-ovn old repo).

A few tweaks were needed in the code in order to get it to work, more
precisely:

* OVN metadata configuration was pointing to some module variables that
  didn't exist.
* OVN metadata configuration generation was missing

Below is the following configuration needed in the local.conf to deploy
OVN:

[[local|localrc]]

enable_plugin neutron https://opendev.org/openstack/neutron

Q_AGENT=ovn
Q_ML2_PLUGIN_MECHANISM_DRIVERS=ovn,logger
Q_ML2_PLUGIN_TYPE_DRIVERS=local,flat,vlan,geneve
Q_ML2_TENANT_NETWORK_TYPE="geneve"

enable_service ovn-northd
enable_service ovn-controller
enable_service neutron-ovn-metadata-agent

disable_service n-net
enable_service q-svc

disable_service q-agt
disable_service q-l3
disable_service q-dhcp
disable_service q-meta

Change-Id: I0b899a33943550a53822d1d057cdee525cbbc6ec
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
changes/66/701366/5
Lucas Alvares Gomes 2 years ago
parent
commit
48ab58b46e
  1. 48
      devstack/lib/ovn_agent
  2. 6
      etc/oslo-config-generator/neutron_ovn_metadata_agent.ini
  3. 13
      neutron/agent/ovn/metadata_agent.py

48
devstack/lib/ovn_agent

@ -26,12 +26,6 @@ source $TOP_DIR/lib/neutron_plugins/openvswitch_agent
# Defaults
# --------
# TODO(lucasagomes): Remove this after the networking-ovn code is
# merged into Neutron
# networking-ovn neutron driver
NETWORKING_OVN_REPO=${NETWORKING_OVN_REPO:-${GIT_BASE}/openstack/networking-ovn.git}
NETWORKING_OVN_BRANCH=${NETWORKING_OVN_BRANCH:-$TARGET_BRANCH}
# Set variables for building OVN from source
OVN_REPO=${OVN_REPO:-https://github.com/ovn-org/ovn.git}
OVN_REPO_NAME=$(basename ${OVN_REPO} | cut -f1 -d'.')
@ -84,7 +78,7 @@ OVN_GENEVE_OVERHEAD=${OVN_GENEVE_OVERHEAD:-38}
# The log level of the OVN databases (north and south)
OVN_DBS_LOG_LEVEL=${OVN_DBS_LOG_LEVEL:-info}
OVN_META_CONF=$NEUTRON_CONF_DIR/networking_ovn_metadata_agent.ini
OVN_META_CONF=$NEUTRON_CONF_DIR/neutron_ovn_metadata_agent.ini
OVS_PREFIX=/usr/local
OVS_SBINDIR=$OVS_PREFIX/sbin
@ -99,11 +93,8 @@ OVN_SHAREDIR=$OVS_PREFIX/share/ovn
OVN_SCRIPTDIR=$OVN_SHAREDIR/scripts
OVN_RUNDIR=$OVS_PREFIX/var/run/ovn
# TODO(lucasagomes): These paths will change once the networking-ovn
# code is merged into Neutron
NETWORKING_OVN_BIN_DIR=$(get_python_exec_prefix)
NETWORKING_OVN_METADATA_BINARY="networking-ovn-metadata-agent"
NETWORKING_OVN_DIR=$DEST/networking-ovn
NEUTRON_OVN_BIN_DIR=$(get_python_exec_prefix)
NEUTRON_OVN_METADATA_BINARY="neutron-ovn-metadata-agent"
# Libs from source
@ -125,9 +116,7 @@ Q_ML2_PLUGIN_TYPE_DRIVERS=${Q_ML2_PLUGIN_TYPE_DRIVERS:-local,flat,vlan,geneve}
Q_ML2_TENANT_NETWORK_TYPE=${Q_ML2_TENANT_NETWORK_TYPE:-"geneve"}
Q_ML2_PLUGIN_GENEVE_TYPE_OPTIONS=${Q_ML2_PLUGIN_GENEVE_TYPE_OPTIONS:-"vni_ranges=1:65536"}
Q_ML2_PLUGIN_EXT_DRIVERS=${Q_ML2_PLUGIN_EXT_DRIVERS:-port_security,dns}
# TODO(lucasagomes): Modify this after the networking-ovn code is
# merged into Neutron
ML2_L3_PLUGIN="networking_ovn.l3.l3_ovn.OVNL3RouterPlugin,trunk"
ML2_L3_PLUGIN="ovn-router,trunk"
# Utility Functions
@ -473,11 +462,6 @@ function install_ovn {
setup_dev_lib "ovsdbapp"
fi
# TODO(lucasagomes): Remove this after the networking-ovn code is
# merged into Neutron
git_clone $NETWORKING_OVN_REPO $NETWORKING_OVN_DIR $NETWORKING_OVN_BRANCH
setup_develop $NETWORKING_OVN_DIR
# Install ovs python module from ovs source.
if [[ "$OVN_INSTALL_OVS_PYTHON_MODULE" == "True" ]]; then
sudo pip uninstall -y ovs
@ -506,7 +490,7 @@ function configure_ovn_plugin {
populate_ml2_config /$Q_PLUGIN_CONF_FILE securitygroup enable_security_group="$Q_USE_SECGROUP"
inicomment /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver
if is_service_enabled networking-ovn-metadata-agent; then
if is_service_enabled neutron-ovn-metadata-agent; then
populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_metadata_enabled=True
else
populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_metadata_enabled=False
@ -525,7 +509,7 @@ function configure_ovn_plugin {
fi
if is_service_enabled n-api-meta ; then
if is_service_enabled networking-ovn-metadata-agent ; then
if is_service_enabled neutron-ovn-metadata-agent ; then
iniset $NOVA_CONF neutron service_metadata_proxy True
fi
fi
@ -544,13 +528,13 @@ function configure_ovn {
fi
# Metadata
if is_service_enabled networking-ovn-metadata-agent && is_service_enabled ovn-controller; then
if is_service_enabled neutron-ovn-metadata-agent && is_service_enabled ovn-controller; then
sudo install -d -o $STACK_USER $NEUTRON_CONF_DIR
mkdir -p $NETWORKING_OVN_DIR/etc/neutron/plugins/ml2
(cd $NETWORKING_OVN_DIR && exec ./tools/generate_config_file_samples.sh)
mkdir -p $NEUTRON_DIR/etc/neutron/plugins/ml2
(cd $NEUTRON_DIR && exec ./tools/generate_config_file_samples.sh)
cp $NETWORKING_OVN_DIR/etc/networking_ovn_metadata_agent.ini.sample $OVN_META_CONF
cp $NEUTRON_DIR/etc/neutron_ovn_metadata_agent.ini.sample $OVN_META_CONF
configure_root_helper_options $OVN_META_CONF
iniset $OVN_META_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
@ -661,8 +645,8 @@ function _start_ovn_services {
if is_service_enabled ovn-controller-vtep ; then
_start_process "devstack@ovn-controller-vtep.service"
fi
if is_service_enabled networking-ovn-metadata-agent; then
_start_process "devstack@networking-ovn-metadata-agent.service"
if is_service_enabled neutron-ovn-metadata-agent; then
_start_process "devstack@neutron-ovn-metadata-agent.service"
fi
}
@ -701,8 +685,8 @@ function start_ovn {
_run_process ovn-controller-vtep "$cmd" "" "$STACK_USER" "root"
fi
if is_service_enabled networking-ovn-metadata-agent; then
run_process networking-ovn-metadata-agent "$NETWORKING_OVN_BIN_DIR/$NETWORKING_OVN_METADATA_BINARY --config-file $OVN_META_CONF"
if is_service_enabled neutron-ovn-metadata-agent; then
run_process neutron-ovn-metadata-agent "$NEUTRON_OVN_BIN_DIR/$NEUTRON_OVN_METADATA_BINARY --config-file $OVN_META_CONF"
# Format logging
setup_logging $OVN_META_CONF
fi
@ -735,9 +719,9 @@ function _stop_ovs_dp {
}
function stop_ovn {
if is_service_enabled networking-ovn-metadata-agent; then
if is_service_enabled neutron-ovn-metadata-agent; then
sudo pkill -9 -f haproxy || :
stop_process networking-ovn-metadata-agent
stop_process neutron-ovn-metadata-agent
fi
if is_service_enabled ovn-controller-vtep ; then
stop_process ovn-controller-vtep

6
etc/oslo-config-generator/neutron_ovn_metadata_agent.ini

@ -0,0 +1,6 @@
[DEFAULT]
output_file = etc/neutron_ovn_metadata_agent.ini.sample
wrap_width = 79
namespace = neutron.ovn.metadata.agent
namespace = oslo.log

13
neutron/agent/ovn/metadata_agent.py

@ -19,19 +19,20 @@ from oslo_config import cfg
from oslo_log import log as logging
from neutron.agent.ovn.metadata import agent
from neutron.conf.agent.ovn.metadata import config as meta
from neutron.conf.agent.metadata import config as meta
from neutron.conf.agent.ovn.metadata import config as ovn_meta
LOG = logging.getLogger(__name__)
def main():
meta.register_meta_conf_opts(meta.SHARED_OPTS)
meta.register_meta_conf_opts(meta.UNIX_DOMAIN_METADATA_PROXY_OPTS)
meta.register_meta_conf_opts(meta.METADATA_PROXY_HANDLER_OPTS)
meta.register_meta_conf_opts(meta.OVS_OPTS, group='ovs')
ovn_meta.register_meta_conf_opts(meta.SHARED_OPTS)
ovn_meta.register_meta_conf_opts(meta.UNIX_DOMAIN_METADATA_PROXY_OPTS)
ovn_meta.register_meta_conf_opts(meta.METADATA_PROXY_HANDLER_OPTS)
ovn_meta.register_meta_conf_opts(ovn_meta.OVS_OPTS, group='ovs')
config.init(sys.argv[1:])
config.setup_logging()
meta.setup_privsep()
ovn_meta.setup_privsep()
utils.log_opt_values(LOG)
agt = agent.MetadataAgent(cfg.CONF)

Loading…
Cancel
Save