summaryrefslogtreecommitdiff
path: root/heat/objects
diff options
context:
space:
mode:
authorCrag Wolfe <cwolfe@redhat.com>2017-01-19 19:54:54 -0500
committerCrag Wolfe <cwolfe@redhat.com>2017-02-16 16:08:31 -0500
commit9ebbd1e6f1140467041220f9f72d5e3c7fe03b2f (patch)
treeb4971adee470c42d7ee36f080256dffcfb1882a9 /heat/objects
parentefdb00d6285be9e70731d96ece33a1ee1a73dadc (diff)
downloadheat-9ebbd1e6f1140467041220f9f72d5e3c7fe03b2f.tar.gz
Data migration enabling storage of resource attributes
Working towards the goal of storing resource attributes in the db so as to avoid re-resolving them when appropriate. Adds an 'attr_data' object to the resource object, defined as a relationship on the already existing resource_properties_data table. Change-Id: I2104078d850da08b22547d7feab2bde00c543478 Partial-Bug: #1660831
Diffstat (limited to 'heat/objects')
-rw-r--r--heat/objects/resource.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/heat/objects/resource.py b/heat/objects/resource.py
index c1a365c2f..f5dee285f 100644
--- a/heat/objects/resource.py
+++ b/heat/objects/resource.py
@@ -78,6 +78,9 @@ class Resource(
'status': fields.StringField(nullable=True),
'status_reason': fields.StringField(nullable=True),
'action': fields.StringField(nullable=True),
+ 'attr_data': fields.ObjectField(
+ rpd.ResourcePropertiesData, nullable=True),
+ 'attr_data_id': fields.IntegerField(nullable=True),
'rsrc_metadata': heat_fields.JsonField(nullable=True),
'data': fields.ListOfObjectsField(
resource_data.ResourceData,
@@ -133,6 +136,12 @@ class Resource(
else:
resource._properties_data = {}
+ if db_resource['attr_data'] is not None:
+ resource['attr_data'] = \
+ rpd.ResourcePropertiesData._from_db_object(
+ rpd.ResourcePropertiesData(context), context,
+ db_resource['attr_data'])
+
resource._context = context
resource.obj_reset_changes()
return resource