Merge "Convergence: Update stack attributes."
This commit is contained in:
commit
08637b5e1c
|
@ -783,7 +783,8 @@ class EngineService(service.Service):
|
||||||
# Once all the validations are done
|
# Once all the validations are done
|
||||||
# if convergence is enabled, take the convergence path
|
# if convergence is enabled, take the convergence path
|
||||||
if current_kwargs['convergence']:
|
if current_kwargs['convergence']:
|
||||||
current_stack.converge_stack(template=tmpl)
|
current_stack.converge_stack(template=tmpl,
|
||||||
|
new_stack=updated_stack)
|
||||||
else:
|
else:
|
||||||
event = eventlet.event.Event()
|
event = eventlet.event.Event()
|
||||||
th = self.thread_group_mgr.start_with_lock(cnxt, current_stack,
|
th = self.thread_group_mgr.start_with_lock(cnxt, current_stack,
|
||||||
|
|
|
@ -936,7 +936,7 @@ class Stack(collections.Mapping):
|
||||||
updater()
|
updater()
|
||||||
|
|
||||||
@profiler.trace('Stack.converge_stack', hide_args=False)
|
@profiler.trace('Stack.converge_stack', hide_args=False)
|
||||||
def converge_stack(self, template, action=UPDATE):
|
def converge_stack(self, template, action=UPDATE, new_stack=None):
|
||||||
"""
|
"""
|
||||||
Updates the stack and triggers convergence for resources
|
Updates the stack and triggers convergence for resources
|
||||||
"""
|
"""
|
||||||
|
@ -948,6 +948,18 @@ class Stack(collections.Mapping):
|
||||||
previous_traversal = self.current_traversal
|
previous_traversal = self.current_traversal
|
||||||
self.current_traversal = uuidutils.generate_uuid()
|
self.current_traversal = uuidutils.generate_uuid()
|
||||||
self.updated_time = datetime.datetime.utcnow()
|
self.updated_time = datetime.datetime.utcnow()
|
||||||
|
if new_stack is not None:
|
||||||
|
self.disable_rollback = new_stack.disable_rollback
|
||||||
|
self.timeout_mins = new_stack.timeout_mins
|
||||||
|
self._set_param_stackid()
|
||||||
|
|
||||||
|
self.tags = new_stack.tags
|
||||||
|
if new_stack.tags:
|
||||||
|
stack_tag_object.StackTagList.set(self.context, self.id,
|
||||||
|
new_stack.tags)
|
||||||
|
else:
|
||||||
|
stack_tag_object.StackTagList.delete(self.context, self.id)
|
||||||
|
|
||||||
self.store()
|
self.store()
|
||||||
|
|
||||||
# TODO(later): lifecycle_plugin_utils.do_pre_ops
|
# TODO(later): lifecycle_plugin_utils.do_pre_ops
|
||||||
|
|
|
@ -1292,6 +1292,7 @@ class StackConvergenceServiceCreateUpdateTest(common.HeatTestCase):
|
||||||
old_stack = tools.get_stack(stack_name, self.ctx,
|
old_stack = tools.get_stack(stack_name, self.ctx,
|
||||||
template=tools.string_template_five,
|
template=tools.string_template_five,
|
||||||
convergence=True)
|
convergence=True)
|
||||||
|
old_stack.timeout_mins = 1
|
||||||
sid = old_stack.store()
|
sid = old_stack.store()
|
||||||
s = stack_object.Stack.get_by_id(self.ctx, sid)
|
s = stack_object.Stack.get_by_id(self.ctx, sid)
|
||||||
|
|
||||||
|
@ -1311,7 +1312,7 @@ class StackConvergenceServiceCreateUpdateTest(common.HeatTestCase):
|
||||||
user_creds_id=old_stack.user_creds_id,
|
user_creds_id=old_stack.user_creds_id,
|
||||||
stack_user_project_id=old_stack.stack_user_project_id,
|
stack_user_project_id=old_stack.stack_user_project_id,
|
||||||
timeout_mins=60,
|
timeout_mins=60,
|
||||||
disable_rollback=True,
|
disable_rollback=False,
|
||||||
parent_resource=None,
|
parent_resource=None,
|
||||||
strict_validate=True,
|
strict_validate=True,
|
||||||
tenant_id=old_stack.tenant_id,
|
tenant_id=old_stack.tenant_id,
|
||||||
|
@ -1326,7 +1327,7 @@ class StackConvergenceServiceCreateUpdateTest(common.HeatTestCase):
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
api_args = {'timeout_mins': 60}
|
api_args = {'timeout_mins': 60, 'disable_rollback': False}
|
||||||
result = self.man.update_stack(self.ctx, old_stack.identifier(),
|
result = self.man.update_stack(self.ctx, old_stack.identifier(),
|
||||||
template, params, None, api_args)
|
template, params, None, api_args)
|
||||||
self.assertEqual(old_stack.convergence, True)
|
self.assertEqual(old_stack.convergence, True)
|
||||||
|
|
Loading…
Reference in New Issue