Skip to content

Commit

Permalink
CP-38020: add CLI interface for NUMA policy host field
Browse files Browse the repository at this point in the history
Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Nov 14, 2023
1 parent bbd948c commit 25dec22
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions ocaml/tests/common/test_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ let make_host2 ~__context ?(ref = Ref.make ()) ?(uuid = make_uuid ())
~display:`enabled ~virtual_hardware_platform_versions:[]
~control_domain:Ref.null ~updates_requiring_reboot:[] ~iscsi_iqn:""
~multipathing:false ~uefi_certificates:"" ~editions:[] ~pending_guidances:[]
~tls_verification_enabled
~numa_affinity_policy:`default
~tls_verification_enabled ~numa_affinity_policy:`default
~last_software_update:(Xapi_host.get_servertime ~__context ~host:ref)
~recommended_guidances:[] ~latest_synced_updates_applied:`unknown ;
ref
Expand Down
10 changes: 10 additions & 0 deletions ocaml/xapi-cli-server/record_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,16 @@ let host_numa_affinity_policy_to_string = function
| `default ->
"default"

let host_numa_affinity_policy_of_string = function
| "any" ->
`any
| "besteffort" ->
`besteffort
| "default" ->
`default
| _ ->
failwith "Bad type"

let pgpu_dom0_access_to_string x = host_display_to_string x

let string_to_vdi_onboot s =
Expand Down
10 changes: 10 additions & 0 deletions ocaml/xapi-cli-server/records.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,16 @@ let host_record rpc session_id host =
Client.Host.set_uefi_certificates ~rpc ~session_id ~host ~value
)
()
; make_field ~name:"numa-affinity-policy"
~get:(fun () ->
(x ()).API.host_numa_affinity_policy
|> Record_util.host_numa_affinity_policy_to_string
)
~set:(fun value ->
Client.Host.set_numa_affinity_policy ~rpc ~session_id ~self:host
~value:(Record_util.host_numa_affinity_policy_of_string value)
)
()
; make_field ~name:"pending-guidances"
~get:(fun () ->
map_and_concat Record_util.update_guidance_to_string
Expand Down

0 comments on commit 25dec22

Please sign in to comment.