Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge msg_vm.c - adrien (please note that there is one line (destruction of the tx_pr...
[simgrid.git] / examples / java / cloud / migration / XVM.java
index 97467cb..6e3671e 100644 (file)
@@ -8,6 +8,7 @@ package cloud.migration;
 
 import org.simgrid.msg.Host;
 import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.HostFailureException;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.VM;
 
@@ -65,10 +66,16 @@ public class XVM extends VM {
         return this.currentLoad;
     }
 
-    public void migrate(Host host){
+    public void migrate(Host host) throws HostFailureException {
         Msg.info("Start migration of VM " + this.getName() + " to " + host.getName());
-        Msg.info("    currentLoad:" + this.currentLoad + "/ramSize:" + this.ramsize + "/dpIntensity:" + this.dpIntensity + "/remaining:" + this.daemon.getRemaining());
-        super.migrate(host);
+        Msg.info("    currentLoad:" + this.currentLoad + "/ramSize:" + this.ramsize + "/dpIntensity:" + this.dpIntensity 
+                       + "/remaining:" + String.format(java.util.Locale.US, "%.2E",this.daemon.getRemaining()));
+        try{
+               super.migrate(host);
+       } catch (Exception e){
+               Msg.info("Something wrong during the live migration of VM "+this.getName());
+               throw new HostFailureException(); 
+        }
         this.setLoad(this.currentLoad); //Fixed the fact that setBound is not propagated to the new node.
         Msg.info("End of migration of VM " + this.getName() + " to node " + host.getName());
     }