Reset *RemovalPoliciesMode for node delete

'update' *RemovalPoliciesMode during 'node delete' can result in
undesired behaviour as we flush the blacklist history and use
the freshly constructed blacklist and decrease the node count.

Change-Id: Iebd0089b6ab35c84e4f20e83f1990c1c5568017f
Closes-Bug: #1848651
(cherry picked from commit 8f5c494150)
This commit is contained in:
Rabi Mishra 2019-10-18 11:30:19 +05:30
parent 9f53c3a962
commit 7494548b73
2 changed files with 7 additions and 1 deletions

View File

@ -113,6 +113,11 @@ class ScaleDownAction(templates.ProcessTemplatesAction):
'resource_list': [r.resource_name for r in role_resources]
}]
# force reset the removal_policies_mode to 'append'
# as 'update' can lead to deletion of unintended nodes.
removal_mode = "{0}RemovalPoliciesMode".format(role)
stack_params[removal_mode] = 'append'
return stack_params
def run(self, context):

View File

@ -139,7 +139,8 @@ class ScaleDownActionTest(base.TestCase):
template={'heat_template_version': '2016-04-30'}
)
clear_list = list(['ComputeCount', 'ComputeRemovalPolicies'])
clear_list = list(['ComputeCount', 'ComputeRemovalPolicies',
'ComputeRemovalPoliciesMode'])
_, kwargs = heatclient.stacks.update.call_args
self.assertEqual(set(kwargs['clear_parameters']), set(clear_list))
self.assertEqual(kwargs['environment'], env)