Skip to content

Commit 676e588

Browse files
simonjbeaumontjohnelse
authored andcommitted
Allow moving last PGPU out of GPU group with VGPUs
With the new API, it is perfectly reasonably to create VGPUs on GPU groups with no pGPUs in them since vGPU -> pGPU allocation is done at VM start time. As such we can loosen the requirements on moving the last pGPU out of a GPU group. Signed-off-by: Si Beaumont <[email protected]>
1 parent 15d595b commit 676e588

File tree

3 files changed

+0
-15
lines changed

3 files changed

+0
-15
lines changed

ocaml/idl/api_errors.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ let event_from_token_parse_failure = "EVENT_FROM_TOKEN_PARSE_FAILURE"
248248
let session_not_registered = "SESSION_NOT_REGISTERED"
249249

250250
let pgpu_in_use_by_vm = "PGPU_IN_USE_BY_VM"
251-
let pgpu_required_by_gpu_group = "PGPU_REQUIRED_BY_GPU_GROUP"
252251
let pgpu_not_compatible_with_gpu_group = "PGPU_NOT_COMPATIBLE_WITH_GPU_GROUP"
253252
let pgpu_insufficient_capacity_for_vgpu = "PGPU_INSUFFICIENT_CAPACITY_FOR_VGPU"
254253
let vgpu_type_not_enabled = "VGPU_TYPE_NOT_ENABLED"

ocaml/idl/datamodel.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,6 @@ let _ =
544544

545545
error Api_errors.pgpu_in_use_by_vm ["VMs"]
546546
~doc:"This PGPU is currently in use by running VMs." ();
547-
error Api_errors.pgpu_required_by_gpu_group ["gpu_group"]
548-
~doc:"Moving this PGPU would leave unbacked VGPUs in the GPU group." ();
549547
error Api_errors.pgpu_not_compatible_with_gpu_group ["type"; "group_types"]
550548
~doc:"PGPU type not compatible with destination group." ();
551549
error Api_errors.pgpu_insufficient_capacity_for_vgpu ["pgpu"; "vgpu"]

ocaml/xapi/xapi_pgpu.ml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,6 @@ let set_GPU_group ~__context ~self ~value =
110110
raise (Api_errors.Server_error (Api_errors.pgpu_in_use_by_vm,
111111
List.map Ref.string_of attached_vms));
112112

113-
(* Precondition: Moving PGPU from current group can't orphan VGPU *)
114-
let src_g = Db.PGPU.get_GPU_group ~__context ~self in
115-
if Db.is_valid_ref __context src_g then begin
116-
let pgpu_is_singleton =
117-
(List.length (Db.GPU_group.get_PGPUs ~__context ~self:src_g) = 1)
118-
and pgpu_has_vgpus =
119-
((Db.GPU_group.get_VGPUs ~__context ~self:src_g) <> []) in
120-
if (pgpu_is_singleton && pgpu_has_vgpus) then
121-
raise (Api_errors.Server_error
122-
(Api_errors.pgpu_required_by_gpu_group, [Ref.string_of src_g]))
123-
end;
124-
125113
let check_compatibility gpu_type group_types =
126114
match group_types with
127115
| [] -> true, [gpu_type]

0 commit comments

Comments
 (0)