From fed1ea1d7528e7a3d2da181112da62cf04cb5092 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 8 Mar 2013 13:46:59 -0500 Subject: Remove instance['instance_type'] relationship from db api This removes the entire relationship between an instance and the flavor it was created from. As such, it removes two tests entirely which examined the old behavior. 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: I8b525a900bf2dc6b193e54aae35fc32248e4cff4 --- nova/tests/cells/test_cells_messaging.py | 1 - nova/tests/test_db_api.py | 20 -------------------- nova/tests/test_instance_types.py | 18 ------------------ 3 files changed, 39 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/cells/test_cells_messaging.py b/nova/tests/cells/test_cells_messaging.py index effe27660..3c7dd1941 100644 --- a/nova/tests/cells/test_cells_messaging.py +++ b/nova/tests/cells/test_cells_messaging.py @@ -938,7 +938,6 @@ class CellsBroadcastMethodsTestCase(test.TestCase): fake_instance = {'id': 2, 'uuid': 'fake_uuid', 'security_groups': 'fake', - 'instance_type': 'fake', 'volumes': 'fake', 'cell_name': 'fake', 'name': 'fake', diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 769ddaea2..0aaa06538 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -369,26 +369,6 @@ class DbApiTestCase(test.TestCase): system_meta = db.instance_system_metadata_get(ctxt, instance['uuid']) self.assertEqual('baz', system_meta['original_image_ref']) - def test_instance_update_of_instance_type_id(self): - ctxt = context.get_admin_context() - - inst_type1 = db.instance_type_get_by_name(ctxt, 'm1.tiny') - inst_type2 = db.instance_type_get_by_name(ctxt, 'm1.small') - - values = {'instance_type_id': inst_type1['id']} - instance = db.instance_create(ctxt, values) - - self.assertEqual(instance['instance_type']['id'], inst_type1['id']) - self.assertEqual(instance['instance_type']['name'], - inst_type1['name']) - - values = {'instance_type_id': inst_type2['id']} - instance = db.instance_update(ctxt, instance['uuid'], values) - - self.assertEqual(instance['instance_type']['id'], inst_type2['id']) - self.assertEqual(instance['instance_type']['name'], - inst_type2['name']) - def test_instance_update_unique_name(self): otherprojectcontext = context.RequestContext(self.user_id, "%s2" % self.project_id) diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 6ae28a1c9..01cdd1327 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -351,24 +351,6 @@ class InstanceTypeTestCase(test.TestCase): "test1", read_deleted="no") self.assertEqual("instance_type1_redo", instance_type["name"]) - def test_will_list_deleted_type_for_active_instance(self): - # Ensure deleted instance types with active instances can be read. - ctxt = context.get_admin_context() - inst_type = instance_types.create("test", 256, 1, 120, 100, "test1") - - instance_params = {"instance_type_id": inst_type["id"]} - instance = db.instance_create(ctxt, instance_params) - - # NOTE(jk0): Delete the instance type and reload the instance from the - # DB. The instance_type object will still be available to the active - # instance, otherwise being None. - instance_types.destroy(inst_type["name"]) - instance = db.instance_get_by_uuid(ctxt, instance["uuid"]) - - self.assertRaises(exception.InstanceTypeNotFound, - instance_types.get_instance_type, inst_type["name"]) - self.assertTrue(instance["instance_type"]) - class InstanceTypeToolsTest(test.TestCase): def _dict_to_metadata(self, data): -- cgit