Skip to content

Commit a8f9bc6

Browse files
authored
CP-51693: introduce feature flag to use JSONRPC for internal pool communication (#6123)
2 parents 4b86134 + a2f3441 commit a8f9bc6

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

ocaml/tests/common/mock_rpc.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let rpc __context call =
2525
Rpc.
2626
{
2727
success= true
28-
; contents= contents |> Xmlrpc.to_string |> Xmlrpc.of_string
28+
; contents= contents |> Jsonrpc.to_string |> Jsonrpc.of_string
2929
; is_notification= false
3030
}
3131
| "VM.update_allowed_operations", [session_id_rpc; self_rpc] ->

ocaml/xapi/helpers.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,13 @@ let make_rpc ~__context rpc : Rpc.response =
395395
let subtask_of = Ref.string_of (Context.get_task_id __context) in
396396
let open Xmlrpc_client in
397397
let tracing = Context.set_client_span __context in
398-
let http = xmlrpc ~subtask_of ~version:"1.1" "/" ~tracing in
398+
let dorpc, path =
399+
if !Xapi_globs.use_xmlrpc then
400+
(XMLRPC_protocol.rpc, "/")
401+
else
402+
(JSONRPC_protocol.rpc, "/jsonrpc")
403+
in
404+
let http = xmlrpc ~subtask_of ~version:"1.1" path ~tracing in
399405
let transport =
400406
if Pool_role.is_master () then
401407
Unix Xapi_globs.unix_domain_socket
@@ -407,7 +413,7 @@ let make_rpc ~__context rpc : Rpc.response =
407413
, !Constants.https_port
408414
)
409415
in
410-
XMLRPC_protocol.rpc ~srcstr:"xapi" ~dststr:"xapi" ~transport ~http rpc
416+
dorpc ~srcstr:"xapi" ~dststr:"xapi" ~transport ~http rpc
411417

412418
let make_timeboxed_rpc ~__context timeout rpc : Rpc.response =
413419
let subtask_of = Ref.string_of (Context.get_task_id __context) in

ocaml/xapi/xapi_globs.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,8 @@ let max_spans = ref 10000
10251025

10261026
let max_traces = ref 10000
10271027

1028+
let use_xmlrpc = ref true
1029+
10281030
let compress_tracing_files = ref true
10291031

10301032
let prefer_nbd_attach = ref false
@@ -1436,6 +1438,11 @@ let other_options =
14361438
, (fun () -> string_of_bool !allow_host_sched_gran_modification)
14371439
, "Allows to modify the host's scheduler granularity"
14381440
)
1441+
; ( "use-xmlrpc"
1442+
, Arg.Set use_xmlrpc
1443+
, (fun () -> string_of_bool !use_xmlrpc)
1444+
, "Use XMLRPC (deprecated) for internal communication or JSONRPC"
1445+
)
14391446
; ( "extauth_ad_backend"
14401447
, Arg.Set_string extauth_ad_backend
14411448
, (fun () -> !extauth_ad_backend)

0 commit comments

Comments
 (0)