]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Re-enable -1 child limits for nested quotas
authorRyan McNair <rdmcnair@us.ibm.com>
Tue, 16 Feb 2016 17:12:53 +0000 (17:12 +0000)
committerRyan McNair <rdmcnair@us.ibm.com>
Sat, 27 Feb 2016 07:16:10 +0000 (07:16 +0000)
commitc02336e4dd889b7b2a474488c4e964d08d558901
tree229b635b0a10b89cea305337a13c8414ab5b764c
parentd3fd2828f6970ab5b2c3cb5014a0ef73eb64feee
Re-enable -1 child limits for nested quotas

Add back support for -1 limits of child projects. The way that we
support the -1 child limits requires the following changes:
  * Continue quota validation up the hierarchy if the current limit is
    -1 until we hit a hard limit or no more parents, and update the
    any relevant parents' allocated value along the way
  * When updating limits, special care needs to be taken when updating
    child limit to be -1, or when changing from a -1 limit
  * Enable support for creating reservations for "allocated" values
    to support the scenario that:
      - a volume is created on a project with a limit of -1
      - the parent's allocated value has been updated appropriately
      - the volume create fails and the child's in_use quota rolls back
      - now we must also rollback the parent's allocated value

NOTE: There is a race condition between validation the NestedQuotas
and when the driver may be switched into use, and if -1 quotas are used
the validation could be out of date. Will look into better support for
switching on of NestedQuotas on live deployment with -1 limits, which
would likely leverage the "allocated" reservation system.

Closes-Bug: #1548645
Closes-Bug: #1544774
Closes-Bug: #1537189
Change-Id: I2d1dba87baf3595cc8f48574e0281ac17509fe7d
12 files changed:
cinder/api/contrib/quotas.py
cinder/db/api.py
cinder/db/sqlalchemy/api.py
cinder/db/sqlalchemy/migrate_repo/versions/066_add_allocated_id_column_to_reservations.py [new file with mode: 0644]
cinder/db/sqlalchemy/models.py
cinder/quota.py
cinder/quota_utils.py
cinder/tests/unit/api/contrib/test_quotas.py
cinder/tests/unit/test_migrations.py
cinder/tests/unit/test_quota.py
cinder/tests/unit/test_quota_utils.py
cinder/volume/flows/api/create_volume.py