From 5cfd1421fcc3bdad95285b9d04d17a6b26fbab0e Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 30 Mar 2020 16:26:59 +0200 Subject: feat: Add option for specifying allocation policy --- .../atlarge/opendc/experiments/sc20/TestExperiment.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'opendc/opendc-experiments-sc20/src') 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 { return if (selectedVms.isEmpty()) { @@ -116,6 +120,19 @@ fun main(args: Array) { val root = system.newDomain("root") val chan = Channel(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) { delay(10) val scheduler = SimpleVirtProvisioningService( - AvailableMemoryAllocationPolicy(), + allocationPolicies.getValue(allocationPolicy), simulationContext, bareMetalProvisioner ) -- cgit v1.2.3 From 548804adc2b675042e59b9e2f6bfba7b0428024c Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 31 Mar 2020 22:24:13 +0200 Subject: feat: Add reversed policies and random allocation policy --- .../com/atlarge/opendc/experiments/sc20/TestExperiment.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'opendc/opendc-experiments-sc20/src') 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 0c5bf461..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 @@ -40,6 +40,7 @@ import com.atlarge.opendc.compute.virt.service.allocation.AvailableCoreMemoryAll 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 @@ -76,7 +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("mem") + val allocationPolicy by parser.storing("name of VM allocation policy to use").default("core-mem") fun getSelectedVmList(): List { return if (selectedVms.isEmpty()) { @@ -122,9 +123,14 @@ fun main(args: Array) { 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(), - "provisioned-cores" to ProvisionedCoresAllocationPolicy() + "active-servers-inv" to NumberOfActiveServersAllocationPolicy(true), + "provisioned-cores" to ProvisionedCoresAllocationPolicy(), + "provisioned-cores-inv" to ProvisionedCoresAllocationPolicy(true), + "random" to RandomAllocationPolicy() ) if (allocationPolicy !in allocationPolicies) { @@ -191,7 +197,6 @@ fun main(args: Array) { event.numberOfDeployedImages, event.hostServer ) - else -> println(event) } } .launchIn(this) -- cgit v1.2.3