From a7e40d36c55aed8015bc32dd137a1094ef31c049 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 3 Dec 2020 20:41:45 +0800 Subject: [PATCH] fix(scheduler): check candidate tag resource is nil --- pkg/scheduler/algorithm/predicates/predicates.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/scheduler/algorithm/predicates/predicates.go b/pkg/scheduler/algorithm/predicates/predicates.go index 5525a1f3b1..d14aeac4dd 100644 --- a/pkg/scheduler/algorithm/predicates/predicates.go +++ b/pkg/scheduler/algorithm/predicates/predicates.go @@ -34,6 +34,7 @@ import ( "yunion.io/x/jsonutils" "yunion.io/x/log" + "yunion.io/x/pkg/gotypes" "yunion.io/x/pkg/util/errors" computeapi "yunion.io/x/onecloud/pkg/apis/compute" @@ -607,7 +608,7 @@ func (p *ServerBaseSchedtagPredicate) Execute(u *core.Unit, c core.Candidater) ( func (p *ServerBaseSchedtagPredicate) GetResources(c core.Candidater) []ISchedtagCandidateResource { res := p.filter.GetCandidateResource(c) - if res == nil { + if res == nil || gotypes.IsNil(res) { return nil } return []ISchedtagCandidateResource{