diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-05 12:12:32 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-05 12:12:32 +0200 |
| commit | e06c953d1c71c704b351c81611e2e2bececf8e67 (patch) | |
| tree | 174b15ad968baed22922c103220c08703426f92d /simulator | |
| parent | 8aaeb93e81fc3c4689d42747f87734fc4732d030 (diff) | |
Move failure models to separate module
Diffstat (limited to 'simulator')
11 files changed, 44 insertions, 10 deletions
diff --git a/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/driver/BareMetalDriver.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/driver/BareMetalDriver.kt index 6f58aa20..8697a553 100644 --- a/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/driver/BareMetalDriver.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/driver/BareMetalDriver.kt @@ -26,7 +26,6 @@ import kotlinx.coroutines.flow.Flow import org.opendc.compute.core.Server import org.opendc.compute.core.image.Image import org.opendc.compute.core.metal.Node -import org.opendc.core.failure.FailureDomain import org.opendc.core.power.Powerable import org.opendc.core.services.AbstractServiceKey import java.util.UUID @@ -34,7 +33,7 @@ import java.util.UUID /** * A driver interface for the management interface of a bare-metal compute node. */ -public interface BareMetalDriver : Powerable, FailureDomain { +public interface BareMetalDriver : Powerable { /** * The [Node] that is controlled by this driver. */ diff --git a/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts index e1ec6421..d7570e54 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts +++ b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts @@ -32,6 +32,7 @@ dependencies { implementation(project(":opendc-utils")) implementation("io.github.microutils:kotlin-logging:1.7.9") implementation(project(":opendc-simulator:opendc-simulator-compute")) + api(project(":opendc-simulator:opendc-simulator-failures")) testImplementation(project(":opendc-simulator:opendc-simulator-core")) testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}") diff --git a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimBareMetalDriver.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimBareMetalDriver.kt index 08bb7e79..7b1f0af6 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimBareMetalDriver.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimBareMetalDriver.kt @@ -41,6 +41,7 @@ import org.opendc.simulator.compute.SimBareMetalMachine import org.opendc.simulator.compute.SimExecutionContext import org.opendc.simulator.compute.SimMachineModel import org.opendc.simulator.compute.workload.SimWorkload +import org.opendc.simulator.failures.FailureDomain import org.opendc.utils.flow.EventFlow import org.opendc.utils.flow.StateFlow import java.time.Clock @@ -67,7 +68,7 @@ public class SimBareMetalDriver( metadata: Map<String, Any>, machine: SimMachineModel, powerModel: PowerModel<SimBareMetalDriver> = ConstantPowerModel(0.0) -) : BareMetalDriver { +) : BareMetalDriver, FailureDomain { /** * The flavor that corresponds to this machine. */ diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts index d93c1713..3b682668 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts +++ b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts @@ -38,6 +38,7 @@ dependencies { implementation(project(":opendc-format")) implementation(project(":opendc-simulator:opendc-simulator-core")) implementation(project(":opendc-simulator:opendc-simulator-compute")) + implementation(project(":opendc-simulator:opendc-simulator-failures")) implementation(project(":opendc-compute:opendc-compute-simulator")) implementation("com.github.ajalt:clikt:2.6.0") diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt index 805e34ee..59498c5b 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt @@ -43,14 +43,14 @@ import org.opendc.compute.core.workload.VmWorkload import org.opendc.compute.simulator.SimVirtDriver import org.opendc.compute.simulator.SimVirtProvisioningService import org.opendc.compute.simulator.allocation.AllocationPolicy -import org.opendc.core.failure.CorrelatedFaultInjector -import org.opendc.core.failure.FailureDomain -import org.opendc.core.failure.FaultInjector import org.opendc.experiments.sc20.experiment.monitor.ExperimentMonitor import org.opendc.experiments.sc20.trace.Sc20StreamingParquetTraceReader import org.opendc.format.environment.EnvironmentReader import org.opendc.format.trace.TraceReader import org.opendc.simulator.compute.interference.PerformanceInterferenceModel +import org.opendc.simulator.failures.CorrelatedFaultInjector +import org.opendc.simulator.failures.FailureDomain +import org.opendc.simulator.failures.FaultInjector import java.io.File import java.time.Clock import kotlin.math.ln diff --git a/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts b/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts new file mode 100644 index 00000000..1c30506f --- /dev/null +++ b/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020 AtLarge Research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +description = "Failure models for OpenDC" + +plugins { + `kotlin-library-convention` +} + +dependencies { + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}") +} diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/CorrelatedFaultInjector.kt b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/CorrelatedFaultInjector.kt index f3bd7f5a..0e15f338 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/CorrelatedFaultInjector.kt +++ b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/CorrelatedFaultInjector.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.core.failure +package org.opendc.simulator.failures import kotlinx.coroutines.* import java.time.Clock diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FailureDomain.kt b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/FailureDomain.kt index 0795b09a..dc3006e8 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FailureDomain.kt +++ b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/FailureDomain.kt @@ -22,7 +22,7 @@ * SOFTWARE. */ -package org.opendc.core.failure +package org.opendc.simulator.failures import kotlinx.coroutines.CoroutineScope diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FaultInjector.kt b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/FaultInjector.kt index ad776641..a866260c 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FaultInjector.kt +++ b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/FaultInjector.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.core.failure +package org.opendc.simulator.failures /** * An interface for stochastically injecting faults into a running system. diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/UncorrelatedFaultInjector.kt index f64b8815..b3bd737e 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt +++ b/simulator/opendc-simulator/opendc-simulator-failures/src/main/kotlin/org/opendc/simulator/failures/UncorrelatedFaultInjector.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.core.failure +package org.opendc.simulator.failures import kotlinx.coroutines.delay import kotlinx.coroutines.launch diff --git a/simulator/settings.gradle.kts b/simulator/settings.gradle.kts index 418b00fb..935a18d0 100644 --- a/simulator/settings.gradle.kts +++ b/simulator/settings.gradle.kts @@ -31,4 +31,5 @@ include(":opendc-experiments:opendc-experiments-sc20") include(":opendc-runner-web") include(":opendc-simulator:opendc-simulator-core") include(":opendc-simulator:opendc-simulator-compute") +include(":opendc-simulator:opendc-simulator-failures") include(":opendc-utils") |
