Skip to content

Commit ccbd130

Browse files
johnelserobhoes
authored andcommitted
CP-14944: Add host-license-remove CLI command
Signed-off-by: John Else <[email protected]>
1 parent c01c9be commit ccbd130

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ocaml/xapi/cli_frontend.ml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,15 @@ add a mapping of 'path' -> '/tmp', the command line should contain the argument
20922092
help="Add a license to a host.";
20932093
implementation=With_fd Cli_operations.host_license_add;
20942094
flags=[];
2095-
};
2095+
};
2096+
"host-license-remove",
2097+
{
2098+
reqd=[];
2099+
optn=["host-uuid"];
2100+
help="Remove any licensing applied to a host.";
2101+
implementation=No_fd Cli_operations.host_license_remove;
2102+
flags=[];
2103+
};
20962104
"host-license-view",
20972105
{
20982106
reqd=[];

ocaml/xapi/cli_operations.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,6 +2995,14 @@ let host_license_add fd printer rpc session_id params =
29952995
marshal fd (Command (PrintStderr "Failed to read license file\n"));
29962996
raise (ExitWithError 1)
29972997

2998+
let host_license_remove printer rpc session_id params =
2999+
let host =
3000+
if List.mem_assoc "host-uuid" params then
3001+
Client.Host.get_by_uuid rpc session_id (List.assoc "host-uuid" params)
3002+
else
3003+
get_host_from_session rpc session_id in
3004+
Client.Host.license_remove rpc session_id host
3005+
29983006
let host_license_view printer rpc session_id params =
29993007
let host =
30003008
if List.mem_assoc "host-uuid" params then

0 commit comments

Comments
 (0)