Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
java-cloud-migration: destroy VMs at the end of the simulation.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Sat, 8 Feb 2014 22:07:52 +0000 (23:07 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Sat, 8 Feb 2014 22:07:52 +0000 (23:07 +0100)
examples/java/cloud/migration/Test.java

index ef7836a..d06e78e 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,6 +33,8 @@ 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;
@@ -48,8 +52,7 @@ public class Test extends Process{
                 125, // Net bandwidth,
                 dpRate // Memory intensity
         );
-
-
+        vms.add(vm1);
         vm1.start();
 
         /* Collocated VMs */
@@ -76,6 +79,7 @@ public class Test extends Process{
                     125, // Net bandwidth,
                     dpRate // Memory intensity
             );
+            vms.add(tmp);
             tmp.start();
             tmp.setLoad(vmSrcLoad[i-1]);
         }
@@ -102,14 +106,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");
@@ -138,5 +139,8 @@ public class Test extends Process{
 
         waitFor(100000);
         Main.setEndOfTest();
+        Msg.info("Destroy VMs");
+        for (VM vm: vms)
+          vm.destroy();
     }
 }