From 2da0b5bfc37febca2183374f74eece0b230f054e Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 3 Apr 2020 09:15:11 +0200 Subject: Filter on vms updated events --- .../kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'opendc/opendc-compute/src') diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt index cc03d5f5..b4626def 100644 --- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt +++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt @@ -50,6 +50,7 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch @@ -90,7 +91,7 @@ class SimpleVirtDriver( override val events: Flow = eventFlow init { - events.onEach { + events.filter { it is HypervisorEvent.VmsUpdated }.onEach { val imagesRunning = vms.map { it.server.image }.toSet() vms.forEach { val performanceModel = -- cgit v1.2.3