From e2f2d10e1a59a6688c6f9763fff0fd45578da5eb Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 23 Jan 2013 17:34:13 -0500 Subject: 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 --- nova/db/sqlalchemy/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/db/sqlalchemy/models.py') 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)) -- cgit