diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-05-05 19:38:09 +0200 |
|---|---|---|
| committer | Georgios Andreadis <info@gandreadis.com> | 2020-05-05 19:38:09 +0200 |
| commit | 9892e3d9a6755e4b9ec213adc30e7539696248f6 (patch) | |
| tree | 83e5126f5610cbdcc7f10786098db146b83d6b77 | |
| parent | b8637f4d54dd228f08029f66f45cfe4d2240ddff (diff) | |
Add check for VMs not in placement data
2 files changed, 18 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}") } } diff --git a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt index 54af8a4b..424f411c 100644 --- a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt +++ b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt @@ -253,6 +253,23 @@ fun main(args: Array<String>) { val reader = Sc20ParquetTraceReader(File(traceDirectory), performanceInterferenceModel, getSelectedVmList(), Random(seed)) while (reader.hasNext()) { val (time, workload) = reader.next() + + if (vmPlacements.isNotEmpty()) { + val vmId = workload.name.replace("VM Workload ", "") + // Check if VM in topology + val clusterName = vmPlacements[vmId] + if (clusterName == null) { + println("Could not find placement data in VM placement file for VM ${vmId}") + continue + } + val machinesInCluster = + hypervisors.filter { (it as SimpleVirtDriver).server.name.contains(clusterName) } + if (machinesInCluster.isEmpty()) { + println("Ignored VM") + continue + } + } + submitted++ delay(max(0, time - simulationContext.clock.millis())) launch { |
