'Update an existing stack based on the provided template and params.
Note that at this stage the template has already been fetched from the
heat-api process if using a template-url.
:param cnxt: RPC context.
:param stack_identity: Name of the stack you want to create.
:param template: Template of stack you want to create.
:param params: Stack Input Params
:param files: Files referenced from the template
:param args: Request parameters/args passed from API
:param environment_files: optional ordered list of environment file
names included in the files dict
:type  environment_files: list or None
:param template_id: the ID of a pre-stored template in the DB'

@context.request_context
def update_stack(self, cnxt, stack_identity, template, params, files, args, environment_files=None, template_id=None):

    db_stack = self._get_stack(cnxt, stack_identity)
    LOG.info('Updating    stack    %s', db_stack.name)
    if (cfg.CONF.reauthentication_auth_method == 'trusts'):
        current_stack = parser.Stack.load(cnxt, stack=db_stack, use_stored_context=True)
    else:
        current_stack = parser.Stack.load(cnxt, stack=db_stack)
    self.resource_enforcer.enforce_stack(current_stack)
    if (current_stack.action == current_stack.SUSPEND):
        msg = _('Updating    a    stack    when    it    is    suspended')
        raise exception.NotSupported(feature=msg)
    if (current_stack.action == current_stack.DELETE):
        msg = _('Updating    a    stack    when    it    is    deleting')
        raise exception.NotSupported(feature=msg)
    (tmpl, current_stack, updated_stack) = self._prepare_stack_updates(cnxt, current_stack, template, params, environment_files, files, args, template_id)
    if current_stack.convergence:
        current_stack.thread_group_mgr = self.thread_group_mgr
        current_stack.converge_stack(template=tmpl, new_stack=updated_stack)
    else:
        msg_queue = eventlet.queue.LightQueue()
        th = self.thread_group_mgr.start_with_lock(cnxt, current_stack, self.engine_id, current_stack.update, updated_stack, msg_queue=msg_queue)
        th.link(self.thread_group_mgr.remove_msg_queue, current_stack.id, msg_queue)
        self.thread_group_mgr.add_msg_queue(current_stack.id, msg_queue)
    return dict(current_stack.identifier())
