summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v2
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/volume/v2')
-rw-r--r--openstackclient/volume/v2/volume.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py
index 1e0cb183..cab0b2f4 100644
--- a/openstackclient/volume/v2/volume.py
+++ b/openstackclient/volume/v2/volume.py
@@ -605,14 +605,16 @@ class SetVolume(command.Command):
result = 0
if parsed_args.size:
try:
- if volume.status != 'available':
- msg = (_("Volume is in %s state, it must be available "
- "before size can be extended") % volume.status)
- raise exceptions.CommandError(msg)
if parsed_args.size <= volume.size:
msg = (_("New size must be greater than %s GB")
% volume.size)
raise exceptions.CommandError(msg)
+ if volume.status != 'available' and \
+ not volume_client.api_version.matches('3.42'):
+
+ msg = (_("Volume is in %s state, it must be available "
+ "before size can be extended") % volume.status)
+ raise exceptions.CommandError(msg)
volume_client.volumes.extend(volume.id, parsed_args.size)
except Exception as e:
LOG.error(_("Failed to set volume size: %s"), e)