From a9c695d82111702c562f4bb36fb9ea964b9d0913 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 17 Jun 2013 19:20:44 -0700 Subject: 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 --- nova/api/ec2/cloud.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'nova/api') 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 -- cgit