Esempio n. 1
0
    def delete_tenant_quota(context, tenant_id):
        """Delete the quota entries for a given tenant_id.

        After deletion, this tenant will use default quota values in conf.
        Raise a "not found" error if the quota for the given tenant was
        never defined.
        """
        if quota_obj.Quota.delete_objects(context, project_id=tenant_id) < 1:
            # No record deleted means the quota was not found
            raise n_exc.TenantQuotaNotFound(tenant_id=tenant_id)
Esempio n. 2
0
    def delete_tenant_quota(context, tenant_id):
        """Delete the quota entries for a given tenant_id.

        After deletion, this tenant will use default quota values in conf.
        Raise a "not found" error if the quota for the given tenant was
        never defined.
        """
        with context.session.begin():
            tenant_quotas = context.session.query(quota_models.Quota)
            tenant_quotas = tenant_quotas.filter_by(tenant_id=tenant_id)
            if not tenant_quotas.delete():
                # No record deleted means the quota was not found
                raise n_exc.TenantQuotaNotFound(tenant_id=tenant_id)