Commit dcab0f07 authored by Lucas Cavalcante's avatar Lucas Cavalcante
Browse files

Merge branch 'sla-simulation' of...

Merge branch 'sla-simulation' of git.lsd.ufcg.edu.br:lenovo-autonomic/cloudsimplus into sla-simulation
parents ae33431c d9f30a5d
......@@ -75,7 +75,8 @@ public class VerticalVmIopsScalingExample {
// Cloudlets
private static final int CLOUDLETS = 1;
private static final int CLOUDLETS_INITIAL_LENGTH = 100_000;
private static final int CLOUDLETS_INITIAL_LENGTH = 1;
private static final int CLOUDLETS_INITIAL_LENGTH_IOPS = 500_000;
private static final int CLOUDLET_PES = 1;
private final CloudSim simulation;
......@@ -84,7 +85,6 @@ public class VerticalVmIopsScalingExample {
private List<Vm> vmList;
private List<Cloudlet> cloudletList;
private int createdCloudlets;
private int createdVms;
public static void main(String[] args) {
......@@ -106,7 +106,7 @@ public class VerticalVmIopsScalingExample {
// cloudletList = new ArrayList<>(CLOUDLETS);
cloudletList = createCloudlets();
simulation = new CloudSim();
simulation = new CloudSim(SCHEDULING_INTERVAL);
simulation.addOnClockTickListener(this::onClockTickListener);
createDatacenter();
......@@ -133,9 +133,8 @@ public class VerticalVmIopsScalingExample {
*/
private void onClockTickListener(EventInfo evt) {
vmList.forEach(vm -> {
Log.printFormatted("\t\tTime %6.1f: Vm %d Disk Usage: %6.2f%% (%2d IOPS. Running Cloudlets: #%d)\n",
Log.printFormatted("\t\tTime %6.1f: Vm %d (%2d IOPS. Running Cloudlets: #%d)\n",
evt.getTime(), vm.getId(),
vm.getIopsVerticalScaling().getResource().getPercentUtilization() * 100.0,
vm.getIops().getCapacity(), vm.getCloudletScheduler().getCloudletExecList().size());
});
}
......@@ -154,7 +153,9 @@ public class VerticalVmIopsScalingExample {
*/
private void createDatacenter() {
for (int i = 0; i < HOSTS; i++) {
hostList.add(createHost());
Host host = createHost();
host.setId(i);
hostList.add(host);
}
Datacenter dc0 = new DatacenterSimple(simulation, hostList, new VmAllocationPolicySimple());
......@@ -309,7 +310,7 @@ public class VerticalVmIopsScalingExample {
UtilizationModel utilization = new UtilizationModelFull();
for (int i = 0; i < CLOUDLETS; i++) {
Cloudlet cloudlet = new CloudletSimple(i, CLOUDLETS_INITIAL_LENGTH, CLOUDLET_PES).setFileSize(1024)
Cloudlet cloudlet = new CloudletSimple(i, CLOUDLETS_INITIAL_LENGTH, CLOUDLETS_INITIAL_LENGTH_IOPS, CLOUDLET_PES).setFileSize(1024)
.setOutputSize(1024).setUtilizationModel(utilization).setUtilizationModelIops(utilization);
list.add(cloudlet);
}
......
......@@ -280,19 +280,24 @@ public abstract class VmAllocationPolicyAbstract implements VmAllocationPolicy {
final ResourceProvisioner provisioner = scaling.getVm().getHost().getProvisioner(resourceClass);
final ResourceManageable vmResource = scaling.getVm().getResource(resourceClass);
final double utilization = vmResource.getPercentUtilization()*100;
final double newTotalVmResource = (double) vmResource.getCapacity() + extraAmountToAllocate;
if(!provisioner.allocateResourceForVm(scaling.getVm(), newTotalVmResource)){
showResourceIsUnavailable(scaling);
return false;
}
scaling.getVm().setIops((long) newTotalVmResource);
Log.printFormattedLine(
"%.2f: %s: %.0f more %s allocated to Vm %d: new capacity is %d. Current resource usage is %.2f%%",
scaling.getVm().getSimulation().clock(),
scaling.getClass().getSimpleName(),
extraAmountToAllocate, resourceClass.getSimpleName(),
scaling.getVm().getId(), vmResource.getCapacity(),
vmResource.getPercentUtilization()*100);
utilization);
return true;
}
......
......@@ -13,8 +13,6 @@ import org.cloudbus.cloudsim.vms.Vm;
final class ResourceProvisionerNull implements ResourceProvisioner {
public ResourceProvisionerNull() {
// TODO Auto-generated constructor stub
System.out.println("Null created");
}
@Override public boolean allocateResourceForVm(Vm vm, long newTotalVmResourceCapacity) {
......
......@@ -171,8 +171,6 @@ public class VerticalVmScalingSimple extends VmScalingAbstract implements Vertic
@Override
public boolean isVmUnderloaded() {
Vm vm = getVm();
Resource r = getResource();
return getResource().getPercentUtilization() < lowerUtilizationThresholdFunction.apply(getVm());
}
......
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