@Override public void removeMigratingInVm(final Vm vm) { deallocateResourcesOfVm(vm); vmsMigratingIn.remove(vm); vmList.remove(vm); vm.setInMigration(false); }
/** * Try to allocate all resources that a VM requires (Storage, RAM, BW and MIPS) to be placed at this Host. * * @param vm the VM to try allocating resources to * @param inMigration If the VM is migrating into the Host or it is being just created for the first time * @return true if the Vm was placed into the host, false if the Host doesn't have enough resources to allocate the Vm */ private boolean allocateResourcesForVm(final Vm vm, final boolean inMigration){ if (!storage.isAmountAvailable(vm.getStorage())) { logAllocationError(vm, inMigration, "MB", this.getStorage(), vm.getStorage()); return false; } if (!ramProvisioner.isSuitableForVm(vm, vm.getCurrentRequestedRam())) { logAllocationError(vm, inMigration, "MB", this.getRam(), vm.getRam()); return false; } if (!bwProvisioner.isSuitableForVm(vm, vm.getCurrentRequestedBw())) { logAllocationError(vm, inMigration, "Mbps", this.getBw(), vm.getBw()); return false; } if (!vmScheduler.isSuitableForVm(vm, true)) { return false; } vm.setInMigration(inMigration); allocateResourcesForVm(vm); return true; }