コード例 #1
0
ファイル: tables.py プロジェクト: openstack/manila-ui
 def get_data(self, request, rule_id):
     rules = manila.share_snapshot_rules_list(
         request, self.table.kwargs['snapshot_id'])
     if rules:
         for rule in rules:
             if rule.id == rule_id:
                 return rule
     raise exceptions.NotFound
コード例 #2
0
 def get_data(self, request, rule_id):
     rules = manila.share_snapshot_rules_list(
         request, self.table.kwargs['snapshot_id'])
     if rules:
         for rule in rules:
             if rule.id == rule_id:
                 return rule
     raise exceptions.NotFound
コード例 #3
0
ファイル: views.py プロジェクト: openstack/manila-ui
 def get_data(self):
     try:
         snapshot_id = self.kwargs['snapshot_id']
         rules = manila.share_snapshot_rules_list(self.request, snapshot_id)
     except Exception:
         redirect = reverse('horizon:project:share_snapshots:index')
         exceptions.handle(self.request,
                           _('Unable to retrieve share snapshot rules.'),
                           redirect=redirect)
     return rules
コード例 #4
0
ファイル: views.py プロジェクト: openstack/manila-ui
 def get_data(self):
     try:
         snapshot_id = self.kwargs['snapshot_id']
         rules = manila.share_snapshot_rules_list(
             self.request, snapshot_id)
     except Exception:
         redirect = reverse('horizon:project:share_snapshots:index')
         exceptions.handle(
             self.request,
             _('Unable to retrieve share snapshot rules.'),
             redirect=redirect)
     return rules
コード例 #5
0
ファイル: views.py プロジェクト: openstack/manila-ui
    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
コード例 #6
0
ファイル: views.py プロジェクト: openstack/manila-ui
    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
コード例 #7
0
    def test_list_snapshot_rules(self):
        api.share_snapshot_rules_list(self.request, self.id)

        client = self.manilaclient
        client.share_snapshots.access_list.assert_called_once_with(self.id)
コード例 #8
0
ファイル: test_manila.py プロジェクト: openstack/manila-ui
    def test_list_snapshot_rules(self):
        api.share_snapshot_rules_list(self.request, self.id)

        client = self.manilaclient
        client.share_snapshots.access_list.assert_called_once_with(self.id)