From 7f448db269c2f60e49edd5c31b514efa184ac8c8 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 8 Mar 2013 13:46:59 -0500 Subject: [PATCH] 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/test_db_api.py | 20 -------------------- nova/tests/test_instance_types.py | 18 ------------------ 2 files changed, 38 deletions(-) diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 769ddaea..0aaa0653 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 6ae28a1c..01cdd132 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):