diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-03-30 16:26:59 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-03-30 17:44:15 +0200 |
| commit | 5cfd1421fcc3bdad95285b9d04d17a6b26fbab0e (patch) | |
| tree | fc24a866f0a4c4a04a770e4dab4e2ed6bdd2b67a | |
| parent | 025ba861ca3d7a771d8645eb19aab9f72bd22b62 (diff) | |
feat: Add option for specifying allocation policy
| -rw-r--r-- | opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt | 19 |
1 files changed, 18 insertions, 1 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..0c5bf461 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,10 @@ 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.core.failure.CorrelatedFaultInjector import com.atlarge.opendc.core.failure.FailureDomain import com.atlarge.opendc.core.failure.FaultInjector @@ -73,6 +76,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("mem") fun getSelectedVmList(): List<String> { return if (selectedVms.isEmpty()) { @@ -116,6 +120,19 @@ fun main(args: Array<String>) { val root = system.newDomain("root") val chan = Channel<Unit>(Channel.CONFLATED) + val allocationPolicies = mapOf( + "mem" to AvailableMemoryAllocationPolicy(), + "core-mem" to AvailableCoreMemoryAllocationPolicy(), + "active-servers" to NumberOfActiveServersAllocationPolicy(), + "provisioned-cores" to ProvisionedCoresAllocationPolicy() + ) + + 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 +154,7 @@ fun main(args: Array<String>) { delay(10) val scheduler = SimpleVirtProvisioningService( - AvailableMemoryAllocationPolicy(), + allocationPolicies.getValue(allocationPolicy), simulationContext, bareMetalProvisioner ) |
