summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-26 10:30:53 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-09-07 14:24:41 +0200
commit561f07bd6547c8273627e9c860324ab892ba5fa7 (patch)
treefe4d7f28e0d916571881f21f4de028e89331d923 /opendc-compute/opendc-compute-simulator
parentb6a8c642b598bfb2eaaea2a8a7e6ad6702d349b6 (diff)
fix(compute): Do not allow failure of inactive guests
This change fixes an issue in SimHost where guests that where inactive were also failed, causing an IllegalStateException.
Diffstat (limited to 'opendc-compute/opendc-compute-simulator')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt
index a4d24740..213d20ee 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt
@@ -452,6 +452,9 @@ public class SimHost(
}
suspend fun fail() {
+ if (state != ServerState.RUNNING) {
+ return
+ }
stop()
state = ServerState.ERROR
}