Merge "Use SQL IN clause instead of OR with exact match comparisons"

This commit is contained in:
Zuul 2022-06-14 16:49:11 +00:00 committed by Gerrit Code Review
commit db93cc5555

View File

@ -13,7 +13,6 @@
from neutron_lib.db import api as db_api
from neutron_lib.objects import common_types
from oslo_versionedobjects import fields as obj_fields
import sqlalchemy as sa
from sqlalchemy.orm import joinedload
from sqlalchemy import sql
@ -61,9 +60,8 @@ class RouterL3AgentBinding(base.NeutronDbObject):
l3_attrs.RouterExtraAttributes,
l3_attrs.RouterExtraAttributes.router_id ==
l3agent.RouterL3AgentBinding.router_id).filter(
sa.or_(
l3_attrs.RouterExtraAttributes.ha == sql.false(),
l3_attrs.RouterExtraAttributes.ha == sql.null())))
l3_attrs.RouterExtraAttributes.ha.in_([sql.false(),
sql.null()])))
bindings = [cls._load_object(context, db_obj) for db_obj in
query.all()]
return bindings