Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / examples / java / cloud / migration / Test.java
index ef7836a..7edaa0a 100644 (file)
@@ -8,6 +8,8 @@ package cloud.migration;
 
 import org.simgrid.msg.*;
 import org.simgrid.msg.Process;
+import java.util.ArrayList;
+import java.util.List;
 
 public class Test extends Process{
 
@@ -31,11 +33,18 @@ public class Test extends Process{
             e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
         }
 
+        List<VM> vms = new ArrayList<VM>();
+
       /* Create VM1 */
         int dpRate = 70;
         int load1 = 90;
         int load2 = 80;
+               
+
+                 Msg.info("This example evaluates the migration time of a VM in presence of collocated VMs on the source and the dest nodes");
+                 Msg.info("The migrated VM has a memory intensity rate of 70% of the network BW and a cpu load of 90% \"(see cloudcom 2013 paper \"Adding a Live Migration Model Into SimGrid\" for further information) "); 
 
+                 Msg.info("Load of collocated VMs fluctuate between 0 and 90% in order to create a starvation issue and see whether it impacts or not the migration time");
         XVM vm1 = null;
         vm1 = new XVM(
                 host0,
@@ -48,8 +57,7 @@ public class Test extends Process{
                 125, // Net bandwidth,
                 dpRate // Memory intensity
         );
-
-
+        vms.add(vm1);
         vm1.start();
 
         /* Collocated VMs */
@@ -76,6 +84,7 @@ public class Test extends Process{
                     125, // Net bandwidth,
                     dpRate // Memory intensity
             );
+            vms.add(tmp);
             tmp.start();
             tmp.setLoad(vmSrcLoad[i-1]);
         }
@@ -93,7 +102,7 @@ public class Test extends Process{
         for (int i=1 ; i <= collocatedDst ; i++){
             tmp = new XVM(
                     host1,
-                    "vm"+i+collocatedSrc,
+                    "vm"+(i+collocatedSrc),
                     1, // Nb of vcpu
                     2048, // Ramsize,
                     125, // Net Bandwidth
@@ -102,14 +111,11 @@ public class Test extends Process{
                     125, // Net bandwidth,
                     dpRate // Memory intensity
             );
+            vms.add(tmp);
             tmp.start();
             tmp.setLoad(vmDstLoad[i-1]);
         }
 
-
-
-
-
         Msg.info("Round trip of VM1 (load "+load1+"%)");
         vm1.setLoad(load1);
         Msg.info("     - Launch migration from host 0 to host 1");
@@ -136,7 +142,9 @@ public class Test extends Process{
         endTime = Msg.getClock();
         Msg.info("     - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");
 
-        waitFor(100000);
         Main.setEndOfTest();
+        Msg.info("Destroy VMs");
+        for (VM vm: vms)
+          vm.destroy();
     }
 }