From 23caa622972708bcf626f7747e509022f70d31fc Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Fri, 31 May 2024 16:10:51 +0200 Subject: 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 --- .../main/kotlin/org/opendc/compute/topology/TopologyFactories.kt | 9 ++++++++- .../kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'opendc-compute/opendc-compute-topology/src') 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), -- cgit v1.2.3