Merge "engine : resume support for nested stacks"

This commit is contained in:
Jenkins 2013-07-02 09:46:09 +00:00 committed by Gerrit Code Review
commit 17a18326d3
2 changed files with 26 additions and 1 deletions

View File

@ -126,6 +126,28 @@ class StackResource(resource.Resource):
return done
def handle_resume(self):
stack = self.nested()
if stack is None:
raise exception.Error(_('Cannot resume %s, stack not created')
% self.name)
resume_task = scheduler.TaskRunner(self._nested.stack_task,
action=self.RESUME,
reverse=False)
resume_task.start(timeout=self._nested.timeout_secs())
return resume_task
def check_resume_complete(self, resume_task):
done = resume_task.step()
if done:
if self._nested.state != (self._nested.RESUME,
self._nested.COMPLETE):
raise exception.Error(self._nested.status_reason)
return done
def get_output(self, op):
'''
Return the specified Output value from the nested stack.

View File

@ -97,7 +97,7 @@ Outputs:
self.m.VerifyAll()
def test_nested_stack_suspend(self):
def test_nested_stack_suspend_resume(self):
urlfetch.get('https://localhost/the.template').AndReturn(
self.nested_template)
self.m.ReplayAll()
@ -108,5 +108,8 @@ Outputs:
scheduler.TaskRunner(rsrc.suspend)()
self.assertEqual(rsrc.state, (rsrc.SUSPEND, rsrc.COMPLETE))
scheduler.TaskRunner(rsrc.resume)()
self.assertEqual(rsrc.state, (rsrc.RESUME, rsrc.COMPLETE))
rsrc.delete()
self.m.VerifyAll()