CP-5923: Add GPU-related helper functions to test_common.ml

Signed-off-by: John Else <john.else@citrix.com>
Implement PGPU.get_remaining_capacity

Signed-off-by: John Else <john.else@citrix.com>
Whitespace: Formatting in Xapi_vm_helpers

$ camlp4o ocaml/xapi/xapi_vm_helpers.ml -printer o | md5sum
4f52a2cd7f2290d29e818aa4edbada31  -

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5845: Modify select_host to take a host list

Modify the function in Xapi_vm_placement to take a list of hosts to choose from
rather than trying all hosts in the pool.

No behavioural change is expected after this changeset since the list being
passed in is currently the list of all hosts.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5845: Use policy when choosing VM host and pGPU

At the pool-level, hosts are split into groups of equally-optimal hosts (based
on GPU_group.allocation_algorithm). The VM placement code is then run
sequentially on each of these groups (cf. was run before on all hosts in pool).
Only when exhausing this list of lists of hosts does it fail to start the VM.

At the host-level, a pGPU is selected according to the same
allocation_algorithm. If no capacity can be found then the VM_REQUIRES_VGPU
error is raised.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5845: Use PGPU.get_remaining_capacity API call

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5923: Add some generic code for vGPU testing

Signed-off-by: John Else <john.else@citrix.com>
CP-5923: Add the test input as an argument to extract_output

Signed-off-by: John Else <john.else@citrix.com>
CP-5923: Add a couple of basic tests of get_remaining_capacity

Signed-off-by: John Else <john.else@citrix.com>