]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Refactor to facilitate DVR scale performance
authorErik Colnick <erik.colnick@hp.com>
Tue, 27 Jan 2015 20:21:18 +0000 (13:21 -0700)
committerErik Colnick <erik.colnick@hp.com>
Wed, 11 Feb 2015 15:42:58 +0000 (08:42 -0700)
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

index 691869ca5a4b0bd92edd2117a106431c6eceb791..bd1f7d090d9d76105ab5d5911706b71b49c16144 100644 (file)
@@ -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,