diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-09-23 01:10:18 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-09-23 01:10:18 +0000 |
commit | d189c48a442d1ad29f561acec6797bbb834fd3cf (patch) | |
tree | 9f02e4599a5b30da0f06f75db3ba2540e3ae6e84 | |
parent | 2800e784c9ba12ad42432886a042029f61ebaf99 (diff) | |
parent | b21d3b6402fe10616fa07df3c0fa6154f46f4b21 (diff) | |
download | nova-d189c48a442d1ad29f561acec6797bbb834fd3cf.tar.gz |
Merge "Record instance faults during boot process"
-rw-r--r-- | nova/compute/manager.py | 8 | ||||
-rw-r--r-- | nova/tests/compute/test_compute_mgr.py | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 28b7d47324..759ed15136 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -2021,6 +2021,8 @@ class ComputeManager(manager.Manager): instance=instance) self._cleanup_allocated_networks(context, instance, requested_networks) + compute_utils.add_instance_fault_from_exc(context, + instance, e, sys.exc_info()) self._set_instance_error_state(context, instance) return retry['exc'] = traceback.format_exception(*sys.exc_info()) @@ -2049,8 +2051,10 @@ class ComputeManager(manager.Manager): requested_networks) self._cleanup_volumes(context, instance.uuid, block_device_mapping, raise_exc=False) + compute_utils.add_instance_fault_from_exc(context, instance, + e, sys.exc_info()) self._set_instance_error_state(context, instance) - except Exception: + except Exception as e: # Should not reach here. msg = _LE('Unexpected build failure, not rescheduling build.') LOG.exception(msg, instance=instance) @@ -2058,6 +2062,8 @@ class ComputeManager(manager.Manager): requested_networks) self._cleanup_volumes(context, instance.uuid, block_device_mapping, raise_exc=False) + compute_utils.add_instance_fault_from_exc(context, instance, + e, sys.exc_info()) self._set_instance_error_state(context, instance) do_build_and_run_instance(context, instance, image, request_spec, diff --git a/nova/tests/compute/test_compute_mgr.py b/nova/tests/compute/test_compute_mgr.py index e5d2ee1c02..4ee8b2ec4e 100644 --- a/nova/tests/compute/test_compute_mgr.py +++ b/nova/tests/compute/test_compute_mgr.py @@ -2071,6 +2071,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase): self.mox.StubOutWithMock(self.compute, '_build_and_run_instance') self.mox.StubOutWithMock(self.compute, '_cleanup_allocated_networks') self.mox.StubOutWithMock(self.compute, '_cleanup_volumes') + self.mox.StubOutWithMock(compute_utils, 'add_instance_fault_from_exc') self.mox.StubOutWithMock(self.compute, '_set_instance_error_state') self.mox.StubOutWithMock(self.compute.compute_task_api, 'build_instances') @@ -2086,6 +2087,8 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase): self.requested_networks) self.compute._cleanup_volumes(self.context, self.instance.uuid, self.block_device_mapping, raise_exc=False) + compute_utils.add_instance_fault_from_exc(self.context, + self.instance, mox.IgnoreArg(), mox.IgnoreArg()) self.compute._set_instance_error_state(self.context, self.instance) self._instance_action_events() self.mox.ReplayAll() @@ -2165,6 +2168,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase): def test_rescheduled_exception_without_retry(self): self.mox.StubOutWithMock(self.compute, '_build_and_run_instance') + self.mox.StubOutWithMock(compute_utils, 'add_instance_fault_from_exc') self.mox.StubOutWithMock(self.compute, '_set_instance_error_state') self.mox.StubOutWithMock(self.compute, '_cleanup_allocated_networks') self.mox.StubOutWithMock(self.compute, '_cleanup_volumes') @@ -2178,6 +2182,8 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase): instance_uuid=self.instance.uuid)) self.compute._cleanup_allocated_networks(self.context, self.instance, self.requested_networks) + compute_utils.add_instance_fault_from_exc(self.context, self.instance, + mox.IgnoreArg(), mox.IgnoreArg()) self.compute._set_instance_error_state(self.context, self.instance) self._instance_action_events() @@ -2283,6 +2289,10 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase): self.block_device_mapping, raise_exc=False) if set_error: self.mox.StubOutWithMock(self.compute, '_set_instance_error_state') + self.mox.StubOutWithMock(compute_utils, + 'add_instance_fault_from_exc') + compute_utils.add_instance_fault_from_exc(self.context, + self.instance, mox.IgnoreArg(), mox.IgnoreArg()) self.compute._set_instance_error_state(self.context, self.instance) self._instance_action_events() self.mox.ReplayAll() |