mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #15215 from zexi/automated-cherry-pick-of-#15214-upstream-master
Automated cherry pick of #15214: fix(scheduler): do free capacity check when storage filter enabled
This commit is contained in:
@@ -148,17 +148,19 @@ func (p *DiskSchedtagPredicate) IsResourceFitInput(ctx context.Context, u *core.
|
||||
}
|
||||
}
|
||||
|
||||
// free capacity check
|
||||
if storage.FreeCapacity < int64(d.SizeMb) {
|
||||
return &FailReason{
|
||||
Reason: fmt.Sprintf("Storage %s free capacity %d < %d(request)", storage.Name, storage.FreeCapacity, d.SizeMb),
|
||||
Type: StorageOwnership,
|
||||
if u.GetHypervisorDriver().DoScheduleStorageFilter() {
|
||||
// free capacity check
|
||||
if storage.FreeCapacity < int64(d.SizeMb) {
|
||||
return &FailReason{
|
||||
Reason: fmt.Sprintf("Storage %s free capacity %d < %d(request)", storage.Name, storage.FreeCapacity, d.SizeMb),
|
||||
Type: StorageCapacity,
|
||||
}
|
||||
}
|
||||
}
|
||||
if storage.ActualFreeCapacity < int64(d.SizeMb) {
|
||||
return &FailReason{
|
||||
Reason: fmt.Sprintf("Storage %s actual free capacity %d < %d(request)", storage.Name, storage.ActualFreeCapacity, d.SizeMb),
|
||||
Type: StorageOwnership,
|
||||
if storage.ActualFreeCapacity < int64(d.SizeMb) {
|
||||
return &FailReason{
|
||||
Reason: fmt.Sprintf("Storage %s actual free capacity %d < %d(request)", storage.Name, storage.ActualFreeCapacity, d.SizeMb),
|
||||
Type: StorageCapacity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,4 +129,5 @@ const (
|
||||
StorageType = "storage_type"
|
||||
StorageOwnership = "storage_ownership"
|
||||
StorageMedium = "storage_medium"
|
||||
StorageCapacity = "storage_capacity"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user