Merge pull request #8830 from rainzm/scheduler/storagetype

feat(scheduler): support filtering storage via medium
This commit is contained in:
yunion-ci-robot
2020-11-16 23:02:13 +08:00
committed by GitHub
2 changed files with 9 additions and 1 deletions
@@ -120,7 +120,14 @@ func (p *DiskSchedtagPredicate) IsResourceFitInput(u *core.Unit, c core.Candidat
}
}
}
if len(d.Medium) != 0 {
if storage.MediumType != d.Medium {
return &FailReason{
fmt.Sprintf("Storage %s medium %s != %s", storage.Name, storage.MediumType, d.Medium),
StorageMedium,
}
}
}
storageTypes := p.GetHypervisorDriver().GetStorageTypes()
if len(storageTypes) != 0 && !utils.IsInStringArray(storage.StorageType, storageTypes) {
return &FailReason{
@@ -126,4 +126,5 @@ const (
StorageMatch = "storage_match"
StorageType = "storage_type"
StorageOwnership = "storage_ownership"
StorageMedium = "storage_medium"
)