]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fixes new plugin-name based debconf system.
authorThomas Goirand <thomas@goirand.fr>
Wed, 31 Jul 2013 19:39:16 +0000 (03:39 +0800)
committerThomas Goirand <thomas@goirand.fr>
Wed, 31 Jul 2013 19:39:16 +0000 (03:39 +0800)
debian/neutron-common.config.in
debian/neutron-common.postinst.in
debian/neutron-common.templates
debian/neutron-server.init
debian/neutron.mydefault

index afb0ae7aff4ebd04f3514ef3346fbb32e557b364..e90d2ae24a1df1fd4d0132868a7d1fecdb88aeab 100644 (file)
@@ -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
index daee6f80bfd2c65751360d6688e5d56249b05f3f..317e503e9c25c17e6fbc9610a9f5c3f9ccc65edb 100644 (file)
@@ -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}"
 
index 80a385808f9e29048ccd838efe74c53a87ec97ac..524dc537b96b644b932637cb3cfeffc85bd2d31b 100644 (file)
@@ -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 
index 516252b820887369c5e3678738040bfc482dd9f6..35304c0f252a95893b791a4552dc10e517216b7c 100644 (file)
@@ -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
 
index 6b78bb7e698a2555e4854d45dbc69170823610ec..92d43b6559f0e74bc0b118efa470b7162b9a9b91 100644 (file)
@@ -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