]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove binding:profile update from Mellanox ML2 MD
authorIrena Berezovsky <irenab@mellanox.com>
Mon, 25 Aug 2014 10:56:38 +0000 (13:56 +0300)
committerIrena Berezovsky <irenab@mellanox.com>
Thu, 28 Aug 2014 18:53:08 +0000 (21:53 +0300)
Remove temporary work-around that populates physical_network in
binding:profile. Now when both neutron and nova use binding:vif_details
to pass attributes to plug neutron port, this work-around is not nequired.
Remove related temporary code from ML2 plugin.

Change-Id: Ib37203af396f31080b1b27b500a571c20917f5a4
Closes-Bug: 1360762

etc/neutron/plugins/ml2/ml2_conf_mlnx.ini
neutron/plugins/ml2/drivers/mlnx/config.py
neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py
neutron/plugins/ml2/plugin.py
neutron/tests/unit/ml2/drivers/test_mech_mlnx.py

index 01b0797cf20463f14fbe91307585ef63756d5975..46139aed85a93c3146a8ade0ad6b4ea7d133187f 100644 (file)
@@ -2,5 +2,3 @@
 # (StrOpt) Type of Network Interface to allocate for VM:
 # mlnx_direct or hostdev according to libvirt terminology
 # vnic_type = mlnx_direct
-# (BoolOpt) Enable server compatibility with old nova
-# apply_profile_patch = False
index c9641d53cf5434436c4f164695aecbe213012b37..eac221b76119d6ea47f7bf0f49acddf4091af57e 100644 (file)
@@ -23,9 +23,6 @@ eswitch_opts = [
                default=portbindings.VIF_TYPE_MLNX_DIRECT,
                help=_("Type of VM network interface: mlnx_direct or "
                       "hostdev")),
-    cfg.BoolOpt('apply_profile_patch',
-                default=False,
-                help=_("Enable server compatibility with old nova")),
 ]
 
 
index 97eb03a4c1562581dde3efe1e5d2c614cef26c9b..51fea633a44aa6ad8500fe9bc7dff9641b52be80 100644 (file)
@@ -18,7 +18,6 @@ from oslo.config import cfg
 
 from neutron.common import constants
 from neutron.extensions import portbindings
-from neutron.openstack.common import jsonutils
 from neutron.openstack.common import log
 from neutron.plugins.ml2 import driver_api as api
 from neutron.plugins.ml2.drivers import mech_agent
@@ -49,7 +48,6 @@ class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
             cfg.CONF.ESWITCH.vnic_type,
             {portbindings.CAP_PORT_FILTER: False},
             portbindings.VNIC_TYPES)
-        self.update_profile = cfg.CONF.ESWITCH.apply_profile_patch
 
     def check_segment_for_agent(self, segment, agent):
         mappings = agent['configurations'].get('interface_mappings', {})
@@ -75,13 +73,6 @@ class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
             context.set_binding(segment[api.ID],
                                 vif_type,
                                 self.vif_details)
-            # REVISIT(irenab): Temporary solution till nova support
-            # will be merged for physical_network propagation
-            # via VIF object to VIFDriver (required by mlnx vif plugging).
-            if self.update_profile:
-                profile = {'physical_network':
-                           segment['physical_network']}
-                context._binding.profile = jsonutils.dumps(profile)
 
     def _get_vif_type(self, requested_vnic_type):
         if requested_vnic_type == portbindings.VNIC_MACVTAP:
index 6ab9f246f4cb5fa86f7591fc62e79b4cf8fca1f9..3979d503f0ba9433444a6991ea383ccea547868f 100644 (file)
@@ -336,14 +336,6 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
                 cur_binding.driver = new_binding.driver
                 cur_binding.segment = new_binding.segment
 
-                # REVISIT(rkukura): The binding:profile attribute is
-                # supposed to be input-only, but the Mellanox driver
-                # currently modifies it while binding. Remove this
-                # code when the Mellanox driver has been updated to
-                # use binding:vif_details instead.
-                if cur_binding.profile != new_binding.profile:
-                    cur_binding.profile = new_binding.profile
-
                 # Update PortContext's port dictionary to reflect the
                 # updated binding state.
                 self._update_port_dict_binding(port, cur_binding)
@@ -891,8 +883,6 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
                 cur_binding.vif_details = new_binding.vif_details
                 cur_binding.driver = new_binding.driver
                 cur_binding.segment = new_binding.segment
-                if cur_binding.profile != new_binding.profile:
-                    cur_binding.profile = new_binding.profile
 
     def delete_port(self, context, id, l3_port_check=True):
         LOG.debug(_("Deleting port %s"), id)
index 343af4233e0ea21982302c571249d47c791dde51..3b880572476f72820ac95b8cbe0c3ae44aedb0f4 100644 (file)
@@ -14,9 +14,6 @@
 #    under the License.
 
 
-import mock
-from oslo.config import cfg
-
 from neutron.common import constants
 from neutron.extensions import portbindings
 from neutron.plugins.ml2 import driver_api as api
@@ -94,30 +91,6 @@ class MlnxMechanismVnicTypeTestCase(MlnxMechanismBaseTestCase,
                                            self.VIF_TYPE)
 
 
-class MlnxMechanismProfileTestCase(MlnxMechanismBaseTestCase):
-    def setUp(self):
-        cfg.CONF.set_override('apply_profile_patch', True, 'ESWITCH')
-        super(MlnxMechanismProfileTestCase, self).setUp()
-
-    def test_profile_contains_physical_net(self):
-        VLAN_SEGMENTS = [{api.ID: 'vlan_segment_id',
-                          api.NETWORK_TYPE: 'vlan',
-                          api.PHYSICAL_NETWORK: 'fake_physical_network',
-                          api.SEGMENTATION_ID: 1234}]
-
-        context = base.FakePortContext(self.AGENT_TYPE,
-                                       self.AGENTS,
-                                       VLAN_SEGMENTS,
-                                       portbindings.VNIC_DIRECT)
-        context._binding = mock.Mock()
-        context._binding.profile = {}
-        segment = VLAN_SEGMENTS[0]
-        agent = self.AGENTS[0]
-        self.driver.try_to_bind_segment_for_agent(context, segment, agent)
-        self.assertEqual('{"physical_network": "fake_physical_network"}',
-                         context._binding.profile)
-
-
 class MlnxMechanismVifDetailsTestCase(MlnxMechanismBaseTestCase):
     def setUp(self):
         super(MlnxMechanismVifDetailsTestCase, self).setUp()