diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-03-31 22:34:25 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-03-31 22:34:25 +0200 |
| commit | c4493dfef3daca816378760f7abf6ed0d2475099 (patch) | |
| tree | 329da79246277f29b38c8eb486697f1271f6a06a /opendc/opendc-experiments-sc20/src/main | |
| parent | d37900e09e225b1738920fa0d5478feb892294c1 (diff) | |
| parent | 548804adc2b675042e59b9e2f6bfba7b0428024c (diff) | |
Merge branch 'feat/2.x-allocation-policies' into '2.x'
Add more allocation policies
Closes #56
See merge request opendc/opendc-simulator!49
Diffstat (limited to 'opendc/opendc-experiments-sc20/src/main')
| -rw-r--r-- | opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt | 26 |
1 files changed, 24 insertions, 2 deletions
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 e6fd5a3a..cc403e6e 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 @@ -36,7 +36,11 @@ import com.atlarge.opendc.compute.metal.service.ProvisioningService import com.atlarge.opendc.compute.virt.HypervisorEvent import com.atlarge.opendc.compute.virt.driver.SimpleVirtDriver import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService +import com.atlarge.opendc.compute.virt.service.allocation.AvailableCoreMemoryAllocationPolicy import com.atlarge.opendc.compute.virt.service.allocation.AvailableMemoryAllocationPolicy +import com.atlarge.opendc.compute.virt.service.allocation.NumberOfActiveServersAllocationPolicy +import com.atlarge.opendc.compute.virt.service.allocation.ProvisionedCoresAllocationPolicy +import com.atlarge.opendc.compute.virt.service.allocation.RandomAllocationPolicy import com.atlarge.opendc.core.failure.CorrelatedFaultInjector import com.atlarge.opendc.core.failure.FailureDomain import com.atlarge.opendc.core.failure.FaultInjector @@ -73,6 +77,7 @@ class ExperimentParameters(parser: ArgParser) { } .default { emptyList() } val failures by parser.flagging("-x", "--failures", help = "enable (correlated) machine failures") + val allocationPolicy by parser.storing("name of VM allocation policy to use").default("core-mem") fun getSelectedVmList(): List<String> { return if (selectedVms.isEmpty()) { @@ -116,6 +121,24 @@ fun main(args: Array<String>) { val root = system.newDomain("root") val chan = Channel<Unit>(Channel.CONFLATED) + val allocationPolicies = mapOf( + "mem" to AvailableMemoryAllocationPolicy(), + "mem-inv" to AvailableMemoryAllocationPolicy(true), + "core-mem" to AvailableCoreMemoryAllocationPolicy(), + "core-mem-inv" to AvailableCoreMemoryAllocationPolicy(true), + "active-servers" to NumberOfActiveServersAllocationPolicy(), + "active-servers-inv" to NumberOfActiveServersAllocationPolicy(true), + "provisioned-cores" to ProvisionedCoresAllocationPolicy(), + "provisioned-cores-inv" to ProvisionedCoresAllocationPolicy(true), + "random" to RandomAllocationPolicy() + ) + + if (allocationPolicy !in allocationPolicies) { + println("error: unknown allocation policy $allocationPolicy") + println("Available:") + allocationPolicies.keys.forEach { key -> println(key) } + } + root.launch { val environment = Sc20ClusterEnvironmentReader(File(environmentFile)) .use { it.construct(root) } @@ -137,7 +160,7 @@ fun main(args: Array<String>) { delay(10) val scheduler = SimpleVirtProvisioningService( - AvailableMemoryAllocationPolicy(), + allocationPolicies.getValue(allocationPolicy), simulationContext, bareMetalProvisioner ) @@ -174,7 +197,6 @@ fun main(args: Array<String>) { event.numberOfDeployedImages, event.hostServer ) - else -> println(event) } } .launchIn(this) |
