]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix query in get_l3_agent_with_min_routers
authorAnn Kamyshnikova <akamyshnikova@mirantis.com>
Mon, 14 Sep 2015 14:29:22 +0000 (17:29 +0300)
committerAnn Kamyshnikova <akamyshnikova@mirantis.com>
Mon, 14 Sep 2015 14:39:00 +0000 (17:39 +0300)
For PostgreSQL if you're using GROUP BY everything in the SELECT
list must be an aggregate count(...) or used in the GROUP BY.

Closes-bug: #1495523

Change-Id: Ieb75d0666ec2f6d2e61686bf2bacea2b9ad6c521

neutron/db/l3_agentschedulers_db.py

index e5e19040ee5bd8b0588090c739a5056b21b3b016..bebd8d1ff134759a192f6002bdee4bb943a16e1f 100644 (file)
@@ -501,6 +501,7 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
             func.count(
                 RouterL3AgentBinding.router_id
             ).label('count')).outerjoin(RouterL3AgentBinding).group_by(
+                agents_db.Agent.id,
                 RouterL3AgentBinding.l3_agent_id).order_by('count')
         res = query.filter(agents_db.Agent.id.in_(agent_ids)).first()
         return res[0]