/** * Gets the current requested mips. * * @return the current requested mips */ public List<Double> getCurrentRequestedMips() { List<Double> currentRequestedMips = getCloudletScheduler().getCurrentRequestedMips(); if (isBeingInstantiated()) { currentRequestedMips = new ArrayList<Double>(); for (int i = 0; i < getNumberOfPes(); i++) { currentRequestedMips.add(getMips()); } } return currentRequestedMips; }
/** * Gets the current requested bw. * * @return the current requested bw */ public long getCurrentRequestedBw() { if (isBeingInstantiated()) { return getBw(); } return (long) (getCloudletScheduler().getCurrentRequestedUtilizationOfBw() * getBw()); }
/** * Gets the current requested ram. * * @return the current requested ram */ public int getCurrentRequestedRam() { if (isBeingInstantiated()) { return getRam(); } return (int) (getCloudletScheduler().getCurrentRequestedUtilizationOfRam() * getRam()); }
/** * Finds a host to allocate for the VM. * * @param vm the virtual machine to be allocated. * @return the chosen host. */ public PowerHost findHostForVm(Vm vm) { double minPower = Double.MAX_VALUE; PowerHost allocatedHost = null; for (PowerHost host : this.<PowerHost>getHostList()) { if (host.isSuitableForVm(vm)) { double maxUtilization = getMaxUtilizationAfterAllocation(host, vm); if ((!vm.isBeingInstantiated() && maxUtilization > getUpperUtilizationThreshold()) || (vm.isBeingInstantiated() && maxUtilization > 1.0)) { continue; } try { double powerAfterAllocation = getPowerAfterAllocation(host, vm); if (powerAfterAllocation != -1) { double powerDiff = powerAfterAllocation - host.getPower(); if (powerDiff < minPower) { minPower = powerDiff; allocatedHost = host; } } } catch (Exception e) { } } } return allocatedHost; }
getVmList().add(vm); if (vm.isBeingInstantiated()) { vm.setBeingInstantiated(false);