[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH] make the output of the CLI host-get-vms-which-prevent-evacuation more uniform
# HG changeset patch # User David Scott <dave.scott@xxxxxxxxxxxxx> # Date 1276898058 -3600 # Node ID 4f9f896fb691d71492f8c357ac9c411c37f86a76 # Parent 8ccd23b730976e8fc3db9def2e9ffde95e4b8486 Make the output of 'xe host-get-vms-which-prevent-evacuation' more uniform Now the regular output looks like this: # xe host-get-vms-which-prevent-evacuation uuid=b82bf253-1494-40f2-9c3d-34f5bd17012d uuid ( RO) : 1d4eba84-9c04-962b-8fd3-f9fb5d597b64 name-label ( RW): oim2 reason ( RO): VM_MISSING_PV_DRIVERS,OpaqueRef:1ea1dad3-3b5c-4a51-2e9b-128688585769 uuid ( RO) : 6a97a613-bfa2-088d-f415-cf49bbb4bb95 name-label ( RW): oim reason ( RO): VM_MISSING_PV_DRIVERS,OpaqueRef:e8eeb830-36ac-fa4b-5703-d8a7bb551331 The --minimal output looks like this: # xe host-get-vms-which-prevent-evacuation uuid=b82bf253-1494-40f2-9c3d-34f5bd17012d --minimal 6a97a613-bfa2-088d-f415-cf49bbb4bb95,1d4eba84-9c04-962b-8fd3-f9fb5d597b64 Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx> diff -r 8ccd23b73097 -r 4f9f896fb691 ocaml/xapi/cli_operations.ml --- a/ocaml/xapi/cli_operations.ml Fri Jun 18 20:54:26 2010 +0100 +++ b/ocaml/xapi/cli_operations.ml Fri Jun 18 22:54:18 2010 +0100 @@ -2593,10 +2593,17 @@ let uuid = List.assoc "uuid" params in let host = Client.Host.get_by_uuid rpc session_id uuid in let vms = Client.Host.get_vms_which_prevent_evacuation rpc session_id host in - let table = List.map (fun (vm, result) -> - Printf.sprintf "%s (%s)" (Client.VM.get_uuid rpc session_id vm) (Client.VM.get_name_label rpc session_id vm), - print_assert_exception (Api_errors.Server_error(List.hd result, List.tl result))) vms in - printer (Cli_printer.PTable [ ("VM", "Error") :: table ]) + + let op (vm, error) = + let error = String.concat "," error in + let record = vm_record rpc session_id vm in + let extra_field = make_field ~name:"reason" ~get:(fun () -> error) () in + let record = { record with fields = record.fields @ [ extra_field ] } in + let selected = List.hd (select_fields params [record] [ "uuid"; "name-label"; "reason"]) in + let table = List.map print_field selected in + printer (Cli_printer.PTable [table]) + in + ignore(List.iter op vms) let host_get_uncooperative_vms printer rpc session_id params = let uuid = List.assoc "uuid" params in ocaml/xapi/cli_operations.ml | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) Attachment:
xen-api.hg.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |