Skip to content

Commit 0607337

Browse files
committed
CP-15277: CLI availability of can_use_hotplug_vif|vbd
Make these new VM guest metrics fields accessible through the CLI. Signed-off-by: Thomas Sanders <[email protected]>
1 parent 9e7c168 commit 0607337

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ocaml/client_records/record_util.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,12 @@ let on_boot_to_string onboot =
460460
| `reset -> "reset"
461461
| `persist -> "persist"
462462

463+
let tristate_to_string tristate =
464+
match tristate with
465+
| `yes -> "true"
466+
| `no -> "false"
467+
| `unspecified -> "unspecified"
468+
463469
let wrap f err x = try f x with _ -> err x
464470
let generic_error x = raise (Record_failure ("Unknown value: "^x))
465471
let rpc_to_string = function | Rpc.String s -> s | _ -> failwith "Bad RPC type in record_util"

ocaml/client_records/records.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,10 @@ let vm_record rpc session_id vm =
882882
~get:(fun () -> default nid (may (fun m -> string_of_bool m.API.vM_guest_metrics_live) (xgm ()) )) ();
883883
make_field ~name:"guest-metrics-last-updated"
884884
~get:(fun () -> default nid (may (fun m -> Date.to_string m.API.vM_guest_metrics_last_updated) (xgm ()) )) ();
885+
make_field ~name:"can-use-hotplug-vbd"
886+
~get:(fun () -> default nid (may (fun m -> Record_util.tristate_to_string m.API.vM_guest_metrics_can_use_hotplug_vbd) (xgm ()) )) ();
887+
make_field ~name:"can-use-hotplug-vif"
888+
~get:(fun () -> default nid (may (fun m -> Record_util.tristate_to_string m.API.vM_guest_metrics_can_use_hotplug_vif) (xgm ()) )) ();
885889
make_field ~name:"cooperative"
886890
(* NB this can receive VM_IS_SNAPSHOT *)
887891
~get:(fun () -> string_of_bool (try Client.VM.get_cooperative rpc session_id vm with _ -> true))

0 commit comments

Comments
 (0)