Skip to content

Commit 59824da

Browse files
committed
Fix talking to older servers
Cinderclient currently supports version 3.71 as defined in `cinderclient.api_versions.MAX_VERSION`. When doing version discovery, we create a temporary client with the MAX_VERSION and use this client to fetch the available versions. If the server doesn't support 3.71, yet, the version discovery request fails with: cinderclient.exceptions.NotAcceptable: Version 3.71 is not supported by the API. Minimum is 3.0 and maximum is 3.70. (HTTP 406) ERROR: Version 3.71 is not supported by the API. Minimum is 3.0 and maximum is 3.70. (HTTP 406) To fix this, we instead create a client with the MIN_VERSION, because the versions endpoint should be available there already. NOTE: Even when specifying an `--os-volume-api-version 3.70` the request fails, because version discovery still takes place in case we have to downgrade from the requested version. Change-Id: I38b71cea6b92da7f451e2a02d55900fe18e9aab0 Signed-off-by: Johannes Kulik <johannes.kulik@sap.com> Closes-Bug: #1998596
1 parent 018955c commit 59824da

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

cinderclient/shell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,11 @@ def main(self, argv):
771771
"using --os-volume-api-version option.")
772772
raise exc.UnsupportedVersion(msg)
773773

774-
API_MAX_VERSION = api_versions.APIVersion(api_versions.MAX_VERSION)
774+
API_MIN_VERSION = api_versions.APIVersion(api_versions.MIN_VERSION)
775775
# FIXME: the endpoint_api_version[0] can ONLY be '3' now, so the
776776
# above line should probably be ripped out and this condition removed
777777
if endpoint_api_version[0] == '3':
778-
disc_client = client.Client(API_MAX_VERSION,
778+
disc_client = client.Client(API_MIN_VERSION,
779779
os_username,
780780
os_password,
781781
os_project_name,
@@ -840,9 +840,9 @@ def _discover_client(self,
840840
if not os_service_type:
841841
os_service_type = self._discover_service_type(discovered_version)
842842

843-
API_MAX_VERSION = api_versions.APIVersion(api_versions.MAX_VERSION)
843+
API_MIN_VERSION = api_versions.APIVersion(api_versions.MIN_VERSION)
844844

845-
if (discovered_version != API_MAX_VERSION or
845+
if (discovered_version != API_MIN_VERSION or
846846
os_service_type != 'volume' or
847847
os_endpoint_type != DEFAULT_CINDER_ENDPOINT_TYPE):
848848
client_args['service_type'] = os_service_type
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
`Bug #1998596 <https://bugs.launchpad.net/python-cinderclient/+bug/1998596>`_:
5+
fixed version discovery if the server was older than the maximum supported
6+
version defined in python-cinderclient.

0 commit comments

Comments
 (0)