Add get_highest_version method
Add method to query a server that supports /v3 endpoint and get the highest supported microversion. Change-Id: If179760787526440c852803eafaf9617bcd2d36e
This commit is contained in:
parent
2800fb0619
commit
61faea2eb3
cinderclient
@ -244,6 +244,18 @@ def _get_server_version_range(client):
|
|||||||
return APIVersion(version.min_version), APIVersion(version.version)
|
return APIVersion(version.min_version), APIVersion(version.version)
|
||||||
|
|
||||||
|
|
||||||
|
def get_highest_version(client):
|
||||||
|
"""Queries the server version info and returns highest supported
|
||||||
|
microversion
|
||||||
|
|
||||||
|
:param client: client object
|
||||||
|
:returns: APIVersion
|
||||||
|
"""
|
||||||
|
server_start_version, server_end_version = _get_server_version_range(
|
||||||
|
client)
|
||||||
|
return server_end_version
|
||||||
|
|
||||||
|
|
||||||
def discover_version(client, requested_version):
|
def discover_version(client, requested_version):
|
||||||
"""Checks ``requested_version`` and returns the most recent version
|
"""Checks ``requested_version`` and returns the most recent version
|
||||||
supported by both the API and the client.
|
supported by both the API and the client.
|
||||||
|
@ -253,3 +253,9 @@ class DiscoverVersionTestCase(utils.TestCase):
|
|||||||
discovered_version.get_string())
|
discovered_version.get_string())
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
self.fake_client.services.server_api_version.called)
|
self.fake_client.services.server_api_version.called)
|
||||||
|
|
||||||
|
def test_get_highest_version(self):
|
||||||
|
self._mock_returned_server_version("3.14", "3.0")
|
||||||
|
highest_version = api_versions.get_highest_version(self.fake_client)
|
||||||
|
self.assertEqual("3.14", highest_version.get_string())
|
||||||
|
self.assertTrue(self.fake_client.services.server_api_version.called)
|
||||||
|
Loading…
Reference in New Issue
Block a user