From dcbae504da7a541acf1d0c67a70b5342793acddc Mon Sep 17 00:00:00 2001 From: Swaminathan Vasudevan Date: Fri, 4 Dec 2015 12:44:10 -0800 Subject: [PATCH] DVR: Remove get_port call from dvr_update_router_addvm 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 | 3 +-- neutron/tests/unit/scheduler/test_l3_agent_scheduler.py | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/neutron/db/l3_dvrscheduler_db.py b/neutron/db/l3_dvrscheduler_db.py index 449270cef65..8dd7ddd6ea1 100644 --- a/neutron/db/l3_dvrscheduler_db.py +++ b/neutron/db/l3_dvrscheduler_db.py @@ -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: diff --git a/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py index 0f6e9a56446..243d6361e57 100644 --- a/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py +++ b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py @@ -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: