diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-08 10:39:58 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-08 10:40:46 +0200 |
| commit | 2ed3ad44885c93287d4ef9c7996db73f1d49d62d (patch) | |
| tree | e7fd268e5d8d42ec9b83ffa045bf25d639d0a066 /simulator/opendc-compute | |
| parent | d0f17b02fe08248e37eda5185eb6c5e40fcb1dcc (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.kt | 2 |
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 } |
