]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
gw_port should be set as lazy='join'
authorarmando-migliaccio <armamig@gmail.com>
Fri, 18 Apr 2014 19:32:26 +0000 (12:32 -0700)
committerThomas Goirand <thomas@goirand.fr>
Mon, 9 Jun 2014 15:06:53 +0000 (23:06 +0800)
This forces the object to be ready ahead of accessing time.
The change in loading behavior is also beneficial while listing
routers, as reduces the amount of queries being issued. Tests
show a performance gain of 15-30% for router-list times.

As Mr. Aaron Rosen is used to saying: Woot woot!!

Closes-bug: #1309144

Change-Id: Ibae261b91de26ca7c50e3f6c80e9be2a799785a3
(cherry picked from commit 966dbb5368d710e2652b18f5b9cb4295f58598da)

neutron/db/l3_db.py

index 6096b19d3c3d685e4248d2756aade6f18405ee98..52a491f4ef9f64efc41a6acbbcdc58bd2d6e5df5 100644 (file)
@@ -51,7 +51,7 @@ class Router(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
     status = sa.Column(sa.String(16))
     admin_state_up = sa.Column(sa.Boolean)
     gw_port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id'))
-    gw_port = orm.relationship(models_v2.Port)
+    gw_port = orm.relationship(models_v2.Port, lazy='joined')
 
 
 class FloatingIP(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):