summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-service/src
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-04-29 12:48:20 +0200
committerGitHub <noreply@github.com>2024-04-29 12:48:20 +0200
commit2dc44c7283200f4689cc1be15115a8b1cd37d456 (patch)
treee815ceb7a2c54ec40ac4072a594687dfe1d95f1b /opendc-compute/opendc-compute-service/src
parentaefa53bc65309869922d44509739bf2664cf50a5 (diff)
Fixed several cpu related bugs, changed input topology (#226)
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.kt10
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
}
}