Exemplo n.º 1
0
 def handle(self, request, data):
     try:
         if base.is_service_enabled(request, 'share'):
             manila_data = dict([(key, data[key]) for key in
                                 api_manila.MANILA_QUOTA_FIELDS])
             api_manila.default_quota_update(request, **manila_data)
             return True
     except Exception:
         exceptions.handle(request,
                           _('Unable to update default quotas.'))
         return False
Exemplo n.º 2
0
    def handle(self, request, data):
        try:
            super(ManilaUpdateDefaultQuotas, self).handle(request, data)

            if base.is_service_enabled(request, 'share'):
                manila_data = dict([(key, data[key]) for key in
                                    MANILA_QUOTA_FIELDS])
                manila.default_quota_update(request, **manila_data)

        except Exception:
            horizon.exceptions.handle(request,
                                      _('Unable to update default quotas.'))

        return True
Exemplo n.º 3
0
    def handle(self, request, data):
        try:
            super(ManilaUpdateDefaultQuotas, self).handle(request, data)

            if base.is_service_enabled(request, 'share'):
                manila_data = dict([(key, data[key])
                                    for key in MANILA_QUOTA_FIELDS])
                manila.default_quota_update(request, **manila_data)

        except Exception:
            horizon.exceptions.handle(request,
                                      _('Unable to update default quotas.'))

        return True
Exemplo n.º 4
0
 def handle(self, request, data):
     try:
         if base.is_service_enabled(request, 'share'):
             manila_data = {}
             # Share group quotas are removed here because default
             # quota update for share groups is not possible yet, see
             # LP #1871252
             allowed_updates = (api_manila.MANILA_QUOTA_FIELDS -
                                {'share_groups', 'share_group_snapshots'})
             for key in allowed_updates:
                 manila_data[key] = data[key]
             api_manila.default_quota_update(request, **manila_data)
             return True
     except Exception:
         exceptions.handle(request, _('Unable to update default quotas.'))
         return False
Exemplo n.º 5
0
    def test_default_quota_update(self, provided_kwargs, expected_kwargs):
        api.default_quota_update(self.request, **provided_kwargs)

        self.manilaclient.quota_classes.update.assert_called_once_with(
            api.DEFAULT_QUOTA_NAME, **expected_kwargs)
Exemplo n.º 6
0
    def test_default_quota_update(self, provided_kwargs, expected_kwargs):
        api.default_quota_update(self.request, **provided_kwargs)

        self.manilaclient.quota_classes.update.assert_called_once_with(
            api.DEFAULT_QUOTA_NAME, **expected_kwargs)