示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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
示例#4
0
 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
示例#5
0
    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")
示例#6
0
    def test_share_replica_list(self):
        api.share_replica_list(self.request)

        self.manilaclient.share_replicas.list.assert_called_once_with(None)
示例#7
0
    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")
示例#8
0
    def test_share_replica_list(self):
        api.share_replica_list(self.request)

        self.manilaclient.share_replicas.list.assert_called_once_with(None)