From 2ed3ad44885c93287d4ef9c7996db73f1d49d62d Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 8 Apr 2021 10:39:58 +0200 Subject: compute: Fix random allocation policy This change fixes an issue in the RandomAllocationPolicy where it would incorrectly obtain the required memory for the server. --- .../org/opendc/compute/service/scheduler/RandomAllocationPolicy.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'simulator') 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 } -- cgit v1.2.3