forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xn_cfg_types.ml
57 lines (47 loc) · 1.3 KB
/
xn_cfg_types.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
open Fun
type value =
| String of string
| Int of int
| List of value list
with rpc
exception Type_error of string * string
let string = function
| String x -> x
| x -> raise (Type_error("string", x |> rpc_of_value |> Jsonrpc.to_string))
let int = function
| Int x -> x
| x -> raise (Type_error("int", x |> rpc_of_value |> Jsonrpc.to_string))
let bool = function
| Int 1 -> true
| Int 0 -> false
| x -> raise (Type_error("bool", x |> rpc_of_value |> Jsonrpc.to_string))
let list f = function
| List vs -> List.map f vs
| x -> raise (Type_error("int", x |> rpc_of_value |> Jsonrpc.to_string))
type config = (string * value) list with rpc
(* Well-known constants *)
let _kernel = "kernel"
let _ramdisk = "ramdisk"
let _root = "root"
let _builder = "builder"
let _bootloader = "bootloader"
let _boot = "boot"
let _name = "name"
let _uuid = "uuid"
let _memory = "memory" (* MiB *)
let _cpus = "cpus" (* pCPUs *)
let _vcpus = "vcpus" (* number of vCPUs *)
let _vif = "vif"
let _backend = "backend"
let _bridge = "bridge"
let _ip = "ip"
let _mac = "mac"
let _script = "script"
let _type = "type"
let _vifname = "vifname"
let _disk = "disk"
let _pci = "pci"
let _msitranslate = "msitranslate"
let _power_mgmt = "power_mgmt"
let _vm_pci_msitranslate = "pci_msitranslate"
let _vm_pci_power_mgmt = "pci_power_mgmt"