summaryrefslogtreecommitdiff
path: root/simulator/opendc-compute
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-08 10:39:58 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-08 10:40:46 +0200
commit2ed3ad44885c93287d4ef9c7996db73f1d49d62d (patch)
treee7fd268e5d8d42ec9b83ffa045bf25d639d0a066 /simulator/opendc-compute
parentd0f17b02fe08248e37eda5185eb6c5e40fcb1dcc (diff)
compute: Fix random allocation policy
This change fixes an issue in the RandomAllocationPolicy where it would incorrectly obtain the required memory for the server.
Diffstat (limited to 'simulator/opendc-compute')
-rw-r--r--simulator/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/RandomAllocationPolicy.kt2
1 files changed, 1 insertions, 1 deletions
diff --git a/simulator/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/RandomAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/RandomAllocationPolicy.kt
index ac7b351d..006e0d1c 100644
--- a/simulator/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/RandomAllocationPolicy.kt
+++ b/simulator/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/RandomAllocationPolicy.kt
@@ -38,7 +38,7 @@ public class RandomAllocationPolicy(private val random: Random = Random(0)) : Al
): HostView? {
return hypervisors.asIterable()
.filter { hv ->
- val fitsMemory = hv.availableMemory >= (server.image.meta["required-memory"] as Long)
+ val fitsMemory = hv.availableMemory >= server.flavor.memorySize
val fitsCpu = hv.host.model.cpuCount >= server.flavor.cpuCount
fitsMemory && fitsCpu
}