@Override public void destroyAllVms() { deallocateResourcesOfAllVms(); for (final Vm vm : vmList) { vm.setCreated(false); storage.deallocateResource(vm.getStorage()); } vmList.clear(); }
/** * Deallocate all resources that a VM was using. * * @param vm the VM */ protected void deallocateResourcesOfVm(final Vm vm) { vm.setCreated(false); ramProvisioner.deallocateResourceForVm(vm); bwProvisioner.deallocateResourceForVm(vm); vmScheduler.deallocatePesFromVm(vm); storage.deallocateResource(vm.getStorage()); }
/** * Process the event for a Broker which wants to create a VM in this * Datacenter. This Datacenter will then send the status back to * the Broker. * * @param evt information about the event just happened * @param ackRequested indicates if the event's sender expects to receive an * acknowledge message when the event finishes to be processed * @return true if a host was allocated to the VM; false otherwise */ protected boolean processVmCreate(final SimEvent evt, final boolean ackRequested) { final Vm vm = (Vm) evt.getData(); final boolean hostAllocatedForVm = vmAllocationPolicy.allocateHostForVm(vm); if (ackRequested) { send(vm.getBroker(), getSimulation().getMinTimeBetweenEvents(), CloudSimTags.VM_CREATE_ACK, vm); } if (hostAllocatedForVm) { if (!vm.isCreated()) { vm.setCreated(true); } final List<Double> mipsList = vm.getHost().getVmScheduler().getAllocatedMips(vm); vm.updateProcessing(getSimulation().clock(), mipsList); } return hostAllocatedForVm; }