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.Host;
10 import org.simgrid.msg.HostNotFoundException;
11 import org.simgrid.msg.Msg;
12 import org.simgrid.msg.VM;
15 * A stupid VM extension to associate a daemon to the VM
17 public class XVM extends VM {
20 private int dpIntensity;
23 private int currentLoad;
25 private Daemon daemon;
27 public XVM(Host host, String name,
28 int nbCores, int ramsize, int netBW, String diskPath, int diskSize, int migNetBW, int dpIntensity){
29 super(host, name, nbCores, ramsize, netBW, diskPath, diskSize, (int)(migNetBW*0.9), dpIntensity);
32 this. dpIntensity = dpIntensity ;
33 this.ramsize= ramsize;
34 this.daemon = new Daemon(this, 100);
38 public void setLoad(int load){
41 // this.getDaemon().setLoad(load);
54 } catch (HostNotFoundException e) {
60 public Daemon getDaemon(){
64 System.out.println("Remaining comp:" + this.daemon.getRemaining());
65 return this.currentLoad;
68 public void migrate(Host host){
69 Msg.info("Start migration of VM " + this.getName() + " to " + host.getName());
70 Msg.info(" currentLoad:" + this.currentLoad + "/ramSize:" + this.ramsize + "/dpIntensity:" + this.dpIntensity + "/remaining:" + this.daemon.getRemaining());
72 this.setLoad(this.currentLoad); //Fixed the fact that setBound is not propagated to the new node.
73 Msg.info("End of migration of VM " + this.getName() + " to node " + host.getName());