#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to allocate the VM in a specific Host?
  • To allocate the VM in a specific Host, extend the VmAllocationPolicySimple classand implement the “allocateHostForVm(Host h, Vm v)” method.

  • This method should be called from the Datacenter class. In Datacenter class, in “processVmCreate()” method only the VmAllocationPolicy class is called.

    protected void processVmCreate(SimEvent ev, boolean ack)

    {

    Vm vm = (Vm) ev.getData();

    boolean result = getVmAllocationPolicy().allocateHostForVm(vm);

    ……

    }

  • The method “allocateHostForVm(vm)” is called by default. Therefore one has to decide in which Host the vm should be allocated and call the “allocateHostForVm(Host host,VM vm)” method in Datacenter class.

    i.e

    protected void processVmCreate(SimEvent ev, boolean ack) {

    Vm vm = (Vm) ev.getData();

    Host hs=//the specific host decided to allocate to vm;

    boolean result = getVmAllocationPolicy().allocateHostForVm(hs,vm);

    ……

    }