]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Fix quota limit range validator
authorElena Ezhova <eezhova@mirantis.com>
Mon, 25 Aug 2014 14:44:32 +0000 (18:44 +0400)
committerElena Ezhova <eezhova@mirantis.com>
Thu, 25 Sep 2014 06:30:14 +0000 (10:30 +0400)
commit3ca85460a178a18dea60399fd369ed84b17721dc
tree001c672946f6ea45de611a233f4ea011161eebb5
parenta49f8e9ebfd30db5c2f9796beb22de758cd139c1
Fix quota limit range validator

In Quota model limit is defined with Integer type which in case of
MySQL and PostgreSQL is always stored in 4 bytes. At the same time,
the current validator checks that the value does not exceed sys.maxsize
which depends on whether the system is 32-bit or 64-bit based.

In SQLite Integer can be stored in 1, 2, 3, 4, 6, or 8 bytes depending
on the magnitude of the value. Nevertheless, assume that it can not
exceed 4 bytes for consistency.

Limited the upper bound of the validator with 2**31 - 1.

Added a unit test.

Closes-Bug: #1338479
Change-Id: Icefa2fc228e4255a022d586cab4590607953d1ee
neutron/common/constants.py
neutron/extensions/quotasv2.py
neutron/tests/unit/test_quota_ext.py