Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions ocaml/xapi/xapi_vgpu_type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -486,18 +486,13 @@ module Intel = struct
~is_host_display_enabled
~is_pci_hidden =
let types =
if is_system_display_device
then begin
match is_host_display_enabled, is_pci_hidden with
| false, true -> [passthrough_gpu]
| true, true -> []
| _, false ->
(make_vgpu_types ~__context
~pci ~whitelist:!Xapi_globs.gvt_g_whitelist)
end else
passthrough_gpu ::
(make_vgpu_types ~__context
~pci ~whitelist:!Xapi_globs.gvt_g_whitelist)
let passthrough_types =
if is_system_display_device && (is_host_display_enabled || not is_pci_hidden)
then []
else [passthrough_gpu]
in
passthrough_types @
(make_vgpu_types ~__context ~pci ~whitelist:!Xapi_globs.gvt_g_whitelist)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The match statement means I have to keep track of what's what. Given they're all boolean values wouldn't it be jsut as clean to use if statements?

let passthrough_types = 
  if not is_system_display_device || not is_host_display_enabled && is_pci_hidden
  then [passthrough_gpu]
  else [] in
...

The match case with false, _, _ and then true, [other stuff] are collapsed.

in
List.map (find_or_create ~__context) types
end
Expand Down