Don't poll heat if no stack exists

Cluster objects are created asynchronously from their underlying
heat stacks, meaning that the periodic update can sometimes end up
trying to poll a cluster's heat stack before the stack has been created.

This change checks whether the stack_id is None and skips polling heat
if so. This has the side effect of resolving bug 1682058, since we don't
try to use a trust and trustee that do not exist.

Change-Id: I73f039659250f1d5b69b23141835c4602c8e019a
Closes-Bug: #1682058
(cherry picked from commit 88a6e3bab5)
This commit is contained in:
Mark Goddard 2017-07-04 19:24:28 +01:00 committed by Ritesh Anand
parent 5fea278843
commit 8cb0e1f570
1 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,11 @@ class HeatDriver(driver.Driver):
raise NotImplementedError("Must implement 'get_template_definition'")
def update_cluster_status(self, context, cluster):
if cluster.stack_id is None:
# NOTE(mgoddard): During cluster creation it is possible to poll
# the cluster before its heat stack has been created. See bug
# 1682058.
return
stack_ctx = mag_ctx.make_cluster_context(cluster)
poller = HeatPoller(clients.OpenStackClients(stack_ctx), context,
cluster, self)