Skip to content

Commit da06ace

Browse files
thomassaBob Ball
authored andcommitted
CP-20679: cope when pgpu metadata is unobtainable
The code that fetched the pgpu metadata from the Nvidia driver was assuming that this would always work for every GPU made by Nvidia. In fact only some Nvidia GPUs support the feature, and even where the feature is available, and the Nvidia driver has been installed on the host, that Nvidia driver has not yet been loaded when xapi starts on host boot. Therefore this commit catches the exception Gpumon_interface.NvmlInterfaceNotAvailable and the exception handler returns and empty list for the metadata. Signed-off-by: Thomas Sanders <[email protected]>
1 parent 709fc49 commit da06ace

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ocaml/xapi/xapi_pgpu.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ let fetch_compatibility_metadata ~__context ~pgpu_pci =
3838
Xapi_gpumon.Nvidia.get_pgpu_compatibility_metadata ~dbg ~pgpu_pci_address
3939
) else []
4040

41+
let maybe_fetch_compatibility_metadata ~__context ~pgpu_pci =
42+
try fetch_compatibility_metadata ~__context ~pgpu_pci
43+
with Gpumon_interface.NvmlInterfaceNotAvailable -> []
44+
4145
let populate_compatibility_metadata ~__context ~pgpu ~pgpu_pci =
4246
let () = Db.PGPU.set_compatibility_metadata ~__context ~self:pgpu
43-
~value:(fetch_compatibility_metadata ~__context ~pgpu_pci)
47+
~value:(maybe_fetch_compatibility_metadata ~__context ~pgpu_pci)
4448
in ()
4549

4650
let create ~__context ~pCI ~gPU_group ~host ~other_config
@@ -55,7 +59,7 @@ let create ~__context ~pCI ~gPU_group ~host ~other_config
5559
~gPU_group ~host ~other_config ~size
5660
~supported_VGPU_max_capacities ~dom0_access
5761
~is_system_display_device
58-
~compatibility_metadata:(fetch_compatibility_metadata ~__context ~pgpu_pci:pCI);
62+
~compatibility_metadata:(maybe_fetch_compatibility_metadata ~__context ~pgpu_pci:pCI);
5963
Db.PGPU.set_supported_VGPU_types ~__context
6064
~self:pgpu ~value:supported_VGPU_types;
6165
Db.PGPU.set_enabled_VGPU_types ~__context

0 commit comments

Comments
 (0)