Amazing technological breakthrough possible @S-Logix 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 perform the VM Migration process?

  • The migration of VM process should be invoked in “Datacenter” class. One have to extend the “Datacenter” class, in “processCloudletSubmit()” method call the “processVmMigrate()” using the “VM_MIGRATE” tag.
  • protected void processCloudletSubmit(SimEvent ev, boolean ack) {
    …………;
    ………….;
    *** choose the vm to migrate and the new host to allocate the migrating vm.
    Let “vm” be the migrating VM and “host” be the chosen Host to allocate the vm. Add the vm,host in Map and trigger the VM_MIGRATE tag.
    Map<String,Object> ma;
    ma = new HashMap<String,Object>();
    ma.put("VM", vm);
    ma.put("Host", host);
    send(this.getId(),delay,CloudSimTags.VM_MIGRATE,ma);
    }
    protected void processVmMigrate(SimEvent ev, boolean ack) {
    Object tmp = ev.getData();
    if (!(tmp instanceof Map<?, ?>)) {
    throw new ClassCastException("The data object must be Map<string, object="">");
    }
    Map<String, Object> migrate = (HashMap<String, Object>) tmp;
    Vm v = (Vm) migrate.get("vm");
    Host h= (Host) migrate.get("host");
    ** Deallocate the vm from its original Host
    getVmAllocationPolicy().deallocateHostForVm(v);
    h.removeMigratingInVm(v);
    ** call the allocation policy and allocate the migrating VM “vm” to the Host “h”
    boolean result = getVmAllocationPolicy().allocateHostForVm(v, h);
    if (!result) {
    Log.printLine("[Datacenter.processVmMigrate] VM allocation to the destination host failed");
    System.exit(0);
    }
    Log.formatLine("%.2f: Migration of VM #%d to Host #%d is completed",CloudSim.clock(),v.getId(),
    v.setInMigration(false);
    }