Check for stack failure earlier in undercloud deploy

For the undercloud deploy, if the stack fails before the deployed-server
resource is created, it will take 30 minutes to time out since there is
no check for the stack status. Further, the exception is not as helpful
as it could be about what failed as not all the events were shown.

This patch adds a check within the loop looking for the deployed-server
resource. It will now fail immediately if the stack fails before the
deployed-server resource is created. It also again outputs the stack
events. Some may be redundant, but it will at least show the errors now.

Change-Id: I9fa3239d688ce83676ecfab2f3d102f9e48a43a5
This commit is contained in:
James Slagle 2017-07-26 12:27:09 -04:00
parent 1645017e23
commit f468bf7947

View File

@ -38,6 +38,7 @@ except ImportError:
from urllib.request import urlopen
from cliff import command
from heatclient.common import event_utils
from heatclient.common import template_utils
from openstackclient.i18n import _
@ -199,6 +200,12 @@ class DeployUndercloud(command.Command):
time.sleep(1)
server_stack_id = self._lookup_tripleo_server_stackid(
orchestration_client, stack_id)
status = orchestration_client.stacks.get(stack_id).status
if status == 'FAILED':
event_utils.poll_for_events(orchestration_client, stack_name)
msg = ('Stack failed before deployed-server resource '
'created.')
raise Exception(msg)
if server_stack_id:
break
if not server_stack_id: