From b667a4ccc373c0345e9d766da6b14fb0d1354e7f Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Wed, 26 Apr 2023 20:50:46 +0800 Subject: [PATCH] fix(scheduler): skip load esxi network free-port cache --- pkg/scheduler/cache/candidate/base.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/scheduler/cache/candidate/base.go b/pkg/scheduler/cache/candidate/base.go index b88ca517e8..cf7909bb92 100644 --- a/pkg/scheduler/cache/candidate/base.go +++ b/pkg/scheduler/cache/candidate/base.go @@ -337,8 +337,15 @@ func newNetworkGetter() *networkGetter { } } +func shouldSkipLoadNetFromCache(host *computemodels.SHost) bool { + if host.IsEmulated || host.HostType == computeapi.HOST_TYPE_ESXI { + return true + } + return false +} + func (g *networkGetter) GetFreePort(host *computemodels.SHost, n *computemodels.SNetwork) (int, error) { - if host.IsEmulated { + if shouldSkipLoadNetFromCache(host) { // not calculate emulated host's network free address return -1, nil } @@ -453,7 +460,7 @@ func (b *BaseHostDesc) GetFreePort(netId string) int { if selNet == nil { return 0 } - if b.IsEmulated { + if shouldSkipLoadNetFromCache(b.SHost) { freeCount, _ := selNet.GetFreeAddressCount() return freeCount }