Merge "Remove instance['instance_type'] relationship from db api"

This commit is contained in:
Jenkins
2013-03-12 16:58:49 +00:00
committed by Gerrit Code Review
2 changed files with 0 additions and 38 deletions

View File

@@ -327,26 +327,6 @@ class DbApiTestCase(DbTestCase):
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)

View File

@@ -365,24 +365,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):