diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2012-03-16 16:51:03 -0700 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2012-03-16 18:18:46 -0700 |
| commit | fe7055a5bd25bef33fe10f4fee858ad8cd30a6ea (patch) | |
| tree | 25caf16d823f19f4c10b443e69df9f77759bfd76 /nova/tests | |
| parent | eb42e7fcd7bb67ab951c9bc6c80a78cd23011458 (diff) | |
Fix run/terminate race conditions.
* synchronize run,terminate,stop,start on instance_uuid
* don't surpress error when unfiltering instance, which
can result in a zombified instance.
* Fixes bug 956719
* Remove debug raise
Change-Id: I8b2eaffdabfd5c1a9414adb1b5ed11e4c48711fc
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_compute.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index a291b2c80..ecb980106 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -932,26 +932,21 @@ class ComputeTestCase(BaseTestCase): self.compute.terminate_instance(self.context, instance['uuid']) - def test_instance_set_to_error_on_deleted_instance_doesnt_raise(self): - """Test that we don't raise InstanceNotFound when trying to set - an instance to ERROR that has already been deleted from under us. - The original exception should be re-raised. + def test_instance_termination_exception_sets_error(self): + """Test that we handle InstanceTerminationFailure + which is propagated up from the underlying driver. """ instance = self._create_fake_instance() - instance_uuid = instance['uuid'] - def fake_allocate_network(context, instance, requested_networks): - # Remove the instance to simulate race condition - self.compute.terminate_instance(self.context, instance['uuid']) - raise rpc_common.RemoteError() + def fake_delete_instance(context, instance): + raise exception.InstanceTerminationFailure(reason='') - self.stubs.Set(self.compute, '_allocate_network', - fake_allocate_network) + self.stubs.Set(self.compute, '_delete_instance', + fake_delete_instance) - self.assertRaises(rpc_common.RemoteError, - self.compute.run_instance, - self.context, - instance_uuid) + self.compute.terminate_instance(self.context, instance['uuid']) + instance = db.instance_get_by_uuid(self.context, instance['uuid']) + self.assertEqual(instance['vm_state'], vm_states.ERROR) def test_network_is_deallocated_on_spawn_failure(self): """When a spawn fails the network must be deallocated""" |
