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
This commit is contained in:
parent
6dc9509d50
commit
e5d6f54e99
|
@ -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
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue