Skip to content

Commit 1e8d243

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix: extend in-use volumes check"
2 parents 54a5d2f + 03933e9 commit 1e8d243

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

openstackclient/volume/v3/volume.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,18 +764,24 @@ def take_action(self, parsed_args):
764764
_("New size must be greater than %s GB") % volume.size
765765
)
766766
raise exceptions.CommandError(msg)
767-
if (
768-
volume.status != 'available'
769-
and not volume_client.api_version.matches('3.42')
770-
):
767+
if volume.status not in ('available', 'in-use'):
771768
msg = (
772769
_(
773770
"Volume is in %s state, it must be available "
774-
"before size can be extended"
771+
"or in-use before size can be extended."
775772
)
776773
% volume.status
777774
)
778775
raise exceptions.CommandError(msg)
776+
if (
777+
volume.status == 'in-use'
778+
and not volume_client.api_version.matches('3.42')
779+
):
780+
msg = _(
781+
"--os-volume-api-version 3.42 or greater is "
782+
"required to extend in-use volumes."
783+
)
784+
raise exceptions.CommandError(msg)
779785
volume_client.volumes.extend(volume.id, parsed_args.size)
780786
except Exception as e:
781787
LOG.error(_("Failed to set volume size: %s"), e)

0 commit comments

Comments
 (0)