@@ -35,7 +35,7 @@ type incompatibility_reason =
3535 | Other
3636[@@ deriving rpcty ]
3737
38- (* * Boolean: compatible? *)
38+ (* * Compatibility between virtual and physical GPU *)
3939type compatibility =
4040 | Compatible
4141 | Incompatible of incompatibility_reason list
@@ -90,69 +90,83 @@ module RPC_API(R : RPC) = struct
9090 ; description =
9191 [ " This interface is used by Xapi and Gpumon to monitor "
9292 ; " physical and virtual GPUs." ]
93- ;
94- version= (1 ,0 ,0 )
93+ ; version= (1 ,0 ,0 )
9594 }
9695
9796 let implementation = implement description
9897
99- (* * common API call parameters *)
98+ (* * Compatibility checking interface for Nvidia vGPUs *)
99+ module Nvidia = struct
100100
101- let debug_info_p = param ~description:
102- [" Uninterpreted string used for debugging." ]
103- debug_info
101+ (* * common API call parameters *)
104102
105- let domid_p = param ~description:
106- [ " Domain ID of the VM in which the vGPU(s) is running ." ]
107- domid
103+ let debug_info_p = param ~description:
104+ [ " Uninterpreted string used for debugging ." ]
105+ debug_info
108106
109- let pgpu_address_p = param ~description:
110- [" PCI bus ID of the pGPU in which the VM is currently running"
111- ;" in the form `domain:bus:device.function` PCI identifier." ]
112- pgpu_address
107+ let domid_p = param ~description:
108+ [" Domain ID of the VM in which the vGPU(s) is running." ]
109+ domid
113110
114- let nvidia_pgpu_metadata_p = param ~description:
115- [" Metadata of Nvidia physical GPU." ]
116- nvidia_pgpu_metadata
111+ let pgpu_address_p = param ~description:
112+ [" PCI bus ID of the pGPU in which the VM is currently running"
113+ ;" in the form `domain:bus:device.function` PCI identifier." ]
114+ pgpu_address
117115
118- let nvidia_vgpu_metadata_p = param ~description:
119- [" Metadata of Nvidia virtual GPU." ]
120- nvidia_vgpu_metadata
116+ let nvidia_pgpu_metadata_p = param ~description:
117+ [" Metadata of Nvidia physical GPU." ]
118+ nvidia_pgpu_metadata
121119
122- let nvidia_vgpu_metadata_list_p = param ~description:
123- [" Metadata list of Nvidia virtual GPU." ]
124- nvidia_vgpu_metadata_list
120+ let nvidia_vgpu_metadata_p = param ~description:
121+ [" Metadata of Nvidia virtual GPU." ]
122+ nvidia_vgpu_metadata
125123
126- let compatibility_p = param ~description:
127- [ " Value indicating whether two or more GPUs are compatible with each other ." ]
128- compatibility
124+ let nvidia_vgpu_metadata_list_p = param ~description:
125+ [ " Metadata list of Nvidia virtual GPU ." ]
126+ nvidia_vgpu_metadata_list
129127
130- (* * Compatibility checking interface for Nvidia vGPUs *)
131- module Nvidia = struct
128+ let compatibility_p = param ~description:
129+ [ " Value indicating whether two or more GPUs are compatible with each other." ]
130+ compatibility
132131
133132 let get_pgpu_metadata =
134133 declare " get_pgpu_metadata"
135- [" Gets the metadata for a pGPU, given its address (PCI bus ID)." ]
136- (debug_info_p @-> pgpu_address_p @-> returning nvidia_pgpu_metadata_p gpu_err )
134+ [ " Gets the metadata for a pGPU, given its address (PCI bus ID)." ]
135+ (debug_info_p
136+ @-> pgpu_address_p
137+ @-> returning nvidia_pgpu_metadata_p gpu_err
138+ )
137139
138140 let get_pgpu_vm_compatibility =
139141 declare " get_pgpu_vm_compatibility"
140- [" Checks compatibility between a VM's vGPU(s) and another pGPU." ]
141- (debug_info_p @-> pgpu_address_p @-> domid_p @-> nvidia_pgpu_metadata_p @-> returning compatibility_p gpu_err )
142+ [ " Checks compatibility between a VM's vGPU(s) and another pGPU." ]
143+ (debug_info_p
144+ @-> pgpu_address_p
145+ @-> domid_p
146+ @-> nvidia_pgpu_metadata_p
147+ @-> returning compatibility_p gpu_err
148+ )
142149
143150 let get_vgpu_metadata =
144151 declare " get_vgpu_metadata"
145- [" Obtains metadata for all vGPUs running in a domain." ]
146- ( debug_info_p @-> domid_p @-> pgpu_address_p @-> returning nvidia_vgpu_metadata_list_p gpu_err )
147-
148- (* * The use case is VM.suspend/VM.resume: before
149- * VM.resume [nvidia_vgpu_metadata] of the suspended VM is checked
150- * against the [nvidia_pgpu_metadata] on the host where the VM is
151- * resumed.
152- * *)
152+ [ " Obtains metadata for all vGPUs running in a domain." ]
153+ ( debug_info_p
154+ @-> domid_p
155+ @-> pgpu_address_p
156+ @-> returning nvidia_vgpu_metadata_list_p gpu_err
157+ )
158+
153159 let get_pgpu_vgpu_compatibility =
154160 declare " get_pgpu_vgpu_compatibility"
155- [" Checks compatibility between a pGPU (on a host) and a list of vGPUs (assigned to a VM). Note: A VM may use several vGPUs." ]
156- ( debug_info_p @-> nvidia_pgpu_metadata_p @-> nvidia_vgpu_metadata_list_p @-> returning compatibility_p gpu_err )
161+ [ " Checks compatibility between a pGPU (on a host) and a list of vGPUs "
162+ ; " (assigned to a VM). Note: A VM may use several vGPUs."
163+ ; " The use case is VM.suspend/VM.resume:"
164+ ; " before VM.resume [nvidia_vgpu_metadata] of the suspended VM is "
165+ ; " checked against the [nvidia_pgpu_metadata] on the host where the VM "
166+ ; " is resumed." ]
167+ ( debug_info_p
168+ @-> nvidia_pgpu_metadata_p
169+ @-> nvidia_vgpu_metadata_list_p
170+ @-> returning compatibility_p gpu_err)
157171 end
158172end
0 commit comments