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;
12 public class Test extends Process{
14 Test(Host host, String name, String[] args) throws HostNotFoundException, NativeException {
15 super(host, name, args);
18 public void main(String[] strings) throws MsgException {
23 /* get hosts 1 and 2*/
28 host0 = Host.getByName("host0");
29 host1 = Host.getByName("host1");
30 }catch (HostNotFoundException e) {
31 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
47 -1, //size of disk image,
48 125, // Net bandwidth,
49 dpRate // Memory intensity
56 int collocatedSrc = 6;
67 for (int i=1 ; i<= collocatedSrc ; i++){
75 -1, //size of disk image,
76 125, // Net bandwidth,
77 dpRate // Memory intensity
80 tmp.setLoad(vmSrcLoad[i-1]);
83 int collocatedDst = 6;
93 for (int i=1 ; i <= collocatedDst ; i++){
100 null, //VM disk image
101 -1, //size of disk image,
102 125, // Net bandwidth,
103 dpRate // Memory intensity
106 tmp.setLoad(vmDstLoad[i-1]);
113 Msg.info("Round trip of VM1 (load "+load1+"%)");
115 Msg.info(" - Launch migration from host 0 to host 1");
116 startTime = Msg.getClock();
118 endTime = Msg.getClock();
119 Msg.info(" - End of Migration from host 0 to host 1 (duration:"+(endTime-startTime)+")");
120 Msg.info(" - Launch migration from host 1 to host 0");
121 startTime = Msg.getClock();
123 endTime = Msg.getClock();
124 Msg.info(" - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");
126 Msg.info("\n \n \nRound trip of VM1 (load "+load2+"%)");
128 Msg.info(" - Launch migration from host 0 to host 1");
129 startTime = Msg.getClock();
131 endTime = Msg.getClock();
132 Msg.info(" - End of Migration from host 0 to host 1 (duration:"+(endTime-startTime)+")");
133 Msg.info(" - Launch migration from host 1 to host 0");
134 startTime = Msg.getClock();
136 endTime = Msg.getClock();
137 Msg.info(" - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");