Convergence: Persist state for stack adopt

Stack create is called internally to complete stack adopt action.
Hence stack adopt will not use stack lock in convergence, so persist
state when state_set is called.

Stack adopt logic is already taken care by convergence.

Change-Id: I2bcfdd7d8b7d9a0ce141ea29ce90253dce0402a8
changes/37/250237/5
Rakesh H S 7 years ago
parent d96bd2f05b
commit d702b6d28a
  1. 2
      heat/engine/stack.py
  2. 6
      heat/tests/test_convg_stack.py

@ -762,7 +762,7 @@ class Stack(collections.Mapping):
self.status_reason = reason
if self.convergence and action in (self.UPDATE, self.DELETE,
self.CREATE):
self.CREATE, self.ADOPT):
# if convergence and stack operation is create/update/delete,
# stack lock is not used, hence persist state
updated = self._persist_state()

@ -497,7 +497,7 @@ class TestConvgStackStateSet(common.HeatTestCase):
'test_stack', utils.dummy_context(),
template=tools.wp_template, convergence=True)
def test_state_set_create_update_delete_complete(self, mock_ps):
def test_state_set_create_adopt_update_delete_complete(self, mock_ps):
self.stack.state_set(self.stack.CREATE, self.stack.COMPLETE,
'Create complete')
self.assertTrue(mock_ps.called)
@ -509,6 +509,10 @@ class TestConvgStackStateSet(common.HeatTestCase):
self.stack.state_set(self.stack.DELETE, self.stack.COMPLETE,
'Delete complete')
self.assertTrue(mock_ps.called)
mock_ps.reset_mock()
self.stack.state_set(self.stack.ADOPT, self.stack.COMPLETE,
'Adopt complete')
self.assertTrue(mock_ps.called)
def test_state_set_stack_suspend(self, mock_ps):
self.stack.state_set(self.stack.SUSPEND, self.stack.IN_PROGRESS,

Loading…
Cancel
Save