NSX|V3: Fix router check for LB service

A neutron router can be attached to multiple loadbalancers.
So the DB query to check if it has any loadbalancers should
epect more than one result.

Change-Id: I5a2aab53cd1e925f8e75d98cb15b979e1cf88c57
This commit is contained in:
Adit Sarfaty 2019-06-11 10:55:43 +03:00
parent 8d7b24f9b6
commit 77aa1ce80c

View File

@ -587,9 +587,9 @@ def get_nsx_lbaas_loadbalancer_binding_by_service(session, lb_service_id):
def has_nsx_lbaas_loadbalancer_binding_by_router(session, nsx_router_id): def has_nsx_lbaas_loadbalancer_binding_by_router(session, nsx_router_id):
try: try:
session.query(nsx_models.NsxLbaasLoadbalancer).filter_by( bindings = session.query(nsx_models.NsxLbaasLoadbalancer).filter_by(
lb_router_id=nsx_router_id).one() lb_router_id=nsx_router_id).all()
return True return len(bindings) > 0
except exc.NoResultFound: except exc.NoResultFound:
return False return False