/** * 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()); }
/** * Instantiates a new host. * * @param id the host id * @param ramProvisioner the ram provisioner * @param bwProvisioner the bw provisioner * @param storage the storage capacity * @param peList the host's PEs list * @param vmScheduler the vm scheduler */ public Host( int id, RamProvisioner ramProvisioner, BwProvisioner bwProvisioner, long storage, List<? extends Pe> peList, VmScheduler vmScheduler) { setId(id); setRamProvisioner(ramProvisioner); setBwProvisioner(bwProvisioner); setStorage(storage); setVmScheduler(vmScheduler); setPeList(peList); setFailed(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()); } }
setStorage(getStorage() - vm.getSize());
setStorage(getStorage() - vm.getSize()); getVmList().add(vm); vm.setHost(this);