Class ResourceProvisionerAbstract

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

public abstract class ResourceProvisionerAbstract
extends Object
implements ResourceProvisioner
An abstract class that implements the basic features of a provisioning policy used by a Host to provide a given resource to its virtual machines.
Since:
3.0.4
Author:
Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
See Also:
ResourceProvisioner
  • Constructor Details

    • ResourceProvisionerAbstract

      protected ResourceProvisionerAbstract()
      Creates a new ResourceManageable Provisioner for which the resource must be set further.
    • ResourceProvisionerAbstract

      public ResourceProvisionerAbstract​(ResourceManageable resource)
      Creates a new ResourceManageable Provisioner.
      Parameters:
      resource - The resource to be managed by the provisioner
  • Method Details

    • getAllocatedResourceForVm

      public long getAllocatedResourceForVm​(Vm vm)
      Description copied from interface: ResourceProvisioner
      Gets the amount of resource allocated to a given VM from the physical resource
      Specified by:
      getAllocatedResourceForVm in interface ResourceProvisioner
      Parameters:
      vm - the VM
      Returns:
      the allocated resource for the VM
    • deallocateResourceForAllVms

      public void deallocateResourceForAllVms()
      Description copied from interface: ResourceProvisioner
      Releases all the allocated amount of the resource used by all VMs.
      Specified by:
      deallocateResourceForAllVms in interface ResourceProvisioner
    • deallocateResourceForVmAndSetAllocationMapEntryToZero

      protected abstract long deallocateResourceForVmAndSetAllocationMapEntryToZero​(Vm vm)
      Deallocate the resource for the given VM, without removing the VM fro the allocation map. The resource usage of the VM entry on the allocation map is just set to 0.
      Parameters:
      vm - the VM to deallocate resource
      Returns:
      the amount of allocated VM resource or zero if VM is not found
    • getResource

      public ResourceManageable getResource()
      Description copied from interface: ResourceProvisioner
      Gets the resource being managed by the provisioner, such as Ram, Pe, Bandwidth, etc.
      Specified by:
      getResource in interface ResourceProvisioner
      Returns:
      the resource managed by this provisioner
    • setResource

      public final void setResource​(ResourceManageable resource)
      Description copied from interface: ResourceProvisioner
      Sets the resource to be managed by the provisioner, such as Ram, Pe, Bandwidth, etc.
      Specified by:
      setResource in interface ResourceProvisioner
      Parameters:
      resource - the resource managed by this provisioner
    • getResourceClass

      protected Class<? extends ResourceManageable> getResourceClass()
      Gets the class of the resource that this provisioner manages.
      Returns:
      the resource class
    • getResourceAllocationMap

      protected Map<Vm,​Long> getResourceAllocationMap()
      Gets the VM resource allocation map, where each key is a VM and each value is the amount of resource allocated to that VM.
      Returns:
      the resource allocation Map
    • getCapacity

      public long getCapacity()
      Description copied from interface: ResourceProvisioner
      Gets the total capacity of the physical resource from the Host that the provisioner manages.
      Specified by:
      getCapacity in interface ResourceProvisioner
      Returns:
      the total physical resource capacity
    • getTotalAllocatedResource

      public long getTotalAllocatedResource()
      Description copied from interface: ResourceProvisioner
      Gets the total amount of resource allocated to all VMs from the physical resource
      Specified by:
      getTotalAllocatedResource in interface ResourceProvisioner
      Returns:
      the total allocated resource among all VMs
    • getAvailableResource

      public long getAvailableResource()
      Description copied from interface: ResourceProvisioner
      Gets the amount of free available physical resource from the host that the provisioner can allocate to VMs.
      Specified by:
      getAvailableResource in interface ResourceProvisioner
      Returns:
      the amount of free available physical resource
    • isResourceAllocatedToVm

      public boolean isResourceAllocatedToVm​(Vm vm)
      Description copied from interface: ResourceProvisioner
      Checks if the resource the provisioner manages is allocated to a given Vm.
      Specified by:
      isResourceAllocatedToVm in interface ResourceProvisioner
      Parameters:
      vm - the VM to check if the resource is allocated to
      Returns:
      true if the resource is allocated to the VM, false otherwise