[PKG-Openstack-devel] [PATCH] Use better short core_plugin name

Zang MingJie zealot0630 at gmail.com
Thu Mar 6 09:37:35 UTC 2014


Due to blueprint config-plugin-by-name[1], core_plugin can use short
name instead of full python class name, the corresponding part should be
changed in debian configuration.

[1] https://blueprints.launchpad.net/neutron/+spec/config-plugin-by-name

Change-Id: I2130fd029aeff7c2955df626cd45c7801d0759f6
---
 debian/neutron-common.config.in   |   26 ++++++-------
 debian/neutron-common.postinst.in |   26 ++++++-------
 debian/plugin_guess_func          |   77 +++++++------------------------------
 3 files changed, 39 insertions(+), 90 deletions(-)

diff --git a/debian/neutron-common.config.in b/debian/neutron-common.config.in
index 0c05f8f..a905a53 100644
--- a/debian/neutron-common.config.in
+++ b/debian/neutron-common.config.in
@@ -10,46 +10,46 @@ OVS_CONF=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
 # Please remember this function is also in debian/plugin_guess_func
 neutron_core_plugin_to_plugin_name () {
 	case ${1} in
-	"neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2")
+	"neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2" | "openvswitch")
 		NEUTRON_PLUGIN_NAME=OpenVSwitch
 	;;
-	"neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2")
+	"neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2" | "linuxbridge")
 		NEUTRON_PLUGIN_NAME=LinuxBridge
 	;;
-	"neutron.plugins.ml2.plugin.Ml2Plugin")
+	"neutron.plugins.ml2.plugin.Ml2Plugin" | "ml2")
 		NEUTRON_PLUGIN_NAME=ml2
 	;;
-	"neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2")
+	"neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2" | "ryu")
 		NEUTRON_PLUGIN_NAME=RYU
 	;;
-	"neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2")
+	"neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2" | "plumgrid")
 		NEUTRON_PLUGIN_NAME=PLUMgrid
 	;;
-	"neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2")
+	"neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2" | "brocade")
 		NEUTRON_PLUGIN_NAME=Brocade
 	;;
-	"neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin")
+	"neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin" | "hyperv")
 		NEUTRON_PLUGIN_NAME=Hyper-V
 	;;
-	"neutron.plugins.bigswitch.plugin.NeutronRestProxyV2")
+	"neutron.plugins.bigswitch.plugin.NeutronRestProxyV2" | "bigswitch")
 		NEUTRON_PLUGIN_NAME=BigSwitch
 	;;
-	"neutron.plugins.cisco.network_plugin.PluginV2")
+	"neutron.plugins.cisco.network_plugin.PluginV2" | "cisco")
 		NEUTRON_PLUGIN_NAME=Cisco
 	;;
-	"neutron.plugins.nicira.NeutronPlugin.NvpPluginV2")
+	"neutron.plugins.nicira.NeutronPlugin.NvpPluginV2" | "nicira")
 		NEUTRON_PLUGIN_NAME=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
 	;;
-	"neutron.plugins.midonet.plugin.MidonetPluginV2")
+	"neutron.plugins.midonet.plugin.MidonetPluginV2" | "midonet")
 		NEUTRON_PLUGIN_NAME=Midonet
 	;;
-	"neutron.plugins.nec.nec_plugin.NECPluginV2")
+	"neutron.plugins.nec.nec_plugin.NECPluginV2" | "nec")
 		NEUTRON_PLUGIN_NAME=Nec
 	;;
 	"neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2")
 		NEUTRON_PLUGIN_NAME=MetaPlugin
 	;;
-	"neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin")
+	"neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin" | "mlnx")
 		NEUTRON_PLUGIN_NAME=Mellanox
 	;;
 	*)
diff --git a/debian/neutron-common.postinst.in b/debian/neutron-common.postinst.in
index d153810..a4114ff 100644
--- a/debian/neutron-common.postinst.in
+++ b/debian/neutron-common.postinst.in
@@ -10,46 +10,46 @@ OVS_CONF=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
 neutron_core_plugin_class () {
 	case ${1} in
 	"OpenVSwitch")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2
+		NEUTRON_PLUGIN_CLASS=openvswitch
 	;;
 	"ml2")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.ml2.plugin.Ml2Plugin
+		NEUTRON_PLUGIN_CLASS=ml2
 	;;
 	"LinuxBridge")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2
+		NEUTRON_PLUGIN_CLASS=linuxbridge
 	;;
 	"RYU")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2
