From 0ea8a37db8c369c245584702d90daf3c94bf6f79 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 8 Nov 2012 06:37:21 -0800 Subject: Make instance_system_metadata load with instance Right now, instance['system_metadata'] is demand-loaded at the first use. This adds the necessary db fu to make it load at instance_get_*() time. Change-Id: Id29342fd34fe710b797b23558ef0fde8809231bc --- nova/db/sqlalchemy/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 2f33eda0c..515d442b2 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1502,7 +1502,8 @@ def _build_instance_get(context, session=None): options(joinedload_all('security_groups.rules')).\ options(joinedload('info_cache')).\ options(joinedload('metadata')).\ - options(joinedload('instance_type')) + options(joinedload('instance_type')).\ + options(joinedload('system_metadata')) @require_context @@ -1535,6 +1536,7 @@ def instance_get_all_by_filters(context, filters, sort_key, sort_dir, query_prefix = session.query(models.Instance).\ options(joinedload('info_cache')).\ options(joinedload('security_groups')).\ + options(joinedload('system_metadata')).\ options(joinedload('metadata')).\ options(joinedload('instance_type')).\ order_by(sort_fn[sort_dir](getattr(models.Instance, sort_key))) -- cgit