summaryrefslogtreecommitdiffstats
path: root/nova/db/sqlalchemy/models.py
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2013-01-23 17:34:13 -0500
committerRussell Bryant <rbryant@redhat.com>2013-01-24 09:39:01 -0500
commite2f2d10e1a59a6688c6f9763fff0fd45578da5eb (patch)
tree2e9b5cabc71a51f7dadaba958b746bf10c63c1e0 /nova/db/sqlalchemy/models.py
parent97a5274f5baea7072c0992e2d2becca539b92a11 (diff)
downloadnova-e2f2d10e1a59a6688c6f9763fff0fd45578da5eb.tar.gz
nova-e2f2d10e1a59a6688c6f9763fff0fd45578da5eb.tar.xz
nova-e2f2d10e1a59a6688c6f9763fff0fd45578da5eb.zip
Avoid db lookup in info_from_instance().
The method info_from_instance() in nova.notifications was doing a db lookup for the system_metadata for an instance. This patch updates that code to get that data from the instance that's passed in instead. The rest of the patch are related changes to make that happen. metadata_to_dict() was needed here. It lived in nova.compute.utils. nova.compute.utils already imported nova.notifications, so using it from there would have created a circular import. Move the method to nova.utils instead and update the tree to use it from its new location. I also noticed that the xen driver had a copy of metdata_to_dict(). This patch removes it and uses the common implementation in nova.utils. 'system_metadata' was added to _extra_keys of the Instance db model so that it would show up in a serialized instance. Tests failed without it as the result of getting instances via the conductor API did not include system_metadata. Now it's there. Part of bp no-db-compute. Change-Id: I451355fb26ae29f13b71438f7896c448b59f97b0
Diffstat (limited to 'nova/db/sqlalchemy/models.py')
-rw-r--r--nova/db/sqlalchemy/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 14c651020..80bbe9512 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -221,7 +221,7 @@ class Instance(BASE, NovaBase):
return base_name
def _extra_keys(self):
- return ['name']
+ return ['name', 'system_metadata']
user_id = Column(String(255))
project_id = Column(String(255))