Commit 42a8080d authored by Anton Beloglazov's avatar Anton Beloglazov

- Fixed host.isSuitableForVM - only accepts a VM, if the maximum requested MIPS…

- Fixed host.isSuitableForVM - only accepts a VM, if the maximum requested MIPS among all virtual PEs < PE capacity
parent e3c84dfc
......@@ -189,7 +189,8 @@ public class Host {
* @return true, if is suitable for vm
*/
public boolean isSuitableForVm(Vm vm) {
return (getVmScheduler().getAvailableMips() >= vm.getCurrentRequestedTotalMips() &&
return (getVmScheduler().getPeCapacity() >= vm.getCurrentRequestedMaxMips() &&
getVmScheduler().getAvailableMips() >= vm.getCurrentRequestedTotalMips() &&
getRamProvisioner().isSuitableForVm(vm, vm.getCurrentRequestedRam()) &&
getBwProvisioner().isSuitableForVm(vm, vm.getCurrentRequestedBw()));
}
......
......@@ -60,6 +60,9 @@ public class HostDynamicWorkload extends Host {
*/
@Override
public double updateVmsProcessing(double currentTime) {
if (CloudSim.clock() > 5 && getId() == 3) {
Log.printLine();
}
double smallerTime = super.updateVmsProcessing(currentTime);
setUtilizationMips(0);
......
......@@ -180,6 +180,21 @@ public class Vm {
return totalRequestedMips;
}
/**
* Gets the current requested max mips among all virtual PEs.
*
* @return the current requested max mips
*/
public double getCurrentRequestedMaxMips() {
double maxMips = 0;
for (double mips : getCurrentRequestedMips()) {
if (mips > maxMips) {
maxMips = mips;
}
}
return maxMips;
}
/**
* Gets the current requested bw.
*
......
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