Skip to content

Commit 84c7e11

Browse files
Frezzlerobhoes
authored andcommitted
Add gpumon interface
Commit 1 of 2 for new gpumon interface. Signed-off-by: Frederico Mazzone <[email protected]>
1 parent 0f9b6d1 commit 84c7e11

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

gpumon/gpumon_client.ml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
(*
2+
* Copyright (C) Citrix Systems Inc.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published
6+
* by the Free Software Foundation; version 2.1 only. with the special
7+
* exception on linking described in file LICENSE.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*)
14+
15+
open Gpumon_interface
16+
open Xcp_client
17+
18+
let xml_url () = "file:" ^ xml_path
19+
20+
module Client = Gpumon_interface.Client(struct
21+
let rpc call =
22+
if !use_switch
23+
then json_switch_rpc queue_name call
24+
else xml_http_rpc
25+
~srcstr:(get_user_agent ())
26+
~dststr:"gpumon"
27+
xml_url
28+
call
29+
end)
30+

gpumon/gpumon_interface.ml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(*
2+
* Copyright (C) Citrix Systems Inc.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published
6+
* by the Free Software Foundation; version 2.1 only. with the special
7+
* exception on linking described in file LICENSE.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*)
14+
15+
let service_name = "gpumon"
16+
let queue_name = Xcp_service.common_prefix ^ service_name
17+
let xml_path = "/var/xapi/" ^ service_name
18+
19+
type debug_info = string
20+
21+
type pgpu_address = string
22+
type pgpu_metadata = string
23+
type domid = int
24+
25+
type incompatibility_reason = Host_driver | Guest_driver | GPU | Other
26+
type compatibility = Compatible | Incompatible of incompatibility_reason list
27+
28+
(** Get the metadata for a pGPU, given its address (PCI bus ID). *)
29+
external get_pgpu_metadata: debug_info -> pgpu_address -> pgpu_metadata = ""
30+
31+
(** Check compatibility between a VM's vGPU(s) and another pGPU.
32+
* pgpu_address = PCI bus ID of the pGPU in which the VM is currently running.
33+
* domid = domain ID of the VM in which the vGPU(s) is running.
34+
* pgpu_metadata = metadata of the pGPU to check compatibility for. *)
35+
external get_pgpu_vm_compatibility: debug_info -> pgpu_address -> domid -> pgpu_metadata -> compatibility = ""

0 commit comments

Comments
 (0)