/** * Destroys all VMs running in the host. * * @pre $none * @post $none */ public void vmDestroyAll() { vmDeallocateAll(); for (Vm vm : getVmList()) { vm.setHost(null); setStorage(getStorage() + vm.getSize()); } getVmList().clear(); }
/** * Deallocate all resources of a VM. * * @param vm the VM */ protected void vmDeallocate(Vm vm) { getRamProvisioner().deallocateRamForVm(vm); getBwProvisioner().deallocateBwForVm(vm); getVmScheduler().deallocatePesForVm(vm); setStorage(getStorage() + vm.getSize()); }
/** * 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()); } }
if (getStorage() < vm.getSize()) { Log.printConcatLine("[VmScheduler.addMigratingInVm] Allocation of VM #", vm.getId(), " to Host #", getId(), " failed by storage"); setStorage(getStorage() - vm.getSize());
if (getStorage() < vm.getSize()) { Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(), " failed by storage"); setStorage(getStorage() - vm.getSize()); getVmList().add(vm); vm.setHost(this);