Allow configuration of nova micro-version in the settings

Allows to config the api version to use on the local_settings
through OPENSTACK_API_VERSIONS.
Updates docs and local_settings.py.example.
Defaults to version 2.

Closes-Bug: 1497056

Change-Id: If9ec4dcdd79baeec105dbe3ec5345b7d6cf1dc10
Signed-off-by: Itxaka <iserrano@redhat.com>
This commit is contained in:
Itxaka 2015-11-19 14:37:57 +01:00
parent ec258c29af
commit 7b30ad54c6
3 changed files with 11 additions and 3 deletions

View File

@ -516,7 +516,8 @@ Default::
{
"data-processing": 1.1,
"identity": 2.0,
"volume": 2
"volume": 2,
"compute": 2
}
Overrides for OpenStack API versions. Use this setting to force the
@ -532,7 +533,8 @@ OpenStack dashboard to use a specific API version for a given service API.
OPENSTACK_API_VERSIONS = {
"data-processing": 1.1,
"identity": 3,
"volume": 2
"volume": 2,
"compute": 2
}
``OPENSTACK_ENABLE_PASSWORD_RETRIEVE``

View File

@ -45,6 +45,10 @@ from openstack_dashboard.api import network_base
LOG = logging.getLogger(__name__)
# Supported compute versions
VERSIONS = base.APIVersionManager("compute", preferred_version=2)
VERSIONS.load_supported_version(1.1, {"client": nova_client, "version": 1.1})
VERSIONS.load_supported_version(2, {"client": nova_client, "version": 2})
# API static values
INSTANCE_ACTIVE_STATE = 'ACTIVE'
@ -445,7 +449,8 @@ class FloatingIpManager(network_base.FloatingIpManager):
def novaclient(request):
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
c = nova_client.Client(2, request.user.username,
c = nova_client.Client(VERSIONS.get_active_version()['version'],
request.user.username,
request.user.token.id,
project_id=request.user.tenant_id,
auth_url=base.url_for(request, 'compute'),

View File

@ -50,6 +50,7 @@ WEBROOT = '/'
# "data-processing": 1.1,
# "identity": 3,
# "volume": 2,
# "compute": 2
#}
# Set this to True if running on multi-domain model. When this is enabled, it