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:

e9d2f833a5

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
This commit is contained in:
Zane Bitter 2018-09-05 19:25:52 -04:00
parent 2c9f7781cc
commit e34da89290
2 changed files with 1 additions and 9 deletions

View File

@ -304,14 +304,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,

View File

@ -1449,7 +1449,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,
new_template_id=template_id,