xapi-project/xen-api — pull request #1553 by simonjbeaumont (2013-11-20 18:24:44+00:00)
Title: CA-115034: Sort PGPUs for VGPU placement with lock

For host-level breadth-first allocation of VGPUs to PGPUs, we were sorting the
PGPUs available by the most capacity and then taking the lock to allocate the
VGPU to the most 'optimal' PGPU.

During bootstorm, the list could be sorted on all hosts before any is
allocated, leading to them all being allocated to the same PGPU (i.e. not
honouring the breadth-first allocation-algorithm field).

The sorting of the PGPUs is now done in the same critical region as the
allocation.

Signed-off-by: Si Beaumont