scheduler: fix disk or net specify resource id execute schedtag filter

This commit is contained in:
Zexi
2019-08-22 21:47:16 +08:00
parent 065f4390c0
commit 83613793e6
3 changed files with 10 additions and 1 deletions
@@ -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,