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. */
6 package cloud.migration;
8 import org.simgrid.msg.Host;
9 import org.simgrid.msg.HostNotFoundException;
10 import org.simgrid.msg.Msg;
11 import org.simgrid.msg.VM;
14 * A stupid VM extension to associate a daemon to the VM
16 public class XVM extends VM {
19 private int dpIntensity;
22 private int currentLoad;
24 private Daemon daemon;
26 public XVM(Host host, String name,
27 int nbCores, int ramsize, int netBW, String diskPath, int diskSize, int migNetBW, int dpIntensity){
28 super(host, name, nbCores, ramsize, netBW, diskPath, diskSize, (int)(migNetBW*0.9), dpIntensity);
31 this. dpIntensity = dpIntensity ;
32 this.ramsize= ramsize;
33 this.daemon = new Daemon(this, 100);
37 public void setLoad(int load){
40 // this.getDaemon().setLoad(load);
53 } catch (HostNotFoundException e) {
59 public Daemon getDaemon(){
63 System.out.println("Remaining comp:" + this.daemon.getRemaining());
64 return this.currentLoad;
67 public void migrate(Host host){
68 Msg.info("Start migration of VM " + this.getName() + " to " + host.getName());
69 Msg.info(" currentLoad:" + this.currentLoad + "/ramSize:" + this.ramsize + "/dpIntensity:" + this.dpIntensity + "/remaining:" + this.daemon.getRemaining());
71 this.setLoad(this.currentLoad); //Fixed the fact that setBound is not propagated to the new node.
72 Msg.info("End of migration of VM " + this.getName() + " to node " + host.getName());