@@ -265,15 +265,19 @@ def schedule(self, plugin, context, loadbalancer_id, env=None):
265265 if group_capacity > capacity_by_group [gn ]:
266266 capacity_by_group [gn ] = group_capacity
267267
268+ # ---------------------------------------------------------
269+ # NOTE(qzhao): Skip to evaluate tenant affinity, because it
270+ # cost much time to load loadbalancers from neutron db.
271+ # ---------------------------------------------------------
268272 # Do we already have this tenant assigned to this
269273 # agent candidate? If we do and it has capacity
270274 # then assign this loadbalancer to this agent.
271- assigned_lbs = plugin .db .list_loadbalancers_on_lbaas_agent (
272- context , candidate ['id' ])
273- for assigned_lb in assigned_lbs :
274- if loadbalancer .tenant_id == assigned_lb .tenant_id :
275- chosen_agent = candidate
276- break
275+ # assigned_lbs = plugin.db.list_loadbalancers_on_lbaas_agent(
276+ # context, candidate['id'])
277+ # for assigned_lb in assigned_lbs:
278+ # if loadbalancer.tenant_id == assigned_lb.tenant_id:
279+ # chosen_agent = candidate
280+ # break
277281
278282 if chosen_agent :
279283 # Does the agent which had tenants assigned
@@ -417,15 +421,21 @@ def schedule(self, plugin, context, loadbalancer_id, env=None):
417421 else :
418422 if group_capacity > capacity_by_group [gn ]:
419423 capacity_by_group [gn ] = group_capacity
424+
425+ # ---------------------------------------------------------
426+ # NOTE(qzhao): Skip to evaluate tenant affinity, because it
427+ # cost much time to load loadbalancers from neutron db.
428+ # ---------------------------------------------------------
420429 # Do we already have this tenant assigned to this
421430 # agent candidate? If we do and it has capacity
422431 # then assign this loadbalancer to this agent.
423- assigned_lbs = plugin .db .list_loadbalancers_on_lbaas_agent (
424- context , candidate ['id' ])
425- for assigned_lb in assigned_lbs :
426- if loadbalancer .tenant_id == assigned_lb .tenant_id :
427- chosen_agent = candidate
428- break
432+ # assigned_lbs = plugin.db.list_loadbalancers_on_lbaas_agent(
433+ # context, candidate['id'])
434+ # for assigned_lb in assigned_lbs:
435+ # if loadbalancer.tenant_id == assigned_lb.tenant_id:
436+ # chosen_agent = candidate
437+ # break
438+
429439 if chosen_agent :
430440 # Does the agent which had tenants assigned
431441 # to it still have capacity?
0 commit comments