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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user