diff --git a/pkg/scheduler/algorithm/predicates/disk_schedtag_predicate.go b/pkg/scheduler/algorithm/predicates/disk_schedtag_predicate.go index 37cadf94ad..40e7c2d8ad 100644 --- a/pkg/scheduler/algorithm/predicates/disk_schedtag_predicate.go +++ b/pkg/scheduler/algorithm/predicates/disk_schedtag_predicate.go @@ -56,6 +56,10 @@ func (d diskW) ResourceKeyword() string { return "storage" } +func (d diskW) IsSpecifyResource() bool { + return d.Storage != "" +} + func (d diskW) GetSchedtags() []*computeapi.SchedtagConfig { return d.DiskConfig.Schedtags } diff --git a/pkg/scheduler/algorithm/predicates/network_schedtag_predicate.go b/pkg/scheduler/algorithm/predicates/network_schedtag_predicate.go index 9d47d14780..f3c9bba6da 100644 --- a/pkg/scheduler/algorithm/predicates/network_schedtag_predicate.go +++ b/pkg/scheduler/algorithm/predicates/network_schedtag_predicate.go @@ -59,6 +59,10 @@ func (n netW) ResourceKeyword() string { return "network" } +func (n netW) IsSpecifyResource() bool { + return n.Network != "" +} + func (n netW) GetSchedtags() []*computeapi.SchedtagConfig { return n.NetworkConfig.Schedtags } diff --git a/pkg/scheduler/algorithm/predicates/predicates.go b/pkg/scheduler/algorithm/predicates/predicates.go index 7ce8f008a3..6a070e408b 100644 --- a/pkg/scheduler/algorithm/predicates/predicates.go +++ b/pkg/scheduler/algorithm/predicates/predicates.go @@ -282,6 +282,7 @@ func (p *PredicatedSchedtagResource) hasAvoidTags() bool { type ISchedtagCustomer interface { JSON(interface{}) *jsonutils.JSONDict Keyword() string + IsSpecifyResource() bool GetSchedtags() []*computeapi.SchedtagConfig ResourceKeyword() string } @@ -330,7 +331,7 @@ func (p *BaseSchedtagPredicate) check(input ISchedtagCustomer, candidate ISchedt res := &PredicatedSchedtagResource{ ISchedtagCandidateResource: candidate, } - if shouldExec { + if shouldExec && !input.IsSpecifyResource() { if err := tagPredicate.Check( SchedtagResourceW{ candidater: candidate,