From 7a7d9d70bacbce33964b38c2abfa143d65511333 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Wed, 5 Sep 2018 19:25:52 -0400 Subject: [PATCH] Allow update of previously-replaced resources The convergence prototype ignored checks of resources that had previously been replaced by another resource. However, it turns out that this was unnecessary in the final version of the prototype: https://github.com/zaneb/heat-convergence-prototype/commit/e9d2f833a53de1ab09e7d936a4826d36ed7bb68d Keeping this limitation prevents us from allowing users to roll back to a previously-existing resource if creating the replacement fails, other than by using the automated rollback mechanism (which is special-cased). Since the graph for the traversal is calculated at the start of the update, there's no need to limit which nodes are allowed to be checked. Only the selected resource will have an is_update=True node in the traversal graph. Removing this additional restriction allows us to improve the algorithm that chooses which resource to update. Since a new traversal ID is stored before we calculate the traversal graph, we can guarantee that no new resource checks will start (though some may still be happening) while the algorithm is choosing, so there's no danger of it picking a resource that later gets replaced. Since we're no longer treating automatic rollback as a special case, reset the replaced_by field whenever we update a previously-replaced resource. Change-Id: I04e7ad90944c2d03ce0e59ba16af9d60d6e01222 Story: #2003579 Task: 26197 (cherry picked from commit e34da892901dbba709d3854f8979eee32594d916) --- heat/engine/check_resource.py | 8 -------- heat/engine/resource.py | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/heat/engine/check_resource.py b/heat/engine/check_resource.py index d04a6f5db1..2424cf934b 100644 --- a/heat/engine/check_resource.py +++ b/heat/engine/check_resource.py @@ -321,14 +321,6 @@ class CheckResource(object): stack.adopt_stack_data = adopt_stack_data stack.thread_group_mgr = self.thread_group_mgr - if is_update: - if (rsrc.replaced_by is not None and - rsrc.current_template_id != tmpl.id): - LOG.debug('Resource %s with id %s already replaced by %s; ' - 'not checking', - rsrc.name, resource_id, rsrc.replaced_by) - return - try: check_resource_done = self._do_check_resource(cnxt, current_traversal, diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 8b6cf57d8f..2e59066843 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -1465,7 +1465,7 @@ class Resource(status.ResourceStatus): self.state_set(self.UPDATE, self.FAILED, six.text_type(failure)) raise failure - self.replaced_by = None + self.replaced_by = None runner = scheduler.TaskRunner( self.update, new_res_def,