Commit 7c0cab28 authored by Rafael Vieira Falcão's avatar Rafael Vieira Falcão
Browse files

Merge branch 'sla-simulation' of...

Merge branch 'sla-simulation' of https://git.lsd.ufcg.edu.br/lenovo-autonomic/cloudsimplus into sla-simulation
parents bd3683c6 dcc1d462
......@@ -22,6 +22,7 @@ import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.ResourceProvisioner;
import org.cloudbus.cloudsim.provisioners.ResourceProvisionerShared;
import org.cloudbus.cloudsim.provisioners.ResourceProvisionerSimple;
import org.cloudbus.cloudsim.resources.Iops;
import org.cloudbus.cloudsim.resources.Pe;
import org.cloudbus.cloudsim.resources.PeSimple;
import org.cloudbus.cloudsim.schedulers.cloudlet.CloudletSchedulerSpaceShared;
......@@ -37,6 +38,9 @@ import org.cloudbus.cloudsim.utilizationmodels.UtilizationModelFull;
import org.cloudbus.cloudsim.utilizationmodels.UtilizationModelUneven;
import org.cloudbus.cloudsim.vms.Vm;
import org.cloudbus.cloudsim.vms.VmSimple;
import org.cloudsimplus.autoscaling.VerticalVmScaling;
import org.cloudsimplus.autoscaling.VerticalVmScalingSimple;
import org.cloudsimplus.autoscaling.resources.ResourceScalingInstantaneous;
import org.cloudsimplus.builders.tables.CloudletsTableBuilder;
import org.cloudsimplus.slametrics.SlaContract;
import org.cloudsimplus.slametrics.SlaMetric;
......@@ -73,19 +77,19 @@ public class SlaExploitationSimulation {
public static int MIGRATION_TIME;
// HOST
private static final int HOST_PES = 160;
private static final int HOST_PES = 25;
public static final int HOST_MIPS = 1000;
public static final int HOST_RAM = 32 * 1024;
public static final int HOST_BW = 1024;
public static final int HOST_BASE_STORAGE = 10 * 1024 * 1024;
public static final int HOST_RAM = 50 * 1024;
public static final int HOST_BW = 1000000;
public static final int HOST_BASE_STORAGE = 2 * 1024 * 1024;
// VM AND CLOUDLET
private static final int NUM_INSTR = 1;
private static final int VM_PES = 1;
private static final int VM_MIPS = 500;
private static final int VM_BW = 10;
private static final int VM_RAM = 1;
private static final int VM_STORAGE = 100 * 1024;
private static final int VM_BW = 1000;
private static final int VM_RAM = 1024;
private static final int VM_STORAGE = 10 * 1024;
public static final double IMPRECISION = 0.0001;
......@@ -100,16 +104,16 @@ public class SlaExploitationSimulation {
public static void main(String[] args) {
//PATH = args[0];
SLA_TIGHT_HOSTS = 1;
SLA_LOOSE_HOSTS = 0;
HOST_IOPS = 500;
SLA_TIGHT_HOSTS = 5;
SLA_LOOSE_HOSTS = 5;
HOST_IOPS = 2500;
MINIMUM_IOPS = 100;
LOW_AVAILABILITY = 99;
VMS = 1;
CLOUDLETS = 1;
CLOUDLET_IOPS = 1000;
LOW_AVAILABILITY = 99.9;
VMS = 250;
CLOUDLETS = 250;
VM_IOPS = 100;
MIGRATION_TIME = 10;
CLOUDLET_IOPS = 5 * 60 * 60 * VM_IOPS;
MIGRATION_TIME = 30;
random = new Random(1);
......@@ -200,7 +204,7 @@ public class SlaExploitationSimulation {
List<Pe> peList = new ArrayList<Pe>(); // List of CPU cores
for (int i = 0; i < peNumber; i++) {
peList.add(new PeSimple(1000, new PeProvisionerSimple()));
peList.add(new PeSimple(HOST_MIPS, new PeProvisionerSimple()));
}
return peList;
......@@ -241,9 +245,9 @@ public class SlaExploitationSimulation {
final List<Cloudlet> list = new ArrayList<>(CLOUDLETS);
UtilizationModel utilization = new UtilizationModelFull();
for (int i = 0; i < CLOUDLETS; i++) {
Cloudlet cloudlet = new CloudletSimple(i, NUM_INSTR, VM_PES).setFileSize(1024)
.setOutputSize(1024).setUtilizationModel(utilization)
.setUtilizationModelIops(new UtilizationModelUneven(0, 100, random.nextLong()))
Cloudlet cloudlet = new CloudletSimple(i, NUM_INSTR, VM_PES).setFileSize(1)
.setOutputSize(1).setUtilizationModel(utilization)
// .setUtilizationModelIops(new UtilizationModelUneven(0, 100, random.nextLong()))
.setIops(CLOUDLET_IOPS);
list.add(cloudlet);
......
......@@ -44,9 +44,11 @@ public class VmAllocationPolicyMigrationSla extends VmAllocationPolicyAbstract {
private static final String TIGHT = "TIGHT";
private static final Double IMPRECISION = 0.001;
private final int MIGRATION_TIME;
private static final double UPPER_THRESHOLD = 0.8;
private static final double LOWER_THRESHOLD = 0.2;
private VerticalVmScaling iopsScaling;
private final int MIGRATION_TIME;
private VmAllocationPolicy allocationPolicy;
......@@ -65,15 +67,6 @@ public class VmAllocationPolicyMigrationSla extends VmAllocationPolicyAbstract {
this.MIGRATION_TIME = migrationTime;
this.previousFragmentation = new HashMap<Host, Double>();
this.currentFragmentation = new HashMap<Host, Double>();
this.iopsScaling = null;
}
public VmAllocationPolicyMigrationSla(VmAllocationPolicy allocationPolicy, int migrationTime, VerticalVmScaling iopsScaling) {
this.allocationPolicy = allocationPolicy;
this.MIGRATION_TIME = migrationTime;
this.previousFragmentation = new HashMap<Host, Double>();
this.currentFragmentation = new HashMap<Host, Double>();
this.iopsScaling = iopsScaling;
}
@Override
......@@ -108,6 +101,7 @@ public class VmAllocationPolicyMigrationSla extends VmAllocationPolicyAbstract {
}
Map<Vm, Host> migrationMap = new HashMap<Vm, Host>();
VerticalVmScaling iopsScaling;
//for each hell host
for(Host h : tightSlaHosts){
......@@ -123,7 +117,10 @@ public class VmAllocationPolicyMigrationSla extends VmAllocationPolicyAbstract {
if(h.isSuitableForVm(vm) && h.addMigratingInVm(vm)){
migrationMap.put(vm, h);
vmIterator.remove();
iopsScaling = createVerticalIopsScaling();
vm.setIopsVerticalScaling(iopsScaling);
iopsScaling.setVm(vm);
}
}
}
......@@ -145,16 +142,119 @@ public class VmAllocationPolicyMigrationSla extends VmAllocationPolicyAbstract {
if(h.isSuitableForVm(vm) && h.addMigratingInVm(vm)){
migrationMap.put(vm, h);
vmIterator.remove();
vm.setIopsVerticalScaling(VerticalVmScaling.NULL);
iopsScaling = VerticalVmScaling.NULL;
vm.setIopsVerticalScaling(iopsScaling);
iopsScaling.setVm(vm);
}
}
}
previousFragmentation.putAll(currentFragmentation);
// if(!migrationMap.isEmpty()){
// System.out.println(migrationMap);
// try {
// Thread.sleep(10000);
// } catch (Exception e) {
// // TODO: handle exception
// }
// }
return migrationMap;
}
/**
* Creates a {@link VerticalVmScaling} for scaling VM's IOPS when it's under or
* overloaded.
*
* <p>
* Realize the lower and upper thresholds are defined inside this method by
* using references to the methods {@link #lowerIopsUtilizationThreshold(Vm)}
* and {@link #upperIopsUtilizationThreshold(Vm)}. These methods enable defining
* thresholds in a dynamic way and even different thresholds for distinct VMs.
* Therefore, it's a powerful mechanism.
* </p>
*
* <p>
* However, if you are defining thresholds in a static way, and they are the
* same for all VMs, you can use a Lambda Expression like below, for instance,
* instead of creating a new method that just returns a constant value:<br>
* {@code verticalIopsScaling.setLowerThresholdFunction(vm -> 0.4);}
* </p>
*
* @see #createListOfScalableVms(int)
*/
private VerticalVmScaling createVerticalIopsScaling() {
// The percentage in which the amount of IOPS has to be scaled
final double scalingFactor = 0.25;
VerticalVmScalingSimple verticalIopsScaling = new VerticalVmScalingSimple(Iops.class, scalingFactor);
/*
* Instead of gradually increasing or decreasing the amount of IOPS, when the
* scaling object detects the Disk usage is above or below the defined
* thresholds, it will automatically calculate the amount of IOPS to add/remove
* to move the VM from the over or underload condition.
*/
verticalIopsScaling.setResourceScaling(new ResourceScalingInstantaneous());
/**
* Different from the line above, the line below implements a ResourceScaling
* using a Lambda Expression. It is just an example which scales the resource
* twice the amount defined by the scaling factor defined in the constructor.
*
* Realize that if the setResourceScaling method is not called, a
* ResourceScalingGradual will be used, which scales the resource according to
* the scaling factor. The lower and upper thresholds after this line can also
* be defined using a Lambda Expression.
*
* So, here we are defining our own {@link ResourceScaling} instead of using the
* available ones such as the {@link ResourceScalingGradual} or
* {@link ResourceScalingInstantaneous}.
*/
// verticalIopsScaling.setResourceScaling(vs ->
// 2*vs.getScalingFactor()*vs.getAllocatedResource());
verticalIopsScaling.setLowerThresholdFunction(this::lowerIopsUtilizationThreshold);
verticalIopsScaling.setUpperThresholdFunction(this::upperIopsUtilizationThreshold);
return verticalIopsScaling;
}
/**
* Defines the minimum Disk utilization percentage that indicates a Vm is
* underloaded. This function is using a statically defined threshold, but it
* would be defined a dynamic threshold based on any condition you want. A
* reference to this method is assigned to each Vertical VM Scaling created.
*
* @param vm
* the VM to check if its Disk is underloaded. <b>The parameter is
* not being used internally, which means the same threshold is used
* for any Vm.</b>
* @return the lower Disk utilization threshold
* @see #createVerticalIopsScaling()
*/
private double lowerIopsUtilizationThreshold(Vm vm) {
return LOWER_THRESHOLD;
}
/**
* Defines the maximum Disk utilization percentage that indicates a Vm is
* overloaded. This function is using a statically defined threshold, but it
* would be defined a dynamic threshold based on any condition you want. A
* reference to this method is assigned to each Vertical VM Scaling created.
*
* @param vm
* the VM to check if its Disk is overloaded. The parameter is not
* being used internally, that means the same threshold is used for
* any Vm.
* @return the upper Disk utilization threshold
* @see #createVerticalIopsScaling()
*/
private double upperIopsUtilizationThreshold(Vm vm) {
return UPPER_THRESHOLD;
}
/**
* Sorts a list of VMs from high to low fragmentation,
* or a list of hosts from low to high fragmentation
......@@ -248,8 +348,7 @@ public class VmAllocationPolicyMigrationSla extends VmAllocationPolicyAbstract {
for (Host h : tightSlaHosts) {
for (Vm vm : h.getVmList()) {
if (vm.getMonitor().getCumulativeVmViolationTime(clock) + MIGRATION_TIME >=
vm.getMonitor().getMaximumAllowedSlaViolationTime()) {
if (vm.getMonitor().getCumulativeCredit(clock) - MIGRATION_TIME >= 0) {
vmList.add(vm);
}
}
......
package org.cloudbus.cloudsim.allocationpolicies.migration;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -100,15 +101,34 @@ public class VmAllocationPolicyMigrationSlaFixedTightHost extends VmAllocationPo
private Map<Vm, Host> optimisticConsolidation(Map<Vm, Host> actualMigrationMap) {
List<Host> orderedLooseHosts = getOrderedLooseHosts();
List<Host> sortedLooseHosts = getLooseHostsSortedAscendingByFragmentation();
for (int j = sortedLooseHosts.size() - 1; j >= 0; j--) {
for (int i = 0; i < sortedLooseHosts.size(); i++) {
if(i == j || sortedLooseHosts.get(i).getVmList().isEmpty())
continue;
for (Vm vm : sortedLooseHosts.get(i).getVmList()) {
if(sortedLooseHosts.get(j).isSuitableForVm(vm) && sortedLooseHosts.get(j).addMigratingInVm(vm)) {
actualMigrationMap.put(vm, sortedLooseHosts.get(j));
}
}
}
}
return actualMigrationMap;
}
private Map<Vm, Host> optimisticConsolidation2(Map<Vm, Host> actualMigrationMap) {
List<Host> sortedLooseHosts = getLooseHostsSortedAscendingByFragmentation();
Iterator<Host> hostIt = sortedLooseHosts.listIterator();
for (int i = 0; i < orderedLooseHosts.size(); i++) {
for (int j = orderedLooseHosts.size() - 1; j >= 0; j--) {
if(i == j || orderedLooseHosts.get(i).getVmList().isEmpty())
break;
for (Vm vm : orderedLooseHosts.get(i).getVmList()) {
if(orderedLooseHosts.get(j).isSuitableForVm(vm)) {
actualMigrationMap.put(vm, orderedLooseHosts.get(j));
for (int j = sortedLooseHosts.size() - 1; j >= 0; j--) {
for (int i = 0; i < sortedLooseHosts.size(); i++) {
if(i == j || sortedLooseHosts.get(i).getVmList().isEmpty())
continue;
for (Vm vm : sortedLooseHosts.get(i).getVmList()) {
if(sortedLooseHosts.get(j).isSuitableForVm(vm) && sortedLooseHosts.get(j).addMigratingInVm(vm)) {
actualMigrationMap.put(vm, sortedLooseHosts.get(j));
}
}
}
......@@ -117,8 +137,8 @@ public class VmAllocationPolicyMigrationSlaFixedTightHost extends VmAllocationPo
return actualMigrationMap;
}
// Returns the list of loose hosts ordered (increse order) by the number of Vm
private List<Host> getOrderedLooseHosts() {
// Returns the list of loose hosts ordered (increase order) by the number of Vm
private List<Host> getLooseHostsSortedAscendingByFragmentation() {
List<Host> looseHosts = getHostsWithLooseSla();
sort(looseHosts);
Collections.reverse(looseHosts);
......
......@@ -208,7 +208,12 @@ public class CloudSim implements Simulation {
this.alreadyRunOnce = true;
while (running) {
int count = 0;
runClockTickAndProcessFutureEventQueue();
if(clock % 3600 <= 10) {
count++;
printMessage(count + "hr passed " + clock);
}
if(abortRequested){
printMessage("\n================== Simulation aborted under request at time "+ clock +" ==================");
return clock;
......
......@@ -332,12 +332,12 @@ public class HostSimple implements Host {
}
if (!vmScheduler.isSuitableForVm(vm)) {
Log.printFormattedLine(
"%.2f: %s: [%s] Allocation of %s to %s failed due to lack of PEs.\n\t "+
"Required %d PEs of %.0f MIPS (%.0f MIPS total). However, there are just %d working PEs of %.0f MIPS, from which %.0f MIPS are available.",
getSimulation().clock(), getClass().getSimpleName(), msg, vm, this,
vm.getNumberOfPes(), vm.getMips(), vm.getTotalMipsCapacity(),
vmScheduler.getWorkingPeList().size(), getMips(), vmScheduler.getAvailableMips());
// Log.printFormattedLine(
// "%.2f: %s: [%s] Allocation of %s to %s failed due to lack of PEs.\n\t "+
// "Required %d PEs of %.0f MIPS (%.0f MIPS total). However, there are just %d working PEs of %.0f MIPS, from which %.0f MIPS are available.",
// getSimulation().clock(), getClass().getSimpleName(), msg, vm, this,
// vm.getNumberOfPes(), vm.getMips(), vm.getTotalMipsCapacity(),
// vmScheduler.getWorkingPeList().size(), getMips(), vmScheduler.getAvailableMips());
return false;
}
......
......@@ -660,10 +660,10 @@ public abstract class CloudletSchedulerAbstract implements CloudletScheduler {
final long requested = (long)getCloudletIopsAbsoluteUtilization(cloudlet);
if(requested > iops.getAvailableResource()){
Log.printFormattedLine(
"%.2f: %s: %s requested %d MB of RAM but just %d was available and allocated to it.",
"%.2f: %s: %s requested %d MB of IOPS but just %d was available and allocated to it.",
vm.getSimulation().clock(), getClass().getSimpleName(), cloudlet, requested, iops.getAvailableResource());
}
iops.allocateResource(Math.min(requested, iops.getAvailableResource()));
// iops.allocateResource(Math.min(requested, iops.getAvailableResource())); FIXME should be removed??
}
}
......
......@@ -91,10 +91,6 @@ public class VmSchedulerTimeShared extends VmSchedulerAbstract {
*/
private boolean allocateMipsShareForVmInternal(final Vm vm, final List<Double> requestedMips) {
if(vm.getId()>=160){
System.out.println("debug");
}
if (!isAllowedToAllocateMips(requestedMips)) {
return false;
}
......@@ -115,9 +111,6 @@ public class VmSchedulerTimeShared extends VmSchedulerAbstract {
* @see #getMipsShareRequestedReduced(Vm, List)
*/
protected void allocateMipsShareForVm(final Vm vm, final List<Double> requestedMipsReduced) {
if(vm.getId()>=160){
System.out.println("debug");
}
final List<Double> mipsShare = getMipsShareToAllocate(vm, requestedMipsReduced);
getAllocatedMipsMap().put(vm, mipsShare);
}
......
......@@ -74,10 +74,6 @@ public class VmSchedulerTimeSharedOverSubscription extends VmSchedulerTimeShared
@Override
protected void allocateMipsShareForVm(final Vm vm, final List<Double> requestedMipsReduced) {
if(vm.getId()>=160){
System.out.println("debug");
}
final double totalRequestedMips = requestedMipsReduced.stream().reduce(0.0, Double::sum);
if (getAvailableMips() >= totalRequestedMips) {
super.allocateMipsShareForVm(vm, requestedMipsReduced);
......
......@@ -135,10 +135,6 @@ public class CsvGenerator {
writer.append(',');
writer.append("cloudlet-id");
writer.append(',');
writer.append("current-sla-violation");
writer.append(',');
writer.append("cumulative-sla-violation");
writer.append(',');
writer.append("vm-credit");
writer.append(',');
writer.append('\n');
......@@ -158,10 +154,6 @@ public class CsvGenerator {
writer.append(String.valueOf(i));
writer.append(',');
writer.append(String.valueOf(cl.getId()));
writer.append(',');
writer.append(String.valueOf(cl.getVm().getMonitor().getInstantaneousVmViolationTime(i)));
writer.append(',');
writer.append(String.valueOf(cl.getVm().getMonitor().getCumulativeVmViolationTime(i)));
writer.append(',');
writer.append(String.valueOf(cl.getVm().getMonitor().getCumulativeCredit(i)));
writer.append('\n');
......
......@@ -42,6 +42,7 @@ public class UtilizationModelUneven extends UtilizationModelAbstract {
setUpperLimit(upper_limit);
setHistory(new HashMap<Double, Double>());
setProbGenerator(new UniformDistr(0, 1, seed));
this.setUnit(Unit.ABSOLUTE);
}
/*
......
......@@ -146,10 +146,11 @@ public class VmAllocationPolicyMigrationSlaTest {
Vm vm0 = new VmSimple(0, 0);
vm0.setContract(contract);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS, 0, false)); // allocatedIops is
// MINIMUM_IOPS
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS, 0, false)); // allocatedIops is MINIMUM_IOPS
vm0.setIOPSUtilization(0, MINIMUM_IOPS);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), 0, 0,
MINIMUM_IOPS, 0, false));
vm0.setIOPSUtilization(5, MINIMUM_IOPS);
Host h0 = createMockedHostWithIops(1, 0, vm0, 0, 0, 0, null);
List<Host> hosts = new ArrayList<Host>();
......@@ -161,10 +162,11 @@ public class VmAllocationPolicyMigrationSlaTest {
vm0 = new VmSimple(0, 0);
vm0.setContract(contract);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is
// MINIMUM_IOPS
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is MINIMUM_IOPS
vm0.setIOPSUtilization(0, MINIMUM_IOPS - 1);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), 0, 0,
MINIMUM_IOPS - 1, 0, false));
vm0.setIOPSUtilization(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), MINIMUM_IOPS -1);
h0 = createMockedHostWithIops(1, 0, vm0, 0, 0, 0, null);
hosts.clear();
......@@ -176,11 +178,13 @@ public class VmAllocationPolicyMigrationSlaTest {
vm0 = new VmSimple(0, 0);
vm0.setContract(contract);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is
// MINIMUM_IOPS
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is MINIMUM_IOPS
vm0.setIOPSUtilization(0, MINIMUM_IOPS -1);
vm0.addStateHistoryEntry(
new VmStateHistoryEntry(vm0.getMonitor().getMaximumAllowedSlaViolationTime() - policy.getMIGRATION_TIME(),
0, 0, MINIMUM_IOPS, 0, false));
vm0.setIOPSUtilization(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), MINIMUM_IOPS);
h0 = createMockedHostWithIops(1, 0, vm0, 0, 0, 0, null);
hosts.clear();
......@@ -392,28 +396,31 @@ public class VmAllocationPolicyMigrationSlaTest {
// VM with enough credit to migrate
Vm vm0 = new VmSimple(0, 0);
vm0.setContract(contract);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS, 0, false)); // allocatedIops is
// MINIMUM_IOPS
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS, 0, false)); // allocatedIops is MINIMUM_IOPS
vm0.setIOPSUtilization(0, MINIMUM_IOPS);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), 0, 0,
MINIMUM_IOPS, 0, false));
vm0.setIOPSUtilization(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), MINIMUM_IOPS);
vm0.setId(0);
// VM about to violate SLA
Vm vm1 = new VmSimple(0, 0);
vm1.setContract(contract);
vm1.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is
// MINIMUM_IOPS
vm1.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is MINIMUM_IOPS
vm1.setIOPSUtilization(0, MINIMUM_IOPS);
vm1.addStateHistoryEntry(new VmStateHistoryEntry(vm1.getMonitor().getMaximumAllowedSlaViolationTime(), 0, 0,
MINIMUM_IOPS - 1, 0, false));
vm1.setIOPSUtilization(vm1.getMonitor().getMaximumAllowedSlaViolationTime(), MINIMUM_IOPS -1);
vm1.setId(1);
// VM without enough credit to migrate
Vm vm2 = new VmSimple(0, 0);
vm2.setContract(contract);
vm2.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is
// MINIMUM_IOPS
vm2.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS - 1, 0, false)); // allocatedIops is MINIMUM_IOPS
vm2.setIOPSUtilization(0, MINIMUM_IOPS -1);
vm2.addStateHistoryEntry(new VmStateHistoryEntry(vm2.getMonitor().getMaximumAllowedSlaViolationTime(), 0, 0,
MINIMUM_IOPS - 1, 0, false));
vm2.setIOPSUtilization(vm1.getMonitor().getMaximumAllowedSlaViolationTime(), MINIMUM_IOPS -1);
vm2.setId(2);
// heaven host
......@@ -642,91 +649,101 @@ public class VmAllocationPolicyMigrationSlaTest {
// VM with enough credit to migrate
Vm vm0 = new VmSimple(1000, 1);
vm0.setContract(contract);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS, 0, false)); // allocatedIops is
// MINIMUM_IOPS
vm0.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS, 0, false)); // allocatedIops is MINIMUM_IOPS
vm0.setIOPSUtilization(0, MINIMUM_IOPS -1);
vm0.addStateHistoryEntry(new VmStateHistoryEntry(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), 0, 0,
MINIMUM_IOPS, 0, false));
vm0.setIOPSUtilization(vm0.getMonitor().getMaximumAllowedSlaViolationTime(), MINIMUM_IOPS -1);
vm0.setId(0);
// VM about to violate SLA
Vm vm1 = new VmSimple(1000, 1);
vm1.setContract(contract);
vm1.addStateHistoryEntry(new VmStateHistoryEntry(0, 0, 0, MINIMUM_IOPS, 0, false)); // allocatedIops is