+		NEUTRON_PLUGIN_CLASS=ryu
 	;;
 	"PLUMgrid")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2
+		NEUTRON_PLUGIN_CLASS=plumgrid
 	;;
 	"Brocade")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2
+		NEUTRON_PLUGIN_CLASS=brocade
 	;;
 	"Hyper-V")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin
+		NEUTRON_PLUGIN_CLASS=hyperv
 	;;
 	"BigSwitch")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.bigswitch.plugin.NeutronRestProxyV2
+		NEUTRON_PLUGIN_CLASS=bigswitch
 	;;
 	"Cisco")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.cisco.network_plugin.PluginV2
+		NEUTRON_PLUGIN_CLASS=cisco
 	;;
 	"Nicira")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
+		NEUTRON_PLUGIN_CLASS=nicira
 	;;
 	"Midonet")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.midonet.plugin.MidonetPluginV2
+		NEUTRON_PLUGIN_CLASS=midonet
 	;;
 	"Nec")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.nec.nec_plugin.NECPluginV2
+		NEUTRON_PLUGIN_CLASS=nec
 	;;
 	"MetaPlugin")
 		NEUTRON_PLUGIN_CLASS=neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2
 	;;
 	"Mellanox")
-		NEUTRON_PLUGIN_CLASS=neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin
+		NEUTRON_PLUGIN_CLASS=mlnx
 	;;
 	*)
 		NEUTRON_PLUGIN_CLASS=""
diff --git a/debian/plugin_guess_func b/debian/plugin_guess_func
index 35bc6c5..93589c2 100644
--- a/debian/plugin_guess_func
+++ b/debian/plugin_guess_func
@@ -6,46 +6,46 @@
 ### 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.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2" | "openvswitch")
 		NEUTRON_PLUGIN_NAME=OpenVSwitch
 	;;
-	"neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2")
+	"neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2" | "linuxbridge")
 		NEUTRON_PLUGIN_NAME=LinuxBridge
 	;;
-	"neutron.plugins.ml2.plugin.Ml2Plugin")
+	"neutron.plugins.ml2.plugin.Ml2Plugin" | "ml2")
 		NEUTRON_PLUGIN_NAME=ml2
 	;;
-	"neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2")
+	"neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2" | "ryu")
 		NEUTRON_PLUGIN_NAME=RYU
 	;;
-	"neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2")
+	"neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2" | "plumgrid")
 		NEUTRON_PLUGIN_NAME=PLUMgrid
 	;;
-	"neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2")
+	"neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2" | "brocade")
 		NEUTRON_PLUGIN_NAME=Brocade
 	;;
-	"neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin")
+	"neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin" | "hyperv")
 		NEUTRON_PLUGIN_NAME=Hyper-V
 	;;
-	"neutron.plugins.bigswitch.plugin.NeutronRestProxyV2")
+	"neutron.plugins.bigswitch.plugin.NeutronRestProxyV2" | "bigswitch")
 		NEUTRON_PLUGIN_NAME=BigSwitch
 	;;
-	"neutron.plugins.cisco.network_plugin.PluginV2")
+	"neutron.plugins.cisco.network_plugin.PluginV2" | "cisco")
 		NEUTRON_PLUGIN_NAME=Cisco
 	;;
-	"neutron.plugins.nicira.NeutronPlugin.NvpPluginV2")
+	"neutron.plugins.nicira.NeutronPlugin.NvpPluginV2" | "nicira")
 		NEUTRON_PLUGIN_NAME=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
 	;;
-	"neutron.plugins.midonet.plugin.MidonetPluginV2")
+	"neutron.plugins.midonet.plugin.MidonetPluginV2" | "midonet")
 		NEUTRON_PLUGIN_NAME=Midonet
 	;;
-	"neutron.plugins.nec.nec_plugin.NECPluginV2")
+	"neutron.plugins.nec.nec_plugin.NECPluginV2" | "nec")
 		NEUTRON_PLUGIN_NAME=Nec
 	;;
 	"neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2")
 		NEUTRON_PLUGIN_NAME=MetaPlugin
 	;;
-	"neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin")
+	"neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin" | "mlnx")
 		NEUTRON_PLUGIN_NAME=Mellanox
 	;;
 	*)
@@ -105,54 +105,3 @@ neutron_plugin_ini_path () {
 	;;
 	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.ml2.plugin.Ml2Plugin")
-		NEUTRON_PLUGIN_NAME=ml2
-	;;
-	"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
-}
-- 
1.7.10.4




More information about the Openstack-devel mailing list