From 052b3936dd20355c9dce059cdc65dace5c8cf721 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Thu, 1 Aug 2013 03:39:16 +0800 Subject: [PATCH] Fixes new plugin-name based debconf system. Rewritten-From: ac54a956afce6c268fb0d565c481b7aca9654bb6 --- trusty/debian/neutron-common.config.in | 2 +- trusty/debian/neutron-common.postinst.in | 70 ++++++++++++++++++++++-- trusty/debian/neutron-common.templates | 13 +++-- trusty/debian/neutron-server.init | 56 ++++++++++++++++++- trusty/debian/neutron.mydefault | 38 +++++-------- 5 files changed, 140 insertions(+), 39 deletions(-) diff --git a/trusty/debian/neutron-common.config.in b/trusty/debian/neutron-common.config.in index afb0ae7af..e90d2ae24 100644 --- a/trusty/debian/neutron-common.config.in +++ b/trusty/debian/neutron-common.config.in @@ -22,7 +22,7 @@ pkgos_read_admin_creds ${N_CONF} keystone_authtoken neutron pkgos_read_config -p high /etc/default/neutron-server NO_SECTION NEUTRON_plugin_path neutron/plugin-select # OVS specific configurations (if that's the one selected) -if [ "${RET}" = "openvswitch/ovs_neutron_plugin.ini" ] ; +if [ "${RET}" = "OpenVSwitch" ] ; # Various network config... pkgos_read_config ${OVS_CONF} OVS tenant_network_type neutron-plugin-openvswitch/tenant_network_type pkgos_read_config ${OVS_CONF} OVS enable_tunneling neutron-plugin-openvswitch/enable_tunneling diff --git a/trusty/debian/neutron-common.postinst.in b/trusty/debian/neutron-common.postinst.in index daee6f80b..317e503e9 100644 --- a/trusty/debian/neutron-common.postinst.in +++ b/trusty/debian/neutron-common.postinst.in @@ -7,32 +7,90 @@ OVS_CONF=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini #PKGOS-INCLUDE# +neutron_core_plugin_class () { + case ${1} in + "OpenVSwitch") + NEUTRON_PLUGIN_CLASS=neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2 + ;; + "LinuxBridge") + NEUTRON_PLUGIN_CLASS=neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2 + ;; + "RYU") + NEUTRON_PLUGIN_CLASS=neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2 + ;; + "PLUMgrid") + NEUTRON_PLUGIN_CLASS=neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2 + ;; + "Brocade") + NEUTRON_PLUGIN_CLASS=neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2 + ;; + "Hyper-V") + NEUTRON_PLUGIN_CLASS=neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin + ;; + "BigSwitch") + NEUTRON_PLUGIN_CLASS=neutron.plugins.bigswitch.plugin.NeutronRestProxyV2 + ;; + "Cisco") + NEUTRON_PLUGIN_CLASS=neutron.plugins.cisco.network_plugin.PluginV2 + ;; + "Nicira") + NEUTRON_PLUGIN_CLASS=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2 + ;; + "Midonet") + NEUTRON_PLUGIN_CLASS=neutron.plugins.midonet.plugin.MidonetPluginV2 + ;; + "Nec") + NEUTRON_PLUGIN_CLASS=neutron.plugins.nec.nec_plugin.NECPluginV2 + ;; + "MetaPlugin") + NEUTRON_PLUGIN_CLASS=neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2 + ;; + "Mellanox") + NEUTRON_PLUGIN_CLASS=neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin + ;; + *) + NEUTRON_PLUGIN_CLASS="" + ;; + esac +} + + + if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then . /usr/share/debconf/confmodule pkgos_var_user_group neutron chmod 755 /var/lib/neutron + pkgos_write_new_conf neutron api-paste.ini + pkgos_write_new_conf neutron neutron.conf + + # Maintain the /etc/default/neutron plugin type selection + # and fill-out the core_plugin class path in /etc/neutron/neutron.conf + # according to what's in /etc/default/neutron. if [ ! -e /etc/default/neutron ] ; then install -D -m 0664 /usr/share/neutron-common/neutron-default /etc/default/neutron fi db_get neutron/plugin-select - NEUTRON_plugin_path=${RET} + NEUTRON_plugin=${RET} if [ -n "${RET}" ] ; then - pkgos_inifile -shinc set /etc/default/neutron NO_SECTION NEUTRON_plugin_path ${RET} + pkgos_inifile -shinc set /etc/default/neutron NO_SECTION NEUTRON_plugin ${RET} + neutron_core_plugin_class ${NEUTRON_plugin} + pkgos_inifile set DEFAULT ${N_CONF} ${NEUTRON_PLUGIN_CLASS} fi - pkgos_write_new_conf neutron api-paste.ini - pkgos_write_new_conf neutron neutron.conf + + # Set the keystone_authtoken directive pkgos_write_admin_creds ${N_CONF} keystone_authtoken neutron - pkgos_dbc_postinst --suite neutron ${OVS_CONF} DATABASE sql_connection neutron $@ + # Set the sql_connection directive + pkgos_dbc_postinst --suite neutron ${N_CONF} DATABASE sql_connection neutron $@ # Maintain the OVS config if [ ! -e ${OVS_CONF} ] ; then install -D -m 0640 -o neutron -g neutron /usr/share/neutron-common/ovs_neutron_plugin.ini ${OVS_CONF} fi - if [ "${NEUTRON_plugin_path}" = "openvswitch/ovs_neutron_plugin.ini" ] ; then + if [ "${NEUTRON_plugin_path}" = "OpenVSwitch" ] ; then db_get neutron-plugin-openvswitch/tenant_network_type pkgos_inifile set ${OVS_CONF} OVS tenant_network_type "${RET}" diff --git a/trusty/debian/neutron-common.templates b/trusty/debian/neutron-common.templates index 80a385808..524dc537b 100644 --- a/trusty/debian/neutron-common.templates +++ b/trusty/debian/neutron-common.templates @@ -33,14 +33,15 @@ _Description: Authentication server password: Template: neutron/plugin-select Type: select -__Choices: brocade/brocade.ini, nicira/nvp.ini, openvswitch/ovs_neutron_plugin.ini, midonet/midonet.ini, nec/nec.ini, mlnx/mlnx_conf.ini, hyperv/hyperv_neutron_plugin.ini, ryu/ryu.ini, ml2/ml2_conf.ini, metaplugin/metaplugin.ini, bigswitch/restproxy.ini, linuxbridge/linuxbridge_conf.ini, cisco/cisco_plugins.ini, plumgrid/plumgrid.ini -Choices-C: brocade/brocade.ini, nicira/nvp.ini, openvswitch/ovs_neutron_plugin.ini, midonet/midonet.ini, nec/nec.ini, mlnx/mlnx_conf.ini, hyperv/hyperv_neutron_plugin.ini, ryu/ryu.ini, ml2/ml2_conf.ini, metaplugin/metaplugin.ini, bigswitch/restproxy.ini, linuxbridge/linuxbridge_conf.ini, cisco/cisco_plugins.ini, plumgrid/plumgrid.ini -Default: openvswitch/ovs_neutron_plugin.ini -_Description: Plugin configuration to load: +__Choices: OpenVSwitch, LinuxBridge, Brocade, Nicira, Midonet, NEC, Mellanox, Hyper-V, RYU, ml2/ml2_conf.ini, MetaPlugin, BigSwitch, Cisco, PLUMgrid +Choices-C: OpenVSwitch, LinuxBridge, Brocade, Nicira, Midonet, NEC, Mellanox, Hyper-V, RYU, ml2/ml2_conf.ini, MetaPlugin, BigSwitch, Cisco, PLUMgrid +Default: OpenVSwitch +_Description: Neutron plugin: Neutron uses a plugin architecture to manage networking. When starting the Neutron server daemon, the configuration file corresponding to the plugin you - wish to use needs to be loaded. Please select which plugin configuration file - should be given as parameter when starting the Neutron server daemon. + wish to use needs to be loaded, by giving it as a parameter when starting the + neutron-server daemon. Also, the core_plugin directive needs to match. Please + select which plugin to use. Template: neutron/configure_db Type: boolean diff --git a/trusty/debian/neutron-server.init b/trusty/debian/neutron-server.init index 516252b82..35304c0f2 100644 --- a/trusty/debian/neutron-server.init +++ b/trusty/debian/neutron-server.init @@ -26,11 +26,61 @@ DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --log-file=$LOGFILE" . /lib/lsb/init-functions +neutron_plugin_ini_path () { + PLUG_INI_BASE=/etc/neutron/plugins/ + case ${1} in + "OpenVSwitch") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}openvswitch/ovs_neutron_plugin.ini + ;; + "LinuxBridge") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}linuxbridge/linuxbridge_conf.ini + ;; + "RYU") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}ryu/ryu.ini + ;; + "PLUMgrid") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}plumgrid/plumgrid.ini + ;; + "Brocade") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}brocade/brocade.ini + ;; + "Hyper-V") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}hyperv/hyperv_neutron_plugin.ini + ;; + "BigSwitch") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}bigswitch/restproxy.ini + ;; + "Cisco") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}cisco/cisco_plugins.ini + ;; + "Nicira") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}nicira/nvp.ini + ;; + "Midonet") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}midonet/midonet.ini + ;; + "Nec") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}nec/nec.ini + ;; + "MetaPlugin") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}metaplugin/metaplugin.ini + ;; + "Mellanox") + NEUTRON_PLUGIN_CONFIG=${PLUG_INI_BASE}mlnx/mlnx_conf.ini + ;; + *) + NEUTRON_PLUGIN_CONFIG="" + ;; + esac +} + if [ -r /etc/default/neutron ] ; then . /etc/default/neutron - if [ -n "${NEUTRON_plugin_path}" ] ; then - NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/${NEUTRON_plugin_path} - DAEMON_ARGS="${DAEMON_ARGS} --config-file=${NEUTRON_PLUGIN_CONFIG}" + if [ -n "${NEUTRON_plugin}" ] ; then + neutron_plugin_ini_path ${NEUTRON_plugin} + if [ -n "${NEUTRON_PLUGIN_CONFIG}" ] ; then + DAEMON_ARGS="${DAEMON_ARGS} --config-file=${NEUTRON_PLUGIN_CONFIG}" + fi fi fi diff --git a/trusty/debian/neutron.mydefault b/trusty/debian/neutron.mydefault index 6b78bb7e6..92d43b655 100644 --- a/trusty/debian/neutron.mydefault +++ b/trusty/debian/neutron.mydefault @@ -3,31 +3,23 @@ # can edit the file if you don't break its (shell script) syntax, or use: # dpkg-reconfigure -plow neutron-server -# Select the path to the configuration file for the plugin which you wish to -# use with Neutron. The path is what's after /etc/neutron/plugins. For example, -# for using /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini in the -# command line of the neutron-server, you should only set: -# openvswitch/ovs_neutron_plugin.ini -# -# Possible values are (currently): -# -# brocade/brocade.ini -# nicira/nvp.ini -# openvswitch/ovs_neutron_plugin.ini -# midonet/midonet.ini -# nec/nec.ini -# mlnx/mlnx_conf.ini -# hyperv/hyperv_neutron_plugin.ini -# ryu/ryu.ini -# ml2/ml2_conf.ini -# metaplugin/metaplugin.ini -# bigswitch/restproxy.ini -# linuxbridge/linuxbridge_conf.ini -# cisco/cisco_plugins.ini -# plumgrid/plumgrid.ini +# Select the plugin to load. Possible values are: +# OpenVSwitch +# LinuxBridge +# RYU +# PLUMgrid +# Brocade +# Hyper-V +# BigSwitch +# Cisco +# Nicira +# Midonet +# Nec +# MetaPlugin +# Mellanox # # If more plugins were to come, then simply editing this file is not enough, # the debconf template will need to be edited to add the new value, otherwise # this will break on upgrades. -NEUTRON_plugin_path=openvswitch/ovs_neutron_plugin.ini +NEUTRON_plugin=OpenVSwitch -- 2.45.2