Added checks on deleting cluster

Checks if cluster is going to be deleted can prevent race condition
problems.

Change-Id: I85e8bcd2d61ff60ba7eadce1242b0489e354889d
Closes-Bug: #1392490
This commit is contained in:
Andrew Lazarev
2014-11-20 15:31:47 -08:00
parent 7505c71848
commit 00401e0f5b
2 changed files with 15 additions and 7 deletions

View File

@@ -144,9 +144,10 @@ def ops_error_handler(f):
ctx = context.ctx()
cluster = conductor.cluster_get(ctx, cluster_id)
# check if cluster still exists (it might have been removed)
if cluster is None:
LOG.info(_LI("Cluster with %s was deleted. Canceling current "
"operation."), cluster_id)
if cluster is None or cluster.status == 'Deleting':
LOG.info(_LI("Cluster %s was deleted or marked for "
"deletion. Canceling current operation."),
cluster_id)
return
LOG.exception(