diff options
Diffstat (limited to 'openstackclient/volume')
| -rw-r--r-- | openstackclient/volume/client.py | 21 | ||||
| -rw-r--r-- | openstackclient/volume/v2/volume.py | 4 |
2 files changed, 17 insertions, 8 deletions
diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py index c4b0dfca..e0e670a9 100644 --- a/openstackclient/volume/client.py +++ b/openstackclient/volume/client.py @@ -37,13 +37,20 @@ def make_client(instance): # Defer client imports until we actually need them from cinderclient import extension - from cinderclient.v1.contrib import list_extensions - from cinderclient.v1 import volume_snapshots - from cinderclient.v1 import volumes - - # Monkey patch for v1 cinderclient - volumes.Volume.NAME_ATTR = 'display_name' - volume_snapshots.Snapshot.NAME_ATTR = 'display_name' + from cinderclient.v3.contrib import list_extensions + from cinderclient.v3 import volume_snapshots + from cinderclient.v3 import volumes + + # Try a small import to check if cinderclient v1 is supported + try: + from cinderclient.v1 import services # noqa + except Exception: + del API_VERSIONS['1'] + + if instance._api_version[API_NAME] == '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, diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index 8ab61d2a..7a5c207a 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -212,6 +212,9 @@ class CreateVolume(command.ShowOne): raise exceptions.CommandError( _("ERROR: --user is deprecated, please use" " --os-username instead.")) + if parsed_args.multi_attach: + LOG.warning(_("'--multi-attach' option is no longer supported by " + "the block storage service.")) volume = volume_client.volumes.create( size=size, @@ -224,7 +227,6 @@ class CreateVolume(command.ShowOne): imageRef=image, source_volid=source_volume, consistencygroup_id=consistency_group, - multiattach=parsed_args.multi_attach, scheduler_hints=parsed_args.hint, ) |
