summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute/src
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-05-05 19:38:09 +0200
committerGeorgios Andreadis <info@gandreadis.com>2020-05-05 19:38:09 +0200
commit9892e3d9a6755e4b9ec213adc30e7539696248f6 (patch)
tree83e5126f5610cbdcc7f10786098db146b83d6b77 /opendc/opendc-compute/src
parentb8637f4d54dd228f08029f66f45cfe4d2240ddff (diff)
Add check for VMs not in placement data
Diffstat (limited to 'opendc/opendc-compute/src')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt2
1 files changed, 1 insertions, 1 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt
index 280f3028..1276a973 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt
@@ -18,7 +18,7 @@ class ReplayAllocationPolicy(val vmPlacements: Map<String, String>) : Allocation
val clusterName = vmPlacements[image.name]
?: throw RuntimeException("Could not find placement data in VM placement file for VM ${image.name}")
val machinesInCluster = hypervisors.filter { it.server.name.contains(clusterName) }
- return machinesInCluster.minBy { it.numberOfActiveServers }
+ return machinesInCluster.maxBy { it.availableMemory }
?: throw RuntimeException("Cloud not find any machines belonging to cluster $clusterName for image ${image.name}")
}
}