From b26a00cfb5b44dad9d65a3ee9376fdcb3e100eec Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Sun, 13 Jan 2013 22:24:54 +0000 Subject: [PATCH] Clean up compute API image_create The _image_create() code in compute manager is the only place where db.instance_test_and_set is used.. which was added before 'expected_task_state' support was added to instance_update. By switching to use self.update(), we can also take advantage of it doing the state change notification for us. The instance update and the compute RPC call have been moved out of _create_image() and into snapshot() and backup() to support a future cells patch. Change-Id: Ib6603f732d28e49cb6f351447da5f6e41615dea5 --- nova/tests/test_db_api.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 7df28bfcb..c70e96cdc 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -299,27 +299,6 @@ class DbApiTestCase(test.TestCase): self.assertRaises(exception.DuplicateVlan, db.network_create_safe, ctxt, values2) - def test_instance_test_and_set(self): - ctxt = context.get_admin_context() - states = [ - (None, [None, 'some'], 'building'), - (None, [None], 'building'), - ('building', ['building'], 'ready'), - ('building', [None, 'building'], 'ready')] - for st in states: - inst = db.instance_create(ctxt, {'vm_state': st[0]}) - uuid = inst['uuid'] - db.instance_test_and_set(ctxt, uuid, 'vm_state', st[1], st[2]) - inst = db.instance_get_by_uuid(ctxt, uuid) - self.assertEqual(inst["vm_state"], st[2]) - - def test_instance_test_and_set_exception(self): - ctxt = context.get_admin_context() - inst = db.instance_create(ctxt, {'vm_state': 'building'}) - self.assertRaises(exception.InstanceInvalidState, - db.instance_test_and_set, ctxt, - inst['uuid'], 'vm_state', [None, 'disable'], 'run') - def test_instance_update_with_instance_uuid(self): # test instance_update() works when an instance UUID is passed. ctxt = context.get_admin_context()