You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The HostSuitability returned when placing a VmGroup is never fully suitable #610
When a VmGroup is placed, VmPlacementPolicyAbstract.placeVm(vm, host) returns a single HostSuitability that combines the results of all VMs in the group. That object is created with new HostSuitability(host, vmGroup), so all its flags (forCores, forRam, forBw, forStorage) start as false. Then setSuitability(other) combines each VM result using &=, so the flags can never become true.
As a result, fully() is always false for a VmGroup, even when all its VMs were created in the Host. The reason is also empty, so it doesn't say why the placement "failed".
Impact
Code that checks the result of placeVm() for a VmGroup (such as a custom VmPlacementPolicy or user code) thinks the group couldn't be placed.
DatacenterSimple.processVmCreate() isn't affected, because it checks if each VM was created instead of using the returned suitability. That's why the examples work.
Proposal
Create the combined HostSuitability with all flags set to true, so that setSuitability() only changes them to false for resources the Host doesn't have for some VM. A factory method in HostSuitability (e.g. HostSuitability.forGroup(host, vmGroup)) makes that explicit and keeps the rule in a single place.
A test must check that the suitability is fully() when all VMs in the group are created, and not fully() when one of them isn't.
Activity