summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorWenhao Xu <xuwenhao2008@gmail.com>2013-02-06 19:49:38 +0800
committerWenhao Xu <xuwenhao2008@gmail.com>2013-02-07 11:55:37 +0800
commitecb1f61412cbeb074ebd8ba5a123e2a55821c148 (patch)
tree13758c417bd94ff2113ee7e04e4ef41202a57853 /nova
parentcc8d92382cdb3121843e9f3982b8d8c45e9e7a74 (diff)
Fix lazy load 'system_metadata' failed problem.
When using lazy load of SQLAlchemy, parent instance may have a problem not bouding to a session object and fail the lazy loading system_metadata. Using joinedload to eagly load the system_metadata in _instance_get_all_query to fix the problem. Fixes: bug 1117232 Change-Id: Id24ca534f6eb57167aee22aca12c1274c90baf3c
Diffstat (limited to 'nova')
-rw-r--r--nova/db/sqlalchemy/api.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index e6d2d3459..6aa4d96da 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1702,7 +1702,8 @@ def _instance_get_all_query(context, project_only=False):
options(joinedload('info_cache')).\
options(joinedload('security_groups')).\
options(joinedload('metadata')).\
- options(joinedload('instance_type'))
+ options(joinedload('instance_type')).\
+ options(joinedload('system_metadata'))
@require_admin_context