summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2013-06-17 19:20:44 -0700
committerChris Behrens <cbehrens@codestud.com>2013-06-22 21:20:57 +0000
commita9c695d82111702c562f4bb36fb9ea964b9d0913 (patch)
treea2909b75d4736b0ee4100b6d5b467a4523f79f63 /nova/api
parentcefb0510b8f12dab17126907661d82094c31741d (diff)
downloadnova-a9c695d82111702c562f4bb36fb9ea964b9d0913.tar.gz
nova-a9c695d82111702c562f4bb36fb9ea964b9d0913.tar.xz
nova-a9c695d82111702c562f4bb36fb9ea964b9d0913.zip
Fix orphaned instance from get_by_uuid() and _from_db_object()
We need to set _context on the Instance object we create during get_by_uuid(), but more specifically during _from_db_object(). In order to properly initialize things like nested objects that themselves need a _context, we should pass it to _from_db_object() always. Same thing for InstanceInfoCache. Related to blueprint unified-object-model Change-Id: I09ab6b5d7d8961b69294536885e8432943b3a611
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index e02f7b6f9..51a86e02f 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -211,9 +211,8 @@ def db_to_inst_obj(context, db_instance):
# NOTE(danms): This is a temporary helper method for converting
# Instance DB objects to NovaObjects without needing to re-query.
inst_obj = instance_obj.Instance._from_db_object(
- instance_obj.Instance(), db_instance,
+ context, instance_obj.Instance(), db_instance,
expected_attrs=['system_metadata', 'metadata'])
- inst_obj._context = context
return inst_obj