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
This commit is contained in:
@@ -42,11 +42,15 @@ def make_client(instance):
|
|||||||
from cinderclient.v3 import volume_snapshots
|
from cinderclient.v3 import volume_snapshots
|
||||||
from cinderclient.v3 import volumes
|
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:
|
try:
|
||||||
from cinderclient.v1 import services # noqa
|
from cinderclient.v1 import services # noqa
|
||||||
except Exception:
|
except Exception:
|
||||||
del API_VERSIONS['1']
|
del API_VERSIONS['1']
|
||||||
|
try:
|
||||||
|
from cinderclient.v2 import services # noqa
|
||||||
|
except Exception:
|
||||||
|
del API_VERSIONS['2']
|
||||||
|
|
||||||
version = instance._api_version[API_NAME]
|
version = instance._api_version[API_NAME]
|
||||||
from cinderclient import api_versions
|
from cinderclient import api_versions
|
||||||
|
Reference in New Issue
Block a user