From: Steven Hardy Date: Fri, 15 Feb 2013 18:31:13 +0000 (+0000) Subject: heat engine : Only create periodic task on CREATE_COMPLETE X-Git-Tag: 2014.1~887 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5bf32e30d0e4d5317e880d3dd3403bd334b90403;p=openstack-build%2Fheat-build.git heat engine : Only create periodic task on CREATE_COMPLETE Only create the stack periodic watcher task if the stack create completed successfully, since we don't want a watcher task if the stack ended up rolling back (or just in CREATE_FAILED state) Change-Id: I5592fa106f740eb2e1dcf40e98a2656627715b6f --- diff --git a/heat/engine/service.py b/heat/engine/service.py index 66009e91..dbad59db 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -193,6 +193,16 @@ class EngineService(service.Service): """ logger.info('template is %s' % template) + def _stack_create(stack): + # Create the stack, and create the periodic task if successful + stack.create() + if stack.state == stack.CREATE_COMPLETE: + # Schedule a periodic watcher task for this stack + self._timer_in_thread(stack.id, self._periodic_watcher_task, + sid=stack.id) + else: + logger.warning("Stack create failed, state %s" % stack.state) + if db_api.stack_get_by_name(context, stack_name): raise exception.StackExists(stack_name=stack_name) @@ -211,11 +221,7 @@ class EngineService(service.Service): stack_id = stack.store() - self._start_in_thread(stack_id, stack.create) - - # Schedule a periodic watcher task for this stack - self._timer_in_thread(stack_id, self._periodic_watcher_task, - sid=stack_id) + self._start_in_thread(stack_id, _stack_create, stack) return dict(stack.identifier())