Class ResourceProvisionerSimple
java.lang.Object
org.cloudsimplus.provisioners.ResourceProvisionerAbstract
org.cloudsimplus.provisioners.ResourceProvisionerSimple
- All Implemented Interfaces:
ResourceProvisioner
- Direct Known Subclasses:
PeProvisionerSimple
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;
- otherwise, it fails.
- Since:
- 3.0.4
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
Field Summary
Fields inherited from interface org.cloudsimplus.provisioners.ResourceProvisioner
NULL -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a new ResourceProvisionerSimple which theResourceManageableit will manage have to be set further.protectedResourceProvisionerSimple(ResourceManageable resource, Function<Vm, ResourceManageable> vmResourceFunction) Creates a ResourceProvisionerSimple for a givenResourceManageable. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallocateResourceForVm(Vm vm, double newTotalVmResource) Allocates an amount of the physical resource for a VM, changing the current capacity of the virtual resource to the given amount.booleanallocateResourceForVm(Vm vm, long newTotalVmResourceCapacity) Allocates an amount of the physical resource for a VM, changing the current capacity of the virtual resource to the given amount.longDeallocate the resource for the given VM.booleanisSuitableForVm(Vm vm, long newVmTotalAllocatedResource) 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.booleanisSuitableForVm(Vm vm, Resource resource) 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.Methods inherited from class org.cloudsimplus.provisioners.ResourceProvisionerAbstract
getAllocatedResourceForVm, getAvailableResource, getCapacity, getTotalAllocatedResource, getVmResourceFunction, setResourcesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cloudsimplus.provisioners.ResourceProvisioner
getPmResource
-
Constructor Details
-
ResourceProvisionerSimple
public ResourceProvisionerSimple()Creates a new ResourceProvisionerSimple which theResourceManageableit will manage have to be set further.- See Also:
-
ResourceProvisionerSimple
protected ResourceProvisionerSimple(ResourceManageable resource, Function<Vm, ResourceManageable> vmResourceFunction) Creates a ResourceProvisionerSimple for a givenResourceManageable.- Parameters:
resource- the resource to be managed by the provisionervmResourceFunction- aFunctionthat receives aVmand returns the virtual resource corresponding to thePM resource
-
-
Method Details
-
allocateResourceForVm
Description copied from interface:ResourceProvisionerAllocates 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 allocatednewTotalVmResourceCapacity- 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 amount.- Returns:
trueif the resource could be allocated;falseotherwise
-
allocateResourceForVm
Description copied from interface:ResourceProvisionerAllocates 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 allocatednewTotalVmResource- 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 amount- Returns:
trueif the resource could be allocated;falseotherwise- See Also:
-
deallocateResourceForVm
Description copied from interface:ResourceProvisionerDeallocate the resource for the given VM.- Parameters:
vm- the VM to deallocate the resource- Returns:
- the amount of allocated VM resource or zero if VM is not found
-
isSuitableForVm
Description copied from interface:ResourceProvisionerChecks 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 capacity on the Host to change the allocated amount for the VMnewVmTotalAllocatedResource- 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
Description copied from interface:ResourceProvisionerChecks 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 capacity on the Host to change the allocated amount for the VMresource- 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
-