summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-topology/src
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-compute/opendc-compute-topology/src')
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt9
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt2
2 files changed, 9 insertions, 2 deletions
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
index bab886a4..656085e8 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
@@ -131,10 +131,17 @@ private fun HostJSONSpec.toHostSpecs(
val powerModel = getPowerModel(powerModel.modelType, powerModel.power, powerModel.maxPower, powerModel.idlePower)
+ var hostName: String
+ if (name == null) {
+ hostName = "Host-$hostId"
+ } else {
+ hostName = name
+ }
+
val hostSpec =
HostSpec(
UUID(random.nextLong(), (hostId).toLong()),
- "$name-${(hostId)}",
+ hostName,
mapOf("cluster" to clusterId),
machineModel,
SimPsuFactories.simple(powerModel),
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt
index f34bc855..110d6fb1 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt
@@ -61,7 +61,7 @@ public data class ClusterSpec(
*/
@Serializable
public data class HostJSONSpec(
- val name: String = "Host",
+ val name: String? = null,
val cpu: CPUSpec,
val memory: MemorySpec,
val powerModel: PowerModelSpec = PowerModelSpec("linear", 350.0, 400.0, 200.0),