def get_data(self): try: share_instance_id = self.kwargs['share_instance_id'] share_instance = manila.share_instance_get(self.request, share_instance_id) share_instance.export_locations = ( manila.share_instance_export_location_list( self.request, share_instance_id)) export_locations = [ exp['path'] for exp in share_instance.export_locations ] share_instance.el_size = ui_utils.calculate_longest_str_size( export_locations) return share_instance except Exception: redirect = reverse('horizon:admin:share_instances:index') exceptions.handle(self.request, _('Unable to retrieve share instance details.'), redirect=redirect)
def get_data(self): try: replica_id = self.kwargs['replica_id'] replica = manila.share_replica_get(self.request, replica_id) replica.export_locations = ( manila.share_instance_export_location_list( self.request, replica_id)) export_locations = [ exp['path'] for exp in replica.export_locations ] replica.el_size = ui_utils.calculate_longest_str_size( export_locations) except Exception: redirect = reverse(self._redirect_url) exceptions.handle( self.request, _('Unable to retrieve replica %sdetails.') % replica_id, redirect=redirect) return replica
def get_data(self): try: share_instance_id = self.kwargs['share_instance_id'] share_instance = manila.share_instance_get( self.request, share_instance_id) share_instance.export_locations = ( manila.share_instance_export_location_list( self.request, share_instance_id)) export_locations = [ exp['path'] for exp in share_instance.export_locations ] share_instance.el_size = ui_utils.calculate_longest_str_size( export_locations) return share_instance except Exception: redirect = reverse('horizon:admin:share_instances:index') exceptions.handle( self.request, _('Unable to retrieve share instance details.'), redirect=redirect)
def get_data(self): try: replica_id = self.kwargs['replica_id'] replica = manila.share_replica_get(self.request, replica_id) try: # The default policy for this API does not allow # non-admins to retrieve export locations. replica.export_locations = ( manila.share_instance_export_location_list( self.request, replica_id)) export_locations = [ exp['path'] for exp in replica.export_locations ] replica.el_size = ui_utils.calculate_longest_str_size( export_locations) except Exception: replica.export_locations = [] except Exception: redirect = reverse(self._redirect_url) exceptions.handle(self.request, _('Unable to retrieve details of replica %s') % self.kwargs['replica_id'], redirect=redirect) return replica
def get_data(self): try: replica_id = self.kwargs['replica_id'] replica = manila.share_replica_get(self.request, replica_id) try: # The default policy for this API does not allow # non-admins to retrieve export locations. replica.export_locations = ( manila.share_instance_export_location_list( self.request, replica_id)) export_locations = [ exp['path'] for exp in replica.export_locations ] replica.el_size = ui_utils.calculate_longest_str_size( export_locations) except Exception: replica.export_locations = [] except Exception: redirect = reverse(self._redirect_url) exceptions.handle( self.request, _('Unable to retrieve details of replica %s') % self.kwargs['replica_id'], redirect=redirect) return replica
def test_list_share_instance_export_locations(self): api.share_instance_export_location_list(self.request, self.id) client = self.manilaclient client.share_instance_export_locations.list.assert_called_once_with( self.id)
def test_list_share_instance_export_locations(self): api.share_instance_export_location_list(self.request, self.id) client = self.manilaclient client.share_instance_export_locations.list.assert_called_once_with( self.id)