def get_data(self): try: share_id = self.kwargs['share_id'] share = manila.share_get(self.request, share_id) share.rules = manila.share_rules_list(self.request, share_id) share.export_locations = manila.share_export_location_list( self.request, share_id) export_locations = [exp['path'] for exp in share.export_locations] share.el_size = ui_utils.calculate_longest_str_size( export_locations) except Exception: redirect = reverse('horizon:project:shares:index') exceptions.handle(self.request, _('Unable to retrieve share details.'), redirect=redirect) return share
def get_data(self): try: share_id = self.kwargs['share_id'] share = manila.share_get(self.request, share_id) share.rules = manila.share_rules_list(self.request, share_id) share.export_locations = manila.share_export_location_list( self.request, share_id) export_locations = [ exp['path'] for exp in share.export_locations] share.el_size = ui_utils.calculate_longest_str_size( export_locations) except Exception: redirect = reverse('horizon:project:shares:index') exceptions.handle(self.request, _('Unable to retrieve share details.'), redirect=redirect) return share
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: snapshot_id = self.kwargs['snapshot_id'] snapshot = manila.share_snapshot_get(self.request, snapshot_id) share = manila.share_get(self.request, snapshot.share_id) if share.mount_snapshot_support: snapshot.rules = manila.share_snapshot_rules_list( self.request, snapshot_id) snapshot.export_locations = ( manila.share_snap_export_location_list( self.request, snapshot)) export_locations = [ exp['path'] for exp in snapshot.export_locations ] snapshot.el_size = ui_utils.calculate_longest_str_size( export_locations) snapshot.share_name_or_id = share.name or share.id except Exception: exceptions.handle(self.request, _('Unable to retrieve snapshot details.'), redirect=self.redirect_url) return snapshot
def get_data(self): try: snapshot_id = self.kwargs['snapshot_id'] snapshot = manila.share_snapshot_get(self.request, snapshot_id) share = manila.share_get(self.request, snapshot.share_id) if share.mount_snapshot_support: snapshot.rules = manila.share_snapshot_rules_list( self.request, snapshot_id) snapshot.export_locations = ( manila.share_snap_export_location_list( self.request, snapshot)) export_locations = [ exp['path'] for exp in snapshot.export_locations ] snapshot.el_size = ui_utils.calculate_longest_str_size( export_locations) snapshot.share_name_or_id = share.name or share.id except Exception: exceptions.handle( self.request, _('Unable to retrieve snapshot details.'), redirect=self.redirect_url) return snapshot
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