-
Notifications
You must be signed in to change notification settings - Fork 531
Description
Hello.
While experimenting around with the Power Classes (PowerDatacenter
, PowerHosts
, PowerVM
, etc), I've come across what looks like a bug to me.
Bug Description
When, within a simulation, we are using:
- VmAllocationPolicySimple() as our Datacentre Allocation Policy, which defaults to SelectionPolicyLeastFull() under the hood.
- Just PowerVMs and PowerHosts within our Datacentre
No PowerVM
is ever allocated to any PowerHost
, throwing a "No Suitable Host Found!" error for each PowerVM, despite the PowerHosts being allocated more than enough PEs and RAM.
When trying to debug the issue, I came upon this code within the SelectionPolicyLeastFull
policy:
Lines 34 to 43 in 062ddf7
if (hostCandidate instanceof PowerHost powerHost) { | |
hostAvailable = powerHost.getUtilizationOfCpu(); | |
} else { | |
hostAvailable = hostCandidate.getGuestScheduler().getAvailableMips(); | |
} | |
if (hostAvailable > maxAvailable) { | |
maxAvailable = hostAvailable; | |
selectedHost = hostCandidate; | |
} |
To my understanding, this line:
Line 35 in 062ddf7
hostAvailable = powerHost.getUtilizationOfCpu(); |
Gets an utilization of the CPU ranging from 0 to 1 - where 0 is no utilization and 1 is maximum utilization.
But this line:
Line 37 in 062ddf7
hostAvailable = hostCandidate.getGuestScheduler().getAvailableMips(); |
Gets the currently available MIPS for the host - where 0 is maximum utilization (there are no more available MIPS) and any higher number represents how many available MIPS are available.
However, with PowerHosts that are yet to receive any PowerVMs or cloudlets, the utilization is always 0, and as such, when we get to this section:
Lines 40 to 43 in 062ddf7
if (hostAvailable > maxAvailable) { | |
maxAvailable = hostAvailable; | |
selectedHost = hostCandidate; | |
} |
We never enter this if statement block, because we are comparing against a higher than 0 number.
Line 25 in 062ddf7
double maxAvailable = Double.MIN_VALUE; |
As such, no host canditate is ever chosen, and thus no PowerVM is ever allocated. Furthermore, even if we did enter this statement, we'd always be holding the Most Full PowerHost as our host candidate.
Potential Fix
For my use case, I'm simply taking available MIPS for the PowerVMs too (as they also have access to this function) and leave the rest as is:
hostAvailable = hostCandidate.getGuestScheduler().getAvailableMips();
This returns us back to what looks like intended behaviour of LeastFull
allocation.
Note
I am quite new at using CloudSim and still getting familiar with the system as a whole. If it is the case that I'm misunderstanding the intended use/functionality here, my sincerest apologies for the inconvenience!