From 87f1de7f694136df96aeb7aa3d856c02d6f8662a Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Mon, 31 Aug 2020 11:42:05 +0200 Subject: [PATCH] Support extending in-use volumes This support was introduced in Cinder microversion 3.42 which has been around for a while. Change-Id: Ie7051cb2095023ef6f0d273488a40d520752c6b5 --- openstack_dashboard/api/cinder.py | 4 +++- openstack_dashboard/api/microversions.py | 1 + openstack_dashboard/dashboards/project/volumes/tables.py | 2 +- .../support-extending-in-use-volume-404b29c2cbc6df84.yaml | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/support-extending-in-use-volume-404b29c2cbc6df84.yaml diff --git a/openstack_dashboard/api/cinder.py b/openstack_dashboard/api/cinder.py index b88534b7d9..e09e409da0 100644 --- a/openstack_dashboard/api/cinder.py +++ b/openstack_dashboard/api/cinder.py @@ -407,7 +407,9 @@ def volume_create(request, size, name, description, volume_type, @profiler.trace def volume_extend(request, volume_id, new_size): - return cinderclient(request).volumes.extend(volume_id, new_size) + client = _cinderclient_with_features(request, + 'extend_in_use_volume') + return client.volumes.extend(volume_id, new_size) @profiler.trace diff --git a/openstack_dashboard/api/microversions.py b/openstack_dashboard/api/microversions.py index 3d52894348..ef28a1ae44 100644 --- a/openstack_dashboard/api/microversions.py +++ b/openstack_dashboard/api/microversions.py @@ -42,6 +42,7 @@ MICROVERSION_FEATURES = { "groups": ["3.27", "3.43", "3.48", "3.58"], "message_list": ["3.5", "3.29"], "limits_project_id_query": ["3.43", "3.50", "3.55"], + "extend_in_use_volume": ["3.42", "3.60"], } } diff --git a/openstack_dashboard/dashboards/project/volumes/tables.py b/openstack_dashboard/dashboards/project/volumes/tables.py index ecb8e4ce20..7f3a603710 100644 --- a/openstack_dashboard/dashboards/project/volumes/tables.py +++ b/openstack_dashboard/dashboards/project/volumes/tables.py @@ -176,7 +176,7 @@ class ExtendVolume(VolumePolicyTargetMixin, tables.LinkAction): policy_rules = (("volume", "volume:extend"),) def allowed(self, request, volume=None): - return volume.status == "available" + return volume.status in ['available', 'in-use'] class EditAttachments(tables.LinkAction): diff --git a/releasenotes/notes/support-extending-in-use-volume-404b29c2cbc6df84.yaml b/releasenotes/notes/support-extending-in-use-volume-404b29c2cbc6df84.yaml new file mode 100644 index 0000000000..a3f5ef746a --- /dev/null +++ b/releasenotes/notes/support-extending-in-use-volume-404b29c2cbc6df84.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Support for extending in-use volumes is added. The extend volume action + will be shown on in-use volumes.