def get_data(self): try: share_id = self.kwargs['share_id'] return manila.share_replica_list(self.request, share_id) except Exception: redirect = reverse(self._redirect_url) exceptions.handle(self.request, _('Unable to retrieve share replicas.'), redirect=redirect)
def get_data(self): try: share_id = self.kwargs['share_id'] return manila.share_replica_list(self.request, share_id) except Exception: redirect = reverse(self._redirect_url) exceptions.handle( self.request, _('Unable to retrieve share replicas.'), redirect=redirect)
def allowed(self, request, replica=None): if replica: share = manila.share_get(request, replica.share_id) replicas = manila.share_replica_list(request, replica.share_id) if share.replication_type is None: return False elif (share.replication_type is 'writable' and replica.status in DELETABLE_STATUSES and len(replicas) > 1) or (share.replication_type in ('dr', 'readable') and replica.status in DELETABLE_STATUSES and replica.replica_state != 'active'): return True return False
def allowed(self, request, replica=None): if replica: share = manila.share_get(request, replica.share_id) replicas = manila.share_replica_list(request, replica.share_id) if share.replication_type is None: return False elif (share.replication_type is 'writable' and replica.status in DELETABLE_STATUSES and len(replicas) > 1) or ( share.replication_type in ('dr', 'readable') and replica.status in DELETABLE_STATUSES and replica.replica_state != 'active'): return True return False
def test_share_replica_list_with_filter_by_share(self): api.share_replica_list(self.request, share="FOO") self.manilaclient.share_replicas.list.assert_called_once_with("FOO")
def test_share_replica_list(self): api.share_replica_list(self.request) self.manilaclient.share_replicas.list.assert_called_once_with(None)
def test_share_replica_list_with_filter_by_share(self): api.share_replica_list(self.request, share="FOO") self.manilaclient.share_replicas.list.assert_called_once_with("FOO")
def test_share_replica_list(self): api.share_replica_list(self.request) self.manilaclient.share_replicas.list.assert_called_once_with(None)