From 999701e2c91433ebd10a92c2665b1533371ac6eb Mon Sep 17 00:00:00 2001 From: Sam Morrison Date: Tue, 3 Dec 2013 17:08:51 +1100 Subject: [PATCH] Use utils method when getting instance metadata and system metadata Change-Id: Idab1ba25a8ec4c7dcc9efbb9d86e7248ae3c351e --- nova/api/metadata/password.py | 2 +- nova/notifications.py | 2 +- nova/virt/baremetal/pxe.py | 3 ++- nova/virt/baremetal/tilera.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nova/api/metadata/password.py b/nova/api/metadata/password.py index c5d020671358..c7fe0a86ab7d 100644 --- a/nova/api/metadata/password.py +++ b/nova/api/metadata/password.py @@ -64,7 +64,7 @@ def handle_password(req, meta_data): conductor_api = conductor.API() instance = conductor_api.instance_get_by_uuid(ctxt, meta_data.uuid) - sys_meta = utils.metadata_to_dict(instance['system_metadata']) + sys_meta = utils.instance_sys_meta(instance) sys_meta.update(convert_password(ctxt, req.body)) conductor_api.instance_update(ctxt, meta_data.uuid, system_metadata=sys_meta) diff --git a/nova/notifications.py b/nova/notifications.py index 57c6edd03b9c..a4bcbe3b18e8 100644 --- a/nova/notifications.py +++ b/nova/notifications.py @@ -416,7 +416,7 @@ def info_from_instance(context, instance_ref, network_info, instance_info["image_meta"] = image_meta_props # add instance metadata - instance_info['metadata'] = instance_ref['metadata'] + instance_info['metadata'] = utils.instance_meta(instance_ref) instance_info.update(kw) return instance_info diff --git a/nova/virt/baremetal/pxe.py b/nova/virt/baremetal/pxe.py index a1396ede77e4..4b5e374dfc96 100644 --- a/nova/virt/baremetal/pxe.py +++ b/nova/virt/baremetal/pxe.py @@ -34,6 +34,7 @@ from nova.openstack.common.gettextutils import _ from nova.openstack.common import log as logging from nova.openstack.common import loopingcall from nova.openstack.common import timeutils +from nova import utils from nova.virt.baremetal import baremetal_states from nova.virt.baremetal import base from nova.virt.baremetal import db @@ -329,7 +330,7 @@ class PXE(base.NodeDriver): image=get_image_file_path(instance), key=ssh_key, net=net_config, - metadata=instance['metadata'], + metadata=utils.instance_meta(instance), admin_password=admin_password, files=injected_files, partition=partition, diff --git a/nova/virt/baremetal/tilera.py b/nova/virt/baremetal/tilera.py index 7b6667790387..bccd2d314e67 100644 --- a/nova/virt/baremetal/tilera.py +++ b/nova/virt/baremetal/tilera.py @@ -205,7 +205,7 @@ class Tilera(base.NodeDriver): image=get_image_file_path(instance), key=ssh_key, net=net_config, - metadata=instance['metadata'], + metadata=utils.instance_meta(instance), admin_password=admin_password, files=injected_files, partition=partition,