VmAllocationPolicySimple

public class VmAllocationPolicySimple extends VmAllocationPolicyAbstract

A VmAllocationPolicy implementation that chooses, as the host for a VM, that one with fewer PEs in use. It is therefore a Worst Fit policy, allocating each VM into the host with most available PEs.

NOTE: This policy doesn’t perform optimization of VM allocation by means of VM migration.

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

Constructors

VmAllocationPolicySimple

public VmAllocationPolicySimple()

Instantiates a VmAllocationPolicySimple.

VmAllocationPolicySimple

public VmAllocationPolicySimple(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> findHostForVmFunction)

Instantiates a VmAllocationPolicySimple, changing the Function to select a Host for a Vm in order to define a different policy.

Parameters:
  • findHostForVmFunction – a Function to select a Host for a given Vm.

See also: VmAllocationPolicy.setFindHostForVmFunction(java.util.function.BiFunction)

Methods

findHostForVm

public Optional<Host> findHostForVm(Vm vm)

Gets the first suitable host from the getHostList() that has the fewest number of used PEs (i.e, higher free PEs).

Returns:an Optional containing a suitable Host to place the VM or an empty Optional if not found