ResourceProvisionerAbstract

public abstract class ResourceProvisionerAbstract 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.

Author:Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho

See also: ResourceProvisioner

Constructors

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

Methods

deallocateResourceForAllVms

public void deallocateResourceForAllVms()

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

getAllocatedResourceForVm

public long getAllocatedResourceForVm(Vm vm)

getAvailableResource

public long getAvailableResource()

getCapacity

public long getCapacity()

getResource

public ResourceManageable getResource()

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

getResourceClass

protected Class<? extends ResourceManageable> getResourceClass()

Gets the class of the resource that this provisioner manages.

Returns:the resource class

getTotalAllocatedResource

public long getTotalAllocatedResource()

isResourceAllocatedToVm

public boolean isResourceAllocatedToVm(Vm vm)

setResource

public final void setResource(ResourceManageable resource)