summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-service/src/main/kotlin
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-11-02 17:20:00 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-11-27 20:50:13 +0000
commit4dfae28c5bd656806a7baf7855c95770f4ad0ed8 (patch)
tree52e2de58503714cc6510db614b4a654af2fdda3c /opendc-compute/opendc-compute-service/src/main/kotlin
parente0856b26c3e1961e7ff4bb3ca038adc4892bbc22 (diff)
refactor(compute/service): Do not split interface and implementation
This change inlines the implementation of the compute service into the `ComputeService` interface. We do not intend to provide multiple implementations of the service. In addition, this approach makes more sense for a Java implementation.
Diffstat (limited to 'opendc-compute/opendc-compute-service/src/main/kotlin')
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt94
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt135
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostListener.kt41
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostModel.kt36
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt43
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/GuestCpuStats.kt44
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/GuestSystemStats.kt39
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostCpuStats.kt47
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt51
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt477
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/HostView.kt44
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt66
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt56
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt161
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ComputeScheduler.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ReplayScheduler.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/ComputeFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/HostFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/InstanceCountFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/RamFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/InstanceCountWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/RamWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt48
32 files changed, 17 insertions, 1399 deletions
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt
deleted file mode 100644
index 9d7dcba6..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service
-
-import org.opendc.common.Dispatcher
-import org.opendc.compute.api.ComputeClient
-import org.opendc.compute.api.Server
-import org.opendc.compute.service.driver.Host
-import org.opendc.compute.service.internal.ComputeServiceImpl
-import org.opendc.compute.service.scheduler.ComputeScheduler
-import org.opendc.compute.service.telemetry.SchedulerStats
-import java.time.Duration
-
-/**
- * The [ComputeService] hosts the API implementation of the OpenDC Compute service.
- */
-public interface ComputeService : AutoCloseable {
- /**
- * The servers that are registered with the "compute" service.
- */
- public val servers: List<Server>
-
- /**
- * The hosts that are registered with the "compute" service.
- */
- public val hosts: Set<Host>
-
- /**
- * Create a new [ComputeClient] to control the compute service.
- */
- public fun newClient(): ComputeClient
-
- /**
- * Add a [host] to the scheduling pool of the compute service.
- */
- public fun addHost(host: Host)
-
- /**
- * Remove a [host] from the scheduling pool of the compute service.
- */
- public fun removeHost(host: Host)
-
- /**
- * Terminate the lifecycle of the compute service, stopping all running instances.
- */
- public override fun close()
-
- /**
- * Lookup the [Host] that currently hosts the specified [server].
- */
- public fun lookupHost(server: Server): Host?
-
- /**
- * Collect the statistics about the scheduler component of this service.
- */
- public fun getSchedulerStats(): SchedulerStats
-
- public companion object {
- /**
- * Construct a new [ComputeService] implementation.
- *
- * @param dispatcher The [Dispatcher] for scheduling future events.
- * @param scheduler The scheduler implementation to use.
- * @param schedulingQuantum The interval between scheduling cycles.
- */
- public operator fun invoke(
- dispatcher: Dispatcher,
- scheduler: ComputeScheduler,
- schedulingQuantum: Duration = Duration.ofMinutes(5)
- ): ComputeService {
- return ComputeServiceImpl(dispatcher, scheduler, schedulingQuantum)
- }
- }
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt
deleted file mode 100644
index efcc0f2c..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver
-
-import org.opendc.compute.api.Server
-import org.opendc.compute.service.driver.telemetry.GuestCpuStats
-import org.opendc.compute.service.driver.telemetry.GuestSystemStats
-import org.opendc.compute.service.driver.telemetry.HostCpuStats
-import org.opendc.compute.service.driver.telemetry.HostSystemStats
-import java.util.UUID
-
-/**
- * Base interface for representing compute resources that host virtualized [Server] instances.
- */
-public interface Host {
- /**
- * A unique identifier representing the host.
- */
- public val uid: UUID
-
- /**
- * The name of this host.
- */
- public val name: String
-
- /**
- * The machine model of the host.
- */
- public val model: HostModel
-
- /**
- * The state of the host.
- */
- public val state: HostState
-
- /**
- * Meta-data associated with the host.
- */
- public val meta: Map<String, Any>
-
- /**
- * The [Server] instances known to the host.
- */
- public val instances: Set<Server>
-
- /**
- * Determine whether the specified [instance][server] can still fit on this host.
- */
- public fun canFit(server: Server): Boolean
-
- /**
- * Register the specified [instance][server] on the host.
- */
- public fun spawn(server: Server)
-
- /**
- * Determine whether the specified [instance][server] exists on the host.
- */
- public operator fun contains(server: Server): Boolean
-
- /**
- * Start the server [instance][server] if it is currently not running on this host.
- *
- * @throws IllegalArgumentException if the server is not present on the host.
- */
- public fun start(server: Server)
-
- /**
- * Stop the server [instance][server] if it is currently running on this host.
- *
- * @throws IllegalArgumentException if the server is not present on the host.
- */
- public fun stop(server: Server)
-
- /**
- * Delete the specified [instance][server] on this host and cleanup all resources associated with it.
- */
- public fun delete(server: Server)
-
- /**
- * Add a [HostListener] to this host.
- */
- public fun addListener(listener: HostListener)
-
- /**
- * Remove a [HostListener] from this host.
- */
- public fun removeListener(listener: HostListener)
-
- /**
- * Query the system statistics of the host.
- */
- public fun getSystemStats(): HostSystemStats
-
- /**
- * Query the system statistics of a [Server] that is located on this host.
- *
- * @param server The [Server] to obtain the system statistics of.
- * @throws IllegalArgumentException if the server is not present on the host.
- */
- public fun getSystemStats(server: Server): GuestSystemStats
-
- /**
- * Query the CPU statistics of the host.
- */
- public fun getCpuStats(): HostCpuStats
-
- /**
- * Query the CPU statistics of a [Server] that is located on this host.
- *
- * @param server The [Server] to obtain the CPU statistics of.
- * @throws IllegalArgumentException if the server is not present on the host.
- */
- public fun getCpuStats(server: Server): GuestCpuStats
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostListener.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostListener.kt
deleted file mode 100644
index f076cae3..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostListener.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver
-
-import org.opendc.compute.api.Server
-import org.opendc.compute.api.ServerState
-
-/**
- * Listener interface for events originating from a [Host].
- */
-public interface HostListener {
- /**
- * This method is invoked when the state of an [instance][server] on [host] changes.
- */
- public fun onStateChanged(host: Host, server: Server, newState: ServerState) {}
-
- /**
- * This method is invoked when the state of a [Host] has changed.
- */
- public fun onStateChanged(host: Host, newState: HostState) {}
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostModel.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostModel.kt
deleted file mode 100644
index f3b94e3d..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostModel.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver
-
-/**
- * Describes the static machine properties of the host.
- *
- * @property cpuCapacity The total CPU capacity of the host in MHz.
- * @property cpuCount The number of logical processing cores available for this host.
- * @property memoryCapacity The amount of memory available for this host in MB.
- */
-public data class HostModel(
- public val cpuCapacity: Double,
- public val cpuCount: Int,
- public val memoryCapacity: Long
-)
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
deleted file mode 100644
index 544b6530..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver
-
-/**
- * The state of a host.
- */
-public enum class HostState {
- /**
- * The host is up and able to host guests.
- */
- UP,
-
- /**
- * The host is in a (forced) down state and unable to host any guests.
- */
- 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/driver/telemetry/GuestCpuStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/GuestCpuStats.kt
deleted file mode 100644
index b5d63471..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/GuestCpuStats.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2022 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver.telemetry
-
-/**
- * Statistics about the CPUs of a guest.
- *
- * @property activeTime The cumulative time (in seconds) that the CPUs of the guest were actively running.
- * @property idleTime The cumulative time (in seconds) the CPUs of the guest were idle.
- * @property stealTime The cumulative CPU time (in seconds) that the guest was ready to run, but not granted time by the host.
- * @property lostTime The cumulative CPU time (in seconds) that was lost due to interference with other machines.
- * @property capacity The available CPU capacity of the guest (in MHz).
- * @property usage Amount of CPU resources (in MHz) actually used by the guest.
- * @property utilization Utilization of the CPU resources (in %) relative to the total CPU capacity.
- */
-public data class GuestCpuStats(
- val activeTime: Long,
- val idleTime: Long,
- val stealTime: Long,
- val lostTime: Long,
- val capacity: Double,
- val usage: Double,
- val utilization: Double
-)
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/GuestSystemStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/GuestSystemStats.kt
deleted file mode 100644
index 6fec5175..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/GuestSystemStats.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2022 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver.telemetry
-
-import java.time.Duration
-import java.time.Instant
-
-/**
- * System-level statistics of a guest.
- *
- * @property uptime The cumulative uptime of the guest since last boot (in ms).
- * @property downtime The cumulative downtime of the guest since last boot (in ms).
- * @property bootTime The time at which the guest booted.
- */
-public data class GuestSystemStats(
- val uptime: Duration,
- val downtime: Duration,
- val bootTime: Instant?
-)
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostCpuStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostCpuStats.kt
deleted file mode 100644
index 55e23c0e..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostCpuStats.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2022 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver.telemetry
-
-/**
- * Statistics about the CPUs of a host.
- *
- * @property activeTime The cumulative time (in seconds) that the CPUs of the host were actively running.
- * @property idleTime The cumulative time (in seconds) the CPUs of the host were idle.
- * @property stealTime The cumulative CPU time (in seconds) that virtual machines were ready to run, but were not able to.
- * @property lostTime The cumulative CPU time (in seconds) that was lost due to interference between virtual machines.
- * @property capacity The available CPU capacity of the host (in MHz).
- * @property demand Amount of CPU resources (in MHz) the guests would use if there were no CPU contention or CPU
- * limits.
- * @property usage Amount of CPU resources (in MHz) actually used by the host.
- * @property utilization Utilization of the CPU resources (in %) relative to the total CPU capacity.
- */
-public data class HostCpuStats(
- val activeTime: Long,
- val idleTime: Long,
- val stealTime: Long,
- val lostTime: Long,
- val capacity: Double,
- val demand: Double,
- val usage: Double,
- val utilization: Double
-)
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt
deleted file mode 100644
index 56bd017d..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2022 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.driver.telemetry
-
-import java.time.Duration
-import java.time.Instant
-
-/**
- * System-level statistics of a host.
-
- * @property uptime The cumulative uptime of the host since last boot (in ms).
- * @property downtime The cumulative downtime of the host since last boot (in ms).
- * @property bootTime The time at which the server started.
- * @property powerUsage Instantaneous power usage of the system (in W).
- * @property energyUsage The cumulative energy usage of the system (in J).
- * @property guestsTerminated The number of guests that are in a terminated state.
- * @property guestsRunning The number of guests that are in a running state.
- * @property guestsError The number of guests that are in an error state.
- * @property guestsInvalid The number of guests that are in an unknown state.
- */
-public data class HostSystemStats(
- val uptime: Duration,
- val downtime: Duration,
- val bootTime: Instant?,
- val powerUsage: Double,
- val energyUsage: Double,
- val guestsTerminated: Int,
- val guestsRunning: Int,
- val guestsError: Int,
- val guestsInvalid: Int
-)
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
deleted file mode 100644
index ac66ff8b..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.internal
-
-import mu.KotlinLogging
-import org.opendc.common.Dispatcher
-import org.opendc.common.util.Pacer
-import org.opendc.compute.api.ComputeClient
-import org.opendc.compute.api.Flavor
-import org.opendc.compute.api.Image
-import org.opendc.compute.api.Server
-import org.opendc.compute.api.ServerState
-import org.opendc.compute.service.ComputeService
-import org.opendc.compute.service.driver.Host
-import org.opendc.compute.service.driver.HostListener
-import org.opendc.compute.service.driver.HostState
-import org.opendc.compute.service.scheduler.ComputeScheduler
-import org.opendc.compute.service.telemetry.SchedulerStats
-import java.time.Duration
-import java.time.Instant
-import java.util.ArrayDeque
-import java.util.Deque
-import java.util.Random
-import java.util.UUID
-import kotlin.math.max
-
-/**
- * Internal implementation of the OpenDC Compute service.
- *
- * @param dispatcher The [Dispatcher] for scheduling future events.
- * @param scheduler The scheduler implementation to use.
- * @param schedulingQuantum The interval between scheduling cycles.
- */
-internal class ComputeServiceImpl(
- private val dispatcher: Dispatcher,
- private val scheduler: ComputeScheduler,
- schedulingQuantum: Duration
-) : ComputeService, HostListener {
- /**
- * The logger instance of this server.
- */
- private val logger = KotlinLogging.logger {}
-
- /**
- * The [Random] instance used to generate unique identifiers for the objects.
- */
- private val random = Random(0)
-
- /**
- * A mapping from host to host view.
- */
- private val hostToView = mutableMapOf<Host, HostView>()
-
- /**
- * The available hypervisors.
- */
- private val availableHosts: MutableSet<HostView> = mutableSetOf()
-
- /**
- * The servers that should be launched by the service.
- */
- private val queue: Deque<SchedulingRequest> = ArrayDeque()
-
- /**
- * The active servers in the system.
- */
- private val activeServers: MutableMap<Server, Host> = mutableMapOf()
-
- /**
- * The registered flavors for this compute service.
- */
- internal val flavorById = mutableMapOf<UUID, InternalFlavor>()
- private val flavors: MutableList<Flavor> = mutableListOf()
-
- /**
- * The registered images for this compute service.
- */
- internal val imageById = mutableMapOf<UUID, InternalImage>()
- private val images: MutableList<Image> = mutableListOf()
-
- /**
- * The registered servers for this compute service.
- */
- private val serverById = mutableMapOf<UUID, InternalServer>()
- override val servers: MutableList<Server> = mutableListOf()
-
- override val hosts: Set<Host>
- get() = hostToView.keys
-
- private val clock = dispatcher.timeSource
- private var maxCores = 0
- private var maxMemory = 0L
- private var _attemptsSuccess = 0L
- private var _attemptsFailure = 0L
- private var _attemptsError = 0L
- private var _serversPending = 0
- private var _serversActive = 0
- private var isClosed = false
-
- /**
- * The [Pacer] to use for scheduling the scheduler cycles.
- */
- private val pacer = Pacer(dispatcher, schedulingQuantum.toMillis()) { doSchedule() }
-
- override fun newClient(): ComputeClient {
- check(!isClosed) { "Service is already closed" }
- return Client(this)
- }
-
- override fun addHost(host: Host) {
- // Check if host is already known
- if (host in hostToView) {
- return
- }
-
- val hv = HostView(host)
- maxCores = max(maxCores, host.model.cpuCount)
- maxMemory = max(maxMemory, host.model.memoryCapacity)
- hostToView[host] = hv
-
- if (host.state == HostState.UP) {
- availableHosts += hv
- }
-
- scheduler.addHost(hv)
- host.addListener(this)
- }
-
- override fun removeHost(host: Host) {
- val view = hostToView.remove(host)
- if (view != null) {
- availableHosts.remove(view)
- scheduler.removeHost(view)
- host.removeListener(this)
- }
- }
-
- override fun lookupHost(server: Server): Host? {
- if (server is InternalServer) {
- return server.host
- }
-
- val internal = requireNotNull(serverById[server.uid]) { "Invalid server passed to lookupHost" }
- return internal.host
- }
-
- override fun close() {
- if (isClosed) {
- return
- }
-
- isClosed = true
- pacer.cancel()
- }
-
- override fun getSchedulerStats(): SchedulerStats {
- return SchedulerStats(
- availableHosts.size,
- hostToView.size - availableHosts.size,
- _attemptsSuccess,
- _attemptsFailure,
- _attemptsError,
- servers.size,
- _serversPending,
- _serversActive
- )
- }
-
- internal fun schedule(server: InternalServer): SchedulingRequest {
- logger.debug { "Enqueueing server ${server.uid} to be assigned to host." }
- val now = clock.millis()
- val request = SchedulingRequest(server, now)
-
- server.launchedAt = Instant.ofEpochMilli(now)
- queue.add(request)
- _serversPending++
- requestSchedulingCycle()
- return request
- }
-
- internal fun delete(flavor: InternalFlavor) {
- flavorById.remove(flavor.uid)
- flavors.remove(flavor)
- }
-
- internal fun delete(image: InternalImage) {
- imageById.remove(image.uid)
- images.remove(image)
- }
-
- internal fun delete(server: InternalServer) {
- serverById.remove(server.uid)
- servers.remove(server)
- }
-
- /**
- * Indicate that a new scheduling cycle is needed due to a change to the service's state.
- */
- private fun requestSchedulingCycle() {
- // Bail out in case the queue is empty.
- if (queue.isEmpty()) {
- return
- }
-
- pacer.enqueue()
- }
-
- /**
- * Run a single scheduling iteration.
- */
- private fun doSchedule() {
- while (queue.isNotEmpty()) {
- val request = queue.peek()
-
- if (request.isCancelled) {
- queue.poll()
- _serversPending--
- continue
- }
-
- val server = request.server
- val hv = scheduler.select(request.server)
- if (hv == null || !hv.host.canFit(server)) {
- logger.trace { "Server $server selected for scheduling but no capacity available for it at the moment" }
-
- if (server.flavor.memorySize > maxMemory || server.flavor.cpuCount > maxCores) {
- // Remove the incoming image
- queue.poll()
- _serversPending--
- _attemptsFailure++
-
- logger.warn { "Failed to spawn $server: does not fit [${clock.instant()}]" }
-
- server.state = ServerState.TERMINATED
- continue
- } else {
- break
- }
- }
-
- val host = hv.host
-
- // Remove request from queue
- queue.poll()
- _serversPending--
-
- logger.info { "Assigned server $server to host $host." }
-
- try {
- server.host = host
-
- host.spawn(server)
- host.start(server)
-
- _serversActive++
- _attemptsSuccess++
-
- hv.instanceCount++
- hv.provisionedCores += server.flavor.cpuCount
- hv.availableMemory -= server.flavor.memorySize
-
- activeServers[server] = host
- } catch (e: Throwable) {
- logger.error(e) { "Failed to deploy VM" }
- _attemptsError++
- }
- }
- }
-
- /**
- * A request to schedule an [InternalServer] onto one of the [Host]s.
- */
- internal data class SchedulingRequest(val server: InternalServer, val submitTime: Long) {
- /**
- * A flag to indicate that the request is cancelled.
- */
- var isCancelled: Boolean = false
- }
-
- override fun onStateChanged(host: Host, newState: HostState) {
- when (newState) {
- HostState.UP -> {
- logger.debug { "[${clock.instant()}] Host ${host.uid} state changed: $newState" }
-
- val hv = hostToView[host]
- if (hv != null) {
- // Corner case for when the hypervisor already exists
- availableHosts += hv
- }
-
- // Re-schedule on the new machine
- requestSchedulingCycle()
- }
- else -> {
- logger.debug { "[${clock.instant()}] Host ${host.uid} state changed: $newState" }
-
- val hv = hostToView[host] ?: return
- availableHosts -= hv
-
- requestSchedulingCycle()
- }
- }
- }
-
- override fun onStateChanged(host: Host, server: Server, newState: ServerState) {
- require(server is InternalServer) { "Invalid server type passed to service" }
-
- if (server.host != host) {
- // This can happen when a server is rescheduled and started on another machine, while being deleted from
- // the old machine.
- return
- }
-
- server.state = newState
-
- if (newState == ServerState.TERMINATED || newState == ServerState.DELETED) {
- logger.info { "[${clock.instant()}] Server ${server.uid} ${server.name} ${server.flavor} finished." }
-
- if (activeServers.remove(server) != null) {
- _serversActive--
- }
-
- val hv = hostToView[host]
- if (hv != null) {
- hv.provisionedCores -= server.flavor.cpuCount
- hv.instanceCount--
- hv.availableMemory += server.flavor.memorySize
- } else {
- logger.error { "Unknown host $host" }
- }
-
- // Try to reschedule if needed
- requestSchedulingCycle()
- }
- }
-
- /**
- * Implementation of [ComputeClient] using a [ComputeService].
- */
- private class Client(private val service: ComputeServiceImpl) : ComputeClient {
- private var isClosed: Boolean = false
-
- override fun queryFlavors(): List<Flavor> {
- check(!isClosed) { "Client is already closed" }
-
- return service.flavors.toList()
- }
-
- override fun findFlavor(id: UUID): Flavor? {
- check(!isClosed) { "Client is already closed" }
-
- return service.flavorById[id]
- }
-
- override fun newFlavor(
- name: String,
- cpuCount: Int,
- memorySize: Long,
- labels: Map<String, String>,
- meta: Map<String, Any>
- ): Flavor {
- check(!isClosed) { "Client is already closed" }
-
- val service = service
- val uid = UUID(service.clock.millis(), service.random.nextLong())
- val flavor = InternalFlavor(
- service,
- uid,
- name,
- cpuCount,
- memorySize,
- labels,
- meta
- )
-
- service.flavorById[uid] = flavor
- service.flavors.add(flavor)
-
- return flavor
- }
-
- override fun queryImages(): List<Image> {
- check(!isClosed) { "Client is already closed" }
-
- return service.images.toList()
- }
-
- override fun findImage(id: UUID): Image? {
- check(!isClosed) { "Client is already closed" }
-
- return service.imageById[id]
- }
-
- override fun newImage(name: String, labels: Map<String, String>, meta: Map<String, Any>): Image {
- check(!isClosed) { "Client is already closed" }
-
- val service = service
- val uid = UUID(service.clock.millis(), service.random.nextLong())
- val image = InternalImage(service, uid, name, labels, meta)
-
- service.imageById[uid] = image
- service.images.add(image)
-
- return image
- }
-
- override fun newServer(
- name: String,
- image: Image,
- flavor: Flavor,
- labels: Map<String, String>,
- meta: Map<String, Any>,
- start: Boolean
- ): Server {
- check(!isClosed) { "Client is closed" }
-
- val service = service
- val uid = UUID(service.clock.millis(), service.random.nextLong())
- val server = InternalServer(
- service,
- uid,
- name,
- requireNotNull(service.flavorById[flavor.uid]) { "Unknown flavor" },
- requireNotNull(service.imageById[image.uid]) { "Unknown image" },
- labels.toMutableMap(),
- meta.toMutableMap()
- )
-
- service.serverById[uid] = server
- service.servers.add(server)
-
- if (start) {
- server.start()
- }
-
- return server
- }
-
- override fun findServer(id: UUID): Server? {
- check(!isClosed) { "Client is already closed" }
-
- return service.serverById[id]
- }
-
- override fun queryServers(): List<Server> {
- check(!isClosed) { "Client is already closed" }
-
- return service.servers.toList()
- }
-
- override fun close() {
- isClosed = true
- }
-
- override fun toString(): String = "ComputeService.Client"
- }
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/HostView.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/HostView.kt
deleted file mode 100644
index 0876209a..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/HostView.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2020 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.internal
-
-import org.opendc.compute.service.ComputeService
-import org.opendc.compute.service.driver.Host
-import java.util.UUID
-
-/**
- * A view of a [Host] as seen from the [ComputeService]
- */
-public class HostView(public val host: Host) {
- /**
- * The unique identifier of the host.
- */
- public val uid: UUID
- get() = host.uid
-
- public var instanceCount: Int = 0
- public var availableMemory: Long = host.model.memoryCapacity
- public var provisionedCores: Int = 0
-
- override fun toString(): String = "HostView[host=$host]"
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt
deleted file mode 100644
index 077ec865..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.internal
-
-import org.opendc.compute.api.Flavor
-import java.util.UUID
-
-/**
- * Internal stateful representation of a [Flavor].
- */
-internal class InternalFlavor(
- private val service: ComputeServiceImpl,
- override val uid: UUID,
- name: String,
- cpuCount: Int,
- memorySize: Long,
- labels: Map<String, String>,
- meta: Map<String, Any>
-) : Flavor {
- override var name: String = name
- private set
-
- override var cpuCount: Int = cpuCount
- private set
-
- override var memorySize: Long = memorySize
- private set
-
- override val labels: MutableMap<String, String> = labels.toMutableMap()
-
- override val meta: MutableMap<String, Any> = meta.toMutableMap()
-
- override fun reload() {
- // No-op: this object is the source-of-truth
- }
-
- override fun delete() {
- service.delete(this)
- }
-
- override fun equals(other: Any?): Boolean = other is Flavor && uid == other.uid
-
- override fun hashCode(): Int = uid.hashCode()
-
- override fun toString(): String = "Flavor[uid=$uid,name=$name]"
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt
deleted file mode 100644
index b27ef33a..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.internal
-
-import org.opendc.compute.api.Image
-import java.util.UUID
-
-/**
- * Internal stateful representation of an [Image].
- */
-internal class InternalImage(
- private val service: ComputeServiceImpl,
- override val uid: UUID,
- override val name: String,
- labels: Map<String, String>,
- meta: Map<String, Any>
-) : Image {
-
- override val labels: MutableMap<String, String> = labels.toMutableMap()
-
- override val meta: MutableMap<String, Any> = meta.toMutableMap()
-
- override fun reload() {
- // No-op: this object is the source-of-truth
- }
-
- override fun delete() {
- service.delete(this)
- }
-
- override fun equals(other: Any?): Boolean = other is Image && uid == other.uid
-
- override fun hashCode(): Int = uid.hashCode()
-
- override fun toString(): String = "Image[uid=$uid,name=$name]"
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt
deleted file mode 100644
index c1353ba1..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.internal
-
-import mu.KotlinLogging
-import org.opendc.compute.api.Server
-import org.opendc.compute.api.ServerState
-import org.opendc.compute.api.ServerWatcher
-import org.opendc.compute.service.driver.Host
-import java.time.Instant
-import java.util.UUID
-
-/**
- * Internal implementation of the [Server] interface.
- */
-internal class InternalServer(
- private val service: ComputeServiceImpl,
- override val uid: UUID,
- override val name: String,
- override val flavor: InternalFlavor,
- override val image: InternalImage,
- override val labels: MutableMap<String, String>,
- override val meta: MutableMap<String, Any>
-) : Server {
- /**
- * The logger instance of this server.
- */
- private val logger = KotlinLogging.logger {}
-
- /**
- * The watchers of this server object.
- */
- private val watchers = mutableListOf<ServerWatcher>()
-
- /**
- * The [Host] that has been assigned to host the server.
- */
- @JvmField internal var host: Host? = null
-
- /**
- * The most recent timestamp when the server entered a provisioning state.
- */
- override var launchedAt: Instant? = null
-
- /**
- * The current scheduling request.
- */
- private var request: ComputeServiceImpl.SchedulingRequest? = null
-
- override fun start() {
- when (state) {
- ServerState.RUNNING -> {
- logger.debug { "User tried to start server but server is already running" }
- return
- }
- ServerState.PROVISIONING -> {
- logger.debug { "User tried to start server but request is already pending: doing nothing" }
- return
- }
- ServerState.DELETED -> {
- logger.warn { "User tried to start terminated server" }
- throw IllegalStateException("Server is terminated")
- }
- else -> {
- logger.info { "User requested to start server $uid" }
- state = ServerState.PROVISIONING
- assert(request == null) { "Scheduling request already active" }
- request = service.schedule(this)
- }
- }
- }
-
- override fun stop() {
- when (state) {
- ServerState.PROVISIONING -> {
- cancelProvisioningRequest()
- state = ServerState.TERMINATED
- }
- ServerState.RUNNING, ServerState.ERROR -> {
- val host = checkNotNull(host) { "Server not running" }
- host.stop(this)
- }
- ServerState.TERMINATED, ServerState.DELETED -> {} // No work needed
- }
- }
-
- override fun delete() {
- when (state) {
- ServerState.PROVISIONING, ServerState.TERMINATED -> {
- cancelProvisioningRequest()
- service.delete(this)
- state = ServerState.DELETED
- }
- ServerState.RUNNING, ServerState.ERROR -> {
- val host = checkNotNull(host) { "Server not running" }
- host.delete(this)
- service.delete(this)
- state = ServerState.DELETED
- }
- else -> {} // No work needed
- }
- }
-
- override fun watch(watcher: ServerWatcher) {
- watchers += watcher
- }
-
- override fun unwatch(watcher: ServerWatcher) {
- watchers -= watcher
- }
-
- override fun reload() {
- // No-op: this object is the source-of-truth
- }
-
- override var state: ServerState = ServerState.TERMINATED
- set(value) {
- if (value != field) {
- watchers.forEach { it.onStateChanged(this, value) }
- }
-
- field = value
- }
-
- /**
- * Cancel the provisioning request if active.
- */
- private fun cancelProvisioningRequest() {
- val request = request
- if (request != null) {
- this.request = null
- request.isCancelled = true
- }
- }
-
- override fun equals(other: Any?): Boolean = other is Server && uid == other.uid
-
- override fun hashCode(): Int = uid.hashCode()
-
- override fun toString(): String = "Server[uid=$uid,state=$state]"
-}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ComputeScheduler.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ComputeScheduler.kt
index a2ab3a2e..0ccaf991 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ComputeScheduler.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ComputeScheduler.kt
@@ -24,7 +24,7 @@ package org.opendc.compute.service.scheduler
import org.opendc.compute.api.Server
import org.opendc.compute.service.ComputeService
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A generic scheduler interface used by the [ComputeService] to select hosts to place [Server]s on.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt
index 0840ba7e..18a319e9 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
import org.opendc.compute.service.scheduler.filters.HostFilter
import org.opendc.compute.service.scheduler.weights.HostWeigher
import java.util.SplittableRandom
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ReplayScheduler.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ReplayScheduler.kt
index 284c1f91..4339b3de 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ReplayScheduler.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/ReplayScheduler.kt
@@ -24,7 +24,7 @@ package org.opendc.compute.service.scheduler
import mu.KotlinLogging
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* Policy replaying VM-cluster assignment.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/ComputeFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/ComputeFilter.kt
index fb842415..b562f838 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/ComputeFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/ComputeFilter.kt
@@ -23,8 +23,8 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
+import org.opendc.compute.service.HostView
import org.opendc.compute.service.driver.HostState
-import org.opendc.compute.service.internal.HostView
/**
* A [HostFilter] that filters on active hosts.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt
index f6736ac0..4a9f41c5 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
import java.util.UUID
/**
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/HostFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/HostFilter.kt
index 9e909ca6..78010fee 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/HostFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/HostFilter.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
import org.opendc.compute.service.scheduler.FilterScheduler
/**
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/InstanceCountFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/InstanceCountFilter.kt
index ed6674b1..5aa38a88 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/InstanceCountFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/InstanceCountFilter.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostFilter] that filters hosts based on the number of instances on the host.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/RamFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/RamFilter.kt
index 8a7a646c..275e8f1c 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/RamFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/RamFilter.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostFilter] that filters hosts based on the memory requirements of a [Server] and the RAM available on the host.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt
index 090e1437..c3753866 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
import java.util.UUID
/**
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt
index 791710c8..d4dff76b 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostFilter] that filters hosts based on the vCPU speed requirements of a [Server] and the available
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt
index abdd79f1..448a6189 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuFilter.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.filters
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostFilter] that filters hosts based on the vCPU requirements of a [Server] and the available vCPUs on the host.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt
index d668fdaf..f79d6d88 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.weights
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostWeigher] that weighs the hosts based on the available memory per core on the host.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt
index aa8a9d53..01799122 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.weights
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
import org.opendc.compute.service.scheduler.FilterScheduler
/**
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/InstanceCountWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/InstanceCountWeigher.kt
index 732cbe03..bfb583a2 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/InstanceCountWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/InstanceCountWeigher.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.weights
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostWeigher] that weighs the hosts based on the number of instances on the host.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/RamWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/RamWeigher.kt
index d18d31f4..bb837fbe 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/RamWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/RamWeigher.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.weights
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostWeigher] that weighs the hosts based on the available RAM (memory) on the host.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt
index a86226e2..f15f60c9 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.weights
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostWeigher] that weighs the hosts based on the difference required vCPU capacity and the available CPU capacity.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt
index 4a22269b..169ad8cb 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt
@@ -23,7 +23,7 @@
package org.opendc.compute.service.scheduler.weights
import org.opendc.compute.api.Server
-import org.opendc.compute.service.internal.HostView
+import org.opendc.compute.service.HostView
/**
* A [HostWeigher] that weighs the hosts based on the remaining number of vCPUs available.
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt
deleted file mode 100644
index 6e9f458a..00000000
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2022 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.service.telemetry
-
-import org.opendc.compute.service.ComputeService
-
-/**
- * Statistics about the scheduling component of the [ComputeService].
- *
- * @property hostsAvailable The number of hosts currently available for scheduling.
- * @property hostsUnavailable The number of hosts unavailable for scheduling.
- * @property attemptsSuccess Scheduling attempts that resulted into an allocation onto a host.
- * @property attemptsFailure The number of failed scheduling attempt due to insufficient capacity at the moment.
- * @property attemptsError The number of scheduling attempts that failed due to system error.
- * @property serversTotal The number of servers registered with the service.
- * @property serversPending The number of servers that are pending to be scheduled.
- * @property serversActive The number of servers that are currently managed by the service and running.
- */
-public data class SchedulerStats(
- val hostsAvailable: Int,
- val hostsUnavailable: Int,
- val attemptsSuccess: Long,
- val attemptsFailure: Long,
- val attemptsError: Long,
- val serversTotal: Int,
- val serversPending: Int,
- val serversActive: Int
-)