mirror of
https://github.com/maxkratz/iflye.git
synced 2024-09-16 19:59:59 +00:00
Implemented scaling of memory and storage of servers
This commit is contained in:
parent
c29a12d640
commit
61ec63126b
2 changed files with 22 additions and 1 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
19
network.model/src/model/converter/ModelConverterConfig.java
Normal file
19
network.model/src/model/converter/ModelConverterConfig.java
Normal 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() {}
|
||||
}
|
Loading…
Reference in a new issue