From e5d6f54e99b6252efef578bea92739e939a8e5d2 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Wed, 15 Aug 2018 01:52:10 +0000 Subject: [PATCH] Make generic group check work with admin table Previously allowed() methods in DeleteVolume and DeleteVolumeSnapshot actions assume that the cinder generic group is always available. The current admin volume and volume snapshot tables do not load generic group information, so these allowed() methods failed and as a result these delete actions are not shown. This commit checks if a volume belongs to a generic group in more robust way. This change makes the project volume table work with deployments without the generic group as well. Change-Id: Idd887434153966d9188acaf08346fa6a0f0e6719 Closes-Bug: #1787065 --- openstack_dashboard/dashboards/project/snapshots/tables.py | 2 +- openstack_dashboard/dashboards/project/volumes/tables.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/dashboards/project/snapshots/tables.py b/openstack_dashboard/dashboards/project/snapshots/tables.py index 3ab72455f2..f0a1e8c1c7 100644 --- a/openstack_dashboard/dashboards/project/snapshots/tables.py +++ b/openstack_dashboard/dashboards/project/snapshots/tables.py @@ -99,7 +99,7 @@ class DeleteVolumeSnapshot(policy.PolicyTargetMixin, tables.DeleteAction): def allowed(self, request, datum=None): if datum: # Can't delete snapshot if part of group snapshot - if datum.group_snapshot: + if getattr(datum, 'group_snapshot_id', None): return False return True diff --git a/openstack_dashboard/dashboards/project/volumes/tables.py b/openstack_dashboard/dashboards/project/volumes/tables.py index 60bce7acd9..57aeeb9e46 100644 --- a/openstack_dashboard/dashboards/project/volumes/tables.py +++ b/openstack_dashboard/dashboards/project/volumes/tables.py @@ -120,7 +120,7 @@ class DeleteVolume(VolumePolicyTargetMixin, tables.DeleteAction): if getattr(volume, 'consistencygroup_id', None): return False # Can't delete volume if part of volume group - if volume.group: + if getattr(volume, 'group_id', None): return False return (volume.status in DELETABLE_STATES and not getattr(volume, 'has_snapshot', False))