How VM is allocated to host

  • VmAllocationPolicySimple class is used for allocating the vm. It is the subclass of VmAllocationPolicy which is an abstract class. VmAllocationPolicySimple allocates vm to the host who’s PEs is less in use.
  • public VmAllocationPolicySimple(List<? Extends Host> list)</p>

    // creates VmAllocationPolicySimple object

    public boolean allocateHostForVm(Vm vm)

    //Allocates a host for the given Vm.

    public boolean allocateHostForVm(Vm vm, Host host)

    // Allocates a specified host for the given Vm.