summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-09-05 19:20:14 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-09-21 11:31:15 +0200
commit2ec5e8f1e44239916779655d4d68a9c6dae8e894 (patch)
treef9c3cf0f6e0e76590818939e01a710fd271d9bf8 /opendc-compute/opendc-compute-simulator
parenta7510e0708b6e5435f8440e588c762d6e6cd8a22 (diff)
refactor(sim/compute): Pass interference key via parameter
This change updates the signature of the `SimHypervisor` interface to accept a `VmInterferenceKey` when creating a new virtual machine, instead of providing a string identifier. This is in preparation for removing the dependency on the `VmInterferenceModel` in the `SimAbstractHypervisor` class.
Diffstat (limited to 'opendc-compute/opendc-compute-simulator')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt5
1 files changed, 3 insertions, 2 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 c28239b4..908353f0 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
@@ -65,7 +65,7 @@ public class SimHost(
scalingGovernor: ScalingGovernor = PerformanceScalingGovernor(),
powerDriver: PowerDriver = SimplePowerDriver(ConstantPowerModel(0.0)),
private val mapper: SimWorkloadMapper = SimMetaWorkloadMapper(),
- interferenceDomain: VmInterferenceDomain? = null,
+ private val interferenceDomain: VmInterferenceDomain? = null,
private val optimize: Boolean = false
) : Host, AutoCloseable {
/**
@@ -144,7 +144,8 @@ public class SimHost(
val guest = guests.computeIfAbsent(server) { key ->
require(canFit(key)) { "Server does not fit" }
- val machine = hypervisor.newMachine(key.flavor.toMachineModel(), key.name)
+ val interferenceKey = interferenceDomain?.createKey(key.name)
+ val machine = hypervisor.newMachine(key.flavor.toMachineModel(), interferenceKey)
val newGuest = Guest(
scope.coroutineContext,
clock,