Esempio n. 1
0
 def __init__(self, request, *args, **kwargs):
     super(UpdateProjectQuotaAction, self).__init__(request, *args, **kwargs)
     if 'project_id' in args[0]:
         project_id = args[0]['project_id']
         self.fields['images'].initial = api.get_image_quota(project_id)
         self.fields['expiration'].initial = api.get_expiration_date(project_id)
         self.fields['object_mb'].initial = api.get_object_mb_quota(project_id)
     else:
         self.fields['images'].initial = 5
         self.fields['expiration'].initial = 'Information not available.'
         self.fields['object_mb'].initial = 204800
Esempio n. 2
0
    def get_quotas(self):
        try:
            self.quota = api.nova.tenant_quota_usages(self.request)

            # jt
            project_id = self.request.session['tenant_id']
            owned_image_count = api.get_image_count(project_id, self.request)
            image_limit = api.get_image_quota(project_id)
            self.quota['images'] = {'used': owned_image_count, 'quota': image_limit}
            self.quota['expiration'] = api.get_expiration_date(project_id)
            object_mb_usage = api.get_object_mb_usage(project_id)
            object_mb_limit = api.get_object_mb_quota(project_id)
            self.quota['object_mb'] = {'used': object_mb_usage, 'quota': object_mb_limit}
        except:
            exceptions.handle(self.request,
                              _("Unable to retrieve quota information."))