diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2024-03-05 16:50:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-05 16:50:35 +0100 |
| commit | 960b3d8a13c67ac4b7f479d5764b0b618fc9ea09 (patch) | |
| tree | 4f103bcf6635341827d9cfa10c10cfde9543f04f /opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute | |
| parent | 5864cbcbfe2eb8c36ca05c3a39c7e5916aeecaec (diff) | |
Cpu fix (#208)
* Updated the topology format to JSON. Updated TopologyReader.kt to handle JSON filed. Added documentation for the new format.
* applied spotless kotlin
* small update
* Updated for spotless apply
* Updated for spotless apply
Diffstat (limited to 'opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute')
3 files changed, 10 insertions, 10 deletions
diff --git a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ComputeService.java b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ComputeService.java index eda9a79f..167b13c7 100644 --- a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ComputeService.java +++ b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ComputeService.java @@ -171,7 +171,7 @@ public final class ComputeService implements AutoCloseable { HostView hv = hostToView.get(host); final ServiceFlavor flavor = serviceServer.getFlavor(); if (hv != null) { - hv.provisionedCores -= flavor.getCpuCount(); + hv.provisionedCores -= flavor.getCoreCount(); hv.instanceCount--; hv.availableMemory += flavor.getMemorySize(); } else { @@ -237,7 +237,7 @@ public final class ComputeService implements AutoCloseable { HostView hv = new HostView(host); HostModel model = host.getModel(); - maxCores = Math.max(maxCores, model.cpuCount()); + maxCores = Math.max(maxCores, model.coreCount()); maxMemory = Math.max(maxMemory, model.memoryCapacity()); hostToView.put(host, hv); @@ -370,7 +370,7 @@ public final class ComputeService implements AutoCloseable { LOGGER.trace( "Server {} selected for scheduling but no capacity available for it at the moment", server); - if (flavor.getMemorySize() > maxMemory || flavor.getCpuCount() > maxCores) { + if (flavor.getMemorySize() > maxMemory || flavor.getCoreCount() > maxCores) { // Remove the incoming image queue.poll(); serversPending--; @@ -403,7 +403,7 @@ public final class ComputeService implements AutoCloseable { attemptsSuccess++; hv.instanceCount++; - hv.provisionedCores += flavor.getCpuCount(); + hv.provisionedCores += flavor.getCoreCount(); hv.availableMemory -= flavor.getMemorySize(); activeServers.put(server, host); diff --git a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ServiceFlavor.java b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ServiceFlavor.java index dba87e2c..0f434a6a 100644 --- a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ServiceFlavor.java +++ b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/ServiceFlavor.java @@ -36,7 +36,7 @@ public final class ServiceFlavor implements Flavor { private final ComputeService service; private final UUID uid; private final String name; - private final int cpuCount; + private final int coreCount; private final long memorySize; private final Map<String, String> labels; private final Map<String, ?> meta; @@ -45,22 +45,22 @@ public final class ServiceFlavor implements Flavor { ComputeService service, UUID uid, String name, - int cpuCount, + int coreCount, long memorySize, Map<String, String> labels, Map<String, ?> meta) { this.service = service; this.uid = uid; this.name = name; - this.cpuCount = cpuCount; + this.coreCount = coreCount; this.memorySize = memorySize; this.labels = labels; this.meta = meta; } @Override - public int getCpuCount() { - return cpuCount; + public int getCoreCount() { + return coreCount; } @Override diff --git a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java index 9caa6da7..2d45817b 100644 --- a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java +++ b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java @@ -29,4 +29,4 @@ package org.opendc.compute.service.driver; * @param cpuCount The number of logical processing cores available for this host. * @param memoryCapacity The amount of memory available for this host in MB. */ -public record HostModel(double cpuCapacity, int cpuCount, long memoryCapacity) {} +public record HostModel(double cpuCapacity, int cpuCount, int coreCount, long memoryCapacity) {} |
