Skip to content

Commit 278ab35

Browse files
authored
CA-413412: Fail to designate new master (#6582)
The user attempted to designate a new master, but the operation failed. The root cause is as follows: After the new proposed master successfully sent the `commit_new_master` API call to the old master, it attempted to send a `logout` request. However, at this point, the old master was already rebooting its xapi service, causing the `logout` to fail. As a result, the process of designating the new master was marked as failed, and the status changed to `broken`. In high-load environments, there can be a delay in sending the logout request, increasing the likelihood that it is sent after the old master has already started rebooting. If `commit_new_master` has already been successful, the success of the subsequent `logout` operation should not be considered critical. Therefore, the solution is to ignore the result of the `logout` request if `commit_new_master` was successful.
2 parents 9c145a0 + 12826e8 commit 278ab35

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ocaml/xapi/helpers.ml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ let call_api_functions ~__context f =
591591
call_api_functions_internal ~__context f
592592

593593
let call_emergency_mode_functions hostname f =
594+
let __FUN = __FUNCTION__ in
594595
let open Xmlrpc_client in
595596
let transport =
596597
SSL
@@ -609,7 +610,13 @@ let call_emergency_mode_functions hostname f =
609610
in
610611
finally
611612
(fun () -> f rpc session_id)
612-
(fun () -> Client.Client.Session.local_logout ~rpc ~session_id)
613+
(fun () ->
614+
try Client.Client.Session.local_logout ~rpc ~session_id
615+
with _ ->
616+
(* This is an emergency mode function, so we don't care about the error
617+
in logout *)
618+
debug "%s: The logout failed in emergency mode function" __FUN
619+
)
613620

614621
let is_domain_zero_with_record ~__context vm_ref vm_rec =
615622
let host_ref = vm_rec.API.vM_resident_on in

0 commit comments

Comments
 (0)