From: Arvind Somya Date: Thu, 18 Jul 2013 20:03:22 +0000 (-0400) Subject: Cisco plugin check for a valid nexus driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b6d787cdc32445858b1a2e89fd373790103444c2;p=openstack-build%2Fneutron-build.git Cisco plugin check for a valid nexus driver The Cisco plugin model should check for a valid Nexus driver before performing any operations on hardware nexus devices. Change-Id: Ib7760cc7bb24e2c7f6692cbd8274aefa71dc21a1 Fixes: Bug #1202822 --- diff --git a/neutron/plugins/cisco/models/virt_phy_sw_v2.py b/neutron/plugins/cisco/models/virt_phy_sw_v2.py index 8d6558066..d51b550ed 100644 --- a/neutron/plugins/cisco/models/virt_phy_sw_v2.py +++ b/neutron/plugins/cisco/models/virt_phy_sw_v2.py @@ -92,6 +92,12 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2): {'module': __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): """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, instance_id): + if not self.config_nexus: + return False + net_dict = self.get_network(context, net_id) net_name = net_dict['name'] @@ -367,11 +376,12 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2): """ LOG.debug(_("delete_port() called")) port = self.get_port(context, id) - vlan_id = self._get_segmentation_id(port['network_id']) - n_args = [port['device_id'], vlan_id] - self._invoke_plugin_per_device(const.NEXUS_PLUGIN, - self._func_name(), - n_args) + if self.config_nexus: + vlan_id = self._get_segmentation_id(port['network_id']) + n_args = [port['device_id'], vlan_id] + self._invoke_plugin_per_device(const.NEXUS_PLUGIN, + self._func_name(), + n_args) try: args = [context, id] ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,