feat(scheduler): support filtering storage via medium

This commit is contained in:
rainzm
2020-11-16 20:46:31 +08:00
parent a3f1f77496
commit bf30c48eea
2 changed files with 9 additions and 1 deletions

View File

@@ -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{

View File

@@ -126,4 +126,5 @@ const (
StorageMatch = "storage_match"
StorageType = "storage_type"
StorageOwnership = "storage_ownership"
StorageMedium = "storage_medium"
)