Skip to content

Conversation

@johnelse
Copy link
Contributor

No description provided.

Signed-off-by: John Else <john.else@citrix.com>
Instead of exposing the master_database ref directly, expose a setter
and document it as for testing purposes only.

Signed-off-by: John Else <john.else@citrix.com>
Signed-off-by: John Else <john.else@citrix.com>
This has very similar arguments to login_no_password, but is not exposed
in the Xapi_session interface.

Signed-off-by: John Else <john.else@citrix.com>
For DR, xapi creates special read-only sessions which are registered
with alternate databases. These sessions can be used to query the
contents of these databases. The external session revalidation function
checks whether sessions are registered in this way and, if they are
registered, it will not destroy them.

However, there is a race window during the period when one of these
sessions has been created but has not yet been registered with a
database. To fix this, we create the session while holding the
registration mutex, so any concurrent revalidation checks will wait
until the registration of the session is complete.

The registration logic is moved down to login_no_password_common, as the
registration mutex needs to be released before the final API call.

n.b. the API call used at the end of login_no_password_common has
changed from session.get_uuid to pool.get_all. The purpose of this API
call is simply to get the pool master to update the last_active time on
the session, so most API calls could be used here. session.get_uuid no
longer works, because the session is already registered with the
alternate database. pool.get_all is chosen as it is currently guaranteed
to return only a small amount of data.

Signed-off-by: John Else <john.else@citrix.com>
@jonludlam
Copy link
Contributor

All looks good to me!

jonludlam pushed a commit that referenced this pull request Feb 24, 2016
CA-199656: Fix race in registering sessions with alternate databases
@jonludlam jonludlam merged commit ce0c4d8 into xapi-project:master Feb 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants