public interface ResourceProvisioner
Host
to provide a given physical resource to its Vm
s.
Each host must have its own instance of a ResourceProvisioner for each
Resource
it owns, such as Ram
, Bandwidth
(BW) and Pe
(CPU).Modifier and Type | Field and Description |
---|---|
static ResourceProvisioner |
NULL
An attribute that implements the Null Object Design Pattern for
ResourceProvisioner objects.
|
Modifier and Type | Method and Description |
---|---|
default boolean |
allocateResourceForVm(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.
|
boolean |
allocateResourceForVm(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.
|
void |
deallocateResourceForAllVms()
Releases all the allocated amount of the resource used by all VMs.
|
boolean |
deallocateResourceForVm(Vm vm)
Releases all the allocated amount of the resource used by a VM.
|
long |
getAllocatedResourceForVm(Vm vm)
Gets the amount of resource allocated to a given VM from the physical resource
|
long |
getAvailableResource()
Gets the amount of free available physical resource from the host that the provisioner can allocate to VMs.
|
long |
getCapacity()
Gets the total capacity of the physical resource from the Host that the provisioner manages.
|
ResourceManageable |
getResource()
|
long |
getTotalAllocatedResource()
Gets the total amount of resource allocated to all VMs from the physical resource
|
boolean |
isResourceAllocatedToVm(Vm vm)
Checks if the resource the provisioner manages is allocated to a given Vm.
|
boolean |
isSuitableForVm(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.
|
void |
setResource(ResourceManageable resource)
|
static final ResourceProvisioner NULL
boolean allocateResourceForVm(Vm vm, long newTotalVmResourceCapacity)
vm
- the virtual machine for which the resource is being allocatednewTotalVmResourceCapacity
- 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 amountdefault boolean allocateResourceForVm(Vm vm, double newTotalVmResource)
This method is just a shorthand to avoid explicitly converting a double to long.
vm
- the virtual machine for which the resource is being allocatednewTotalVmResource
- 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 amountallocateResourceForVm(Vm, long)
long getAllocatedResourceForVm(Vm vm)
vm
- the VMlong getTotalAllocatedResource()
boolean deallocateResourceForVm(Vm vm)
vm
- the vmvoid deallocateResourceForAllVms()
boolean isSuitableForVm(Vm vm, long newVmTotalAllocatedResource)
vm
- the vm to check if there is enough available resource on the host to
change the allocated amount for the VMnewVmTotalAllocatedResource
- the new total amount of resource to allocate for the VM.ResourceManageable getResource()
void setResource(ResourceManageable resource)
resource
- the resource managed by this provisionerlong getCapacity()
long getAvailableResource()
boolean isResourceAllocatedToVm(Vm vm)
vm
- the VM to check if the resource is allocated toCopyright © 2015–2019 Systems, Security and Image Communication Lab - Instituto de Telecomunica����es (IT) - Universidade da Beira Interior (UBI) - Instituto Federal de Educa����o Ci��ncia e Tecnologia do Tocantins (IFTO). All rights reserved.