quotas.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Trusted-Platform-Module-nova 作者: BU-NU-CLOUD-SP16 项目源码 文件源码
def delete(self, req, id):
        if self.ext_mgr.is_loaded('os-extended-quotas'):
            context = req.environ['nova.context']
            authorize_delete(context)
            params = urlparse.parse_qs(req.environ.get('QUERY_STRING', ''))
            user_id = params.get('user_id', [None])[0]
            if user_id and not self.ext_mgr.is_loaded('os-user-quotas'):
                raise webob.exc.HTTPNotFound()
            try:
                nova.context.authorize_project_context(context, id)
                # NOTE(alex_xu): back-compatible with db layer hard-code admin
                # permission checks. This has to be left only for API v2.0
                # because this version has to be stable even if it means that
                # only admins can call this method while the policy could be
                # changed.
                nova.context.require_admin_context(context)
                if user_id:
                    QUOTAS.destroy_all_by_project_and_user(context,
                                                           id, user_id)
                else:
                    QUOTAS.destroy_all_by_project(context, id)
                return webob.Response(status_int=202)
            except exception.Forbidden:
                raise webob.exc.HTTPForbidden()
        raise webob.exc.HTTPNotFound()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号