@@ -2387,7 +2387,8 @@ let sysprep =
23872387module Other_config = struct
23882388 let protected_keys =
23892389 [
2390- (" pci" , _R_POOL_ADMIN)
2390+ (" hvm_serial" , _R_POOL_ADMIN)
2391+ ; (" pci" , _R_POOL_ADMIN)
23912392 ; (" folder" , _R_VM_OP)
23922393 ; (" XenCenter.CustomFields.*" , _R_VM_OP)
23932394 ]
@@ -2437,6 +2438,51 @@ module Other_config = struct
24372438 ~flags: [`Session ] ()
24382439end
24392440
2441+ module Platform = struct
2442+ let protected_keys = [(" hvm_serial" , _R_POOL_ADMIN)]
2443+
2444+ let call =
2445+ call
2446+ ~lifecycle: [(Published , rel_rio, " platform-specific configuration" )]
2447+ ~allowed_roles: _R_VM_ADMIN
2448+
2449+ let add_to_platform =
2450+ call ~name: " add_to_platform"
2451+ ~doc: " Add the given key-value pair to the platform field of the given VM."
2452+ ~params:
2453+ [
2454+ (Ref _vm, " self" , " reference to object" )
2455+ ; (String , " key" , " Key to add" )
2456+ ; (String , " value" , " Value to add" )
2457+ ]
2458+ ~map_keys_roles: protected_keys ~flags: [`Session ] ()
2459+
2460+ let remove_from_platform =
2461+ call ~name: " remove_from_platform"
2462+ ~doc:
2463+ " Remove the given key and its corresponding value from the platform \
2464+ field of the given VM. If the key is not in that Map, then do \
2465+ nothing."
2466+ ~params:
2467+ [
2468+ (Ref _vm, " self" , " reference to object" )
2469+ ; (String , " key" , " Key of entry to remove" )
2470+ ]
2471+ ~map_keys_roles: protected_keys ~flags: [`Session ] ()
2472+
2473+ (* map_keys_roles can't be cited here, since they're only implemented for
2474+ {add_to,remove_from}_platform, RBAC handling is done in a manual
2475+ implementation. *)
2476+ let set_platform =
2477+ call ~name: " set_platform" ~doc: " Set the platform field of the given VM."
2478+ ~params:
2479+ [
2480+ (Ref _vm, " self" , " reference to object" )
2481+ ; (Map (String , String ), " value" , " New value to set" )
2482+ ]
2483+ ~flags: [`Session ] ()
2484+ end
2485+
24402486let vm_uefi_mode =
24412487 Enum
24422488 ( " vm_uefi_mode"
@@ -2643,6 +2689,9 @@ let t =
26432689 ; Other_config. add_to_other_config
26442690 ; Other_config. remove_from_other_config
26452691 ; Other_config. set_other_config
2692+ ; Platform. add_to_platform
2693+ ; Platform. remove_from_platform
2694+ ; Platform. set_platform
26462695 ]
26472696 ~contents:
26482697 ([
@@ -2771,9 +2820,10 @@ let t =
27712820 ~qualifier: DynamicRO ~ty: (Set (Ref _vtpm)) " VTPMs" " virtual TPMs"
27722821 ; namespace ~name: " PV" ~contents: pv ()
27732822 ; namespace ~name: " HVM" ~contents: hvm ()
2774- ; field
2823+ ; field ~qualifier: StaticRO
27752824 ~ty: (Map (String , String ))
27762825 ~lifecycle: [(Published , rel_rio, " platform-specific configuration" )]
2826+ ~map_keys_roles: [(" hvm_serial" , _R_POOL_ADMIN)]
27772827 " platform" " platform-specific configuration"
27782828 ; field
27792829 ~lifecycle:
@@ -2789,6 +2839,7 @@ let t =
27892839 ~map_keys_roles:
27902840 [
27912841 (" pci" , _R_POOL_ADMIN)
2842+ ; (" hvm_serial" , _R_POOL_ADMIN)
27922843 ; (" folder" , _R_VM_OP)
27932844 ; (" XenCenter.CustomFields.*" , _R_VM_OP)
27942845 ]
0 commit comments