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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user