summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt2
-rw-r--r--opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt17
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 {