]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Adds debian/plugin_guess_func
authorThomas Goirand <thomas@goirand.fr>
Tue, 24 Sep 2013 11:18:50 +0000 (19:18 +0800)
committerThomas Goirand <thomas@goirand.fr>
Tue, 24 Sep 2013 11:18:50 +0000 (19:18 +0800)
Rewritten-From: ea3a87996c698b4c255662983fcf22147823ec1c

xenial/debian/neutron-common.install
xenial/debian/neutron-server.init
xenial/debian/plugin_guess_func [new file with mode: 0644]

index 74b4f14b0f6394607a5fa07a2d991d7cba83fb12..519d89b8792110136ba3dbf7a1233c09a411b547 100644 (file)
@@ -6,3 +6,4 @@ etc/neutron/rootwrap.d/* /etc/neutron/rootwrap.d
 etc/policy.json                /etc/neutron
 etc/rootwrap.conf      /etc/neutron
 usr/bin/neutron*
+debian/plugin_guess_func       /usr/share/neutron-common
index e55452669795b729d1f72cfe9ea4ae2c533d52af..3beb8ec1c528bd44a87db4f7cd53cd1044d03ed1 100644 (file)
@@ -26,102 +26,8 @@ DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --log-file=$LOGFILE"
 
 . /lib/lsb/init-functions
 
-### Guess the plugin name depending on the class of the plugin in /etc/neutron/neutron.conf ###
-neutron_core_plugin_to_plugin_name () {
-       case ${1} in
-       "neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2")
-               NEUTRON_PLUGIN_NAME=OpenVSwitch
-       ;;
-       "neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2")
-               NEUTRON_PLUGIN_NAME=LinuxBridge
-       ;;
-       "neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2")
-               NEUTRON_PLUGIN_NAME=RYU
-       ;;
-       "neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2")
-               NEUTRON_PLUGIN_NAME=PLUMgrid
-       ;;
-       "neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2")
-               NEUTRON_PLUGIN_NAME=Brocade
-       ;;
-       "neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin")
-               NEUTRON_PLUGIN_NAME=Hyper-V
-       ;;
-       "neutron.plugins.bigswitch.plugin.NeutronRestProxyV2")
-               NEUTRON_PLUGIN_NAME=BigSwitch
-       ;;
-       "neutron.plugins.cisco.network_plugin.PluginV2")
-               NEUTRON_PLUGIN_NAME=Cisco
-       ;;
-       "neutron.plugins.nicira.NeutronPlugin.NvpPluginV2")
-               NEUTRON_PLUGIN_NAME=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
-       ;;
-       "neutron.plugins.midonet.plugin.MidonetPluginV2")
-               NEUTRON_PLUGIN_NAME=Midonet
-       ;;
-       "neutron.plugins.nec.nec_plugin.NECPluginV2")
-               NEUTRON_PLUGIN_NAME=Nec
-       ;;
-       "neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2")
-               NEUTRON_PLUGIN_NAME=MetaPlugin
-       ;;
-       "neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin")
-               NEUTRON_PLUGIN_NAME=Mellanox
-       ;;
-       *)
-               NEUTRON_PLUGIN_NAME="other"
-       ;;
-       esac
-}
-
-### Guess the path of the plugin .ini file depending on the plugin name ###
-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
-}
+[ -x /usr/share/neutron-common/plugin_guess_func ] || exit 0
+. /usr/share/neutron-common/plugin_guess_func
 
 ### Maintain the plugin selection so that we can load the corresponding .ini file ###
 if ! [ -r /etc/neutron/neutron.conf ] ; then
diff --git a/xenial/debian/plugin_guess_func b/xenial/debian/plugin_guess_func
new file mode 100644 (file)
index 0000000..e3869d7
--- /dev/null
@@ -0,0 +1,146 @@
+#!/bin/sh
+
+### Guess the plugin name depending on the class of the plugin in /etc/neutron/neutron.conf ###
+neutron_core_plugin_to_plugin_name () {
+       case ${1} in
+       "neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2")
+               NEUTRON_PLUGIN_NAME=OpenVSwitch
+       ;;
+       "neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2")
+               NEUTRON_PLUGIN_NAME=LinuxBridge
+       ;;
+       "neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2")
+               NEUTRON_PLUGIN_NAME=RYU
+       ;;
+       "neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2")
+               NEUTRON_PLUGIN_NAME=PLUMgrid
+       ;;
+       "neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2")
+               NEUTRON_PLUGIN_NAME=Brocade
+       ;;
+       "neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin")
+               NEUTRON_PLUGIN_NAME=Hyper-V
+       ;;
+       "neutron.plugins.bigswitch.plugin.NeutronRestProxyV2")
+               NEUTRON_PLUGIN_NAME=BigSwitch
+       ;;
+       "neutron.plugins.cisco.network_plugin.PluginV2")
+               NEUTRON_PLUGIN_NAME=Cisco
+       ;;
+       "neutron.plugins.nicira.NeutronPlugin.NvpPluginV2")
+               NEUTRON_PLUGIN_NAME=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
+       ;;
+       "neutron.plugins.midonet.plugin.MidonetPluginV2")
+               NEUTRON_PLUGIN_NAME=Midonet
+       ;;
+       "neutron.plugins.nec.nec_plugin.NECPluginV2")
+               NEUTRON_PLUGIN_NAME=Nec
+       ;;
+       "neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2")
+               NEUTRON_PLUGIN_NAME=MetaPlugin
+       ;;
+       "neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin")
+               NEUTRON_PLUGIN_NAME=Mellanox
+       ;;
+       *)
+               NEUTRON_PLUGIN_NAME="other"
+       ;;
+       esac
+}
+
+### Guess the path of the plugin .ini file depending on the plugin name ###
+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
+}
+
+### Translates the core_plugin directive value from neutron.conf into the plugin name ###
+neutron_core_plugin_to_plugin_name () {
+       case ${1} in
+       "neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2")
+               NEUTRON_PLUGIN_NAME=OpenVSwitch
+       ;;
+       "neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2")
+               NEUTRON_PLUGIN_NAME=LinuxBridge
+       ;;
+       "neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2")
+               NEUTRON_PLUGIN_NAME=RYU
+       ;;
+       "neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2")
+               NEUTRON_PLUGIN_NAME=PLUMgrid
+       ;;
+       "neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2")
+               NEUTRON_PLUGIN_NAME=Brocade
+       ;;
+       "neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin")
+               NEUTRON_PLUGIN_NAME=Hyper-V
+       ;;
+       "neutron.plugins.bigswitch.plugin.NeutronRestProxyV2")
+               NEUTRON_PLUGIN_NAME=BigSwitch
+       ;;
+       "neutron.plugins.cisco.network_plugin.PluginV2")
+               NEUTRON_PLUGIN_NAME=Cisco
+       ;;
+       "neutron.plugins.nicira.NeutronPlugin.NvpPluginV2")
+               NEUTRON_PLUGIN_NAME=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
+       ;;
+       "neutron.plugins.midonet.plugin.MidonetPluginV2")
+               NEUTRON_PLUGIN_NAME=Midonet
+       ;;
+       "neutron.plugins.nec.nec_plugin.NECPluginV2")
+               NEUTRON_PLUGIN_NAME=Nec
+       ;;
+       "neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2")
+               NEUTRON_PLUGIN_NAME=MetaPlugin
+       ;;
+       "neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin")
+               NEUTRON_PLUGIN_NAME=Mellanox
+       ;;
+       *)
+               NEUTRON_PLUGIN_NAME="other"
+       ;;
+       esac
+}