@Test public void getOverCapacityScore() { List<Vm> vms = new ArrayList<>(); Vm vm1 = new Vm.Builder((long) 1, 8, 8192, 40).build(); vm1.setHost(host); Vm vm2 = new Vm.Builder((long) 2, 2, 2048, 2).build(); vms.add(vm1); vms.add(vm2); assertEquals(-6, host.getOverCapacityScore(vms), 0.1); }
public double getOverCapacityScore(List<Vm> vms) { HostUsage hostUsage = getUsage(vms); return getCpuOverCapacityScore(hostUsage) + getRamOverCapacityScore(hostUsage) + getDiskOverCapacityScore(hostUsage); }
Host extends AbstractPersistable { public double getOverCapacityScore(List<Vm> vms) { HostUsage hostUsage = getUsage(vms); return getCpuOverCapacityScore(hostUsage) + getRamOverCapacityScore(hostUsage) + getDiskOverCapacityScore(hostUsage); } }
Host extends AbstractPersistable { public double getOverCapacityScore(List<Vm> vms) { HostUsage hostUsage = getUsage(vms); return getCpuOverCapacityScore(hostUsage) + getRamOverCapacityScore(hostUsage) + getDiskOverCapacityScore(hostUsage); } Host(Long id, String hostname, int ncpus, double ramMb, double diskGb, boolean initiallyOff); }
Host extends AbstractPersistable { public double getOverCapacityScore(List<Vm> vms) { HostUsage hostUsage = getUsage(vms); return getCpuOverCapacityScore(hostUsage) + getRamOverCapacityScore(hostUsage) + getDiskOverCapacityScore(hostUsage); } Host(Long id, String hostname, int ncpus, double ramMb, double diskGb, boolean initiallyOff); HostUsage getUsage(List<Vm> vms); double getOverCapacityScore(List<Vm> vms); boolean missingFixedVMs(List<Vm> vms); String getHostname(); int getNcpus(); double getRamMb(); double getDiskGb(); void addFixedVm(long vmId); boolean wasOffInitiallly(); @Override String toString(); }
Host extends AbstractPersistable { public double getOverCapacityScore(List<Vm> vms) { HostUsage hostUsage = getUsage(vms); return getCpuOverCapacityScore(hostUsage) + getRamOverCapacityScore(hostUsage) + getDiskOverCapacityScore(hostUsage); } Host(Long id, String hostname, int ncpus, double ramMb, double diskGb, boolean initiallyOff); HostUsage getUsage(List<Vm> vms); double getOverCapacityScore(List<Vm> vms); boolean missingFixedVMs(List<Vm> vms); String getHostname(); int getNcpus(); double getRamMb(); double getDiskGb(); void addFixedVm(long vmId); boolean wasOffInitiallly(); @Override String toString();  }