Merge "Extract failure reason before deleting nova server"
This commit is contained in:
commit
709df3811e
@ -323,10 +323,13 @@ class Instance(resource.Resource):
|
|||||||
volume_attach.start()
|
volume_attach.start()
|
||||||
return volume_attach.done()
|
return volume_attach.done()
|
||||||
elif server.status == 'ERROR':
|
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 = scheduler.TaskRunner(self._delete_server, server)
|
||||||
delete(wait_time=0.2)
|
delete(wait_time=0.2)
|
||||||
exc = exception.Error("Build of server %s failed." %
|
exc = exception.Error("Build of server %s failed: %s (%s)" %
|
||||||
server.name)
|
(server.name, message, code))
|
||||||
raise exc
|
raise exc
|
||||||
else:
|
else:
|
||||||
exc = exception.Error('%s instance[%s] status[%s]' %
|
exc = exception.Error('%s instance[%s] status[%s]' %
|
||||||
|
@ -225,6 +225,11 @@ class InstancesTest(HeatTestCase):
|
|||||||
instance = self._create_test_instance(return_server,
|
instance = self._create_test_instance(return_server,
|
||||||
'test_instance_create')
|
'test_instance_create')
|
||||||
return_server.status = 'ERROR'
|
return_server.status = 'ERROR'
|
||||||
|
return_server.fault = {
|
||||||
|
'message': 'NoValidHost',
|
||||||
|
'code': 500,
|
||||||
|
'created': '2013-08-14T03:12:10Z'
|
||||||
|
}
|
||||||
self.m.StubOutWithMock(return_server, 'get')
|
self.m.StubOutWithMock(return_server, 'get')
|
||||||
return_server.get()
|
return_server.get()
|
||||||
return_server.get().AndRaise(
|
return_server.get().AndRaise(
|
||||||
|
Loading…
Reference in New Issue
Block a user