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()
|
||||
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]' %
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user