From b8637f4d54dd228f08029f66f45cfe4d2240ddff Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Tue, 5 May 2020 19:01:39 +0200 Subject: Fix cluster format --- .../opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt | 4 ++-- .../com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt | 4 +++- 2 files changed, 5 insertions(+), 3 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 790121c4..280f3028 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 @@ -16,10 +16,10 @@ class ReplayAllocationPolicy(val vmPlacements: Map) : Allocation image: SimpleVirtProvisioningService.ImageView ): HypervisorView? { val clusterName = vmPlacements[image.name] - ?: throw IllegalArgumentException("Could not find placement data in VM placement file for VM ${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 } - ?: throw IllegalArgumentException("Cloud not find any machines belonging to cluster $clusterName for image ${image.name}") + ?: throw RuntimeException("Cloud not find any machines belonging to cluster $clusterName for image ${image.name}") } } } diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt index f8ce4380..5295ae03 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt @@ -44,7 +44,9 @@ class Sc20VmPlacementReader(input: InputStream, mapper: ObjectMapper = jacksonOb private val placements = mapper.readValue>(input) override fun construct(): Map { - return placements.mapKeys { "vm__workload__${it.key}.txt" } + return placements + .mapKeys { "vm__workload__${it.key}.txt" } + .mapValues { it.value.split("/")[1] } // Clusters have format XX0 / X00 } override fun close() {} -- cgit v1.2.3