Fix Manage Replicas button availability
Some share types don't support replication. It should be checked along with the replication availability itself to make "Manage Replicas" button properly enabled or disabled. Change-Id: I736e993125870b44b4105d544ab433692a04b657 Closes-Bug: #1619244
This commit is contained in:
parent
8be1120326
commit
b8fd858d63
|
@ -203,8 +203,9 @@ class ManageReplicas(tables.LinkAction):
|
|||
classes = ("btn-edit",)
|
||||
policy_rules = (("share", "share:replica_get_all"),)
|
||||
|
||||
def allowed(self, request, *args, **kwargs):
|
||||
return manila.is_replication_enabled()
|
||||
def allowed(self, request, share):
|
||||
share_replication_enabled = share.replication_type is not None
|
||||
return manila.is_replication_enabled() and share_replication_enabled
|
||||
|
||||
|
||||
class SharesTable(shares_tables.SharesTable):
|
||||
|
|
|
@ -229,8 +229,9 @@ class ManageReplicas(tables.LinkAction):
|
|||
classes = ("btn-edit",)
|
||||
policy_rules = (("share", "share:replica_get_all"),)
|
||||
|
||||
def allowed(self, request, *args, **kwargs):
|
||||
return manila.is_replication_enabled()
|
||||
def allowed(self, request, share):
|
||||
share_replication_enabled = share.replication_type is not None
|
||||
return manila.is_replication_enabled() and share_replication_enabled
|
||||
|
||||
|
||||
class AddRule(tables.LinkAction):
|
||||
|
|
|
@ -76,6 +76,7 @@ nameless_share = shares.Share(
|
|||
'share_server_id': '1',
|
||||
'share_network_id': '7f3d1c33-8d00-4511-29df-a2def31f3b5d',
|
||||
'availability_zone': 'Test AZ',
|
||||
'replication_type': None,
|
||||
'mount_snapshot_support': False})
|
||||
|
||||
share_with_metadata = shares.Share(
|
||||
|
@ -91,6 +92,7 @@ share_with_metadata = shares.Share(
|
|||
'share_server_id': '1',
|
||||
'share_network_id': '7f3d1c33-8d00-4511-29df-a2def31f3b5d',
|
||||
'availability_zone': 'Test AZ',
|
||||
'replication_type': 'readable',
|
||||
'mount_snapshot_support': False})
|
||||
|
||||
other_share = shares.Share(
|
||||
|
@ -107,6 +109,7 @@ other_share = shares.Share(
|
|||
'share_server_id': '1',
|
||||
'share_network_id': '7f3d1c33-8d00-4511-29df-a2def31f3b5d',
|
||||
'availability_zone': 'Test AZ',
|
||||
'replication_type': 'readable',
|
||||
'mount_snapshot_support': False})
|
||||
|
||||
share_replica = share_replicas.ShareReplica(
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
fixes:
|
||||
- Fixed Manage Replicas button availability.
|
Loading…
Reference in New Issue