Commit 2a72d522 authored by Anton Beloglazov's avatar Anton Beloglazov

- Added: collecting state data for hosts and VMs

parent bd09bbc0
...@@ -46,7 +46,7 @@ public class Host { ...@@ -46,7 +46,7 @@ public class Host {
private VmScheduler vmScheduler; private VmScheduler vmScheduler;
/** The vm list. */ /** The vm list. */
private List<? extends Vm> vmList; private final List<? extends Vm> vmList = new ArrayList<Vm>();
/** The pe list. */ /** The pe list. */
private List<? extends Pe> peList; private List<? extends Pe> peList;
...@@ -55,8 +55,8 @@ public class Host { ...@@ -55,8 +55,8 @@ public class Host {
private boolean failed; private boolean failed;
/** The vms migrating in. */ /** The vms migrating in. */
private List<Vm> vmsMigratingIn; private final List<Vm> vmsMigratingIn = new ArrayList<Vm>();
/** The datacenter where the host is placed. */ /** The datacenter where the host is placed. */
private Datacenter datacenter; private Datacenter datacenter;
...@@ -83,7 +83,6 @@ public class Host { ...@@ -83,7 +83,6 @@ public class Host {
setVmScheduler(vmScheduler); setVmScheduler(vmScheduler);
setPeList(peList); setPeList(peList);
setVmList(new ArrayList<Vm>());
setFailed(false); setFailed(false);
} }
...@@ -118,13 +117,13 @@ public class Host { ...@@ -118,13 +117,13 @@ public class Host {
*/ */
public void addMigratingInVm(Vm vm) { public void addMigratingInVm(Vm vm) {
vm.setInMigration(true); vm.setInMigration(true);
if (!getVmsMigratingIn().contains(vm)) { if (!getVmsMigratingIn().contains(vm)) {
if (getStorage() < vm.getSize()){ if (getStorage() < vm.getSize()){
Log.printLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by storage"); Log.printLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by storage");
System.exit(0); System.exit(0);
} }
if (!getRamProvisioner().allocateRamForVm(vm, vm.getCurrentRequestedRam())) { if (!getRamProvisioner().allocateRamForVm(vm, vm.getCurrentRequestedRam())) {
Log.printLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by RAM"); Log.printLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by RAM");
System.exit(0); System.exit(0);
...@@ -142,7 +141,7 @@ public class Host { ...@@ -142,7 +141,7 @@ public class Host {
} }
setStorage(getStorage() - vm.getSize()); setStorage(getStorage() - vm.getSize());
getVmsMigratingIn().add(vm); getVmsMigratingIn().add(vm);
getVmList().add(vm); getVmList().add(vm);
updateVmsProcessing(CloudSim.clock()); updateVmsProcessing(CloudSim.clock());
...@@ -210,7 +209,7 @@ public class Host { ...@@ -210,7 +209,7 @@ public class Host {
Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by storage"); Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by storage");
return false; return false;
} }
if (!getRamProvisioner().allocateRamForVm(vm, vm.getCurrentRequestedRam())) { if (!getRamProvisioner().allocateRamForVm(vm, vm.getCurrentRequestedRam())) {
Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by RAM"); Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId() + " failed by RAM");
return false; return false;
...@@ -323,7 +322,7 @@ public class Host { ...@@ -323,7 +322,7 @@ public class Host {
* @return the free pes number * @return the free pes number
*/ */
public int getFreePesNumber() { public int getFreePesNumber() {
return PeList.getFreePesNumber((List<Pe>) getPeList()); return PeList.getFreePesNumber(getPeList());
} }
/** /**
...@@ -332,7 +331,7 @@ public class Host { ...@@ -332,7 +331,7 @@ public class Host {
* @return the total mips * @return the total mips
*/ */
public int getTotalMips() { public int getTotalMips() {
return PeList.getTotalMips((List<Pe>) getPeList()); return PeList.getTotalMips(getPeList());
} }
/** /**
...@@ -512,7 +511,7 @@ public class Host { ...@@ -512,7 +511,7 @@ public class Host {
protected void setVmScheduler(VmScheduler vmScheduler) { protected void setVmScheduler(VmScheduler vmScheduler) {
this.vmScheduler = vmScheduler; this.vmScheduler = vmScheduler;
} }
/** /**
* Gets the pe list. * Gets the pe list.
* *
...@@ -545,16 +544,6 @@ public class Host { ...@@ -545,16 +544,6 @@ public class Host {
return (List<T>) vmList; return (List<T>) vmList;
} }
/**
* Sets the vm list.
*
* @param <T> the generic type
* @param vmList the new vm list
*/
protected <T extends Vm> void setVmList(List<T> vmList) {
this.vmList = vmList;
}
/** /**
* Sets the storage. * Sets the storage.
* *
...@@ -588,7 +577,7 @@ public class Host { ...@@ -588,7 +577,7 @@ public class Host {
public boolean setFailed(String resName, boolean failed) { public boolean setFailed(String resName, boolean failed) {
// all the PEs are failed (or recovered, depending on fail) // all the PEs are failed (or recovered, depending on fail)
this.failed = failed; this.failed = failed;
PeList.setStatusFailed((List<Pe>) getPeList(), resName, getId(), failed); PeList.setStatusFailed(getPeList(), resName, getId(), failed);
return true; return true;
} }
...@@ -602,7 +591,7 @@ public class Host { ...@@ -602,7 +591,7 @@ public class Host {
public boolean setFailed(boolean failed) { public boolean setFailed(boolean failed) {
// all the PEs are failed (or recovered, depending on fail) // all the PEs are failed (or recovered, depending on fail)
this.failed = failed; this.failed = failed;
PeList.setStatusFailed((List<Pe>) getPeList(), failed); PeList.setStatusFailed(getPeList(), failed);
return true; return true;
} }
...@@ -617,7 +606,7 @@ public class Host { ...@@ -617,7 +606,7 @@ public class Host {
* @post $none * @post $none
*/ */
public boolean setPeStatus(int peId, int status) { public boolean setPeStatus(int peId, int status) {
return PeList.setPeStatus((List<Pe>) getPeList(), peId, status); return PeList.setPeStatus(getPeList(), peId, status);
} }
/** /**
...@@ -629,15 +618,6 @@ public class Host { ...@@ -629,15 +618,6 @@ public class Host {
return vmsMigratingIn; return vmsMigratingIn;
} }
/**
* Sets the vms migrating in.
*
* @param vmsMigratingIn the new vms migrating in
*/
protected void setVmsMigratingIn(List<Vm> vmsMigratingIn) {
this.vmsMigratingIn = vmsMigratingIn;
}
/** /**
* Gets the data center. * Gets the data center.
* @return the data center where the host runs * @return the data center where the host runs
...@@ -645,7 +625,7 @@ public class Host { ...@@ -645,7 +625,7 @@ public class Host {
public Datacenter getDatacenter(){ public Datacenter getDatacenter(){
return this.datacenter; return this.datacenter;
} }
/** /**
* Sets the data center. * Sets the data center.
* *
......
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import org.cloudbus.cloudsim.core.CloudSim; import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.lists.PeList; import org.cloudbus.cloudsim.lists.PeList;
...@@ -32,8 +31,8 @@ public class HostDynamicWorkload extends Host { ...@@ -32,8 +31,8 @@ public class HostDynamicWorkload extends Host {
/** The previous utilization mips. */ /** The previous utilization mips. */
private double previousUtilizationMips; private double previousUtilizationMips;
/** The under allocated mips. */ /** The state history. */
private Map<String, List<List<Double>>> underAllocatedMips; private final List<HostStateHistoryEntry> stateHistory = new LinkedList<HostStateHistoryEntry>();
/** /**
* Instantiates a new host. * Instantiates a new host.
...@@ -55,8 +54,6 @@ public class HostDynamicWorkload extends Host { ...@@ -55,8 +54,6 @@ public class HostDynamicWorkload extends Host {
super(id, ramProvisioner, bwProvisioner, storage, peList, vmScheduler); super(id, ramProvisioner, bwProvisioner, storage, peList, vmScheduler);
setUtilizationMips(0); setUtilizationMips(0);
setPreviousUtilizationMips(0); setPreviousUtilizationMips(0);
setUnderAllocatedMips(new HashMap<String, List<List<Double>>>());
setVmsMigratingIn(new ArrayList<Vm>());
} }
/* (non-Javadoc) /* (non-Javadoc)
...@@ -67,6 +64,7 @@ public class HostDynamicWorkload extends Host { ...@@ -67,6 +64,7 @@ public class HostDynamicWorkload extends Host {
double smallerTime = super.updateVmsProcessing(currentTime); double smallerTime = super.updateVmsProcessing(currentTime);
setPreviousUtilizationMips(getUtilizationMips()); setPreviousUtilizationMips(getUtilizationMips());
setUtilizationMips(0); setUtilizationMips(0);
double hostTotalRequestedMips = 0;
for (Vm vm : getVmList()) { for (Vm vm : getVmList()) {
getVmScheduler().deallocatePesForVm(vm); getVmScheduler().deallocatePesForVm(vm);
...@@ -97,6 +95,8 @@ public class HostDynamicWorkload extends Host { ...@@ -97,6 +95,8 @@ public class HostDynamicWorkload extends Host {
Log.formatLine("%.2f: [Host #" + getId() + "] MIPS for VM #" + vm.getId() + " by PEs (" + getPesNumber() + " * " + getVmScheduler().getPeCapacity() + ")." + pesString, CloudSim.clock()); Log.formatLine("%.2f: [Host #" + getId() + "] MIPS for VM #" + vm.getId() + " by PEs (" + getPesNumber() + " * " + getVmScheduler().getPeCapacity() + ")." + pesString, CloudSim.clock());
} }
vm.addStateHistoryEntry(currentTime, totalAllocatedMips, totalRequestedMips, (vm.isInMigration() && !getVmsMigratingIn().contains(vm)));
if (getVmsMigratingIn().contains(vm)) { if (getVmsMigratingIn().contains(vm)) {
Log.formatLine("%.2f: [Host #" + getId() + "] VM #" + vm.getId() + " is being migrated to Host #" + getId(), CloudSim.clock()); Log.formatLine("%.2f: [Host #" + getId() + "] VM #" + vm.getId() + " is being migrated to Host #" + getId(), CloudSim.clock());
} else { } else {
...@@ -104,8 +104,6 @@ public class HostDynamicWorkload extends Host { ...@@ -104,8 +104,6 @@ public class HostDynamicWorkload extends Host {
Log.formatLine("%.2f: [Host #" + getId() + "] Under allocated MIPS for VM #" + vm.getId() + ": %.2f", CloudSim.clock(), totalRequestedMips - totalAllocatedMips); Log.formatLine("%.2f: [Host #" + getId() + "] Under allocated MIPS for VM #" + vm.getId() + ": %.2f", CloudSim.clock(), totalRequestedMips - totalAllocatedMips);
} }
updateUnderAllocatedMips(vm, totalRequestedMips, totalAllocatedMips);
if (vm.isInMigration()) { if (vm.isInMigration()) {
Log.formatLine("%.2f: [Host #" + getId() + "] VM #" + vm.getId() + " is in migration", CloudSim.clock()); Log.formatLine("%.2f: [Host #" + getId() + "] VM #" + vm.getId() + " is in migration", CloudSim.clock());
totalAllocatedMips /= 0.9; // performance degradation due to migration - 10% totalAllocatedMips /= 0.9; // performance degradation due to migration - 10%
...@@ -113,8 +111,11 @@ public class HostDynamicWorkload extends Host { ...@@ -113,8 +111,11 @@ public class HostDynamicWorkload extends Host {
} }
setUtilizationMips(getUtilizationMips() + totalAllocatedMips); setUtilizationMips(getUtilizationMips() + totalAllocatedMips);
hostTotalRequestedMips += totalRequestedMips;
} }
addStateHistoryEntry(currentTime, getUtilizationMips(), hostTotalRequestedMips, (getUtilizationMips() > 0));
return smallerTime; return smallerTime;
} }
...@@ -175,29 +176,6 @@ public class HostDynamicWorkload extends Host { ...@@ -175,29 +176,6 @@ public class HostDynamicWorkload extends Host {
return getBwProvisioner().getUsedBw(); return getBwProvisioner().getUsedBw();
} }
/**
* Update under allocated mips.
*
* @param vm the vm
* @param requested the requested
* @param allocated the allocated
*/
protected void updateUnderAllocatedMips(Vm vm, double requested, double allocated) {
List<List<Double>> underAllocatedMipsArray;
List<Double> underAllocatedMips = new ArrayList<Double>();
underAllocatedMips.add(requested);
underAllocatedMips.add(allocated);
if (getUnderAllocatedMips().containsKey(vm.getUid())) {
underAllocatedMipsArray = getUnderAllocatedMips().get(vm.getUid());
} else {
underAllocatedMipsArray = new ArrayList<List<Double>>();
}
underAllocatedMipsArray.add(underAllocatedMips);
getUnderAllocatedMips().put(vm.getUid(), underAllocatedMipsArray);
}
/** /**
* Get current utilization of CPU in percentage. * Get current utilization of CPU in percentage.
* *
...@@ -269,22 +247,25 @@ public class HostDynamicWorkload extends Host { ...@@ -269,22 +247,25 @@ public class HostDynamicWorkload extends Host {
this.previousUtilizationMips = previousUtilizationMips; this.previousUtilizationMips = previousUtilizationMips;
} }
/**
* Gets the under allocated mips.
*
* @return the under allocated mips
*/
public Map<String, List<List<Double>>> getUnderAllocatedMips() {
return underAllocatedMips;
}
/** /**
* Sets the under allocated mips. * Gets the state history.
* *
* @param underAllocatedMips the under allocated mips * @return the state history
*/ */
protected void setUnderAllocatedMips(Map<String, List<List<Double>>> underAllocatedMips) { public List<HostStateHistoryEntry> getStateHistory() {
this.underAllocatedMips = underAllocatedMips; return stateHistory;
}
/**
* Adds the state history entry.
*
* @param time the time
* @param allocatedMips the allocated mips
* @param requestedMips the requested mips
* @param isActive the is active
*/
public void addStateHistoryEntry(double time, double allocatedMips, double requestedMips, boolean isActive) {
getStateHistory().add(new HostStateHistoryEntry(time, allocatedMips, requestedMips, isActive));
} }
} }
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2011, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim;
/**
* The Class HostStateHistoryEntry.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.1.2
*/
public class HostStateHistoryEntry {
/** The time. */
private double time;
/** The allocated mips. */
private double allocatedMips;
/** The requested mips. */
private double requestedMips;
/** The is active. */
private boolean isActive;
/**
* Instantiates a new vm mips allocation history entry.
*
* @param time the time
* @param allocatedMips the allocated mips
* @param requestedMips the requested mips
* @param isActive the is active
*/
public HostStateHistoryEntry(double time, double allocatedMips, double requestedMips, boolean isActive) {
setTime(time);
setAllocatedMips(allocatedMips);
setRequestedMips(requestedMips);
setActive(isActive);
}
/**
* Sets the time.
*
* @param time the new time
*/
protected void setTime(double time) {
this.time = time;
}
/**
* Gets the time.
*
* @return the time
*/
public double getTime() {
return time;
}
/**
* Sets the allocated mips.
*
* @param allocatedMips the new allocated mips
*/
protected void setAllocatedMips(double allocatedMips) {
this.allocatedMips = allocatedMips;
}
/**
* Gets the allocated mips.
*
* @return the allocated mips
*/
public double getAllocatedMips() {
return allocatedMips;
}
/**
* Sets the requested mips.
*
* @param requestedMips the new requested mips
*/
protected void setRequestedMips(double requestedMips) {
this.requestedMips = requestedMips;
}
/**
* Gets the requested mips.
*
* @return the requested mips
*/
public double getRequestedMips() {
return requestedMips;
}
/**
* Sets the active.
*
* @param isActive the new active
*/
public void setActive(boolean isActive) {
this.isActive = isActive;
}
/**
* Checks if is active.
*
* @return true, if is active
*/
public boolean isActive() {
return isActive;
}
}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
...@@ -29,6 +30,7 @@ public class Vm { ...@@ -29,6 +30,7 @@ public class Vm {
/** The user id. */ /** The user id. */
private int userId; private int userId;
/** The uid. */
private String uid; private String uid;
/** The size. */ /** The size. */
...@@ -73,20 +75,21 @@ public class Vm { ...@@ -73,20 +75,21 @@ public class Vm {
/** The recently created. */ /** The recently created. */
private boolean recentlyCreated; private boolean recentlyCreated;
/** The mips allocation history. */
private final List<VmStateHistoryEntry> stateHistory = new LinkedList<VmStateHistoryEntry>();
/** /**
* Creates a new VMCharacteristics object. * Creates a new VMCharacteristics object.
* *
* @param id unique ID of the VM * @param id unique ID of the VM
* @param userId ID of the VM's owner * @param userId ID of the VM's owner
* @param size amount of storage * @param mips the mips
* @param pesNumber amount of CPUs
* @param ram amount of ram * @param ram amount of ram
* @param bw amount of bandwidth * @param bw amount of bandwidth
* @param pesNumber amount of CPUs * @param size amount of storage
* @param vmm virtual machine monitor * @param vmm virtual machine monitor
* @param cloudletScheduler cloudletScheduler policy for cloudlets * @param cloudletScheduler cloudletScheduler policy for cloudlets
* @param priority the priority
* @param mips the mips
*
* @pre id >= 0 * @pre id >= 0
* @pre userId >= 0 * @pre userId >= 0
* @pre size > 0 * @pre size > 0
...@@ -179,7 +182,7 @@ public class Vm { ...@@ -179,7 +182,7 @@ public class Vm {
} }
return totalRequestedMips; return totalRequestedMips;
} }
/** /**
* Gets the current requested max mips among all virtual PEs. * Gets the current requested max mips among all virtual PEs.
* *
...@@ -235,6 +238,11 @@ public class Vm { ...@@ -235,6 +238,11 @@ public class Vm {
return getTotalUtilizationOfCpu(time) * getMips(); return getTotalUtilizationOfCpu(time) * getMips();
} }
/**
* Sets the uid.
*
* @param uid the new uid
*/
public void setUid(String uid) { public void setUid(String uid) {
this.uid = uid; this.uid = uid;
} }
...@@ -576,4 +584,25 @@ public class Vm { ...@@ -576,4 +584,25 @@ public class Vm {
this.recentlyCreated = recentlyCreated; this.recentlyCreated = recentlyCreated;
} }
/**
* Gets the state history.
*
* @return the state history
*/
public List<VmStateHistoryEntry> getStateHistory() {
return stateHistory;
}
/**
* Adds the state history entry.
*
* @param time the time
* @param allocatedMips the allocated mips
* @param requestedMips the requested mips
* @param isInMigration the is in migration
*/
public void addStateHistoryEntry(double time, double allocatedMips, double requestedMips, boolean isInMigration) {
getStateHistory().add(new VmStateHistoryEntry(time, allocatedMips, requestedMips, isInMigration));
}
} }
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2011, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim;
/**
* The Class VmMipsAllocationHistoryEntry.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.1.2
*/
public class VmStateHistoryEntry {
/** The time. */
private double time;
/** The allocated mips. */
private double allocatedMips;
/** The requested mips. */
private double requestedMips;
/** The is in migration. */
private boolean isInMigration;
/**
* Instantiates a new vm mips allocation history entry.
*
* @param time the time
* @param allocatedMips the allocated mips
* @param requestedMips the requested mips
* @param isInMigration the is in migration
*/
public VmStateHistoryEntry(double time, double allocatedMips, double requestedMips, boolean isInMigration) {
setTime(time);
setAllocatedMips(allocatedMips);
setRequestedMips(requestedMips);
setInMigration(isInMigration);
}
/**
* Sets the time.
*
* @param time the new time
*/
protected void setTime(double time) {
this.time = time;
}
/**
* Gets the time.
*
* @return the time
*/
public double getTime() {
return time;
}
/**
* Sets the allocated mips.
*
* @param allocatedMips the new allocated mips
*/
protected void setAllocatedMips(double allocatedMips) {
this.allocatedMips = allocatedMips;
}
/**
* Gets the allocated mips.
*
* @return the allocated mips
*/
public double getAllocatedMips() {
return allocatedMips;
}
/**
* Sets the requested mips.
*
* @param requestedMips the new requested mips
*/
protected void setRequestedMips(double requestedMips) {
this.requestedMips = requestedMips;
}
/**
* Gets the requested mips.
*
* @return the requested mips
*/
public double getRequestedMips() {
return requestedMips;
}
/**
* Sets the in migration.
*
* @param isInMigration the new in migration
*/
protected void setInMigration(boolean isInMigration) {
this.isInMigration = isInMigration;
}
/**
* Checks if is in migration.
*
* @return true, if is in migration
*/
public boolean isInMigration() {
return isInMigration;
}
}
...@@ -8,11 +8,8 @@ ...@@ -8,11 +8,8 @@
package org.cloudbus.cloudsim.power; package org.cloudbus.cloudsim.power;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import org.cloudbus.cloudsim.Datacenter; import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterCharacteristics; import org.cloudbus.cloudsim.DatacenterCharacteristics;
...@@ -100,16 +97,16 @@ public class PowerDatacenter extends Datacenter { ...@@ -100,16 +97,16 @@ public class PowerDatacenter extends Datacenter {
Vm vm = (Vm) migrate.get("vm"); Vm vm = (Vm) migrate.get("vm");
PowerHost targetHost = (PowerHost) migrate.get("host"); PowerHost targetHost = (PowerHost) migrate.get("host");
PowerHost oldHost = (PowerHost) vm.getHost(); PowerHost oldHost = (PowerHost) vm.getHost();
if (oldHost == null) { if (oldHost == null) {
Log.formatLine("%.2f: Migration of VM #%d to Host #%d is started", currentTime, vm.getId(), targetHost.getId()); Log.formatLine("%.2f: Migration of VM #%d to Host #%d is started", currentTime, vm.getId(), targetHost.getId());
} else { } else {
Log.formatLine("%.2f: Migration of VM #%d from Host #%d to Host #%d is started", currentTime, vm.getId(), oldHost.getId(), targetHost.getId()); Log.formatLine("%.2f: Migration of VM #%d from Host #%d to Host #%d is started", currentTime, vm.getId(), oldHost.getId(), targetHost.getId());
} }
targetHost.addMigratingInVm(vm); targetHost.addMigratingInVm(vm);
incrementMigrationCount(); incrementMigrationCount();
/** VM migration delay = RAM / bandwidth **/ /** VM migration delay = RAM / bandwidth **/
// we use BW / 2 to model BW available for migration purposes, the other half of BW is for VM communication // we use BW / 2 to model BW available for migration purposes, the other half of BW is for VM communication
// around 16 seconds for 1024 MB using 1 Gbit/s network // around 16 seconds for 1024 MB using 1 Gbit/s network
...@@ -127,7 +124,7 @@ public class PowerDatacenter extends Datacenter { ...@@ -127,7 +124,7 @@ public class PowerDatacenter extends Datacenter {
setLastProcessTime(currentTime); setLastProcessTime(currentTime);
} }
} }
/** /**
* Update cloudet processing without scheduling future events. * Update cloudet processing without scheduling future events.
* *
...@@ -169,9 +166,9 @@ public class PowerDatacenter extends Datacenter { ...@@ -169,9 +166,9 @@ public class PowerDatacenter extends Datacenter {
} }
setPower(getPower() + timeFrameDatacenterEnergy); setPower(getPower() + timeFrameDatacenterEnergy);
checkCloudletCompletion(); checkCloudletCompletion();
/** Remove completed VMs **/ /** Remove completed VMs **/
for (PowerHost host : this.<PowerHost>getHostList()) { for (PowerHost host : this.<PowerHost>getHostList()) {
for (Vm vm : host.getCompletedVms()) { for (Vm vm : host.getCompletedVms()) {
...@@ -182,19 +179,19 @@ public class PowerDatacenter extends Datacenter { ...@@ -182,19 +179,19 @@ public class PowerDatacenter extends Datacenter {
} }
Log.printLine(); Log.printLine();
setLastProcessTime(currentTime); setLastProcessTime(currentTime);
return minTime; return minTime;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.cloudbus.cloudsim.Datacenter#processVmMigrate(org.cloudbus.cloudsim.core.SimEvent, boolean) * @see org.cloudbus.cloudsim.Datacenter#processVmMigrate(org.cloudbus.cloudsim.core.SimEvent, boolean)
*/ */
@Override @Override
protected void processVmMigrate(SimEvent ev, boolean ack) { protected void processVmMigrate(SimEvent ev, boolean ack) {
updateCloudetProcessingWithoutSchedulingFutureEvents(); updateCloudetProcessingWithoutSchedulingFutureEvents();
super.processVmMigrate(ev, ack); super.processVmMigrate(ev, ack);
updateCloudetProcessingWithoutSchedulingFutureEvents(); updateCloudetProcessingWithoutSchedulingFutureEvents();
} }
/* (non-Javadoc) /* (non-Javadoc)
...@@ -240,25 +237,6 @@ public class PowerDatacenter extends Datacenter { ...@@ -240,25 +237,6 @@ public class PowerDatacenter extends Datacenter {
return result; return result;
} }
/**
* Gets the under allocated mips.
*
* @return the under allocated mips
*/
public Map<String, List<List<Double>>> getUnderAllocatedMips() {
Map<String, List<List<Double>>> underAllocatedMips = new HashMap<String, List<List<Double>>>();
for (PowerHost host : this.<PowerHost>getHostList()) {
for (Entry<String, List<List<Double>>> entry : host.getUnderAllocatedMips().entrySet()) {
if (!underAllocatedMips.containsKey(entry.getKey())) {
underAllocatedMips.put(entry.getKey(), new ArrayList<List<Double>>());
}
underAllocatedMips.get(entry.getKey()).addAll(entry.getValue());
}
}
return underAllocatedMips;
}
/** /**
* Checks if is disable migrations. * Checks if is disable migrations.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment