Horizon Microversion Support¶
Several services use API microversions, which allows consumers of that API to specify an exact version when making a request. This can be useful in ensuring a feature continues to work as expected across many service releases.
Adding a feature that was introduced in a microversion¶
Add the feature to the
openstack_dashboard/api/microversions.pyunder the appropriate service name. The feature should have at least two versions listed; the minimum version (i.e. the version that introduced the feature) and the current working version. Providing multiple versions reduces project maintenance overheads and helps Horizon work with older service deployments.
is_feature_availablefunction for your service to show or hide the function.:
from openstack_dashboard.api import service ... def allowed(self, request): return service.is_feature_available('feature')
Send the correct microversion with
get_microversionfunction in the API layer.:
def resource_list(request): try: microversion = get_microversion(request, 'feature') client = serviceclient(request, microversion) return client.resource_list()