Class ResourceProvisionerSimple

java.lang.Object
org.cloudbus.cloudsim.provisioners.ResourceProvisionerAbstract
org.cloudbus.cloudsim.provisioners.ResourceProvisionerSimple
All Implemented Interfaces:
ResourceProvisioner
Direct Known Subclasses:
PeProvisionerSimple

public class ResourceProvisionerSimple extends ResourceProvisionerAbstract
A best-effort ResourceProvisioner policy used by a Host to provide a resource to VMs:
  • if there is available amount of the resource on the host, it provides;
  • otherwise, it fails.
Since:
3.0.4
Author:
Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
  • Constructor Details

  • Method Details

    • allocateResourceForVm

      public boolean allocateResourceForVm(Vm vm, long newTotalVmResourceCapacity)
      Description copied from interface: ResourceProvisioner
      Allocates an amount of the physical resource for a VM, changing the current capacity of the virtual resource to the given amount.
      Parameters:
      vm - the virtual machine for which the resource is being allocated
      newTotalVmResourceCapacity - the new total amount of resource to allocate to the VM, changing the allocate resource to this new amount. It doesn't increase the current allocated VM resource by the given amount, instead, it changes the VM allocated resource to that specific amount
      Returns:
      $true if the resource could be allocated; $false otherwise
    • allocateResourceForVm

      public boolean allocateResourceForVm(Vm vm, double newTotalVmResource)
      Description copied from interface: ResourceProvisioner
      Allocates an amount of the physical resource for a VM, changing the current capacity of the virtual resource to the given amount.

      This method is just a shorthand to avoid explicitly converting a double to long.

      Parameters:
      vm - the virtual machine for which the resource is being allocated
      newTotalVmResource - the new total amount of resource to allocate to the VM, changing the allocated resource to this new amount. It doesn't increase the current allocated VM resource by the given amount, instead, it changes the VM allocated resource to that specific amount
      Returns:
      $true if the resource could be allocated; $false otherwise
      See Also:
    • deallocateResourceForVm

      public long deallocateResourceForVm(Vm vm)
      Description copied from interface: ResourceProvisioner
      Deallocate the resource for the given VM.
      Parameters:
      vm - the VM to deallocate resource
      Returns:
      the amount of allocated VM resource or zero if VM is not found
    • isSuitableForVm

      public boolean isSuitableForVm(Vm vm, long newVmTotalAllocatedResource)
      Description copied from interface: ResourceProvisioner
      Checks if it is possible to change the current allocated resource for a given VM to a new amount, depending on the available physical resource remaining.
      Parameters:
      vm - the vm to check if there is enough available resource on the host to change the allocated amount for the VM
      newVmTotalAllocatedResource - the new total amount of resource to be allocated for the VM.
      Returns:
      true, if it is possible to allocate the new total VM resource; false otherwise
    • isSuitableForVm

      public boolean isSuitableForVm(Vm vm, Resource resource)
      Description copied from interface: ResourceProvisioner
      Checks if it is possible to change the current allocated resource for a given VM to a new amount, depending on the available physical resource remaining.
      Parameters:
      vm - the vm to check if there is enough available resource on the host to change the allocated amount for the VM
      resource - the resource where its capacity it to be allocated for the VM.
      Returns:
      true, if it is possible to allocate the new total VM resource; false otherwise