From 1934ea3edc9efd38baeca70280afdfd8175e21a5 Mon Sep 17 00:00:00 2001 From: tb365 Date: Wed, 1 Sep 2021 10:34:20 +0800 Subject: [PATCH] lb list api support search elastic ip --- pkg/compute/models/loadbalancers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/compute/models/loadbalancers.go b/pkg/compute/models/loadbalancers.go index 4dcabcae09..988bfb93c1 100644 --- a/pkg/compute/models/loadbalancers.go +++ b/pkg/compute/models/loadbalancers.go @@ -191,7 +191,9 @@ func (man *SLoadbalancerManager) ListItemFilter( } if len(query.Address) > 0 { - q = q.In("address", query.Address) + c1 := sqlchemy.In(q.Field("id"), ElasticipManager.Query("associate_id").In("ip_addr", query.Address)) + c2 := sqlchemy.In(q.Field("address"), query.Address) + q = q.Filter(sqlchemy.OR(c1, c2)) } if len(query.AddressType) > 0 { q = q.In("address_type", query.AddressType)