summaryrefslogtreecommitdiff
path: root/trove/quota
diff options
context:
space:
mode:
authorzhanggang <zhanggang@cmss.chinamobile.com>2018-07-16 11:27:34 +0800
committerzhanggang <zhanggang@cmss.chinamobile.com>2018-07-17 15:14:11 +0800
commit474b0b3aaa6a46f5d000822c7c3fc38ad16fbd06 (patch)
tree0cb9604740534da68714bc6d1d29d444852378dc /trove/quota
parent87fd1c4b0ec1f0788c0e0478acf80e7e280c16a4 (diff)
downloadtrove-474b0b3aaa6a46f5d000822c7c3fc38ad16fbd06.tar.gz
Sync the data fields of DB* class and table fields.
This update try to fix some problems: 1. define the 'id' both in _data_fields and _auto_generated_attrs. 2. some of tables don't have the 'id' field. 3. _data_fields of DBInstance miss some table fields. 4. Change the key of persisted_models as the same of table name to make it more readable. Change-Id: I0ad96824e8de978ff5b6766085549b1e1a2509cf Signed-off-by: zhanggang <zhanggang@cmss.chinamobile.com>
Diffstat (limited to 'trove/quota')
-rw-r--r--trove/quota/models.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/trove/quota/models.py b/trove/quota/models.py
index 31b7542d..e2ae0979 100644
--- a/trove/quota/models.py
+++ b/trove/quota/models.py
@@ -29,7 +29,8 @@ class Quota(dbmodels.DatabaseModelBase):
"""Defines the base model class for a quota."""
_data_fields = ['created', 'updated', 'tenant_id', 'resource',
- 'hard_limit', 'id']
+ 'hard_limit']
+ _table_name = 'quotas'
def __init__(self, tenant_id, resource, hard_limit,
id=utils.generate_uuid(), created=timeutils.utcnow(),
@@ -45,15 +46,16 @@ class Quota(dbmodels.DatabaseModelBase):
class QuotaUsage(dbmodels.DatabaseModelBase):
"""Defines the quota usage for a tenant."""
- _data_fields = ['created', 'updated', 'tenant_id', 'resource',
- 'in_use', 'reserved', 'id']
+ _data_fields = ['created', 'updated', 'tenant_id',
+ 'in_use', 'reserved', 'resource']
+ _table_name = 'quota_usages'
class Reservation(dbmodels.DatabaseModelBase):
"""Defines the reservation for a quota."""
- _data_fields = ['created', 'updated', 'usage_id',
- 'id', 'delta', 'status']
+ _data_fields = ['created', 'updated', 'usage_id', 'delta', 'status']
+ _table_name = 'reservations'
Statuses = enum(NEW='New',
RESERVED='Reserved',