/* (non-Javadoc) * @see entropy.monitoring.ConfigurationAdapter#extractConfiguration() */ @Override public Configuration extractConfiguration() { Configuration config = new SimpleConfiguration(); for (ServerType server : Utils.getAllServers(currentFit4Green)) { Node node = getNode(server); if (server.getStatus() == ServerStatusType.ON || server.getStatus() == ServerStatusType .POWERING_ON) { // POWERING_ON nodes are seen as ON by entropy as they will be // soon on. This avoids ping-pong effect on the state. config.addOnline(node); for (VirtualMachineType VM : Utils.getVMs(server)) { VirtualMachine vm = getVM(node, VM); config.setRunOn(vm, node); } } else { // OFF, POWERING_OFF config.addOffline(node); } } return config; }
public F4GConfigurationAdapter( FIT4GreenType f4g, VMTypeType vmType, IPowerCalculator powerCalculator, OptimizationObjective optiObjective) { currentFit4Green = f4g; currentVMType = vmType; log = Logger.getLogger(F4GConfigurationAdapter.class.getName()); allServers = Utils.getAllServers(f4g); this.powerCalculator = powerCalculator; powerCalculation = new StaticPowerCalculation(null); this.optiObjective = optiObjective; }