def test_grandkid_negative_one_limit_enforced(self): quota = {'volumes': 2, 'gigabytes': 2} body = {'quota_set': quota} self.controller.update(self.req, self.A.id, body) quota['volumes'] = -1 quota['gigabytes'] = -1 self.controller.update(self.req, self.B.id, body) self.controller.update(self.req, self.C.id, body) self.controller.update(self.req, self.D.id, body) def _reserve(project_id): quotas.QUOTAS._driver.reserve( self.req.environ['cinder.context'], quotas.QUOTAS.resources, {'volumes': 1, 'gigabytes': 1}, project_id=project_id) _reserve(self.C.id) _reserve(self.D.id) self.assertRaises(exception.OverQuota, _reserve, self.B.id) self.assertRaises(exception.OverQuota, _reserve, self.C.id) self.assertRaises(exception.OverQuota, _reserve, self.D.id) # Make sure the rollbacks went successfully for allocated for all res for res in quota.keys(): self._assert_quota_show(self.A.id, res, allocated=2, limit=2) self._assert_quota_show(self.B.id, res, allocated=1, limit=-1) self._assert_quota_show(self.C.id, res, reserved=1, limit=-1) self._assert_quota_show(self.D.id, res, reserved=1, limit=-1)