#!/bin/sh set -e . /usr/share/debconf/confmodule N_CONF=/etc/neutron/neutron.conf OVS_CONF=/etc/neutron/plugins/ml2/openvswitch_agent.ini # Please remember this function is also in debian/plugin_guess_func neutron_core_plugin_to_plugin_name () { case ${1} in "neutron.plugins.ml2.plugin.Ml2Plugin"|"ml2") NEUTRON_PLUGIN_NAME=ml2 ;; "networking_plumgrid.neutron.plugins.plugin:NeutronPluginPLUMgridV2"|"plumgrid") NEUTRON_PLUGIN_NAME=plumgrid ;; "midonet.neutron.plugin_v1:MidonetPluginV2"|"modonet") NEUTRON_PLUGIN_NAME=midonet ;; "midonet.neutron.plugin_v2:MidonetPluginV2"|"midonet_v2") NEUTRON_PLUGIN_NAME=midonet_v2 ;; "networking_nec.nwa.l2.plugin:NECNWAL2Plugin"|"necnwa") NEUTRON_PLUGIN_NAME=nec ;; "neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin") NEUTRON_PLUGIN_NAME=mellanox ;; "vmware_nsx.plugin:NsxMhPlugin"|"vmware") NEUTRON_PLUGIN_NAME=vmware ;; *) NEUTRON_PLUGIN_NAME="other" ;; esac } #PKGOS-INCLUDE# pkgos_var_user_group neutron chmod 755 /var/lib/neutron # Configure the SQL connection pkgos_dbc_read_conf -pkg neutron-common ${N_CONF} database connection neutron $@ pkgos_rabbit_read_conf ${N_CONF} oslo_messaging_rabbit neutron # Configure the keystone_authtoken pkgos_read_admin_creds ${N_CONF} keystone_authtoken neutron # Select which plugin to use if [ -r "${N_CONF}" ] ; then pkgos_inifile get ${N_CONF} DEFAULT core_plugin if [ -n "${RET}" ] ; then NEUTRON_CORE_PLUGIN_CLASS=${RET} neutron_core_plugin_to_plugin_name ${NEUTRON_CORE_PLUGIN_CLASS} db_set neutron/plugin-select ${NEUTRON_PLUGIN_NAME} fi fi db_input high neutron/plugin-select || true db_go db_get neutron/plugin-select NEUTRON_PLUGIN_NAME=${RET} read_nova_admin_credentials () { pkgos_read_config -p high ${N_CONF} nova url neutron/nova_url pkgos_read_config -p high ${N_CONF} nova region_name neutron/nova_region pkgos_read_config -p medium ${N_CONF} nova project_name neutron/nova_admin_tenant_name pkgos_read_config -p medium ${N_CONF} nova username neutron/nova_admin_username pkgos_read_config -p high ${N_CONF} nova password neutron/nova_admin_password } # OVS specific configurations (if that's the one selected) if [ "${NEUTRON_PLUGIN_NAME}" = "OpenVSwitch" ] ; then # Various network config... pkgos_read_config ${OVS_CONF} OVS tenant_network_type neutron/tenant_network_type pkgos_read_config ${OVS_CONF} OVS enable_tunneling neutron/enable_tunneling pkgos_read_config ${OVS_CONF} OVS tunnel_id_ranges neutron/tunnel_id_ranges read_nova_admin_credentials # Guess values to put in the local_ip directive IF=`LC_ALL=C route | grep default |awk -- '{ print $8 }'` guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet addr' | sed 's/.\+inet addr:\([0-9.]\+\).\+/\1/'` if [ -z "${guessed_ip_addr}" ] ; then guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet adr' | sed 's/.\+inet adr:\([0-9.]\+\).\+/\1/'` fi db_set neutron/local_ip ${guessed_ip_addr} pkgos_read_config ${OVS_CONF} OVS local_ip neutron/local_ip fi exit 0