-
Notifications
You must be signed in to change notification settings - Fork 7
feat(linstorvolumemanager): cache controller uri in a file #83
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
base: 3.2.12-8.3
Are you sure you want to change the base?
feat(linstorvolumemanager): cache controller uri in a file #83
Conversation
958caec
to
42b42bc
Compare
drivers/linstorvolumemanager.py
Outdated
address = uri.removeprefix("linstor://") | ||
session = util.timeout_call(10, util.get_localAPI_session) | ||
for host_ref, host_record in session.xenapi.host.get_all(): | ||
if host_record.get('address', '') != address: | ||
continue | ||
return util.strtobool( | ||
session.xenapi.host.call_plugin(host_ref, PLUGIN, PLUGIN_CMD, {}) |
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'm not sure that's necessary here. We can instead do a refactoring of the codebase:
- We will assume that the cache is valid 99% of the time.
- We can directly attempt to create a LINSTOR instance from the URI without checking anything using a plugin. This is the initial idea.
- I think we can implement a new static function on
LinstorVolumeManager
that is used to create an instance of the class using the cached value directly without any checks. If it fails, we rebuild the local cache and try again. This allows us to improve several smapi functions. - There are a few edge cases left with this idea:
- In some places we use the URI to create the journaler (linstor.KV) and to create a linstor object. We could try to use the cached URI without checks again and add a try/catch directly on these specific cases. In case of connection failure, we explicitly request the cache update.
- I see one last edge case concerning the creation of a linstor instance using
get_ips_from_xha_config_file
, we could directly use the function to get the cached URI. In the worst can we can again fallback on the xha config file.
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.
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.
Sounds good from my POV. Feel free to continue when you have time. :)
42b42bc
to
065e30c
Compare
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
… of __init__ Signed-off-by: Mathieu Labourier <[email protected]>
…nection error Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
Signed-off-by: Mathieu Labourier <[email protected]>
…y logging Signed-off-by: Mathieu Labourier <[email protected]>
c315328
to
9760980
Compare
No description provided.