summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-03 20:12:24 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-03 20:12:24 +0200
commit993da5586c23a8cf9c29f5970cc84284e847b408 (patch)
tree26c1c9628d1bb3b923f17b8e3f98d65dad9b57fc
parentc4016fcfd37550b237f6940eaffb5b4efd607601 (diff)
feat: Fix failure duration parameters
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt4
-rw-r--r--opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt13
-rw-r--r--opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt12
3 files changed, 20 insertions, 9 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
index cec1d1a7..2d95b489 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
@@ -307,11 +307,11 @@ public class SimpleBareMetalDriver(
get() = domain
override suspend fun fail() {
- // serverContext?.unavailable = true
+ serverContext?.unavailable = true
}
override suspend fun recover() {
- // serverContext?.unavailable = false
+ serverContext?.unavailable = false
}
override fun toString(): String = "SimpleBareMetalDriver(node = ${nodeState.value.uid})"
diff --git a/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt
index f363bf45..f46ce512 100644
--- a/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt
+++ b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt
@@ -90,7 +90,7 @@ public class CorrelatedFaultInjector(
ensureActive()
// Make sure to convert delay from hours to milliseconds
- val d = lognvariate(iatScale, iatShape) * 3600 * 1e6
+ val d = lognvariate(iatScale, iatShape) * 3.6e6
// Handle long overflow
if (simulationContext.clock.millis() + d <= 0) {
@@ -99,14 +99,19 @@ public class CorrelatedFaultInjector(
delay(d.toLong())
+
val n = lognvariate(sizeScale, sizeShape).toInt()
val targets = active.shuffled(random).take(n)
+
+ println("[${simulationContext.clock.instant()}] FAIL $targets")
+
+
for (failureDomain in targets) {
active -= failureDomain
failureDomain.fail()
}
- val df = lognvariate(dScale, dShape) * 3600 * 1e6
+ val df = lognvariate(dScale, dShape) * 6e4
// Handle long overflow
if (simulationContext.clock.millis() + df <= 0) {
@@ -115,8 +120,12 @@ public class CorrelatedFaultInjector(
delay(df.toLong())
+ println("[${simulationContext.clock.instant()}] RECOVER $targets")
+
for (failureDomain in targets) {
failureDomain.recover()
+
+ // Re-enqueue machine to be failed
enqueue(failureDomain)
}
}
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 400cef33..ca7e31ea 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
@@ -104,10 +104,11 @@ class ExperimentParameters(parser: ArgParser) {
*/
fun createFaultInjector(domain: Domain, random: Random): FaultInjector {
// Parameters from A. Iosup, A Framework for the Study of Grid Inter-Operation Mechanisms, 2009
+ // GRID'5000
return CorrelatedFaultInjector(domain,
- iatScale = -1.39, iatShape = 1.03,
+ iatScale = -1.39, iatShape = 1.03, // Hours
sizeScale = 1.88, sizeShape = 1.25,
- dScale = 1.88, dShape = 1.25,
+ dScale = 9.51, dShape = 3.21, // Minutes
random = random
)
}
@@ -245,11 +246,12 @@ fun main(args: Array<String>) {
monitor.onVmStateChanged(it.server)
// Detect whether the VM has finished running
- if (it.server.state == ServerState.ERROR || it.server.state == ServerState.SHUTOFF) {
+ if (it.server.state == ServerState.SHUTOFF) {
running -= server
+ }
- if (running.isEmpty() && (!reader.hasNext() || availableHypervisors == 0))
- finish.send(Unit)
+ if (running.isEmpty() && !reader.hasNext()) {
+ finish.send(Unit)
}
}
.collect()