Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • 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);

    ……

    }