1 /* Copyright (c) 2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 package cloud.migration;
9 import org.simgrid.msg.Msg;
10 import org.simgrid.msg.VM;
11 import org.simgrid.msg.Host;
12 import org.simgrid.msg.HostNotFoundException;
13 import org.simgrid.msg.HostFailureException;
15 public class XVM extends VM {
16 private int dpIntensity;
19 private int currentLoad;
21 private Daemon daemon;
23 public XVM(Host host, String name,
24 int nbCores, int ramsize, int netBW, String diskPath, int diskSize, int migNetBW, int dpIntensity){
25 super(host, name, nbCores, ramsize, netBW, diskPath, diskSize, (int)(migNetBW*0.9), dpIntensity);
28 this. dpIntensity = dpIntensity ;
29 this.ramsize= ramsize;
30 this.daemon = new Daemon(this, 100);
33 public void setLoad(int load){
36 // this.getDaemon().setLoad(load);
48 } catch (HostNotFoundException e) {
54 public Daemon getDaemon(){
59 System.out.println("Remaining comp:" + this.daemon.getRemaining());
60 return this.currentLoad;
63 public void migrate(Host host) throws HostFailureException {
64 Msg.info("Start migration of VM " + this.getName() + " to " + host.getName());
65 Msg.info(" currentLoad:" + this.currentLoad + "/ramSize:" + this.ramsize + "/dpIntensity:" + this.dpIntensity
66 + "/remaining:" + String.format(java.util.Locale.US, "%.2E",this.daemon.getRemaining()));
69 } catch (Exception e){
70 Msg.info("Something wrong during the live migration of VM "+this.getName());
71 throw new HostFailureException();
73 this.setLoad(this.currentLoad); //Fixed the fact that setBound is not propagated to the new node.
74 Msg.info("End of migration of VM " + this.getName() + " to node " + host.getName());