Skip to content

CP-51693: introduce feature flag to use JSONRPC for internal pool communication #6123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion ocaml/tests/common/mock_rpc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let rpc __context call =
Rpc.
{
success= true
; contents= contents |> Xmlrpc.to_string |> Xmlrpc.of_string
; contents= contents |> Jsonrpc.to_string |> Jsonrpc.of_string
; is_notification= false
}
| "VM.update_allowed_operations", [session_id_rpc; self_rpc] ->
Expand Down
10 changes: 8 additions & 2 deletions ocaml/xapi/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,13 @@ let make_rpc ~__context rpc : Rpc.response =
let subtask_of = Ref.string_of (Context.get_task_id __context) in
let open Xmlrpc_client in
let tracing = Context.set_client_span __context in
let http = xmlrpc ~subtask_of ~version:"1.1" "/" ~tracing in
let dorpc, path =
if !Xapi_globs.use_xmlrpc then
(XMLRPC_protocol.rpc, "/")
else
(JSONRPC_protocol.rpc, "/jsonrpc")
in
let http = xmlrpc ~subtask_of ~version:"1.1" path ~tracing in
let transport =
if Pool_role.is_master () then
Unix Xapi_globs.unix_domain_socket
Expand All @@ -407,7 +413,7 @@ let make_rpc ~__context rpc : Rpc.response =
, !Constants.https_port
)
in
XMLRPC_protocol.rpc ~srcstr:"xapi" ~dststr:"xapi" ~transport ~http rpc
dorpc ~srcstr:"xapi" ~dststr:"xapi" ~transport ~http rpc

let make_timeboxed_rpc ~__context timeout rpc : Rpc.response =
let subtask_of = Ref.string_of (Context.get_task_id __context) in
Expand Down
7 changes: 7 additions & 0 deletions ocaml/xapi/xapi_globs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,8 @@ let max_spans = ref 10000

let max_traces = ref 10000

let use_xmlrpc = ref true

let compress_tracing_files = ref true

let prefer_nbd_attach = ref false
Expand Down Expand Up @@ -1436,6 +1438,11 @@ let other_options =
, (fun () -> string_of_bool !allow_host_sched_gran_modification)
, "Allows to modify the host's scheduler granularity"
)
; ( "use-xmlrpc"
, Arg.Set use_xmlrpc
, (fun () -> string_of_bool !use_xmlrpc)
, "Use XMLRPC (deprecated) for internal communication or JSONRPC"
)
; ( "extauth_ad_backend"
, Arg.Set_string extauth_ad_backend
, (fun () -> !extauth_ad_backend)
Expand Down
Loading