From fa6d12d7be7ffb6286b4f1894745ac78d6d810b8 Mon Sep 17 00:00:00 2001 From: wanyaoqi <18528551+wanyaoqi@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:03:04 +0800 Subject: [PATCH] fix(region): check normal type nic is null (#19729) --- pkg/compute/models/hosts.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index b761302f69..c813e22107 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -1742,7 +1742,12 @@ func (h *SHost) getNetInterfacesInternal(wireId string, nicTypes []compute.TNicT q = q.Equals("wire_id", wireId) } if len(nicTypes) > 0 { - q = q.In("nic_type", nicTypes) + //q.IsNullOrEmpty() + if ok, _ := utils.InArray(compute.NIC_TYPE_NORMAL, nicTypes); ok { + q = q.Filter(sqlchemy.OR(sqlchemy.In(q.Field("nic_type"), nicTypes), sqlchemy.IsNull(q.Field("nic_type")))) + } else { + q = q.In("nic_type", nicTypes) + } } q = q.Asc("index") q = q.Asc("vlan_id")