summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-topology
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-05-31 16:10:51 +0200
committerGitHub <noreply@github.com>2024-05-31 16:10:51 +0200
commit23caa622972708bcf626f7747e509022f70d31fc (patch)
treecc83d5bc75cb73341dbb2357a57983bd42f6b46d /opendc-compute/opendc-compute-topology
parentad20465a5df47b49561bb0afbdda5cd65c5da4b8 (diff)
Addded host_name and boot_time_absolute to the output files (#233)
Added host_name to the host output file. Added boot_time_absolute to the server output file. renamed absolute_timestamp to timestamp_absolute in all output files
Diffstat (limited to 'opendc-compute/opendc-compute-topology')
-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),