From bd5a9b87a784135d9da808fec77e23b8f4d538d0 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 8 Mar 2013 13:45:45 -0500 Subject: Remove uses of instance['instance_type'] from nova/notifications This is one change in a series aimed at removing the use of instance-linked instance_type objects, in favor of the decoupled type data in system_metadata. See bug 1140119 for more details. Change-Id: Iebbb0fa0bf306d6a7c8b83594e13a4b99f27c404 --- nova/tests/compute/test_compute_utils.py | 6 ++++-- nova/tests/test_notifications.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute_utils.py b/nova/tests/compute/test_compute_utils.py index 884aac628..2de9d0beb 100644 --- a/nova/tests/compute/test_compute_utils.py +++ b/nova/tests/compute/test_compute_utils.py @@ -260,14 +260,16 @@ class UsageInfoTestCase(test.TestCase): def _create_instance(self, params={}): """Create a test instance.""" + instance_type = instance_types.get_instance_type_by_name('m1.tiny') + sys_meta = instance_types.save_instance_type_info({}, instance_type) inst = {} inst['image_ref'] = 1 inst['reservation_id'] = 'r-fakeres' inst['launch_time'] = '10' inst['user_id'] = self.user_id inst['project_id'] = self.project_id - type_id = instance_types.get_instance_type_by_name('m1.tiny')['id'] - inst['instance_type_id'] = type_id + inst['instance_type_id'] = instance_type['id'] + inst['system_metadata'] = sys_meta inst['ami_launch_index'] = 0 inst['root_gb'] = 0 inst['ephemeral_gb'] = 0 diff --git a/nova/tests/test_notifications.py b/nova/tests/test_notifications.py index c9c80818a..0c50d4933 100644 --- a/nova/tests/test_notifications.py +++ b/nova/tests/test_notifications.py @@ -71,18 +71,20 @@ class NotificationsTestCase(test.TestCase): self.instance = self._wrapped_create() def _wrapped_create(self, params=None): + instance_type = instance_types.get_instance_type_by_name('m1.tiny') + sys_meta = instance_types.save_instance_type_info({}, instance_type) inst = {} inst['image_ref'] = 1 inst['user_id'] = self.user_id inst['project_id'] = self.project_id - type_id = instance_types.get_instance_type_by_name('m1.tiny')['id'] - inst['instance_type_id'] = type_id + inst['instance_type_id'] = instance_type['id'] inst['root_gb'] = 0 inst['ephemeral_gb'] = 0 inst['access_ip_v4'] = '1.2.3.4' inst['access_ip_v6'] = 'feed:5eed' inst['display_name'] = 'test_instance' inst['hostname'] = 'test_instance_hostname' + inst['system_metadata'] = sys_meta if params: inst.update(params) return db.instance_create(self.context, inst) -- cgit