From: Thomas Goirand Date: Tue, 24 Sep 2013 11:18:50 +0000 (+0800) Subject: Adds debian/plugin_guess_func X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ea3a87996c698b4c255662983fcf22147823ec1c;p=openstack-build%2Fneutron-build.git Adds debian/plugin_guess_func --- diff --git a/debian/neutron-common.install b/debian/neutron-common.install index 74b4f14b0..519d89b87 100644 --- a/debian/neutron-common.install +++ b/debian/neutron-common.install @@ -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 diff --git a/debian/neutron-server.init b/debian/neutron-server.init index e55452669..3beb8ec1c 100644 --- a/debian/neutron-server.init +++ b/debian/neutron-server.init @@ -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/debian/plugin_guess_func b/debian/plugin_guess_func new file mode 100644 index 000000000..e3869d7dd --- /dev/null +++ b/debian/plugin_guess_func @@ -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 +}