Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ocaml/xapi/cli_frontend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,24 @@ let rec cmdtable_data : (string*cmd_spec) list =
flags=[Vm_selectors];
};

"vm-add-tags",
{
reqd=["tag"];
optn=[];
help="Add the given value to the tags field of the given VM. If the value is already in that Set, then do nothing.";
implementation=No_fd Cli_operations.vm_add_tags;
flags=[Standard;Vm_selectors]
};

"vm-remove-tags",
{
reqd=["tag"];
optn=[];
help="Remove the given value from the tags field of the given VM. If the value is not in that Set, then do nothing.";
implementation=No_fd Cli_operations.vm_remove_tags;
flags=[Standard;Vm_selectors]
};

"vm-query-services",
{
reqd=[];
Expand Down
16 changes: 16 additions & 0 deletions ocaml/xapi/cli_operations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2300,6 +2300,22 @@ let vm_memory_shadow_multiplier_set printer rpc session_id params =
Client.VM.set_shadow_multiplier_live rpc session_id vm multiplier) params ["multiplier"] in
()

let vm_add_tags printer rpc session_id params =
ignore(do_vm_op printer rpc session_id
(fun vmr ->
let vm = vmr.getref () in
let tag = List.assoc "tag" params in
Client.VM.add_tags rpc session_id vm tag
) params ["tag"])

let vm_remove_tags printer rpc session_id params =
ignore(do_vm_op printer rpc session_id
(fun vmr ->
let vm = vmr.getref () in
let tag = List.assoc "tag" params in
Client.VM.remove_tags rpc session_id vm tag
) params ["tag"])

let vm_query_services printer rpc session_id params =
ignore(do_vm_op printer rpc session_id
(fun vm ->
Expand Down