Implement volume quota support in Cinder

parital fix for bug 1023311
  * To use needs cinderclient https://review.openstack.org/#/c/11509/
  * Updates quota classes with changes in Nova
  * Adds needed quota related DB tables
  * Updates test_quota to reflect changes in Nova
  * Adds absolute limits and empty rate limit functions
  * Updates test/integration/test_volume to make it work w/ above changes

Change-Id: I221c7a9dc51a2bb9bf7228c056f63ba9546cf5f9
This commit is contained in:
John Griffith
2012-08-16 15:52:52 -06:00
parent a55430ce28
commit a3af3f87f5
20 changed files with 4595 additions and 437 deletions

View File

@@ -241,8 +241,43 @@ class QuotaClass(BASE, CinderBase):
hard_limit = Column(Integer, nullable=True)
class QuotaUsage(BASE, CinderBase):
"""Represents the current usage for a given resource."""
__tablename__ = 'quota_usages'
id = Column(Integer, primary_key=True)
project_id = Column(String(255), index=True)
resource = Column(String(255))
in_use = Column(Integer)
reserved = Column(Integer)
@property
def total(self):
return self.in_use + self.reserved
until_refresh = Column(Integer, nullable=True)
class Reservation(BASE, CinderBase):
"""Represents a resource reservation for quotas."""
__tablename__ = 'reservations'
id = Column(Integer, primary_key=True)
uuid = Column(String(36), nullable=False)
usage_id = Column(Integer, ForeignKey('quota_usages.id'), nullable=False)
project_id = Column(String(255), index=True)
resource = Column(String(255))
delta = Column(Integer)
expire = Column(DateTime, nullable=False)
class Snapshot(BASE, CinderBase):
"""Represents a block storage device that can be attached to a vm."""
"""Represents a block storage device that can be attached to a VM."""
__tablename__ = 'snapshots'
id = Column(String(36), primary_key=True)