Test() method now tries the connection token aquired #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the client has a token acquired by former authentication we should
use it to test the connection. It is not enough just to keep holding the
token state when in fact it is no longer valid.
Description of the Change
The change actually performs a simple request to the ovirt-engine API, using an OPTIONS
https method with the Bearer token. If the token is no longer valid the request fails
and a reauthentication is made, to acquire a new token.
Benefits
Long running application, that needs to to communicate with engine API can survive
events of session expirations or timeouts and tokens being removed, without
creating new connections over and over again, by using the
Test()
method.This should save us from constant login attempts, and load on the session management module
in the engine.
Possible Drawbacks
It may be that we want to design the client in a way that it only uses auth token and not to really
perform login with user/pass. In that case we would need to change some of the behaviours.
Verification Process
Use the procedure described in the issue to verify #193 (comment)
Fixes: #193
@imjoey PTAL