summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-31 15:02:37 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-31 15:50:36 +0100
commitc9750e52a10157f3838b934fed4f04fae69c539a (patch)
tree1dd498da02298c9924f6c37974f4311df6948cb2 /opendc-compute/opendc-compute-simulator
parent587a5af75d9adee5a3f765261931cd6e8ab6ff43 (diff)
feat(sim/compute): Add support for snapshotting workloads
This change updates the interface of `SimWorkload` to support snapshotting workloads. We introduce a new method `snapshot()` to this interface which returns a new `SimWorkload` that can be started at a later point in time and on another `SimMachine`, which continues progress from the moment the workload was snapshotted.
Diffstat (limited to 'opendc-compute/opendc-compute-simulator')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt6
1 files changed, 1 insertions, 5 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 b3e56f38..5eccc6ec 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
@@ -280,7 +280,7 @@ public class SimHost(
val bootWorkload = bootModel.get()
val hypervisor = hypervisor
- val hypervisorWorkload = object : SimWorkload {
+ val hypervisorWorkload = object : SimWorkload by hypervisor {
override fun onStart(ctx: SimMachineContext) {
try {
_bootTime = clock.instant()
@@ -296,10 +296,6 @@ public class SimHost(
throw cause
}
}
-
- override fun onStop(ctx: SimMachineContext) {
- hypervisor.onStop(ctx)
- }
}
val workload = if (bootWorkload != null) SimWorkloads.chain(bootWorkload, hypervisorWorkload) else hypervisorWorkload