diff options
| author | Dan Smith <danms@us.ibm.com> | 2012-11-08 06:37:21 -0800 |
|---|---|---|
| committer | Dan Smith <danms@us.ibm.com> | 2012-11-08 11:38:36 -0800 |
| commit | 0ea8a37db8c369c245584702d90daf3c94bf6f79 (patch) | |
| tree | e1669bbd6c3ed7dc638cadef15297995b66b47ed | |
| parent | 0e6f300360a5797b267b89bf8244b86b7e3eedd1 (diff) | |
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
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 4 |
1 files changed, 3 insertions, 1 deletions
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))) |
