diff options
| author | Zuul <zuul@review.opendev.org> | 2020-11-17 14:51:42 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2020-11-17 14:51:42 +0000 |
| commit | 2005a1e833a004f9b8fc4ec7a6795c48f6a8cd6a (patch) | |
| tree | 28b09e84e07874513fa054040d66f12b5ef31891 /openstackclient/volume/client.py | |
| parent | 24edeb24a678b8cf8a8e296b303b367c45678a82 (diff) | |
| parent | 4c0bfb03fc688575fa93667bb59d399fd1c6b41d (diff) | |
| download | python-openstackclient-2005a1e833a004f9b8fc4ec7a6795c48f6a8cd6a.tar.gz | |
Merge "Allow to resize in-use volumes"
Diffstat (limited to 'openstackclient/volume/client.py')
| -rw-r--r-- | openstackclient/volume/client.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py index 1fbfaaee..64e8b9f3 100644 --- a/openstackclient/volume/client.py +++ b/openstackclient/volume/client.py @@ -29,6 +29,7 @@ API_VERSIONS = { "1": "cinderclient.v1.client.Client", "2": "cinderclient.v2.client.Client", "3": "cinderclient.v3.client.Client", + "3.42": "cinderclient.v3.client.Client", } @@ -47,14 +48,19 @@ def make_client(instance): except Exception: del API_VERSIONS['1'] - if instance._api_version[API_NAME] == '1': + version = instance._api_version[API_NAME] + from cinderclient import api_versions + # convert to APIVersion object + version = api_versions.get_api_version(version) + + if version.ver_major == '1': # Monkey patch for v1 cinderclient volumes.Volume.NAME_ATTR = 'display_name' volume_snapshots.Snapshot.NAME_ATTR = 'display_name' volume_client = utils.get_client_class( API_NAME, - instance._api_version[API_NAME], + version.ver_major, API_VERSIONS ) LOG.debug('Instantiating volume client: %s', volume_client) @@ -76,6 +82,7 @@ def make_client(instance): http_log_debug=http_log_debug, region_name=instance.region_name, endpoint_override=endpoint_override, + api_version=version, **kwargs ) |
