/** * Updates the list of maps between a VM and the host where it is place. * @see #savedAllocation */ protected void saveAllocation() { getSavedAllocation().clear(); for (Host host : getHostList()) { for (Vm vm : host.getVmList()) { if (host.getVmsMigratingIn().contains(vm)) { continue; } Map<String, Object> map = new HashMap<String, Object>(); map.put("host", host); map.put("vm", vm); getSavedAllocation().add(map); } } }
/** * Removes a migrating in vm. * * @param vm the vm */ public void removeMigratingInVm(Vm vm) { vmDeallocate(vm); getVmsMigratingIn().remove(vm); getVmList().remove(vm); getVmScheduler().getVmsMigratingIn().remove(vm.getUid()); vm.setInMigration(false); }
/** * Reallocate migrating in vms. Gets the VM in the migrating in queue * and allocate them on the host. */ public void reallocateMigratingInVms() { for (Vm vm : getVmsMigratingIn()) { if (!getVmList().contains(vm)) { getVmList().add(vm); } if (!getVmScheduler().getVmsMigratingIn().contains(vm.getUid())) { getVmScheduler().getVmsMigratingIn().add(vm.getUid()); } getRamProvisioner().allocateRamForVm(vm, vm.getCurrentRequestedRam()); getBwProvisioner().allocateBwForVm(vm, vm.getCurrentRequestedBw()); getVmScheduler().allocatePesForVm(vm, vm.getCurrentRequestedMips()); setStorage(getStorage() - vm.getSize()); } }
vm.setInMigration(true); if (!getVmsMigratingIn().contains(vm)) { if (getStorage() < vm.getSize()) { Log.printConcatLine("[VmScheduler.addMigratingInVm] Allocation of VM #", vm.getId(), " to Host #", getVmsMigratingIn().add(vm); getVmList().add(vm); updateVmsProcessing(CloudSim.clock());