Skip to content

Commit 8a293a0

Browse files
authored
CA-403759: Initialise licensing after no-other-masters check (#6257)
When the coordinator restarts. the no-other-masters check in the startup sequence does two things for each pool member: 1. It checks that the host agrees that it is are not the coordinator. 2. It unblocks the host's master_connection thread, which is likely waiting for a reconnection delay to expire, which may be up to 256 seconds (exponential backoff is used). The delay is interrupted to immediately unblock DB calls. Licensing initialisation comes earlier in the startup sequence, but under certain circumstance make calls to other host, in particular after an upgrade. A this time, hosts may still be blocked on the master_connection for up to 256 s, which adds an unnecessary delay to the coordinator's startup sequence and therefore the usability of the API. Address this by reversing the order of the two startup actions.
2 parents d6e1139 + f346848 commit 8a293a0

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

ocaml/database/master_connection.ml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,24 +235,17 @@ let do_db_xml_rpc_persistent_with_reopen ~host:_ ~path (req : string) :
235235
let time_sofar = Unix.gettimeofday () -. time_call_started in
236236
if !connection_timeout < 0. then (
237237
if not !surpress_no_timeout_logs then (
238-
debug
239-
"Connection to master died. I will continue to retry indefinitely \
240-
(supressing future logging of this message)." ;
241238
error
242239
"Connection to master died. I will continue to retry indefinitely \
243-
(supressing future logging of this message)."
244-
) ;
245-
surpress_no_timeout_logs := true
240+
(supressing future logging of this message)." ;
241+
surpress_no_timeout_logs := true
242+
)
246243
) else
247244
debug
248245
"Connection to master died: time taken so far in this call '%f'; will \
249246
%s"
250247
time_sofar
251-
( if !connection_timeout < 0. then
252-
"never timeout"
253-
else
254-
Printf.sprintf "timeout after '%f'" !connection_timeout
255-
) ;
248+
(Printf.sprintf "timeout after '%f'" !connection_timeout) ;
256249
if time_sofar > !connection_timeout && !connection_timeout >= 0. then
257250
if !restart_on_connection_timeout then (
258251
debug "Exceeded timeout for retrying master connection: restarting xapi" ;

ocaml/xapi/xapi.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,6 @@ let server_init () =
12181218
, []
12191219
, Monitor_master.update_configuration_from_master
12201220
)
1221-
; ("Initialising licensing", [], handle_licensing)
12221221
; ( "message_hook_thread"
12231222
, [Startup.NoExnRaising]
12241223
, Xapi_message.start_message_hook_thread ~__context
@@ -1252,6 +1251,7 @@ let server_init () =
12521251
, [Startup.OnlyMaster]
12531252
, check_no_other_masters
12541253
)
1254+
; ("Initialising licensing", [], handle_licensing)
12551255
; ( "Registering periodic functions"
12561256
, []
12571257
, fun () -> Xapi_periodic_scheduler_init.register ~__context

0 commit comments

Comments
 (0)