summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2013-03-12 16:39:19 -0400
committerDan Smith <danms@us.ibm.com>2013-03-12 16:39:19 -0400
commit4814280ce0af71ad38155d07eefea7c762935fa7 (patch)
tree109f2d5a6e145d1174335f050458d191f51fa037 /nova/tests
parentf0fc1240090938ae9d945bb91bfeda4e5d42ac9c (diff)
Make run_instance() bail quietly if instance has been deleted
Right now, we make a big mess in the logs if someone deletes an instance before we get a chance to run it. This cleans that up to a single warning message. Fixes bug 1154292 Change-Id: I2de0c2993d6a16d9482878eee4eef10bfd78c3e6
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 0e41678b3..a3ce7bdae 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -708,6 +708,19 @@ class ComputeTestCase(BaseTestCase):
self.compute.run_instance,
self.context, instance=instance)
+ def test_run_instance_bails_on_missing_instance(self):
+ # Make sure that run_instance() will quickly ignore a deleted instance
+ called = {}
+ instance = self._create_instance()
+
+ def fake_instance_update(self, *a, **args):
+ called['instance_update'] = True
+ raise exception.InstanceNotFound(instance_id='foo')
+ self.stubs.Set(self.compute, '_instance_update', fake_instance_update)
+
+ self.compute.run_instance(self.context, instance)
+ self.assertIn('instance_update', called)
+
def test_can_terminate_on_error_state(self):
# Make sure that the instance can be terminated in ERROR state.
#check failed to schedule --> terminate