diff options
| author | Dan Smith <danms@us.ibm.com> | 2013-03-08 13:45:45 -0500 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-03-09 17:17:07 +0000 |
| commit | bd5a9b87a784135d9da808fec77e23b8f4d538d0 (patch) | |
| tree | 6873d9c36706a70dfc5b46ab596daa330464c0d9 /nova/tests | |
| parent | 666ffe34aceef9d35528eae5ebafda19a9d43734 (diff) | |
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
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/compute/test_compute_utils.py | 6 | ||||
| -rw-r--r-- | nova/tests/test_notifications.py | 6 |
2 files changed, 8 insertions, 4 deletions
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) |
