feat: Add method 'Sku' to CandidatePropertyGetter

This commit is contained in:
rainzm
2020-09-07 16:14:28 +08:00
parent 4b4875cd70
commit 0bd84dd4b0
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -30,6 +30,7 @@ import (
computemodels "yunion.io/x/onecloud/pkg/compute/models"
"yunion.io/x/onecloud/pkg/scheduler/api"
"yunion.io/x/onecloud/pkg/scheduler/core"
"yunion.io/x/onecloud/pkg/scheduler/data_manager/sku"
schedmodels "yunion.io/x/onecloud/pkg/scheduler/models"
)
@@ -124,6 +125,11 @@ func (b baseHostGetter) HostSchedtags() []computemodels.SSchedtag {
return b.h.HostSchedtags
}
func (b baseHostGetter) Sku(instanceType string) *sku.ServerSku {
zone := b.Zone()
return sku.GetByZone(instanceType, zone.GetId())
}
func (b baseHostGetter) Storages() []*api.CandidateStorage {
return b.h.Storages
}
+2
View File
@@ -28,6 +28,7 @@ import (
computemodels "yunion.io/x/onecloud/pkg/compute/models"
"yunion.io/x/onecloud/pkg/scheduler/api"
"yunion.io/x/onecloud/pkg/scheduler/core/score"
"yunion.io/x/onecloud/pkg/scheduler/data_manager/sku"
schedmodels "yunion.io/x/onecloud/pkg/scheduler/models"
)
@@ -74,6 +75,7 @@ type CandidatePropertyGetter interface {
Region() *computemodels.SCloudregion
HostType() string
HostSchedtags() []computemodels.SSchedtag
Sku(string) *sku.ServerSku
Storages() []*api.CandidateStorage
Networks() []*api.CandidateNetwork
OvnCapable() bool