Set DEFAULT_OS_COMPUTE_API_VERSION to 2.5
The client currently implements support for microversions 2.2, 2.4 and 2.11. According the nova API microversion history: http://docs.openstack.org/developer/nova/api_microversion_history.html 2.3 just returns extra attributes in the response so it's not a problem for the client. We should expose those at some point but it's not a breaking change. 2.5 is a server-side only change since the client allows filtering servers by IPv6 address but the server wasn't honoring that until 2.5. There are no client side changes for that microversion. 2.6 is the first backwards incompatible microversion since it replaces the old specific console APIs (RDP/serial/SPICE/VNC) with a new generic remote-consoles API. The client must be updated to handle this since requesting any microversion >=2.6 for consoles will fail right now. This is exposed on the CLI right now because the CLI defaults to the 2.latest microversion. So even though the client actually supports the 2.11 microversion, we shouldn't default to higher than 2.5 because we have gaps in handling 2.6->2.10. This change fixes the default for the CLI by setting DEFAULT_OS_COMPUTE_API_VERSION=2.5. Partial-Bug: #1500688 Change-Id: I52074f9a3e7faa6a7a51c3fa9766100acf25dee2 (cherry picked from commitd045019f0f
) ------------------------------------------------------------------------ The first change introduced a regression which is fixed in the following squashed change to make the complete fix. ------------------------------------------------------------------------ Correct usage of API_MAX_VERSION and DEFAULT_OS_COMPUTE_API_VERSION Commitd045019f0f
use the variables API_MAX_VERSION and DEFAULT_OS_COMPUTE_API_VERSION with wrong way. API_MAX_VERSION means the max version of client supported. This variable only be changed when client support the new version. And it's must bumped sequentially. DEFAULT_OS_COMPUTE_API_VERSION is default value of option '--os-compute-api-version', this value decided the default behaviour of nova client. The nova client CLI behaviour should be that client negotiate with server side to find out most recent version betweeyn client and server. So the value should be '2.latest'. And it won't be changed except we decided to change the default behaviour of nova client CLI. Change-Id: Iba9bfa136245bd2899c427ac0c231a30c00bd7f3 Closes-Bug: #1508244 (cherry picked from commit28bf8ddb06
)
This commit is contained in:
parent
3636685ede
commit
dc4970728b
|
@ -20,4 +20,9 @@ from novaclient import api_versions
|
|||
__version__ = pbr.version.VersionInfo('python-novaclient').version_string()
|
||||
|
||||
API_MIN_VERSION = api_versions.APIVersion("2.1")
|
||||
API_MAX_VERSION = api_versions.APIVersion("2.11")
|
||||
# The max version should be the latest version that is supported in the client,
|
||||
# not necessarily the latest that the server can provide. This is only bumped
|
||||
# when client supported the max version, and bumped sequentially, otherwise
|
||||
# the client may break due to server side new version may include some
|
||||
# backward incompatible change.
|
||||
API_MAX_VERSION = api_versions.APIVersion("2.5")
|
||||
|
|
|
@ -51,7 +51,11 @@ from novaclient.openstack.common import cliutils
|
|||
from novaclient import utils
|
||||
|
||||
DEFAULT_MAJOR_OS_COMPUTE_API_VERSION = "2.0"
|
||||
DEFAULT_OS_COMPUTE_API_VERSION = "2.latest"
|
||||
# The default behaviour of nova client CLI is that CLI negotiates with server
|
||||
# to find out the most recent version between client and server, and
|
||||
# '2.latest' means to that. This value never be changed until we decided to
|
||||
# change the default behaviour of nova client CLI.
|
||||
DEFAULT_OS_COMPUTE_API_VERSION = '2.latest'
|
||||
DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL'
|
||||
DEFAULT_NOVA_SERVICE_TYPE = "compute"
|
||||
|
||||
|
|
|
@ -65,6 +65,12 @@ FAKE_ENV5 = {'OS_USERNAME': 'username',
|
|||
'OS_COMPUTE_API_VERSION': '2',
|
||||
'OS_AUTH_SYSTEM': 'rackspace'}
|
||||
|
||||
FAKE_ENV6 = {'OS_USERNAME': 'username',
|
||||
'OS_PASSWORD': 'password',
|
||||
'OS_TENANT_NAME': 'tenant_name',
|
||||
'OS_AUTH_URL': 'http://no.where/v2.0',
|
||||
'OS_AUTH_SYSTEM': 'rackspace'}
|
||||
|
||||
|
||||
def _create_ver_list(versions):
|
||||
return {'versions': {'values': versions}}
|
||||
|
@ -424,6 +430,25 @@ class ShellTest(utils.TestCase):
|
|||
keyring_saver = mock_client_instance.client.keyring_saver
|
||||
self.assertIsInstance(keyring_saver, novaclient.shell.SecretsHelper)
|
||||
|
||||
@mock.patch('novaclient.client.Client')
|
||||
def test_microversion_with_default_behaviour(self, mock_client):
|
||||
self.make_env(fake_env=FAKE_ENV6)
|
||||
self.mock_server_version_range.return_value = (
|
||||
api_versions.APIVersion("2.1"), api_versions.APIVersion("2.3"))
|
||||
self.shell('list')
|
||||
client_args = mock_client.call_args_list[1][0]
|
||||
self.assertEqual(api_versions.APIVersion("2.3"), client_args[0])
|
||||
|
||||
@mock.patch('novaclient.client.Client')
|
||||
def test_microversion_with_default_behaviour_with_legacy_server(
|
||||
self, mock_client):
|
||||
self.make_env(fake_env=FAKE_ENV6)
|
||||
self.mock_server_version_range.return_value = (
|
||||
api_versions.APIVersion(), api_versions.APIVersion())
|
||||
self.shell('list')
|
||||
client_args = mock_client.call_args_list[1][0]
|
||||
self.assertEqual(api_versions.APIVersion("2.0"), client_args[0])
|
||||
|
||||
@mock.patch('novaclient.client.Client')
|
||||
def test_microversion_with_latest(self, mock_client):
|
||||
self.make_env()
|
||||
|
|
Loading…
Reference in New Issue