From 052442ef66a5f293a0aa376db6b1f5f38a88572d Mon Sep 17 00:00:00 2001 From: rainzm Date: Fri, 2 Apr 2021 19:09:53 +0800 Subject: [PATCH 1/2] fix(region): de-duplication when obtaining the number of hosts --- pkg/compute/models/wires.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/compute/models/wires.go b/pkg/compute/models/wires.go index f5c528258c..a2ddebf913 100644 --- a/pkg/compute/models/wires.go +++ b/pkg/compute/models/wires.go @@ -237,7 +237,7 @@ func (wire *SWire) getHostwireQuery() *sqlchemy.SQuery { } func (wire *SWire) HostCount() (int, error) { - q := wire.getHostwireQuery() + q := HostwireManager.Query().Equals("wire_id", wire.Id).GroupBy("host_id") return q.CountWithError() } From 841ec1f251e6aae005e2966dbb267c487a3fabe4 Mon Sep 17 00:00:00 2001 From: rainzm Date: Fri, 2 Apr 2021 19:10:41 +0800 Subject: [PATCH 2/2] fix(region): expand the bridge field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于 esxi 中,bridge 是 dvs 的一个路径,长度为 16 字段会不够用 --- pkg/compute/models/hostwires.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/compute/models/hostwires.go b/pkg/compute/models/hostwires.go index 21f5116b2b..f708ec5a95 100644 --- a/pkg/compute/models/hostwires.go +++ b/pkg/compute/models/hostwires.go @@ -55,7 +55,7 @@ func init() { type SHostwire struct { SHostJointsBase - Bridge string `width:"16" charset:"ascii" nullable:"false" list:"domain" update:"domain" create:"domain_required"` + Bridge string `width:"64" charset:"ascii" nullable:"false" list:"domain" update:"domain" create:"domain_required"` // 接口名称 Interface string `width:"16" charset:"ascii" nullable:"false" list:"domain" update:"domain" create:"domain_required"` // 是否是主地址