Join on explcit relationship paths

The join() in get_router_for_floatingip() is joining from entity
to entity without an explicit ON clause which creates an ambiguous
situation.  SQLAlchemy 1.3 guards against this now, so use the
real relationship-bound path so that the ORM does not need to guess.

Closes-bug: #1819260
Change-Id: Ia377a9d1a32a78abdaee74c79e395acd77e486ef
This commit is contained in:
Mike Bayer 2019-03-08 14:09:14 -05:00 committed by LIU Yulong
parent a01b7125cd
commit c04b8ddd90
1 changed files with 1 additions and 1 deletions

View File

@ -1160,7 +1160,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
# TODO(lujinluo): Need IPAllocation and Port object
routerport_qry = context.session.query(
RouterPort.router_id, models_v2.IPAllocation.ip_address).join(
models_v2.Port, models_v2.IPAllocation).filter(
RouterPort.port, models_v2.Port.fixed_ips).filter(
models_v2.Port.network_id == internal_port['network_id'],
RouterPort.port_type.in_(constants.ROUTER_INTERFACE_OWNERS),
models_v2.IPAllocation.subnet_id == internal_subnet['id']