diff options
Diffstat (limited to 'opendc-compute/opendc-compute-service/src')
| -rw-r--r-- | opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt index 451ea4b6..cefb3f7a 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt @@ -36,15 +36,15 @@ public class VCpuFilter(private val allocationRatio: Double) : HostFilter { server: Server, ): Boolean { val requested = server.flavor.coreCount - val total = host.host.model.coreCount - val limit = total * allocationRatio + val totalCores = host.host.model.coreCount + val limit = totalCores * allocationRatio // Do not allow an instance to overcommit against itself, only against other instances - if (requested > total) { + if (requested > totalCores) { return false } - val free = limit - host.provisionedCores - return free >= requested + val availableCores = limit - host.provisionedCores + return availableCores >= requested } } |
