]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Validate value when user update quota
authorwanghao <wanghao749@huawei.com>
Thu, 2 Jul 2015 09:41:17 +0000 (17:41 +0800)
committerwanghao <wanghao749@huawei.com>
Fri, 21 Aug 2015 02:08:31 +0000 (10:08 +0800)
commitb2abe32ed02649dd2e21fbc945e8863798419450
treec476d47071c2ae2cfeee3c7fd0bc7486332197d5
parentdf8aa190701e5cbacc368e7b711574377295b6c6
Validate value when user update quota

Cinder currently doesn't check the existing resource
when user lowers the quota sets. It should have an optional
action that doesn't allow to update the quota of resources
lower than current usage.

This patch adds code to validate the update value of quota and
ensure the value can't be lower than existing resource.

APIImpact
Add an optional boolean argument 'skip_validation' with default value True.
{
  "quota_set": {xxxx},
  "skip_validation": 'True'/'False'
}
If skip_validation=False and the update value is lower than existing resource,
API will return 400 Bad Request.

Change-Id: I24428ce53e5d10e77235f372bb6d0b70ea672412
Closes-Bug: #1304234
cinder/api/contrib/quotas.py
cinder/tests/unit/api/contrib/test_quotas.py