Client Caching Of Negotiated Version¶
This adds support for caching the version negotiated by the ironicclient, between itself and the ironic server. This is supplementary to the ‘api microversion’ spec approved in the Kilo release.
When the ironicclient talks to the ironic server, there may be a mismatch in supported API versions. The client and server negotiate a version to be used in communicating, but since the ironicclient can be used as a user interactive client, this process of negotiation would be repeated for each command line invocation.
It would be useful, for each ironic server that the ironicclient talks to, to cache the version agreed upon for communication, so that each conversation between client and server does not require renegotiation.
This version caching would need to be per user, for each ironic server (host, network port pair specific) and would be time-bound (say 5 minutes), so any future upgrade of the client or server would benefit from supporting newer available versions.
The proposed implementation consists of caching the negotiated version information between an ironicclient and ironic server in local file storage for use by future invocations of the ironicclient.
This information would be cached for a specific period of time, before becoming stale and ignored.
Specifically, we are proposing:
Using the dogpile.cache caching system, a pre-existing library that is already included in global requirements. It is currently used by os-client-config, which is used by openstackclient.
Storing the cached information in local file storage, using appdirs to provide the correct location
Indexing the version information in an ironic-server:network-port pair (such as ‘example.com:1234’) so that multiple ironic servers running on the same IP address will be cached independently for each user invoking python-ironicclient
Having a default period of 5 minutes for caching version information for each ironic server
Storing the version information in a well-known, standardised, local file storage location means that, if the user wants to, they can remove the cached version information manually triggering a renegotiation of the version to be used in communication between the client and server.
An alternative file-based solution was proposed, but rejected in favour of using dogpile.cache.
The suggestion to move to dogpile.cache was made both in the code review and was discussed in IRC.
Reasons for using dogpile.cache included: commonality with existing file caching libraries used elsewhere in OpenStack, and use of tested common libraries typically means less bugs.
Data model impact¶
State Machine Impact¶
REST API impact¶
Client (CLI) impact¶
This spec only affects the python-ironicclient, not ironic server.
RPC API impact¶
Driver API impact¶
Nova driver impact¶
Other end user impact¶
This change potentially reduces network traffic between the client and server and hence aids scalability.
This change potentially reduces network traffic between the client and server and hence improves latency between when a request is made to ironic and when the response is received.
Other deployer impact¶
- Primary assignee:
mrda - Michael Davies <firstname.lastname@example.org>
The implementation of this spec has already commenced - see 
Unit tests will be provided to verify this solution
Upgrades and Backwards Compatibility¶
 API Microversions Spec: http://specs.openstack.org/openstack/ironic-specs/specs/kilo/api-microversions.html
 Documentation on dogpile.cache is found here: https://dogpilecache.readthedocs.org/en/latest/
 dogpile.cache is already specified in https://github.com/openstack/requirements/blob/master/global-requirements.txt
 Documentation on appdirs is found here: https://pypi.org/project/appdirs
 Original custom file cache solution: https://review.opendev.org/#/c/173674/1/
 Current state of the implementation at the time of this spec being raised: https://review.opendev.org/#/c/173674/19