-
Notifications
You must be signed in to change notification settings - Fork 296
CA-422713: XSI-2105: Pool.join failed due to AD status corrupt #6832
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1889,13 +1889,13 @@ let enable_external_auth ~__context ~host ~config ~service_name ~auth_type = | |
|
|
||
| (* CP-718: Disables external auth/directory service for host *) | ||
| let disable_external_auth_common ?(during_pool_eject = false) ~__context ~host | ||
| ~config () = | ||
| ~config ~force () = | ||
| (* CP-825: Serialize execution of host-enable-extauth and host-disable-extauth *) | ||
| (* we need to protect against concurrent access to the host.external_auth_type variable *) | ||
| with_lock serialize_host_enable_disable_extauth (fun () -> | ||
| let host_name_label = Db.Host.get_name_label ~__context ~self:host in | ||
| let auth_type = Db.Host.get_external_auth_type ~__context ~self:host in | ||
| if auth_type = "" then | ||
| if auth_type = "" && not force then | ||
| (* nothing to do, external authentication is already disabled *) | ||
| let msg = "external authentication service is already disabled" in | ||
| debug "Failed to disable external authentication in host %s: %s" | ||
|
|
@@ -1936,6 +1936,8 @@ let disable_external_auth_common ?(during_pool_eject = false) ~__context ~host | |
| , [msg] | ||
| ) | ||
| ) | ||
| | Extauth_is_disabled -> | ||
| Some Extauth_is_disabled | ||
| | e -> | ||
| (*absorb any exception*) | ||
| debug | ||
|
|
@@ -1957,19 +1959,6 @@ let disable_external_auth_common ?(during_pool_eject = false) ~__context ~host | |
| Xapi_globs.event_hook_auth_on_xapi_initialize_succeeded := true ; | ||
|
|
||
| (* succeeds because there's no need to initialize anymore *) | ||
|
|
||
| (* If any cache is present, clear it in order to ensure cached | ||
| logins don't persist after disabling external | ||
| authentication. *) | ||
| Xapi_session.clear_external_auth_cache () ; | ||
|
|
||
| (* 3. CP-703: we always revalidate all sessions after the external authentication has been disabled *) | ||
| (* so that all sessions that were externally authenticated will be destroyed *) | ||
| debug | ||
| "calling revalidate_all_sessions after disabling external auth for \ | ||
| host %s" | ||
| host_name_label ; | ||
| Xapi_session.revalidate_all_sessions ~__context ; | ||
| if not during_pool_eject then | ||
| (* CA-28168 *) | ||
| (* CA-24856: detect non-homogeneous external-authentication config in this host *) | ||
|
|
@@ -1978,19 +1967,18 @@ let disable_external_auth_common ?(during_pool_eject = false) ~__context ~host | |
| if auth_type = Xapi_globs.auth_type_AD then | ||
| Extauth_ad.stop_backend_daemon ~wait_until_success:false ; | ||
| match plugin_disable_failure with | ||
| | None -> | ||
| (* we do not want to stop pool_eject and permit Extauth_is_disabled during force *) | ||
| | Some e when during_pool_eject || (e = Extauth_is_disabled && force) -> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the use of |
||
| () | ||
| | Some e -> | ||
| if not during_pool_eject then | ||
| raise e (* bubble up plugin's on_disable exception *) | ||
| else | ||
| () | ||
| (* we do not want to stop pool_eject *) | ||
| raise e | ||
| | None -> | ||
| () | ||
| ) | ||
|
|
||
| let disable_external_auth ~__context ~host ~config = | ||
| let disable_external_auth ~__context ~host ~config ~force = | ||
| disable_external_auth_common ~during_pool_eject:false ~__context ~host ~config | ||
| () | ||
| ~force () | ||
|
|
||
| module Static_vdis_list = Xapi_database.Static_vdis_list | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2037,7 +2037,7 @@ let eject_self ~__context ~host = | |
| (* disable the external authentication of this slave being ejected *) | ||
| (* this call will return an exception if something goes wrong *) | ||
| Xapi_host.disable_external_auth_common ~during_pool_eject:true ~__context | ||
| ~host ~config:[] () ; | ||
| ~host ~config:[] ~force:false () ; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not clear for what cases we need force:false? What's the benefit of it?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we do not use |
||
|
|
||
| (* FIXME: in the future, we should send the windows AD admin/pass here *) | ||
| (* in order to remove the slave from the AD database during pool-eject *) | ||
|
|
@@ -2973,7 +2973,7 @@ let enable_external_auth ~__context ~pool:_ ~config ~service_name ~auth_type = | |
| (* best-effort attempt to disable all enabled hosts, swallowing any exceptions *) | ||
| try | ||
| call_fn_on_host ~__context | ||
| (Client.Host.disable_external_auth ~config) | ||
| (Client.Host.disable_external_auth ~config ~force:false) | ||
| host | ||
| with e -> | ||
| debug | ||
|
|
@@ -3041,7 +3041,7 @@ let disable_external_auth ~__context ~pool:_ ~config = | |
| (* forward the call to the host in the pool *) | ||
| try | ||
| call_fn_on_host ~__context | ||
| (Client.Host.disable_external_auth ~config) | ||
| (Client.Host.disable_external_auth ~config ~force:false) | ||
| host ; | ||
| (* no failed host to add to the filtered list, just visit next host *) | ||
| (host, "", "") | ||
|
|
@@ -3100,9 +3100,21 @@ let disable_external_auth ~__context ~pool:_ ~config = | |
| ) | ||
| ) | ||
| ) else (* OK *) | ||
| ( | ||
| (* If any cache is present, clear it in order to ensure cached | ||
| logins don't persist after disabling external | ||
| authentication. *) | ||
| Xapi_session.clear_external_auth_cache () ; | ||
|
|
||
| (* CP-703: we always revalidate all sessions after the external authentication has been disabled *) | ||
| (* so that all sessions that were externally authenticated will be destroyed *) | ||
| debug "calling revalidate_all_sessions after disabling external auth" ; | ||
| Xapi_session.revalidate_all_sessions ~__context ; | ||
|
|
||
| debug | ||
| "The external authentication of all hosts in the pool was disabled \ | ||
| successfully" | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it change the behavior? If the pool disable partially fails, some hosts have been disabled. Does it need to clear the session?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, we should not clear the session. |
||
| ) | ||
|
|
||
| (* CA-24856: detect non-homogeneous external-authentication config in pool *) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not let the user pass the force value like
xe host-disable-external-auth --force=trueThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is let use use
--force=trueper my test.note:
force=true|--forceis forced to reach here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the command requires --force to make the user aware of it is a recover command only. So the user can't select force:false. It is intended, Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, This API is hidden, only used for specific purpose with
--forcefor awareness.