Commit d2495835 authored by rodrigo.calheiros's avatar rodrigo.calheiros

VmSchedulerTimeSharedOverSubscription updated to be used as VM scheduling policy when users

want to disregard amount of MIPS required by VMs and allow oversubscription of hosts.

If more MIPS than available are required in VmSchedulerTimeShared, allocation failed by MIPS.
This does not happen in VmSchedulerTimeSharedOverSubscription.
parent 863a9c93
...@@ -17,8 +17,7 @@ import org.cloudbus.cloudsim.util.MathUtil; ...@@ -17,8 +17,7 @@ import org.cloudbus.cloudsim.util.MathUtil;
/** /**
* This is a Time-Shared VM Scheduler, which allows over-subscription. In other words, the scheduler * This is a Time-Shared VM Scheduler, which allows over-subscription. In other words, the scheduler
* still allows the allocation of VMs that require more CPU capacity that is available. * still allows the allocation of VMs that require more CPU capacity that is available.
* Oversubscription results in performance degradation. Each virtual PE cannot be allocated more CPU * Oversubscription results in performance degradation.
* capacity than MIPS of a single PE.
* *
* @author Anton Beloglazov * @author Anton Beloglazov
* @since CloudSim Toolkit 2.0 * @since CloudSim Toolkit 2.0
...@@ -48,12 +47,7 @@ public class VmSchedulerTimeSharedOverSubscription extends VmSchedulerTimeShared ...@@ -48,12 +47,7 @@ public class VmSchedulerTimeSharedOverSubscription extends VmSchedulerTimeShared
@Override @Override
protected boolean allocatePesForVm(String vmUid, List<Double> mipsShareRequested) { protected boolean allocatePesForVm(String vmUid, List<Double> mipsShareRequested) {
double totalRequestedMips = 0; double totalRequestedMips = 0;
double peMips = getPeCapacity();
for (Double mips : mipsShareRequested) { for (Double mips : mipsShareRequested) {
// each virtual PE of a VM must require not more than the capacity of a physical PE
if (mips > peMips) {
return false;
}
totalRequestedMips += mips; totalRequestedMips += mips;
} }
...@@ -144,4 +138,50 @@ public class VmSchedulerTimeSharedOverSubscription extends VmSchedulerTimeShared ...@@ -144,4 +138,50 @@ public class VmSchedulerTimeSharedOverSubscription extends VmSchedulerTimeShared
setAvailableMips(0); setAvailableMips(0);
} }
/**
* Update allocation of VMs on PEs.
*/
@Override
protected void updatePeProvisioning() {
// getPeMap().clear();
// for (Pe pe : getPeList()) {
// pe.getPeProvisioner().deallocateMipsForAllVms();
// }
//
// Iterator<Pe> peIterator = getPeList().iterator();
// Pe pe = peIterator.next();
// PeProvisioner peProvisioner = pe.getPeProvisioner();
// double availableMips = peProvisioner.getAvailableMips();
//
// for (Map.Entry<String, List<Double>> entry : getMipsMap().entrySet()) {
// String vmUid = entry.getKey();
// getPeMap().put(vmUid, new LinkedList<Pe>());
//
// for (double mips : entry.getValue()) {
// while (mips >= 0.1) {
// if (availableMips >= mips) {
// peProvisioner.allocateMipsForVm(vmUid, mips);
// getPeMap().get(vmUid).add(pe);
// availableMips -= mips;
// break;
// } else {
// peProvisioner.allocateMipsForVm(vmUid, availableMips);
// getPeMap().get(vmUid).add(pe);
// mips -= availableMips;
// if (mips <= 0.1) {
// break;
// }
// if (!peIterator.hasNext()) {
// Log.printLine("There is no enough MIPS (" + mips + ") to accommodate VM " + vmUid);
// // System.exit(0);
// }
// pe = peIterator.next();
// peProvisioner = pe.getPeProvisioner();
// availableMips = peProvisioner.getAvailableMips();
// }
// }
// }
// }
}
} }
...@@ -20,15 +20,9 @@ import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; ...@@ -20,15 +20,9 @@ import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter; import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker; import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics; import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage; import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel; import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull; import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim; import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple; import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple; import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
...@@ -188,7 +182,7 @@ public class TimeSharedProblemDetector { ...@@ -188,7 +182,7 @@ public class TimeSharedProblemDetector {
new BwProvisionerSimple(bw), new BwProvisionerSimple(bw),
storage, storage,
peList, peList,
new VmSchedulerTimeShared(peList) new VmSchedulerTimeSharedOverSubscription(peList)
) )
); // This is our machine ); // This is our machine
......
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