diff --git a/heat/engine/resources/instance.py b/heat/engine/resources/instance.py index 2b2376a0de..11d99de89f 100644 --- a/heat/engine/resources/instance.py +++ b/heat/engine/resources/instance.py @@ -323,10 +323,13 @@ class Instance(resource.Resource): volume_attach.start() return volume_attach.done() elif server.status == 'ERROR': + fault = server.fault or {} + message = fault.get('message', 'Unknown') + code = fault.get('code', 500) delete = scheduler.TaskRunner(self._delete_server, server) delete(wait_time=0.2) - exc = exception.Error("Build of server %s failed." % - server.name) + exc = exception.Error("Build of server %s failed: %s (%s)" % + (server.name, message, code)) raise exc else: exc = exception.Error('%s instance[%s] status[%s]' % diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index bb8f031268..8a07c346e2 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -225,6 +225,11 @@ class InstancesTest(HeatTestCase): instance = self._create_test_instance(return_server, 'test_instance_create') return_server.status = 'ERROR' + return_server.fault = { + 'message': 'NoValidHost', + 'code': 500, + 'created': '2013-08-14T03:12:10Z' + } self.m.StubOutWithMock(return_server, 'get') return_server.get() return_server.get().AndRaise(