Merge "Cisco plugin check for a valid nexus driver"

This commit is contained in:
Jenkins 2013-07-23 05:54:51 +00:00 committed by Gerrit Code Review
commit 1b3a505a01

View File

@ -92,6 +92,12 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
{'module': __name__, {'module': __name__,
'name': self.__class__.__name__}) 'name': self.__class__.__name__})
# Check whether we have a valid Nexus driver loaded
self.config_nexus = False
nexus_driver = cfg.CONF.CISCO.nexus_driver
if nexus_driver.endswith('CiscoNEXUSDriver'):
self.config_nexus = True
def __getattribute__(self, name): def __getattribute__(self, name):
"""Delegate calls to OVS sub-plugin. """Delegate calls to OVS sub-plugin.
@ -252,6 +258,9 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
def _invoke_nexus_for_net_create(self, context, tenant_id, net_id, def _invoke_nexus_for_net_create(self, context, tenant_id, net_id,
instance_id): instance_id):
if not self.config_nexus:
return False
net_dict = self.get_network(context, net_id) net_dict = self.get_network(context, net_id)
net_name = net_dict['name'] net_name = net_dict['name']
@ -367,6 +376,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
""" """
LOG.debug(_("delete_port() called")) LOG.debug(_("delete_port() called"))
port = self.get_port(context, id) port = self.get_port(context, id)
if self.config_nexus:
vlan_id = self._get_segmentation_id(port['network_id']) vlan_id = self._get_segmentation_id(port['network_id'])
n_args = [port['device_id'], vlan_id] n_args = [port['device_id'], vlan_id]
self._invoke_plugin_per_device(const.NEXUS_PLUGIN, self._invoke_plugin_per_device(const.NEXUS_PLUGIN,