Commit e6cbe43b authored by Anton Beloglazov's avatar Anton Beloglazov

- Added a restriction to VmSchedulerTimeShared: each virtual PE of a VM must…

- Added a restriction to VmSchedulerTimeShared: each virtual PE of a VM must require not more than the capacity of a physical PE
parent ba4dac91
......@@ -141,6 +141,19 @@ public abstract class VmScheduler {
return max;
}
/**
* Returns PE capacity in MIPS.
*
* @return mips
*/
public double getPeCapacity() {
if (getPeList() == null) {
Log.printLine("Pe list is empty");
return 0;
}
return getPeList().get(0).getMips();
}
/**
* Gets the vm list.
*
......
......@@ -80,22 +80,22 @@ public class VmSchedulerTimeShared extends VmScheduler {
* @return true, if successful
*/
protected boolean allocatePesForVm(String vmUid, List<Double> mipsShareRequested) {
/**
* TODO: add a restriction of the amount of MIPS allocated to a VM. A VM must require
* not more than is the capacity of a PE.
*/
getMipsMapRequested().put(vmUid, mipsShareRequested);
setPesInUse(getPesInUse() + mipsShareRequested.size());
double totalRequestedMips = 0;
double peMips = getPeCapacity();
for (Double mips : mipsShareRequested) {
if (mips > peMips) { // each virtual PE of a VM must require not more than the capacity of a physical PE
return false;
}
totalRequestedMips += mips;
}
List<Double> mipsShareAllocated = new ArrayList<Double>();
for (Double mipsRequested : mipsShareRequested) {
if (getVmsInMigration().contains(vmUid)) {
mipsRequested *= 0.9; // performance degradation 10%
mipsRequested *= 0.9; // performance degradation due to migration = 10% MIPS
}
mipsShareAllocated.add(mipsRequested);
}
......
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