Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make msg_vm_migrate robust (i.e. now SRC or DST can be turned off during the migratio...
[simgrid.git] / examples / java / cloud / migration / XVM.java
index 03dd601..46b2dc9 100644 (file)
@@ -3,10 +3,12 @@
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
+
 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;
 
@@ -64,10 +66,15 @@ 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);
+        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());
     }