Implemented scaling of memory and storage of servers

This commit is contained in:
Maximilian Kratz 2021-07-10 12:14:09 +02:00
parent c29a12d640
commit 61ec63126b
2 changed files with 22 additions and 1 deletions

View file

@ -139,7 +139,9 @@ public class BasicModelConverter {
for (final JsonElement actSrv : servers) {
final JsonObject srv = (JsonObject) actSrv;
ModelFacade.getInstance().addServerToNetwork(srv.get("id").getAsString(), networkId,
srv.get("cpu").getAsInt(), srv.get("memory").getAsInt(), srv.get("storage").getAsInt(),
srv.get("cpu").getAsInt(), //
(int) (1.0 * srv.get("memory").getAsLong() * ModelConverterConfig.MEMORY_SCALING), //
(int) (1.0 * srv.get("storage").getAsLong() * ModelConverterConfig.MEMORY_SCALING), //
srv.get("depth").getAsInt());
}

View file

@ -0,0 +1,19 @@
package model.converter;
/**
* Configuration of the model converter classes
*
* @author Maximilian Kratz {@literal <maximilian.kratz@stud.tu-darmstadt.de>}
*/
public class ModelConverterConfig {
/**
* Scaling factor of all memory related resources of the servers (memory, storage).
*/
public static double MEMORY_SCALING = 1.0 / 1024;
/**
* Private constructor ensures no instantiation of this class.
*/
private ModelConverterConfig() {}
}