Beispiel #1
0
 def test_quota_destroy_all_by_project(self):
     reservations = _quota_reserve(self.ctxt, "project1")
     db.quota_destroy_all_by_project(self.ctxt, "project1")
     self.assertEqual(db.quota_get_all_by_project(self.ctxt, "project1"), {"project_id": "project1"})
     self.assertEqual(db.quota_usage_get_all_by_project(self.ctxt, "project1"), {"project_id": "project1"})
     for r in reservations:
         self.assertRaises(exception.ReservationNotFound, db.reservation_get, self.ctxt, r)
Beispiel #2
0
    def delete(self, req, id):

        context = req.environ['cinder.context']
        authorize_delete(context)

        try:
            db.quota_destroy_all_by_project(context, id)
        except exception.AdminRequired:
            raise webob.exc.HTTPForbidden()
Beispiel #3
0
    def delete(self, req, id):

        context = req.environ['cinder.context']
        authorize_delete(context)

        try:
            db.quota_destroy_all_by_project(context, id)
        except exception.AdminRequired:
            raise webob.exc.HTTPForbidden()
Beispiel #4
0
    def destroy_all_by_project(self, context, project_id):
        """Destroy all that is associated with a project.

        This includes quotas, usages and reservations.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        """

        db.quota_destroy_all_by_project(context, project_id)
Beispiel #5
0
    def destroy_all_by_project(self, context, project_id):
        """Destroy all that is associated with a project.

        This includes quotas, usages and reservations.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        """

        db.quota_destroy_all_by_project(context, project_id)
Beispiel #6
0
 def test_quota_destroy_all_by_project(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     db.quota_destroy_all_by_project(self.ctxt, 'project1')
     self.assertEqual(db.quota_get_all_by_project(self.ctxt, 'project1'),
                      {'project_id': 'project1'})
     self.assertEqual(
         db.quota_usage_get_all_by_project(self.ctxt, 'project1'),
         {'project_id': 'project1'})
     for r in reservations:
         self.assertRaises(exception.ReservationNotFound,
                           db.reservation_get, self.ctxt, r)
Beispiel #7
0
 def test_quota_destroy_all_by_project(self):
     _quota_reserve(self.ctxt, "project1")
     db.quota_destroy_all_by_project(self.ctxt, "project1")
     self.assertEqual(db.quota_get_all_by_project(self.ctxt, "project1"), {"project_id": "project1"})
     self.assertEqual(db.quota_usage_get_all_by_project(self.ctxt, "project1"), {"project_id": "project1"})