diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst index cd4b81b5f5..6d7175bb3a 100644 --- a/doc/source/topics/settings.rst +++ b/doc/source/topics/settings.rst @@ -517,7 +517,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 @@ -533,7 +534,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`` diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py index 3790284bdb..056fd7e195 100644 --- a/openstack_dashboard/api/nova.py +++ b/openstack_dashboard/api/nova.py @@ -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'), diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index ac03705756..149848aee6 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -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