diff options
| author | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2021-05-20 09:18:26 -0400 |
|---|---|---|
| committer | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2021-05-20 09:20:56 -0400 |
| commit | b019a561876b51523021654f3b499c962ce54fb6 (patch) | |
| tree | cef6e75e580891e0591fc267099a87f684a4102e /openstackclient/volume | |
| parent | 6bdf030953d449693c97bff8812b7ced981a2015 (diff) | |
| download | python-openstackclient-b019a561876b51523021654f3b499c962ce54fb6.tar.gz | |
Add check for cinderclient.v2 support
Block Storage API v2 support is being removed from the cinderclient
during the Xena development cycle [0], so add a check to determine
whether the available cinderclient has v2 support.
[0] https://wiki.openstack.org/wiki/CinderXenaPTGSummary#Removing_the_Block_Storage_API_v2
Change-Id: Id54da1704d94526071f500c36a6e38d6d84aa7b8
Diffstat (limited to 'openstackclient/volume')
| -rw-r--r-- | openstackclient/volume/client.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py index 64e8b9f3..37cb4168 100644 --- a/openstackclient/volume/client.py +++ b/openstackclient/volume/client.py @@ -42,11 +42,15 @@ def make_client(instance): from cinderclient.v3 import volume_snapshots from cinderclient.v3 import volumes - # Try a small import to check if cinderclient v1 is supported + # Check whether the available cinderclient supports v1 or v2 try: from cinderclient.v1 import services # noqa except Exception: del API_VERSIONS['1'] + try: + from cinderclient.v2 import services # noqa + except Exception: + del API_VERSIONS['2'] version = instance._api_version[API_NAME] from cinderclient import api_versions |
