summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2013-05-10 15:34:00 -0700
committerDan Smith <danms@us.ibm.com>2013-05-22 17:03:06 -0700
commit96164cecc6b7bf447d06896f723dab416e63ee06 (patch)
tree7431eec5c982513e741e2a2ba7025fe398a1ddab /nova/utils.py
parent986fa041a7cb8b85f4b3be47407288c1f71c0972 (diff)
downloadnova-96164cecc6b7bf447d06896f723dab416e63ee06.tar.gz
nova-96164cecc6b7bf447d06896f723dab416e63ee06.tar.xz
nova-96164cecc6b7bf447d06896f723dab416e63ee06.zip
Make a few places tolerant of sys_meta being a dict
This will be necessary as we start to introduce objects with real dicts in system_metadata. These are the common spots that need to be ready ahead of time. The rest are at the actual use sites and can/will be replaced when individual uses are converted to objects. Related to bp/unified-internal-objects Change-Id: I8314e0d52ec2ae800765f60ce58ce9b309d7d513
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 3e9d8c597..97551e8eb 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -1032,6 +1032,13 @@ def dict_to_metadata(metadata):
return result
+def instance_sys_meta(instance):
+ if isinstance(instance['system_metadata'], dict):
+ return instance['system_metadata']
+ else:
+ return metadata_to_dict(instance['system_metadata'])
+
+
def get_wrapped_function(function):
"""Get the method at the bottom of a stack of decorators."""
if not hasattr(function, 'func_closure') or not function.func_closure: