@@ -27,7 +27,7 @@ let v6rpc call =
2727 let open Xmlrpc_client in
2828 XMLRPC_protocol. rpc ~srcstr: " xapi" ~dststr: " v6d" ~transport: (Unix socket) ~http: (xmlrpc ~version: " 1.0" " /" ) call
2929
30- let construct_additional ~__context additional =
30+ let rec apply_edition ~__context edition additional =
3131 (* Get localhost's current license state. *)
3232 let host = Helpers. get_localhost ~__context in
3333 let license_server = Db.Host. get_license_server ~__context ~self: host in
@@ -40,13 +40,9 @@ let construct_additional ~__context additional =
4040 let socket_count = List. assoc " socket_count" cpu_info in
4141 let current_license_params =
4242 List. replace_assoc " sockets" socket_count current_license_params in
43+ (* Construct the RPC params to be sent to v6d *)
4344 let additional = (" current_edition" , current_edition) ::
4445 license_server @ current_license_params @ additional in
45- additional
46-
47- let rec apply_edition ~__context edition additional =
48- (* Construct the RPC params to be sent to v6d *)
49- let additional = construct_additional ~__context additional in
5046 let params = [ Rpc. rpc_of_string (Context. string_of_task __context)
5147 ; V6rpc. rpc_of_apply_edition_in
5248 { V6rpc. edition_in = edition
@@ -102,27 +98,3 @@ let get_version dbg =
10298 with _ ->
10399 raise (Api_errors. Server_error (Api_errors. v6d_failure, [] ))
104100
105- let get_current_edition ~__context additional =
106- try
107- let additional = construct_additional ~__context additional in
108- let params = [ Rpc. rpc_of_string (Context. string_of_task __context)
109- ; V6rpc. rpc_of_get_current_edition_in additional ] in
110-
111- let call = Rpc. call " get_current_edition" params in
112- let response = try v6rpc call with _ -> raise V6DaemonFailure in
113-
114- debug " response: %s" (Rpc. to_string response.Rpc. contents);
115-
116- if response.Rpc. success then
117- (* We reuse apply_edition_out for this RPC call *)
118- let r = V6rpc. apply_edition_out_of_rpc response.Rpc. contents in
119- r.V6rpc. edition_out, r.V6rpc. features_out, r.V6rpc. additional_out
120- else
121- let e = V6errors. error_of_rpc response.Rpc. contents in
122- match e with
123- | s , _ when s = V6errors. v6d_failure ->
124- raise V6DaemonFailure
125- | name , args ->
126- raise (Api_errors. Server_error (name, args))
127- with _ ->
128- raise (Api_errors. Server_error (Api_errors. v6d_failure, [] ))
0 commit comments