Allow CREATE_COMPLETE status when cluster/bay update check

This patch will prevent when check update complete request got earlier
replied than the status change to update in progress in magnum.
This will cause the cluster failed in stack but completed in magnum.
The stack will not be able to take that cluster/bay back at this point.
Partial-Bug: #1702433

Change-Id: I0074b76e6ec925f80bb50a7e67a81cda9438941b
This commit is contained in:
ricolin 2017-07-05 16:47:16 +08:00 committed by Rico Lin
parent 76eafe84de
commit 601c5ba1e0
2 changed files with 10 additions and 2 deletions

View File

@ -138,7 +138,10 @@ class Bay(resource.Resource):
def check_update_complete(self, id):
bay = self.client().bays.get(id)
if bay.status == 'UPDATE_IN_PROGRESS':
# Check update complete request might get status before the status
# got changed to update in progress, so we allow `CREATE_COMPLETE`
# for it.
if bay.status in ['UPDATE_IN_PROGRESS', 'CREATE_COMPLETE']:
return False
# check for None due to Magnum bug
# https://bugs.launchpad.net/magnum/+bug/1507598

View File

@ -224,7 +224,12 @@ class Cluster(resource.Resource):
def check_update_complete(self, id):
cluster = self.client().clusters.get(id)
if cluster.status == 'UPDATE_IN_PROGRESS':
# Check update complete request might get status before the status
# got changed to update in progress, so we allow `CREATE_COMPLETE`
# for it.
# TODO(ricolin): we should find way to make sure status check will
# only perform after action really started.
if cluster.status in ['UPDATE_IN_PROGRESS', 'CREATE_COMPLETE']:
return False
elif cluster.status == 'UPDATE_COMPLETE':
return True