From f10f1f16777572ca22d43670095c6d73ae9dcce5 Mon Sep 17 00:00:00 2001 From: Erik Colnick Date: Tue, 27 Jan 2015 13:21:18 -0700 Subject: [PATCH] Refactor to facilitate DVR scale performance To facilitate work for DVR scale performance improvements, refactor l3_agentschedulers_db.list_active_sync_routers_on_active_l3_agent to pull out logic that will be overridden into the private method _get_active_l3_agent_routers_sync_data Partial-Bug: 1413314 Change-Id: Ia454b037529c9b6f3750a67dc0eabb7e01419ea8 --- neutron/db/l3_agentschedulers_db.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/neutron/db/l3_agentschedulers_db.py b/neutron/db/l3_agentschedulers_db.py index 691869ca5..bd1f7d090 100644 --- a/neutron/db/l3_agentschedulers_db.py +++ b/neutron/db/l3_agentschedulers_db.py @@ -272,6 +272,16 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase, else: return {'routers': []} + def _get_active_l3_agent_routers_sync_data(self, context, host, agent, + router_ids): + if n_utils.is_extension_supported(self, + constants.L3_HA_MODE_EXT_ALIAS): + return self.get_ha_sync_data_for_host(context, host, + router_ids=router_ids, + active=True) + + return self.get_sync_data(context, router_ids=router_ids, active=True) + def list_active_sync_routers_on_active_l3_agent( self, context, host, router_ids): agent = self._get_agent_by_type_and_host( @@ -287,16 +297,10 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase, RouterL3AgentBinding.router_id.in_(router_ids)) router_ids = [item[0] for item in query] if router_ids: - if n_utils.is_extension_supported(self, - constants.L3_HA_MODE_EXT_ALIAS): - return self.get_ha_sync_data_for_host(context, host, - router_ids=router_ids, - active=True) - else: - return self.get_sync_data(context, router_ids=router_ids, - active=True) - else: - return [] + return self._get_active_l3_agent_routers_sync_data(context, host, + agent, + router_ids) + return [] def get_l3_agents_hosting_routers(self, context, router_ids, admin_state_up=None, -- 2.45.2