mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
scheduler: fix disk or net specify resource id execute schedtag filter
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user