lib/neutron: allow to add more ml2 extension drivers

The patch will allow jobs to append new ml2 extension drivers without
overriding port_security.

Change-Id: I45f017d1b8a3054452c3166ed4fb460d21959adb
This commit is contained in:
Ihar Hrachyshka 2017-03-07 06:31:49 +00:00
parent cb484abf80
commit f511c368f8
2 changed files with 32 additions and 1 deletions

View File

@ -163,7 +163,7 @@ function configure_neutron_new {
iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_vxlan vni_ranges 1001:2000
iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_flat flat_networks public
if [[ "$NEUTRON_PORT_SECURITY" = "True" ]]; then
iniset $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers port_security
neutron_ml2_extension_driver_add port_security
fi
fi
@ -481,6 +481,18 @@ function neutron_service_plugin_class_add_new {
iniset $NEUTRON_CONF DEFAULT service_plugins $plugins
}
function _neutron_ml2_extension_driver_add {
local driver=$1
local drivers=""
drivers=$(iniget $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers)
if [ $drivers ]; then
drivers+=","
fi
drivers+="${driver}"
iniset $NEUTRON_CORE_PLUGIN_CONF ml2 extension_drivers $drivers
}
function neutron_server_config_add_new {
_NEUTRON_SERVER_EXTRA_CONF_FILES_ABS+=($1)
}
@ -553,6 +565,15 @@ function neutron_service_plugin_class_add {
fi
}
function neutron_ml2_extension_driver_add {
if is_neutron_legacy_enabled; then
# Call back to old function
_neutron_ml2_extension_driver_add_old "$@"
else
_neutron_ml2_extension_driver_add "$@"
fi
}
function install_neutron_agent_packages {
if is_neutron_legacy_enabled; then
# Call back to old function

View File

@ -870,6 +870,16 @@ function _neutron_service_plugin_class_add {
fi
}
# _neutron_ml2_extension_driver_add_old() - add ML2 extension driver
function _neutron_ml2_extension_driver_add_old {
local extension=$1
if [[ $Q_ML2_PLUGIN_EXT_DRIVERS == '' ]]; then
Q_ML2_PLUGIN_EXT_DRIVERS=$extension
elif [[ ! ,${Q_ML2_PLUGIN_EXT_DRIVERS}, =~ ,${extension}, ]]; then
Q_ML2_PLUGIN_EXT_DRIVERS="$Q_ML2_PLUGIN_EXT_DRIVERS,$extension"
fi
}
# mutnauq_server_config_add() - add server config file
function mutnauq_server_config_add {
_Q_PLUGIN_EXTRA_CONF_FILES_ABS+=($1)