]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
DVR: Remove get_port call from dvr_update_router_addvm
authorSwaminathan Vasudevan <swaminathan.vasudevan@hp.com>
Fri, 4 Dec 2015 20:44:10 +0000 (12:44 -0800)
committerSwaminathan Vasudevan <swaminathan.vasudevan@hp.com>
Mon, 21 Dec 2015 21:36:58 +0000 (13:36 -0800)
The dvr_update_router_addvm un-necessarily calls the
get_port to retreive the port dict, even though the port
dict is already passed in.

So this patch will remove the get_port call.

Change-Id: Ib893024ef0cf811497f077f5ae9d3965ea19f288

neutron/db/l3_dvrscheduler_db.py
neutron/tests/unit/scheduler/test_l3_agent_scheduler.py

index 449270cef65cd3e0e863707dbb8217d83e5b5dba..8dd7ddd6ea17f8198c860a71a5db44e70a5b4104 100644 (file)
@@ -100,8 +100,7 @@ class L3_DVRsch_db_mixin(l3agent_sch_db.L3AgentSchedulerDbMixin):
     """
 
     def dvr_update_router_addvm(self, context, port):
-        port_dict = self._core_plugin.get_port(context, port['id'])
-        port_host = port_dict[portbindings.HOST_ID]
+        port_host = port[portbindings.HOST_ID]
         l3_agent_on_host = (self.get_l3_agents(
             context, filters={'host': [port_host]}) or [None])[0]
         if not l3_agent_on_host:
index 0f6e9a564468d05aa0eefcfefbfc170f8ac25693..243d6361e574128e668414e1d0562278d0e9bea2 100644 (file)
@@ -1197,9 +1197,6 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase):
             return_value=dvr_ports),\
                 mock.patch('neutron.api.rpc.agentnotifiers.l3_rpc_agent_api'
                            '.L3AgentNotifyAPI'),\
-                mock.patch(
-                    'neutron.db.db_base_plugin_v2.NeutronDbPluginV2.get_port',
-                    return_value=port),\
                 mock.patch.object(
                         self.dut, 'get_l3_agents',
                         return_value=[agent_on_host]) as get_l3_agents: