diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-04 17:55:26 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-04 22:24:00 +0200 |
| commit | 8aaeb93e81fc3c4689d42747f87734fc4732d030 (patch) | |
| tree | a83bde82f66b73fe58e65c66c36054f8e5543894 /simulator/opendc-compute | |
| parent | 47f803afc14a50c467d2f5f7ff406824428223f7 (diff) | |
Extract simulation-related code from OpenDC Compute (core)
This change splits the opendc-compute module into two modules:
1. opendc-compute-core
The interfaces and APIs that represent a IaaS platform.
2. opendc-compute-simulator
The implementation of these interfaces using simulation components
from opendc-simulator-compute.
Diffstat (limited to 'simulator/opendc-compute')
| -rw-r--r-- | simulator/opendc-compute/build.gradle.kts | 22 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/build.gradle.kts | 41 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/Flavor.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Flavor.kt) | 0 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/Server.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Server.kt) | 0 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt) | 0 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/ServerState.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerState.kt) | 0 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt) | 0 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/image/Image.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/Image.kt) | 0 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/Metadata.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/Node.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Node.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/NodeEvent.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeEvent.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/NodeState.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeState.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/driver/BareMetalDriver.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/service/ProvisioningService.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt) | 6 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/service/SimpleProvisioningService.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/SimpleProvisioningService.kt) | 6 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/Hypervisor.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/Hypervisor.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/HypervisorEvent.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorEvent.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/driver/InsufficientMemoryOnServerException.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/driver/VirtDriver.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt) | 5 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/service/VirtProvisioningEvent.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/service/VirtProvisioningService.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt) | 11 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt) | 0 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts | 41 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/ComputeSimExecutionContext.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ComputeSimExecutionContext.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/HypervisorView.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/HypervisorView.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimBareMetalDriver.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimBareMetalDriver.kt) | 20 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtDriver.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimVirtDriver.kt) | 8 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtDriverWorkload.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimVirtDriverWorkload.kt) | 2 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtProvisioningService.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt) | 49 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimWorkloadImage.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/SimWorkloadImage.kt) | 3 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AllocationPolicy.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AllocationPolicy.kt) | 10 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AvailableCoreMemoryAllocationPolicy.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AvailableMemoryAllocationPolicy.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ComparableAllocationPolicyLogic.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt) | 8 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/NumberOfActiveServersAllocationPolicy.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ProvisionedCoresAllocationPolicy.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/RandomAllocationPolicy.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt) | 8 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ReplayAllocationPolicy.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt) | 8 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/power/PowerModels.kt (renamed from simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/power/PowerModels.kt) | 4 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimBareMetalDriverTest.kt (renamed from simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/driver/SimBareMetalDriverTest.kt) | 3 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimProvisioningServiceTest.kt (renamed from simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt) | 7 | ||||
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimVirtDriverTest.kt (renamed from simulator/opendc-compute/src/test/kotlin/org/opendc/compute/virt/SimHypervisorTest.kt) | 8 |
42 files changed, 186 insertions, 128 deletions
diff --git a/simulator/opendc-compute/build.gradle.kts b/simulator/opendc-compute/build.gradle.kts index 94af7861..bf920306 100644 --- a/simulator/opendc-compute/build.gradle.kts +++ b/simulator/opendc-compute/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 AtLarge Research + * 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 @@ -20,22 +20,4 @@ * SOFTWARE. */ -description = "Cloud computing fabric simulation model" - -/* Build configuration */ -plugins { - `kotlin-library-convention` -} - -dependencies { - api(project(":opendc-core")) - implementation(project(":opendc-utils")) - implementation("io.github.microutils:kotlin-logging:1.7.9") - implementation(project(":opendc-simulator:opendc-simulator-compute")) - - testImplementation(project(":opendc-simulator:opendc-simulator-core")) - testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}") - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") - testImplementation("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}") -} +description = "Cloud computing fabric controller of OpenDC" diff --git a/simulator/opendc-compute/opendc-compute-core/build.gradle.kts b/simulator/opendc-compute/opendc-compute-core/build.gradle.kts new file mode 100644 index 00000000..9682b50f --- /dev/null +++ b/simulator/opendc-compute/opendc-compute-core/build.gradle.kts @@ -0,0 +1,41 @@ +/* + * 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. + */ + +description = "Core implementation of the OpenDC Compute service" + +/* Build configuration */ +plugins { + `kotlin-library-convention` +} + +dependencies { + api(project(":opendc-core")) + implementation(project(":opendc-utils")) + implementation("io.github.microutils:kotlin-logging:1.7.9") + + testImplementation(project(":opendc-simulator:opendc-simulator-core")) + testImplementation(project(":opendc-compute:opendc-compute-simulator")) + testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}") + testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") + testImplementation("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}") +} diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Flavor.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/Flavor.kt index e5ca115f..e5ca115f 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Flavor.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/Flavor.kt diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Server.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/Server.kt index 948f622f..948f622f 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Server.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/Server.kt diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt index e9212832..e9212832 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerState.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/ServerState.kt index 4b9d7c13..4b9d7c13 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerState.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/ServerState.kt diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt index 01f86a1b..01f86a1b 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/Image.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/image/Image.kt index e481fcc3..e481fcc3 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/Image.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/image/Image.kt diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/Metadata.kt index 61a992b2..11eadd87 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/Metadata.kt @@ -22,7 +22,7 @@ * SOFTWARE. */ -package org.opendc.compute.metal +package org.opendc.compute.core.metal /* * Common metadata keys for bare-metal nodes. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Node.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/Node.kt index 5cb4be1a..6d9506f1 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Node.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/Node.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.metal +package org.opendc.compute.core.metal import kotlinx.coroutines.flow.Flow import org.opendc.compute.core.Server diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeEvent.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/NodeEvent.kt index d367f2e6..4423e2bf 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeEvent.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/NodeEvent.kt @@ -22,7 +22,7 @@ * SOFTWARE. */ -package org.opendc.compute.metal +package org.opendc.compute.core.metal /** * An event that is emitted by a [Node]. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeState.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/NodeState.kt index e76e0b43..bdc4841e 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeState.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/NodeState.kt @@ -22,7 +22,7 @@ * SOFTWARE. */ -package org.opendc.compute.metal +package org.opendc.compute.core.metal /** * An enumeration describing the possible states of a bare-metal compute node. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/driver/BareMetalDriver.kt index 5d8521ae..6f58aa20 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/driver/BareMetalDriver.kt @@ -20,12 +20,12 @@ * SOFTWARE. */ -package org.opendc.compute.metal.driver +package org.opendc.compute.core.metal.driver import kotlinx.coroutines.flow.Flow import org.opendc.compute.core.Server import org.opendc.compute.core.image.Image -import org.opendc.compute.metal.Node +import org.opendc.compute.core.metal.Node import org.opendc.core.failure.FailureDomain import org.opendc.core.power.Powerable import org.opendc.core.services.AbstractServiceKey diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/service/ProvisioningService.kt index c8b38912..bad5b47c 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/service/ProvisioningService.kt @@ -20,11 +20,11 @@ * SOFTWARE. */ -package org.opendc.compute.metal.service +package org.opendc.compute.core.metal.service import org.opendc.compute.core.image.Image -import org.opendc.compute.metal.Node -import org.opendc.compute.metal.driver.BareMetalDriver +import org.opendc.compute.core.metal.Node +import org.opendc.compute.core.metal.driver.BareMetalDriver import org.opendc.core.services.AbstractServiceKey import java.util.UUID diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/SimpleProvisioningService.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/service/SimpleProvisioningService.kt index 3d126ba1..5222f2fb 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/SimpleProvisioningService.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/metal/service/SimpleProvisioningService.kt @@ -20,12 +20,12 @@ * SOFTWARE. */ -package org.opendc.compute.metal.service +package org.opendc.compute.core.metal.service import kotlinx.coroutines.CancellationException import org.opendc.compute.core.image.Image -import org.opendc.compute.metal.Node -import org.opendc.compute.metal.driver.BareMetalDriver +import org.opendc.compute.core.metal.Node +import org.opendc.compute.core.metal.driver.BareMetalDriver /** * A very basic implementation of the [ProvisioningService]. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/Hypervisor.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/Hypervisor.kt index 5dd98bbc..1ae52baa 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/Hypervisor.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/Hypervisor.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.virt +package org.opendc.compute.core.virt import kotlinx.coroutines.flow.Flow import org.opendc.core.Identity diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorEvent.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/HypervisorEvent.kt index 1e2e285c..9fb437de 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorEvent.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/HypervisorEvent.kt @@ -20,10 +20,10 @@ * SOFTWARE. */ -package org.opendc.compute.virt +package org.opendc.compute.core.virt import org.opendc.compute.core.Server -import org.opendc.compute.virt.driver.VirtDriver +import org.opendc.compute.core.virt.driver.VirtDriver /** * An event that is emitted by a [VirtDriver]. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/driver/InsufficientMemoryOnServerException.kt index 83dd70d4..6fe84ea6 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/driver/InsufficientMemoryOnServerException.kt @@ -1,3 +1,3 @@ -package org.opendc.compute.virt.driver +package org.opendc.compute.core.virt.driver public class InsufficientMemoryOnServerException : IllegalStateException("Insufficient memory left on server.") diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/driver/VirtDriver.kt index 54728eb6..5ecfd357 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/driver/VirtDriver.kt @@ -20,13 +20,12 @@ * SOFTWARE. */ -package org.opendc.compute.virt.driver +package org.opendc.compute.core.virt.driver import kotlinx.coroutines.flow.Flow -import org.opendc.compute.core.Flavor import org.opendc.compute.core.Server import org.opendc.compute.core.image.Image -import org.opendc.compute.virt.HypervisorEvent +import org.opendc.compute.core.virt.HypervisorEvent import org.opendc.core.services.AbstractServiceKey import java.util.UUID diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/service/VirtProvisioningEvent.kt index 31f5d2c9..abd2fc95 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/service/VirtProvisioningEvent.kt @@ -22,7 +22,7 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service +package org.opendc.compute.core.virt.service /** * An event that is emitted by the [VirtProvisioningService]. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/service/VirtProvisioningService.kt index 13dfd640..ab96e0a3 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/virt/service/VirtProvisioningService.kt @@ -20,25 +20,18 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service +package org.opendc.compute.core.virt.service import kotlinx.coroutines.flow.Flow -import org.opendc.compute.core.Flavor import org.opendc.compute.core.Server import org.opendc.compute.core.image.Image -import org.opendc.compute.virt.driver.VirtDriver -import org.opendc.compute.virt.service.allocation.AllocationPolicy +import org.opendc.compute.core.virt.driver.VirtDriver /** * A service for VM provisioning on a cloud. */ public interface VirtProvisioningService { /** - * The policy used for allocating a VM on the available hypervisors. - */ - public val allocationPolicy: AllocationPolicy - - /** * The events emitted by the service. */ public val events: Flow<VirtProvisioningEvent> diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt index 6c724277..6c724277 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt +++ b/simulator/opendc-compute/opendc-compute-core/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt diff --git a/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts new file mode 100644 index 00000000..e1ec6421 --- /dev/null +++ b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts @@ -0,0 +1,41 @@ +/* + * 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. + */ + +description = "Simulator for OpenDC Compute" + +/* Build configuration */ +plugins { + `kotlin-library-convention` +} + +dependencies { + api(project(":opendc-compute:opendc-compute-core")) + implementation(project(":opendc-utils")) + implementation("io.github.microutils:kotlin-logging:1.7.9") + implementation(project(":opendc-simulator:opendc-simulator-compute")) + + testImplementation(project(":opendc-simulator:opendc-simulator-core")) + testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}") + testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") + testImplementation("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}") +} diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ComputeSimExecutionContext.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/ComputeSimExecutionContext.kt index 3295a8e8..153a86b3 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ComputeSimExecutionContext.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/ComputeSimExecutionContext.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.core.execution +package org.opendc.compute.simulator import org.opendc.compute.core.Server import org.opendc.simulator.compute.SimExecutionContext diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/HypervisorView.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/HypervisorView.kt index cf6b4487..1a79523e 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/HypervisorView.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/HypervisorView.kt @@ -20,10 +20,10 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service +package org.opendc.compute.simulator import org.opendc.compute.core.Server -import org.opendc.compute.virt.driver.VirtDriver +import org.opendc.compute.core.virt.driver.VirtDriver import java.util.UUID public class HypervisorView( diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimBareMetalDriver.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimBareMetalDriver.kt index 4f72d599..08bb7e79 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimBareMetalDriver.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimBareMetalDriver.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.metal.driver +package org.opendc.compute.simulator import kotlinx.coroutines.* import kotlinx.coroutines.flow.Flow @@ -28,14 +28,13 @@ import org.opendc.compute.core.Flavor import org.opendc.compute.core.Server import org.opendc.compute.core.ServerEvent import org.opendc.compute.core.ServerState -import org.opendc.compute.core.execution.ComputeSimExecutionContext import org.opendc.compute.core.image.EmptyImage import org.opendc.compute.core.image.Image -import org.opendc.compute.core.image.SimWorkloadImage -import org.opendc.compute.metal.Node -import org.opendc.compute.metal.NodeEvent -import org.opendc.compute.metal.NodeState -import org.opendc.compute.metal.power.ConstantPowerModel +import org.opendc.compute.core.metal.Node +import org.opendc.compute.core.metal.NodeEvent +import org.opendc.compute.core.metal.NodeState +import org.opendc.compute.core.metal.driver.BareMetalDriver +import org.opendc.compute.simulator.power.ConstantPowerModel import org.opendc.core.power.PowerModel import org.opendc.core.services.ServiceRegistry import org.opendc.simulator.compute.SimBareMetalMachine @@ -218,8 +217,11 @@ public class SimBareMetalDriver( events.emit(NodeEvent.StateChanged(value, field.state)) } - if (field.server != null && value.server != null && field.server.state != value.server.state) { - serverEvents?.emit(ServerEvent.StateChanged(value.server, field.server.state)) + val oldServer = field.server + val newServer = value.server + + if (oldServer != null && newServer != null && oldServer.state != newServer.state) { + serverEvents?.emit(ServerEvent.StateChanged(newServer, oldServer.state)) } nodeState.value = value diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimVirtDriver.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtDriver.kt index 357ad714..09eec1ef 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimVirtDriver.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtDriver.kt @@ -20,17 +20,17 @@ * SOFTWARE. */ -package org.opendc.compute.virt.driver +package org.opendc.compute.simulator import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.launch import org.opendc.compute.core.* -import org.opendc.compute.core.execution.ComputeSimExecutionContext import org.opendc.compute.core.image.Image -import org.opendc.compute.core.image.SimWorkloadImage -import org.opendc.compute.virt.HypervisorEvent +import org.opendc.compute.core.virt.HypervisorEvent +import org.opendc.compute.core.virt.driver.InsufficientMemoryOnServerException +import org.opendc.compute.core.virt.driver.VirtDriver import org.opendc.core.services.ServiceRegistry import org.opendc.simulator.compute.SimExecutionContext import org.opendc.simulator.compute.SimHypervisor diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimVirtDriverWorkload.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtDriverWorkload.kt index 91d400a4..58b9408a 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimVirtDriverWorkload.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtDriverWorkload.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.virt.driver +package org.opendc.compute.simulator import kotlinx.coroutines.coroutineScope import org.opendc.simulator.compute.SimExecutionContext diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtProvisioningService.kt index e7c2b8cc..e83370d7 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimVirtProvisioningService.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service +package org.opendc.compute.simulator import kotlinx.coroutines.* import kotlinx.coroutines.flow.Flow @@ -32,14 +32,13 @@ import org.opendc.compute.core.Server import org.opendc.compute.core.ServerEvent import org.opendc.compute.core.ServerState import org.opendc.compute.core.image.Image -import org.opendc.compute.core.image.SimWorkloadImage -import org.opendc.compute.metal.service.ProvisioningService -import org.opendc.compute.virt.HypervisorEvent -import org.opendc.compute.virt.driver.InsufficientMemoryOnServerException -import org.opendc.compute.virt.driver.SimVirtDriver -import org.opendc.compute.virt.driver.SimVirtDriverWorkload -import org.opendc.compute.virt.driver.VirtDriver -import org.opendc.compute.virt.service.allocation.AllocationPolicy +import org.opendc.compute.core.metal.service.ProvisioningService +import org.opendc.compute.core.virt.HypervisorEvent +import org.opendc.compute.core.virt.driver.InsufficientMemoryOnServerException +import org.opendc.compute.core.virt.driver.VirtDriver +import org.opendc.compute.core.virt.service.VirtProvisioningEvent +import org.opendc.compute.core.virt.service.VirtProvisioningService +import org.opendc.compute.simulator.allocation.AllocationPolicy import org.opendc.utils.flow.EventFlow import java.time.Clock import java.util.* @@ -47,16 +46,19 @@ import kotlin.coroutines.Continuation import kotlin.coroutines.resume import kotlin.math.max -private val logger = KotlinLogging.logger {} - @OptIn(ExperimentalCoroutinesApi::class) -public class SimpleVirtProvisioningService( +public class SimVirtProvisioningService( private val coroutineScope: CoroutineScope, private val clock: Clock, private val provisioningService: ProvisioningService, - override val allocationPolicy: AllocationPolicy + public val allocationPolicy: AllocationPolicy ) : VirtProvisioningService { /** + * The logger instance to use. + */ + private val logger = KotlinLogging.logger {} + + /** * The hypervisors that have been launched by the service. */ private val hypervisors: MutableMap<Server, HypervisorView> = mutableMapOf() @@ -106,7 +108,8 @@ public class SimpleVirtProvisioningService( launch { var init = false val deployedNode = provisioningService.deploy(node, hypervisorImage) - deployedNode.server!!.events.onEach { event -> + val server = deployedNode.server!! + server.events.onEach { event -> when (event) { is ServerEvent.StateChanged -> { if (!init) { @@ -118,7 +121,7 @@ public class SimpleVirtProvisioningService( }.launchIn(this) delay(1) - onHypervisorAvailable(deployedNode.server, workload.driver) + onHypervisorAvailable(server, workload.driver) } } } @@ -135,7 +138,7 @@ public class SimpleVirtProvisioningService( ): Server { eventFlow.emit( VirtProvisioningEvent.MetricsAvailable( - this@SimpleVirtProvisioningService, + this@SimVirtProvisioningService, hypervisors.size, availableHypervisors.size, ++submittedVms, @@ -173,7 +176,7 @@ public class SimpleVirtProvisioningService( val call = coroutineScope.launch { delay(delay) - this@SimpleVirtProvisioningService.call = null + this@SimVirtProvisioningService.call = null schedule() } this.call = call @@ -190,7 +193,7 @@ public class SimpleVirtProvisioningService( if (requiredMemory > maxMemory || imageInstance.flavor.cpuCount > maxCores) { eventFlow.emit( VirtProvisioningEvent.MetricsAvailable( - this@SimpleVirtProvisioningService, + this@SimVirtProvisioningService, hypervisors.size, availableHypervisors.size, submittedVms, @@ -230,7 +233,7 @@ public class SimpleVirtProvisioningService( eventFlow.emit( VirtProvisioningEvent.MetricsAvailable( - this@SimpleVirtProvisioningService, + this@SimVirtProvisioningService, hypervisors.size, availableHypervisors.size, submittedVms, @@ -251,7 +254,7 @@ public class SimpleVirtProvisioningService( eventFlow.emit( VirtProvisioningEvent.MetricsAvailable( - this@SimpleVirtProvisioningService, + this@SimVirtProvisioningService, hypervisors.size, availableHypervisors.size, submittedVms, @@ -309,7 +312,7 @@ public class SimpleVirtProvisioningService( eventFlow.emit( VirtProvisioningEvent.MetricsAvailable( - this@SimpleVirtProvisioningService, + this@SimVirtProvisioningService, hypervisors.size, availableHypervisors.size, submittedVms, @@ -332,7 +335,7 @@ public class SimpleVirtProvisioningService( eventFlow.emit( VirtProvisioningEvent.MetricsAvailable( - this@SimpleVirtProvisioningService, + this@SimVirtProvisioningService, hypervisors.size, availableHypervisors.size, submittedVms, @@ -358,7 +361,7 @@ public class SimpleVirtProvisioningService( eventFlow.emit( VirtProvisioningEvent.MetricsAvailable( - this@SimpleVirtProvisioningService, + this@SimVirtProvisioningService, hypervisors.size, availableHypervisors.size, submittedVms, diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/SimWorkloadImage.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimWorkloadImage.kt index 1dd9a34b..b48de1d5 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/SimWorkloadImage.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimWorkloadImage.kt @@ -20,8 +20,9 @@ * SOFTWARE. */ -package org.opendc.compute.core.image +package org.opendc.compute.simulator +import org.opendc.compute.core.image.Image import org.opendc.core.resource.TagContainer import org.opendc.simulator.compute.workload.SimWorkload import java.util.* diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AllocationPolicy.kt index 099d1740..2018b9f2 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AllocationPolicy.kt @@ -20,11 +20,11 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation -import org.opendc.compute.metal.Node -import org.opendc.compute.virt.service.HypervisorView -import org.opendc.compute.virt.service.SimpleVirtProvisioningService +import org.opendc.compute.core.metal.Node +import org.opendc.compute.simulator.HypervisorView +import org.opendc.compute.simulator.SimVirtProvisioningService /** * A policy for selecting the [Node] an image should be deployed to, @@ -39,7 +39,7 @@ public interface AllocationPolicy { */ public fun select( hypervisors: Set<HypervisorView>, - image: SimpleVirtProvisioningService.ImageView + image: SimVirtProvisioningService.ImageView ): HypervisorView? } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AvailableCoreMemoryAllocationPolicy.kt index cfbf3cd3..38a07b2b 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AvailableCoreMemoryAllocationPolicy.kt @@ -20,9 +20,9 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation -import org.opendc.compute.virt.service.HypervisorView +import org.opendc.compute.simulator.HypervisorView /** * An [AllocationPolicy] that selects the machine with the highest/lowest amount of memory per core. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AvailableMemoryAllocationPolicy.kt index 48172765..e87abd7b 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/AvailableMemoryAllocationPolicy.kt @@ -20,9 +20,9 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation -import org.opendc.compute.virt.service.HypervisorView +import org.opendc.compute.simulator.HypervisorView /** * Allocation policy that selects the node with the most available memory. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ComparableAllocationPolicyLogic.kt index c971cd7e..6aff2bab 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ComparableAllocationPolicyLogic.kt @@ -20,10 +20,10 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation -import org.opendc.compute.virt.service.HypervisorView -import org.opendc.compute.virt.service.SimpleVirtProvisioningService +import org.opendc.compute.simulator.HypervisorView +import org.opendc.compute.simulator.SimVirtProvisioningService /** * The logic for an [AllocationPolicy] that uses a [Comparator] to select the appropriate node. @@ -36,7 +36,7 @@ public interface ComparableAllocationPolicyLogic : AllocationPolicy.Logic { override fun select( hypervisors: Set<HypervisorView>, - image: SimpleVirtProvisioningService.ImageView + image: SimVirtProvisioningService.ImageView ): HypervisorView? { return hypervisors.asSequence() .filter { hv -> diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/NumberOfActiveServersAllocationPolicy.kt index 63ba64ce..5e2b895c 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/NumberOfActiveServersAllocationPolicy.kt @@ -20,9 +20,9 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation -import org.opendc.compute.virt.service.HypervisorView +import org.opendc.compute.simulator.HypervisorView /** * Allocation policy that selects the node with the least amount of active servers. diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ProvisionedCoresAllocationPolicy.kt index d76e9c82..4344d979 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ProvisionedCoresAllocationPolicy.kt @@ -20,9 +20,9 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation -import org.opendc.compute.virt.service.HypervisorView +import org.opendc.compute.simulator.HypervisorView /** * An [AllocationPolicy] that takes into account the number of vCPUs that have been provisioned on this machine diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/RandomAllocationPolicy.kt index 26e61673..ac34f410 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/RandomAllocationPolicy.kt @@ -20,10 +20,10 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation -import org.opendc.compute.virt.service.HypervisorView -import org.opendc.compute.virt.service.SimpleVirtProvisioningService +import org.opendc.compute.simulator.HypervisorView +import org.opendc.compute.simulator.SimVirtProvisioningService import kotlin.random.Random /** @@ -34,7 +34,7 @@ public class RandomAllocationPolicy(private val random: Random = Random(0)) : Al override fun invoke(): AllocationPolicy.Logic = object : AllocationPolicy.Logic { override fun select( hypervisors: Set<HypervisorView>, - image: SimpleVirtProvisioningService.ImageView + image: SimVirtProvisioningService.ImageView ): HypervisorView? { return hypervisors.asIterable() .filter { hv -> diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ReplayAllocationPolicy.kt index a623633d..fda863bb 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ReplayAllocationPolicy.kt @@ -20,11 +20,11 @@ * SOFTWARE. */ -package org.opendc.compute.virt.service.allocation +package org.opendc.compute.simulator.allocation import mu.KotlinLogging -import org.opendc.compute.virt.service.HypervisorView -import org.opendc.compute.virt.service.SimpleVirtProvisioningService +import org.opendc.compute.simulator.HypervisorView +import org.opendc.compute.simulator.SimVirtProvisioningService private val logger = KotlinLogging.logger {} @@ -38,7 +38,7 @@ public class ReplayAllocationPolicy(private val vmPlacements: Map<String, String override fun invoke(): AllocationPolicy.Logic = object : AllocationPolicy.Logic { override fun select( hypervisors: Set<HypervisorView>, - image: SimpleVirtProvisioningService.ImageView + image: SimVirtProvisioningService.ImageView ): HypervisorView? { val clusterName = vmPlacements[image.name] ?: throw IllegalStateException("Could not find placement data in VM placement file for VM ${image.name}") diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/power/PowerModels.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/power/PowerModels.kt index 9286626c..09651720 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/power/PowerModels.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/power/PowerModels.kt @@ -20,11 +20,11 @@ * SOFTWARE. */ -package org.opendc.compute.metal.power +package org.opendc.compute.simulator.power import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map -import org.opendc.compute.metal.driver.BareMetalDriver +import org.opendc.compute.core.metal.driver.BareMetalDriver import org.opendc.core.power.PowerModel /** diff --git a/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/driver/SimBareMetalDriverTest.kt b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimBareMetalDriverTest.kt index 584dcef4..0f1bd444 100644 --- a/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/driver/SimBareMetalDriverTest.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimBareMetalDriverTest.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.metal.driver +package org.opendc.compute.simulator import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.collect @@ -32,7 +32,6 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.opendc.compute.core.ServerEvent import org.opendc.compute.core.ServerState -import org.opendc.compute.core.image.SimWorkloadImage import org.opendc.simulator.compute.SimMachineModel import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.ProcessingNode diff --git a/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimProvisioningServiceTest.kt index 6f13e557..def78ce7 100644 --- a/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimProvisioningServiceTest.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.metal.service +package org.opendc.compute.simulator import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay @@ -29,8 +29,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestCoroutineScope import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.opendc.compute.core.image.SimWorkloadImage -import org.opendc.compute.metal.driver.SimBareMetalDriver +import org.opendc.compute.core.metal.service.SimpleProvisioningService import org.opendc.simulator.compute.SimMachineModel import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.ProcessingNode @@ -43,7 +42,7 @@ import java.util.UUID * Test suite for the [SimpleProvisioningService]. */ @OptIn(ExperimentalCoroutinesApi::class) -internal class SimpleProvisioningServiceTest { +internal class SimProvisioningServiceTest { private lateinit var machineModel: SimMachineModel @BeforeEach diff --git a/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/virt/SimHypervisorTest.kt b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimVirtDriverTest.kt index 9d33d395..a0c61f29 100644 --- a/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/virt/SimHypervisorTest.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimVirtDriverTest.kt @@ -20,7 +20,7 @@ * SOFTWARE. */ -package org.opendc.compute.virt +package org.opendc.compute.simulator import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay @@ -33,9 +33,7 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll import org.opendc.compute.core.Flavor -import org.opendc.compute.core.image.SimWorkloadImage -import org.opendc.compute.metal.driver.SimBareMetalDriver -import org.opendc.compute.virt.driver.SimVirtDriverWorkload +import org.opendc.compute.core.virt.HypervisorEvent import org.opendc.simulator.compute.SimMachineModel import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.ProcessingNode @@ -49,7 +47,7 @@ import java.util.UUID * Basic test-suite for the hypervisor. */ @OptIn(ExperimentalCoroutinesApi::class) -internal class SimHypervisorTest { +internal class SimVirtDriverTest { private lateinit var scope: TestCoroutineScope private lateinit var clock: Clock private lateinit var machineModel: SimMachineModel |
