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
This commit is contained in:
Matt Riedemann 2015-10-01 09:19:14 -07:00
parent abd0630bad
commit d045019f0f
3 changed files with 24 additions and 1 deletions

View File

@ -20,4 +20,10 @@ from novaclient import api_versions
__version__ = pbr.version.VersionInfo('python-novaclient').version_string()
API_MIN_VERSION = api_versions.APIVersion("2.1")
# 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 what a user
# can opt into with the --os-compute-api-version option on the CLI. Note that
# there may be gaps in supported microversions before this max version which is
# why novaclient.shell.DEFAULT_OS_COMPUTE_API_VERSION is not 2.latest or
# necessarily equal to API_MAX_VERSION.
API_MAX_VERSION = api_versions.APIVersion("2.11")

View File

@ -51,7 +51,16 @@ 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"
# We default to the highest *incremental* version that we know we can support.
# There should not be gaps in support for this version even if
# novaclient.API_MAX_VERSION is higher. The difference is API_MAX_VERSION
# caps what the user can request (they are opting into something), whereas
# DEFAULT_OS_COMPUTE_API_VERSION should be the highest version that the client
# actually supports without gaps in between. When a higher incremental version
# is implemented in the client, this version should be updated. Note that this
# value should never be 2.latest since what's latest changes depending on which
# cloud provider you're talking to.
DEFAULT_OS_COMPUTE_API_VERSION = '2.5'
DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL'
DEFAULT_NOVA_SERVICE_TYPE = "compute"

View File

@ -516,6 +516,14 @@ class ShellTest(utils.TestCase):
err = sys.stderr.getvalue()
self.assertEqual(err, 'ERROR (MyException): message\n')
def test_default_os_compute_api_version(self):
default_version = api_versions.APIVersion(
novaclient.shell.DEFAULT_OS_COMPUTE_API_VERSION)
# The default should never be the latest.
self.assertFalse(default_version.is_latest())
# The default should be less than or equal to API_MAX_VERSION.
self.assertLessEqual(default_version, novaclient.API_MAX_VERSION)
class TestLoadVersionedActions(utils.TestCase):