mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #5360 from wanyaoqi/automated-cherry-pick-of-#5359-upstream-release-3.1
Automated cherry pick of #5359: enable network list filter by host show vpc networks
This commit is contained in:
@@ -1797,8 +1797,17 @@ func (manager *SNetworkManager) ListItemFilter(ctx context.Context, q *sqlchemy.
|
||||
if err != nil {
|
||||
return nil, httperrors.NewResourceNotFoundError2(HostManager.Keyword(), hostStr)
|
||||
}
|
||||
host := hostObj.(*SHost)
|
||||
sq := HostwireManager.Query("wire_id").Equals("host_id", hostObj.GetId())
|
||||
q = q.Filter(sqlchemy.In(q.Field("wire_id"), sq.SubQuery()))
|
||||
if len(host.OvnVersion) > 0 {
|
||||
wireQuery := WireManager.Query("id").IsNotNull("vpc_id")
|
||||
q = q.Filter(sqlchemy.OR(
|
||||
sqlchemy.In(q.Field("wire_id"), wireQuery.SubQuery()),
|
||||
sqlchemy.In(q.Field("wire_id"), sq.SubQuery())),
|
||||
)
|
||||
} else {
|
||||
q = q.Filter(sqlchemy.In(q.Field("wire_id"), sq.SubQuery()))
|
||||
}
|
||||
}
|
||||
|
||||
if len(input.Ip) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user