summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-service
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-09-22 10:55:13 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-09-22 14:49:36 +0200
commit21270e0b4250bd6927e85227fa825cf8ed59aaed (patch)
treeb7df4a40226eb4f96f22fa99b749010ab4c7399e /opendc-compute/opendc-compute-service
parent6171ab09f1df2ab3475a7b28ece383a9f87a77c5 (diff)
refactor(compute): Add separate error host state
This change adds a new HostState to indicate that the host is in an error state as opposed to being purposefully unavailable.
Diffstat (limited to 'opendc-compute/opendc-compute-service')
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt11
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt2
2 files changed, 9 insertions, 4 deletions
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt
index 6d85ee2d..ca6c625c 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt
@@ -27,12 +27,17 @@ package org.opendc.compute.service.driver
*/
public enum class HostState {
/**
- * The host is up.
+ * The host is up and able to host guests.
*/
UP,
/**
- * The host is down.
+ * The host is in a (forced) down state and unable to host any guests.
*/
- DOWN
+ DOWN,
+
+ /**
+ * The host is in an error state and unable to host any guests.
+ */
+ ERROR,
}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt
index 21aaa19e..52ee780b 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt
@@ -411,7 +411,7 @@ internal class ComputeServiceImpl(
// Re-schedule on the new machine
requestSchedulingCycle()
}
- HostState.DOWN -> {
+ else -> {
logger.debug { "[${clock.instant()}] Host ${host.uid} state changed: $newState" }
val hv = hostToView[host] ?: return