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.*;
10 import org.simgrid.msg.Process;
11 import java.util.ArrayList;
12 import java.util.List;
14 public class Test extends Process{
16 Test(Host host, String name, String[] args) throws HostNotFoundException, NativeException {
17 super(host, name, args);
20 public void main(String[] strings) throws MsgException {
25 /* get hosts 1 and 2*/
30 host0 = Host.getByName("host0");
31 host1 = Host.getByName("host1");
32 }catch (HostNotFoundException e) {
33 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
36 List<VM> vms = new ArrayList<VM>();
51 -1, //size of disk image,
52 125, // Net bandwidth,
53 dpRate // Memory intensity
59 int collocatedSrc = 6;
70 for (int i=1 ; i<= collocatedSrc ; i++){
78 -1, //size of disk image,
79 125, // Net bandwidth,
80 dpRate // Memory intensity
84 tmp.setLoad(vmSrcLoad[i-1]);
87 int collocatedDst = 6;
97 for (int i=1 ; i <= collocatedDst ; i++){
100 "vm"+i+collocatedSrc,
103 125, // Net Bandwidth
104 null, //VM disk image
105 -1, //size of disk image,
106 125, // Net bandwidth,
107 dpRate // Memory intensity
111 tmp.setLoad(vmDstLoad[i-1]);
114 Msg.info("Round trip of VM1 (load "+load1+"%)");
116 Msg.info(" - Launch migration from host 0 to host 1");
117 startTime = Msg.getClock();
119 endTime = Msg.getClock();
120 Msg.info(" - End of Migration from host 0 to host 1 (duration:"+(endTime-startTime)+")");
121 Msg.info(" - Launch migration from host 1 to host 0");
122 startTime = Msg.getClock();
124 endTime = Msg.getClock();
125 Msg.info(" - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");
127 Msg.info("\n \n \nRound trip of VM1 (load "+load2+"%)");
129 Msg.info(" - Launch migration from host 0 to host 1");
130 startTime = Msg.getClock();
132 endTime = Msg.getClock();
133 Msg.info(" - End of Migration from host 0 to host 1 (duration:"+(endTime-startTime)+")");
134 Msg.info(" - Launch migration from host 1 to host 0");
135 startTime = Msg.getClock();
137 endTime = Msg.getClock();
138 Msg.info(" - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");
142 Msg.info("Destroy VMs");